10

Does anybody know how to get PTX assembler annotated with C/C++ code with new LLVM back-end?

Can easily get it with CUDA 4.0 or earlier but NVCC rejects all my flags after upgrading CUDA toolkit to version 4.2.

Andrey Kamaev
  • 29,582
  • 6
  • 94
  • 88
  • I don't know of a way to do that with nvvm. The documentation is still pretty sketchy though, so there might be a way. – talonmies Jul 14 '12 at 14:25

3 Answers3

4

nvcc from CUDA 6.0 preview supports option --source-in-ptx.

geek
  • 1,809
  • 1
  • 12
  • 12
3

Does nvcc.exe --opencc-options -LIST:source=on -ptx kernel.cu work? I have installed cuda 4.2 and this command generates *.ptx file with commented C code between ptx assembler lines.

Insomnious
  • 801
  • 7
  • 7
  • Don't work for me: `nvcc warning : Option '--opencc-options (-Xopencc)' is obsolete and ignored, when targeting compute_20, sm_20, or higher` – Andrey Kamaev Jul 18 '12 at 17:58
  • 4
    [Here](http://webcache.googleusercontent.com/search?q=cache:7IFbmpUoYdMJ:forums.nvidia.com/index.php%3Fshowtopic%3D217257%26view%3Dold+&cd=4&hl=ru&ct=clnk&client=firefox-a) is answer by nvidia. Briefly this functionality i.e. "mixed listing" feature was tied to a component-specific flag. As CUDA 4.1 and higher introduces a new frontend for sm_2x and up, that component has been replaced, and thus the flag is no longer accepted. If you just want to use them as markers, you could make your own by inserting inline PTX-"assembler" comments as follows `asm volatile ("// this is line ...");` – Insomnious Jul 18 '12 at 18:24
3

You may want to use the --source-in-ptx and -G nvcc flags to see your original code in the PTX file.

Kyselejsyreček
  • 459
  • 1
  • 3
  • 16