Issue with specifying ptxas options

May 16, 2013 at 4:09 PM
Hello,

As the title suggests, I wish to specify ptxas flags in the compiler options, but it seems to have no effect. From a tiny bit of research (googling) and from inspecting your code, I think there're a couple of problems here. First, ptxas flags can't be specified together with the -ptx compiler option, even when I try to call nvcc from command line, using both of these options will result in the compiler ignoring the ptxas flags. Second, even if it were possible, I would need to compile with -arch=compute_20 instead of -arch=sm_21 in order to use -code=sm_21 and so making the ptxas run, but eArchitecture.ToString() results in the string "sm_XX" (instead of the required "compute_20").

Maybe a little more background would help address the issue:

here's an example
km = CudafyTranslator.Cudafy(ePlatform.x86, eArchitecture.sm_21);

km.CompilerOptionsList[0].AddOption("-code=compute_20,sm_21"); // Assume here I've somehow got past the -arch=compute_20 problem
km.CompilerOptionsList[0].AddOption("-Xptxas");
km.CompilerOptionsList[0].AddOption("-dlcm=cg");
km.Compile(eGPUCompiler.CudaNvcc);
This had no effect, as you can check the .ptx file and see there's no difference (as much as I can gather, the -dlcm=cg flag should replace all ld.global instructions with ld.global.cg).
So, is there any way to affect the creation of the .ptx file? Is there a way to add those compilation flags?
Alternatively, can I compile (to .cubin file) my kernels and loading them with Cuady?

Thank you very much, I'd appreciate any help here, since this might be a show stopper for me.
Coordinator
May 16, 2013 at 8:14 PM
CUDAfy currently only works with ptx. You can use CudafyTranslator.Translate method instead of .Cudafy. This is identical except it does not compile. Please feel free to look through source code and suggest changes.