-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[Backend] DirectX (D3D12, DXIL) Backend #5276
Comments
Hi @python3kgae , Thanks for proposing this, it looks really attractive!
Note that we are (conservatively) planning to upgrade to LLVM-12. It's probably fine for us to directly go to 15 as well. One thing we've recently noticed, is the installation speed from (Ive followed https://apt.llvm.org/ for
I see. I'm not sure how feasible it is to share the generated LLVM IR between CUDA and DXIL. Hopefully this is not a problem :-) (Taking SPIR-V as an example. Although it claims to support both Vulkan and OpenCL, they use very different Execution Model, making it nontrivial to share the same SPIR-V between these two APIs).
If we can have a working codegen, D3D12 runtime API shouldn't be too hard to sort out :-) |
If clang is only used for COMPILE_LLVM_RUNTIME, We can keep using clang-10 first. llvm 15 should be OK to link bitcode generated with llvm 10. |
@python3kgae |
@ailzhang I checked https://github.com/taichi-dev/taichi/blob/master/cmake/TaichiCore.cmake#L253-L288, it is where llvm header and lib are added. it only require llvm version >= 10, llvm 15 doesn't require any change for this part. I've got taichi repo compiled with llvm 15. Most of the changes are related to the opaque pointer feature which require add type when create LoadInst/GEP. Currently I'm hacking to get the type from llvm type, need help to get the type from taichi type instead of llvm type. |
This could be specific to the nightly package. I tried the release version on a Ubuntu 22.04. The time of |
…5998) 2 passes are added for DXIL generation. TaichiIntrinsicLower will translate taichi intrinsic like thread_idx into the form DirectX backend expected. TaichiRuntimeContextLower will translate the TaichiRuntimeContext parameter for kernel into Buffers/ConstantBuffers. TaichiRuntimeContextLower is empty now. It is added after inline so optimizations reduce the load/store on temp ptr. And it is easier to know a store is on the TaichiRuntimeContext. Related issue = #5276 Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Fix build fail and enable dx12 build for windows cpu ci to make sure it compiles. Related issue = #5276
Build based on release/15.x branch and cherry-picked some patch for DX12. Issue: #5276 ### Brief Summary
Copied from cuda codegen. Issue: #5276 Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Only make sure the pipeline generate something. No real dxil generated yet. Move DX12 build to gpu ci which will run the aot test. Issue: #5276 Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
add DirectX-Headers as a submodule. Issue: #5276
Add Dx12ProgramImpl. Prepare change to launch dx12 kernel like dx11 instead of LlvmRuntimeExecutor. Because dx12 uses buffer instead of pointer directly. Issue: #5276 Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Concisely describe the proposed feature
I would like to add a DirectX 12 backend to the compiler so that I can use new features which requires shader model >= 6.0.
Describe the solution you'd like (if any)
The plan is in 3 steps.
Add llvm 15 support which is required for generate DXIL.
Code change will be guarded with something like "#ifdef TI_LLVM_15" if llvm 15 require different implementation.
CMake option TI_LLVM_15 will be added to control it and OFF by default.
Add AOT compile first which could be tested by add c++ directx12 test without backend.
DXIL support in llvm 15 is still in early state. It will be a long journey to support all features.
CodeGenLLVM will be used as base class for llvm ir generation when codegen. Then some llvm passes will be added to prepare for DXIL generation and finally use DirectX backend in llvm 15 to generate DXIL.
A kernel which has more than 1 tasks is a new thing for DXIL, no plan to support this feature at first.
Add DirectX 12 backend.
No an expert on this part :(
Maybe start support for simple cases first.
Additional comments
I'm working on DXIL generation on llvm 15. Targeting language other then HLSL to DXIL will help the design of DXIL generation.
This is personal work, not official contribution (which requires examine and approve).
The text was updated successfully, but these errors were encountered: