As far as I can tell, simple kernel code like the one below gets completed illiminated by the nvcc/cuda compiler, is it possible to turn this “code illimination” off ? (I already tried -O0 (doesn’t seem to help, code is still illiminated(?!?))) External Image =D
You can at least preserve the code up to the PTX stage by giving nvcc the flag [font=“Courier New”]–opencc-options=-O0[/font]. ptxas will still optimize it away though, even with [font=“Courier New”]–ptxas-options=-O0[/font].
So this means even hand writing a ptx file would be useless since hand writing assembler instructions would be “optimized/illiminated” away ?! :(
Assuming ptxas is called before the ptx file is executed by the driver ?
Or perhaps ptxas is only for cubins or so ?
I tried executing such an unoptimized ptx file… which had 6 registers and some mov’s… so far according to visual profiler it only executed 2 instructions or so… so this could be an indication that the runtime environment/and/or driver optimizes the files before running, so this code gets illiminated…
The CUDA Driver API does contain this enumeration:
//
// Level of optimizations to apply to generated code (0 - 4), with 4
// being the default and highest level of optimizations.
// Option type: unsigned int
//
CU_JIT_OPTIMIZATION_LEVEL,
I am not yet sure what it’s for… or which api function it’s for… something about “online” compiler…
Ok I see it’s for:
cuModuleLoadDataEx
So perhaps with this API it’s possible to prevent the code illimination from happening… when loading the ptx file…
However there is a little problem… the api is not really for a file… it’s only for “an image”, which is some kind of memory structure.
If you want control over what code goes into the image, perhaps you really have to use an assembler. I’m working on one; PathScale also has one. Though the progress on PathScale’s side seems to have stopped (at least not that we could see. Perhaps if you buy their Enzo and they will tell you more).
Could you perhaps copy & paste a small example of such a cuobjdump ? might be interesting to include such examples on your website as well, so people can get an idea of what this is all about External Image