-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugging produced PTX? #5
Comments
I've found that I can get the kernel to pause on an exception and then I can attach |
Actually, this is pretty easy. I can make a PR. |
Could you please tell more about your CUDA debugging experience? I'm curious because I never tried this before even with C++ CUDA. |
This is my first go at it as well. Reading the NVIDIA docs it seems pretty straightforward. The best feature I've seen so far is that if you set the environment variable However, I'm still having a problem with my application and haven't actually gotten to the point of being able to use the debugger yet. Building with the latest
I believe the line of code it's trying to compile is this: let z = unsafe { core::intrinsics::powf64(r1, 1. / (n + 1) as f64) }; I don't get this error when I compile in release mode however which is strange. Any ideas? |
From playing round a bit, in both release and debug mode, I get linker errors saying it cannot select things like |
Also, with a very simple kernel that does compile and link in debug mode, when I try to load it the driver gives me
|
I think it worth trying external About |
My plan is to finish rust-crate-compile-test first and then we will be able to test I'm afraid I need to make debug mode optional for now :( |
Thanks, I'll look into using a library to provide the math functions. |
I think it would be nice if that's possible. I suspect that even PTX of very small crates can also cause |
https://www.dropbox.com/s/kghoah6wobqcx5a/proxy.ptx?dl=1 |
I think files are okay,
What is actually weird, it's:
You are right, |
Could you please try with There is a good chance that the PTX won't cause |
It not longer causes |
Ah, never mind, I see that I just have to set it to run in debug mode. I will try that out. |
Okay, confirming that my PTX built in debug mode does not cause |
Okay, thank you for testing! Could you please create a simple repo with general steps, so I or somebody else can play around with debugging? |
I've started a repo with a similar layout to my main application I've been working on. I will add some steps to the README on how to introduce a bug to the code and then debug it. |
Thanks for sharing, looks impressive! Glad to see that the whole Rust - CUDA thing (at least partially) works not only for me :) About debugging... I was able to setup and hit a breakpoint at the kernel.
So at least in theory debugging is possible :) Unfortunately it's far from being usable because somehow
I think we could try to create a small app with CUDA in Clang. Then we can compare Rust and Clang PTX assemblies for debugging-related things. |
Nice, you got a bit farther than I could. That was the next thing I was trying to figure out how to do, was set a breakpoint before the program ran. If we need to get an example of PTX code we know is debuggable, I had actually already done some work in that direction. My first approach to this, which I gave up on, was to use the technique mentioned here, but adding the debug options to the original |
Caveat: Minimally tested and super hacky. I did some experiments on this issue and managed and got source code locations working. I managed to backport the feature this commit and some others by the same author What is working:
What is not working:
I did this mainly as a quick experiment so do not expect any production ready code quality ;) |
@Vespasian these are good findings, thanks! Am I right, is it only 2 LLVM commits you had to backport? I think the |
I'm trying to figure out how to produce a debuggable binary from the PTX file that I can debug with the NVIDIA tools. It's looking like I'm going to need a non-release-mode version of the PTX file. Could you could expose whether to pass the
--release
option toxargo
or not? Is this even the right thing to do for trying to debug a CUDA kernel produced with this tool?The text was updated successfully, but these errors were encountered: