-
Notifications
You must be signed in to change notification settings - Fork 938
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
DirectX IR #4302
Comments
Some information about DXIL vs DXIR: |
Note that the DXIL document ( https://github.com/Microsoft/DirectXShaderCompiler/blob/master/docs/DXIL.rst#introduction ) says
Is releasing the DXIR specification still planned ? |
So as far as I can tell, no unless we bug them a lot or write it ourselves. The only guidance we've got is that issue I opened a while ago. Something else I worked out a while ago is that if we did produce DXIR we would need to ship dxcompiler in some form as it doesn't come with windows, which could cause some interesting licensing problems. |
Here is the code in Mesa fork that Microsoft develops, it takes Mesa IR and targets DXIL (derived from LLVM 3.7 IR) without linking to LLVM. We should take it and develop our backend. Edit: reading about http://www.jlekstrand.net/jason/projects/mesa/nir-notes/ |
Having llvm bit code writing abilities could be useful targeting metal as well. |
DXIR has been formally disowned now: I'm working on using the dxc llvm fork to emit DXIL from C++. However the code is extremely buggy, and a lot of the MS-written passes expect constructs coming in from the high-level HL/DXIR collection of types. If you try emitting DXIL intrinsics (like @dx.op.load/store/sample) and running the provided passes to perform inlining, scalarization, array flattening etc, stuff breaks. So I hack a lot on what they proivde. MS doesn't answer issues related to this. I think people who really want this working should get together and figure a way forward, because it's real hard to do this as an individual. |
Latest matrix discussion. Thank you @seanbaxter for sharing the knowledge! |
DirectX 12, like Metal (#4), uses LLVM bitcode as its low-level representation which is actually quite well documented (DXIL). However, the diagram at the top of that documentation suggests we probably want to be targeting their high level IR (DXIR), which as far as I can tell is almost completly undocumented 😞, although is also LLVM IR.
The optimisations done between DXIR and DXIL are:
Which don't sound particularly fun, or reasonable, to implement, although it might be possible. This will involve linking to some part of the DirectXShaderCompiler, which shouldn't be too hard as it all currently builds (after jumping through every hoop) to a load of static libraries, once we've worked out which libraries we need.
Their compiler also can output back out to SPIR-V and they have a HLSL to SPIR-V feature map, which should come in handy.
The text was updated successfully, but these errors were encountered: