-
Notifications
You must be signed in to change notification settings - Fork 722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[spirv] Add bare bone code for SPIR-V codegen #233
Conversation
Added ENABLE_SPIRV_CODEGEN in CMake config to control the building of SPIR-V component and wrap up SPIR-V code using it. Also add -spirv to hctbuild to turn it on.
@antiagainst, It will cover your contributions to all Microsoft-managed open source projects. |
@antiagainst What are your plans for generating the SPIR-V? I ask because I am in the process of redoing, for want of a better word, Khronos' SPIRV-LLVM for LLVM trunk utilising TableGen with the idea to more easily support SPIR-V graphics (as opposed to purely compute). Are you interested in collaborating ? edit: Ah, I see you plan to do it straight for the AST. |
@thewilsonator: This is the project repo right? That's super cool! Yep, we go from AST directly to SPIR-V. So we won't use LLVM IR or its derivatives. Our focus is translating HLSL. We've listed our thoughts in #216 with more details in docs/SPIR-V.rst. |
That's the one, although there is also some changes (build system related and intrinsics) that are in my fork of LLVM. Would you be interested in the TableGen files for specifying the SPIRV binary format? I have sections 3.1 through 3.31 complete and section 3.32.1 through 7 of the SPIRV spec done and am working on the rest of section 3.32 atm (though I can put the incomplete version up if you want to start asap). You would still need to do the ExtInsts for Vulkan, as my priority is the OpenCL ExtInsts. |
@thewilsonator: TableGen for SPIR-V binary format is definitely helpful to us. Would you mind to share a link? I only found one .td file in the repo which seems just a skeleton. |
@thewilsonator : Are you using the JSON grammar files from SPIRV-Headers, for the core and extended instruction specs? That way updates for new revisions and standard extensions can be supported automatically. (Actually, isn't this off topic for this PR?) |
@antiagainst sure The only major thing lacking is a tablegen backend for it, but I don't think it should be too difficult and you'll probably want different stuff printed out anyway. Sorry for the late reply. If there's anything confusing just open an issue. The only major thing I think I will refactor soon is instruction taking a variable number of words (atm instruction with string literals are implicitly assumed to be "variadic"). |
@dneto0 No I'm going off of the .pdf of the spec. The json loses a lot of info w.r.t e.g. the types of the IdRef, IdResultType and IdResult operands. Perhaps it would be possible from the .xml but my past experience of trying to parse the Vulkan spec was not fun. |
@thewilsonator: Thanks for the links! I'll take a look. |
clang-spirv-tests uses a lot of external projects that keep themselves clean with different standards of warnings flags. This alters the appropriate cmake files to disable flags that the DXC build enables. Fixes 72 gcc and 166 clang warnings. Additionally catch some sign mismatch comparisons in tests built as part of clang-spirv-tests. Fixes 2 gcc and 2 clang warnings, but one of them has multiple sources So it's kind of a lot more. Contributes to google#206
libclangSPIRV
and skeletonASTFrontendAction
for SPIR-V-spirv
intodxc
for invokingEmitSPIRVAction
ENABLE_SPIRV_CODEGEN
in CMake and
-spirv
inhctbuild
.For #216
cc @dneto0 @ehsannas