Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upInvalid PTX error when using NVPTX `syncthreads` intrinsic #54115
Comments
peterhj
referenced this issue
Nov 6, 2018
Merged
Rename `llvm.cuda.syncthreads` -> `llvm.nvvm.barrier0` #589
This comment has been minimized.
This comment has been minimized.
|
For some LLVM versions now,
should, compiled using your target json and command, yield the following assembly:
Also note that I just submitted a PR w/ this change to https://github.com/rust-lang-nursery/stdsimd, so if core works with the NVPTX backend (it does now, right?) then I'd prefer to use the |
jonas-schievink
added
A-codegen
O-NVPTX
T-compiler
labels
Jan 27, 2019
This comment has been minimized.
This comment has been minimized.
|
The original problem seems caused by an incorrect intrinsic declaration. Like @peterhj showed, fixing the bad declaration generates correct code, so I'll close this (please leave a comment if this is not correct and I'll reopen). Regarding support for |
bheisler commentedSep 11, 2018
If a library references the
syncthreadsintrinsic using the NVPTX LLVM backend,rustcgenerates an invalid PTX file. Basic example:test.rs:nvptx64-nvidia-cuda.json:{ "arch": "nvptx64", "cpu": "sm_20", "data-layout": "e-i64:64-v16:16-v32:32-n16:32:64", "linker": "ptx-linker", "linker-flavor": "ld", "linker-is-gnu": true, "dll-prefix": "", "dll-suffix": ".ptx", "dynamic-linking": true, "llvm-target": "nvptx64-nvidia-cuda", "max-atomic-width": 0, "os": "cuda", "obj-is-bitcode": true, "panic-strategy": "abort", "target-endian": "little", "target-pointer-width": "64", "target-c-int-width": "32" }Command:
rustc --target nvptx64-nvidia-cuda test.rs -O --emit=asmThis produces the following (invalid) PTX assembly file:
Notice how the file is treating llvm.cuda.syncthreads as an external function? I believe that should be a single instruction (though I'm not sure which instruction).
See also denzp/rust-ptx-linker#19