Skip to content

feat: prototype a Vulkan compute backend - #811

Closed
nothingnesses wants to merge 1 commit into
bendlang:mainfrom
nothingnesses:feat/vulkan-backend
Closed

nothingnesses wants to merge 1 commit into
bendlang:mainfrom
nothingnesses:feat/vulkan-backend

Conversation

@nothingnesses

@nothingnesses nothingnesses commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Paused. The maintainer declined the backend because of maintenance capacity and compiler-size limits. I do not plan further implementation at this point. The branches and experiments remain available. The Vulkan backend is not implemented.

This draft proposed an optional backend for modern AMD, Intel and NVIDIA GPUs, with Linux first and a Radeon 780M as the initial test device. The plan preserved CUDA and Metal defaults, the shared C runtime and bend2/bend.ts.

Current change

tests/run/gpu_heap_handoff.bend exercises two marked calls with heap-allocated trees and IO between the calls. It supplies a test case for the backend work without a Vulkan dependency.

The new fixture passes through the source CLI, Bun JS, Node JS and native CPU code with one and two threads. GPU execution and gates/test.ts are not tested yet. The latter requires access to the Mac mini cluster.

Compilation checkpoint

The compiler probes and feasibility report are in the separate development repository.

The adapted device runtime passes Clang's OpenCL front end with -Werror. None of the nine clspv runtime variants produces valid Vulkan SPIR-V. The failures include inconsistent pointer types, an LLVM abort and unsupported option combinations.

Slang's small pointer and 32-bit atomic probes produce valid SPIR-V, but its parser rejects C unions. A full-runtime Slang experiment remains pending. No GPU execution occurred, and Bend's compiler and existing backends remain unchanged.

Remaining work if resumed

  • Add pinned compiler probes and a feasibility report.
  • Compile the shared device runtime to SPIR-V that is valid for Vulkan.
  • Run a Bend computation on the Radeon device and reject CPU fallback.
  • Test allocation, parallel joins, atomics and repeated CPU/GPU handoffs.
  • Measure performance and assess the memory strategy for discrete GPUs.
  • Test other vendors and check existing CUDA and Metal behaviour before broader support claims.

If work resumes, the first prototype remains a review point before full integration. A separate runtime or substantial changes to the shared code will need further discussion.

I also asked about this on Discord. The older request in #341 concerns Bend 1.

@nothingnesses

Copy link
Copy Markdown
Contributor Author

The first compilation experiment is blocked before GPU execution. The probes and report include pinned tools and reproduction commands.

The adapted device runtime passes Clang's OpenCL front end, but none of the nine clspv variants produces valid Vulkan SPIR-V. A smaller heap-aliasing probe also fails validation at an atomic store.

Slang compiles the small pointer and 32-bit atomic probes successfully. A full-runtime experiment still needs replacements for C union bitcasts and checks of the other runtime constructs.

Bend's compiler, CUDA and Metal code remain unchanged. No GPU execution occurred. The draft checklist remains incomplete.

@VictorTaelin

VictorTaelin commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for the exploration. We are keeping the language at a size a small team can maintain, and a Vulkan lane would, for now, cross that threshold (comp.ts is already at its budget). So this stays out of the main repo, but a fork is welcome, and we would happily link it. Closing.

Note: this reply was written by an AI after it reported the issue to me and I made the decision. If anything here is wrong, reply and I will review it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants