digitalmars.D - [GSoC 2026] DCompute Vulkan Backend
Hi everyone, I am making this thread to share my weekly updates for the **DCompute Vulkan Backend** project. Here are the 3 main parts of my project (Mentored by Nicholas Wilson): * **LDC Compiler:** Connect D's data types with Vulkan's memory rules by adding a wrapper kernel. I will also fix pointer sizes to make correct SPIR-V files. * **Testing:** Check the compiled `.spv` files with Vulkan tools to make sure the memory works right. * **DCompute Runtime:** Build the host-side system to start the Vulkan device and run the code. I will post my progress, problems, and questions as replies to this thread every week. This helps keep everything in one place. I am excited to share my work with you all! GitHub: [https://github.com/gnavdev28](https://github.com/gnavdev28)
May 09
Hi everyone, here is my progress update for **Week 1** of the DCompute Vulkan Backend project. * 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`. * **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. * **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. * Commits/PRs: https://github.com/ldc-developers/ldc/pull/5132 * My Personal Blog: Will update soon! Feel free to leave any feedback or suggestions!
May 24








Quang Ha <ha.phamquang.dev gmail.com>