2 ms·
this Rust demo also uses PTX directly During the build, build.rs uses rustc_codegen_nvvm to compile the GPU kernel to PTX. The resulting PTX is embedded in
by LowLevelMahn 1y ago
this Rust demo also uses PTX directly
During the build, build.rs uses rustc_codegen_nvvm to compile the GPU kernel to PTX.
The resulting PTX is embedded into the CPU binary as static data.
The host code is compiled normally.
- LegNeato 1y agoTo be more technically correct, we compile to NVVM IR and then use NVIDIA's NVVM to convert it to PTX.
- saagarjha 1y agoThat’s not really the same thing; it compiles through PTX rather than using inline assembly.
- LegNeato 1y agoFYI, you can drop down into ptx if need be: https://github.com/Rust-GPU/Rust-CUDA/blob/aa7e61512788cc70200005eb318b7441a97fad6d/crates/cuda_std/src/mem.rs#L40 https://github.com/Rust-GPU/Rust-CUDA/blob/aa7e61512788cc702...