1

I have a single file of CUDA code compiled to intermediate language PTX code, example.ptx. I would be interested to start poking around with this short file, trying to understand how it works.

I don't have previous experience fiddling around with intermediate code representation, but what I gather is that I can some how print out a figure of the control flow, to support me trying to reverse engineer this. Cuda Binary Utilities mention nvdisasm and shows nice Graphviz figures of the control flow, but it seems to work only for cubin files. I understand that these cubin files are optimized further from PTX, depending on the current GPU architecture.

My question is: Can I use nvdisasm to generate control flow image from example.ptx, or compile the ptx file to a cubin file, and use that to generate the image?

1
  • No, because PTX is a virtual machine language, not actual executable machine cone Commented Jan 29, 2021 at 12:14

1 Answer 1

2

or compile the ptx file to a cubin file, and use that

Yes, you can do that. Compile your ptx file to a cubin with:

nvcc example.ptx -cubin 

(the result will be in example.cubin or you could add e.g. -o myfile.cubin to name it something else)

This cubin file can be fed to nvdisasm for processing.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.