denzp / rust-ptx-linker

The missing puzzle piece for NVPTX experience with Rust
MIT License
52 stars 11 forks source link

passing target arch to linker causes CUDA_ERROR_INVALID _PTX #31

Closed jon-chuang closed 4 years ago

jon-chuang commented 4 years ago
cat ~/.cargo/config 
[target.nvptx64-nvidia-cuda]
rustflags = ["-C", "link-arg=-arch=sm_xx",]

When running calling a kernel via the "cuModuleLoadData" api, we get the error: CUDA_ERROR_INVALID _PTX for all sm_xx, including xx=30.

This is somewhat weird. Is there somewhere else I am supposed to tell rustc or the linker about the arch?

jon-chuang commented 4 years ago

I've just noticed that this is caused by a malformed codegen that produces the string .target rch sm_xx instead of .target sm_xx in the generated .ptx file.

jon-chuang commented 4 years ago

Looks like it was supposed to be linker-arg=--arch.. not =-arch. Alternatively, -a sm_xx