convert cubin to object file run edited cubin file

Hi All,

I’m wondering if there is a simple way to convert a cubin file to an object file?

I need this because I want to run the edited cubin file on GPU. I know one way to do it is to use driver API functions. But it seems too complicated for my purpose.

I know I can do “nvcc -cubin” to compile to myfile.cubin, then I edit the cubin file (delete instructions, add instructions, etc, BTW, I know what the instructions mean by using decuda), I just need something further to convert the edited cubin file to an object file.



Hi, I figured this out. This actually can be done pretty easily. I put it here for the people who might be interested this.

There are 3 steps,

(1) do “nvcc”, this will generete a temporaty cubin file in folder /tmp

(2) modify this cubin file according to your needs.

(3) do “nvcc -dryrun” to list all nvcc compiliation commands, run all commands after fatbin (including fatbin) to generate the object file of the modified cubin file. (you can copy these compiliation commands to a script to make it more convenient )