[GSoC 2026] DCompute Vulkan Backend
Quang Ha
ha.phamquang.dev at gmail.com
Mon May 25 02:09:37 UTC 2026
Hi everyone, here is my progress update for **Week 1** of the
DCompute Vulkan Backend project.
#### 🛠️ What I Did This Week
* Squashed [Nicholas's
PR](https://github.com/ldc-developers/ldc/pull/4958) to
thoroughly analyze the required implementation details in
`targetVulkan.cpp` and `dcomputecodegenerator.cpp`.
* Investigated the `TODO` in `dcomputecodegenerator.cpp` and
implemented support for parsing the `vulkan-{version}` target
value by adapting the existing OpenCL (OCL) and CUDA logic.
* Updated `cl_options.cpp` to include Vulkan in the
`--mdcompute-targets` flag's description.
* Addressed the hardcoded 64-bit pointer assignment in
`targetVulkan.cpp` to fix the layout issue for different pointer
sizes.
* Refactored relevant files by updating the LLVM version macro
checks from `LLVM_LDC_VER >= 2100` to `LLVM_VERSION_MAJOR >= 23`.
#### 🛑 Challenges
* **The .spv file output problem:** I used the
`--mdcompute-targets` flag to make a `.spv` file, but it was in
COFF format, not real SPIR-V. It was very strange. When I added a
logging line just to print things out, it made correct SPIR-V
code. After that, I built the newest LLVM 23 (on May 24), and it
went back to COFF format. Nicholas and I didn't understand why.
Finally, I fixed it. I copied the "HACK" part from
`DComputeTarget::emit` to `DComputeTarget::writeModule`. Now it
works normally.
* **Build error:** I got a linker error when building. But it
was easy to fix. I just changed the paths in the `CMakeLists.txt`
file.
* **The TODO part:** There is a `TODO` for `spirv.Layout` in
`targetVulkan.cpp`. It is very difficult to understand. So, I
haven't touched it yet. I need more time to study it.
#### 🎯 Plans for Next Week
* **Look into spirv.Layout:** I will spend time studying the
`TODO` about `spirv.Layout` in `targetVulkan.cpp` because I
didn't finish it this week.
* **Write more tests:** I will write some more test files to
make sure the compiler always makes the correct `.spv` files.
* **Update my PR:** I will wait for Nicholas to finish
reviewing my PR. Then, I will update the code and fix any issues
he points out.
#### 🔗 Resources & Code
* Commits/PRs: https://github.com/ldc-developers/ldc/pull/5132
* My Personal Blog: Will update soon!
Feel free to leave any feedback or suggestions!
More information about the Digitalmars-d
mailing list