Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
668 views
in Technique[技术] by (71.8m points)

parallel processing - Using nvdisasm to generate control flow image of PTX code

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?

question from:https://stackoverflow.com/questions/65952925/using-nvdisasm-to-generate-control-flow-image-of-ptx-code

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...