Skip to content

grx6741/llvm-wgsl

 
 

Repository files navigation

LLVM WGSL Backend

A very naive WGSL backend for LLVM intended to be used to port CUDA programs to the browser with WebGPU.

Building

  1. If you are cloning this repo for the first time, then clone this repo recursively to get dawn's repo as well
git clone https://github.com/grx6741/llvm-wgsl.git --recursive
  1. Install LLVM 19.0.0 from source or use a package manager.
sudo apt install llvm-19-dev
  1. Compile with cmake.
# Note, may not work with other compilers like gcc
export CC=clang
export CXX=clang++
cmake -B build -G Ninja # only tested with Ninja
  1. Build with ninja.
cmake --build build

Usage

  1. Take a LLVM IR file compiled with clang of a cuda program.
clang -x cuda -emit-llvm cuda.cu --cuda-gpu-arch=sm_50 --cuda-device-only --cuda-path=$(CUDA_PATH)
  1. Run the WGSL backend.
./build/bin/llvm-wgsl cuda.ll
  1. The output will be a WGSL file.

Features

  • Nothing is implemented yet.

About

WGSL Backend for LLVM

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published