[GSoC 2026] DCompute Vulkan Backend

Quang Ha ha.phamquang.dev at gmail.com
Tue Jun 2 04:35:14 UTC 2026


### My GSoC Progress: Week 2 Update

Hi everyone, here is my progress update for **Week 2** of the 
DCompute Vulkan Backend project.

#### 🛠️ What I Did This Week
    * **Updated `target.cpp`:** I added `gABI = abi; gIR = _ir; 
gTargetMachine = targetMachine;` to `writeModule` to help the 
compiler write the correct file format.

    * **Added missing tags:** I added `@CompileFor.deviceOnly` to 
`test_vulkan.d` so it can emit the module. I also added the 
`@kernel()` tag to the test functions so the compiler knows the 
entry point.

    * **Fixed 3 big crashes in `targetVulkan.cpp`:** This was my 
most important work this week. I updated the LLVM intrinsic calls:
       * Deleted `i1false` from the `handlefrombinding` call to 
fix the bad signature.
       * Added `i32zero->getType()` and changed `i32one` to 
`i32zero` to fix the `getpointer` invalid index.
       * Wrote a `CreateStructGEP` loop to get each `fieldTy` and 
load them one by one. This replaced the old `CreateAlignedLoad` 
for the big struct and fixed the element type error.
    * **Checked `isWritable`:** I used `spirv-dis` to check the 
`TargetExtType`. I saw `OpMemberDecorate %_struct_20 0 
NonWritable`. I am researching if the number should be `0` or `1`.

#### 🛑 Challenges
    * **The COFF file problem:** At first, my compiler made a COFF 
file, not a `.spv` file. Sometimes it was right, sometimes wrong. 
It was very strange until I updated `writeModule`.
    * **Missing Kernel and "not set" spam:** The `.spv` file did 
not have `OpEntryPoint` and `_kernel`. Also, when I put a log 
inside `addKernelMetadata`, my screen was full of `"-> 
dcomputetarget: not set"`. I found out I just missed the 
`@CompileFor.deviceOnly` and `@kernel()` tags.
    * **The Compiler Crashes:** Right after the file emitted, the 
compiler crashed 3 times in a row! First, it had a bad signature. 
Second, it had an invalid index. Third, LLVM did not let me load 
a big struct at the same time. I had to debug and fix all of them 
in `targetVulkan.cpp`.

#### 🎯 Plans for Next Week
    * **Update my PR:** I will wait for Nicholas to check my pull 
request and I will update my code.
    * **Find `isWritable` answer:** I will find the final answer 
for the `isWritable` number (0 or 1).
    * **Write more tests:** I will write more test files to make 
sure everything works perfectly.

#### 🔗 Resources & Code
* Commits/PRs: https://github.com/ldc-developers/ldc/pull/5132
* My Personal Blog: Updating soon!


More information about the Digitalmars-d mailing list