decuda 0.1.1

CUDA to HIP, SYCL, OpenCL, and Rust GPU migration tool — automatic source-code translator for porting CUDA C++ kernels to AMD ROCm HIP, Intel oneAPI SYCL, Khronos OpenCL, and Rust GPU (cust / rust-gpu)
Documentation
// Generated by decuda.
// Host-side runtime calls are translated to the `cust` crate. Kernels
// are emitted as `TODO(decuda)` blocks: rust-gpu translation requires
// the kernel to be authored as a Rust fn. See `examples/` for a
// scaffolded SPIR-V kernel module you can flesh out.
//
// Add to your Cargo.toml:
//   [dependencies]
//   cust = "0.3"

// Fixture: kernel-launch syntax inside comments and string literals must
// NOT be captured by the preprocessor. Only the real launch on the last
// line should be harvested.
// was: #include cuda_runtime.h  ->  cust::cuda_build_setup() /* TODO: import cust crate */

// Here is a fake launch in a line comment: foo<<<1, 1>>>(a);
/* block comment: bar<<<2, 2>>>(b, c); */
const char* code = "k<<<1, 1>>>(x);";

// TODO(decuda): rewrite as rust-gpu kernel fn
 void real_kernel(int* x) {
    x[thread_idx] = 1;
}

void launch(int* x) {
    { /* decuda cust launch */ let _kernel = modules.get_function("real_kernel"); unsafe { let _ = launch!( _kernel<<<1 as grid_size, 32 as block_size, 0 as usize, default>>>(x) ); } };
}