Skip to content

Commit 9bafe73

Browse files
nnethercoteLegNeato
authored andcommitted
Add a tip for debuggin with ptxas.
Something I learned recently.
1 parent f17db63 commit 9bafe73

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

guide/src/nvvm/debugging.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ which I will add to the project soon.
3333
## Miscompilations
3434

3535
Miscompilations are rare but annoying. They usually result in one of two things happening:
36-
- CUDA rejecting the PTX as a whole (throwing an InvalidPtx error). This is rare but the most common cause is declaring invalid
37-
extern functions (just grep for `extern` in the PTX file and check if it's odd functions that aren't CUDA syscalls like vprintf, malloc, free, etc).
36+
- CUDA rejecting the PTX as a whole (throwing an `InvalidPtx` error). Run `ptxas` on the `.ptx`
37+
file to get a more informative error message. This is rare but the most common cause is declaring
38+
invalid extern functions (just grep for `extern` in the PTX file and check if it's odd functions
39+
that aren't CUDA syscalls like vprintf, malloc, free, etc).
3840
- The PTX containing invalid behavior. This is very specific and rare but if you find this, the best way to debug it is:
3941
- Try to get a minimal working example so we don't have to search through megabytes of LLVM IR/PTX.
4042
- Use `RUSTFLAGS="--emit=llvm-ir"` and find `crate_name.ll` in `target/nvptx64-nvidia-cuda/<debug/release>/deps/` and attach it in any bug report.

0 commit comments

Comments
 (0)