[GSoC 2026] DCompute Vulkan Backend

Quang Ha ha.phamquang.dev at gmail.com
Fri Aug 21 16:37:45 UTC 2026


> Interesting. What's the bug? If you don't mind me asking.

### My GSoC Progress: Fixing LLVM and Running Vulkan Compute! 🚀

First of all, I want to sincerely apologize to FinalEvilution and 
everyone for the long silence. I have been deep in the debugging 
trenches for a while, but I am finally back with the ultimate 
update!

To answer FinalEvilution's question: *"Interesting. What's the 
bug? If you don't mind me asking."* — The short answer is that 
the LLVM SPIR-V Backend was creating an invalid instruction when 
compiling shaders for Vulkan. You can find the full technical 
details of how I fixed this in the LLVM section below!

Now, onto the best news: the project is successfully done! I am 
just waiting for the final reviews and merges to officially wrap 
up GSoC. After this, my next big stop is DConf 2026!

#### 🛠️ What I Did
* **Fixed Bugs in LLVM SPIR-V Backend:**
   * When compiling shaders for Vulkan, LLVM created an invalid 
instruction (`OpBitcast` on pointers). I fixed it by using 
`OpAccessChain` instead.
   * Added support for `PhysicalStorageBuffer` in Vulkan so 
pointer addresses work correctly.
   * Made the code clean and generic so any language can use it, 
not just D.
   * Added a new test file in LLVM 
(`physical-storage-buffer-load-store.ll`) and opened a pull 
request to LLVM.
* **Fixed LDC ABI Issues:**
   * Fixed how D passes pointers to Vulkan compute shaders so the 
GPU can read the buffer directly.
   * Updated the target detector in LDC to recognize `spirv`, 
`spirv32`, and `spirv64`.
* **Tested on Real GPU:**
   * Tested with our C++ Vulkan test program.
   * Both the minimal test (`67.36f`) and Vector Addition (A + B = 
C) ran successfully and gave the correct output!

#### 🛑 Challenges
* **Understanding LLVM Codebase:** LLVM is very large, so finding 
where the bug happened took a lot of time and debugging.
* **Clean Code:** My mentor, Nicholas Wilson, helped me review 
the code to make sure it follows all LLVM coding rules.

#### 🎯 Plans for Next Week (and Beyond)
* Follow the LLVM pull request and reply to reviewers.
* Fix the CI issue in the LDC repository.
* Get ready for my upcoming online talk: "Vulkan Compute Support 
in DCompute and LDC" at DConf 2026 this September!
* Write more compute test cases in D for Vulkan.

#### 🔗 Resources & Code
* **LDC PR:** https://github.com/ldc-developers/ldc/pull/5132
* **LLVM PR:** https://github.com/llvm/llvm-project/pull/216919
* **My Personal Blog:** https://gnavdev28.github.io


More information about the Digitalmars-d mailing list