From what I understand, CUDA’s PTX file is the virtual bytecode that is JIT compiled by the device runtime. This means that the file is cross platform, you can generate the PTX file and it will run on any CUDA compatible device. However, when I read the file in a text editor, I see these directives “.file” which have information about files on the original computer I compiled it for. So I am unsure what the purpose of these directives are. Also, given that my generated PTX files shouldn’t be dependent on these files, can these safely be removed? (Like if I wanted to start writing my own PTX generator).
Share
If you inspect the body of your functions, you will most likely find instructions of form
.loc fileNum fileLineThis indicates, that the following code was generated from a line
fileLinefrom filefileNum. ThefileNumis an index integer naming a file predeclared by the.filedirective you are asking.This can help you correlate your source code with the produced PTX output.
During JIT compilation PTX is converted into a native GPU machine code. There, those
.locand.filedoes not appear at all. It has absolutely no impact on the final machine code.