问题
I would like to be able to use a feature in PTX 1.3 which is not yet implemented it the C interface. Is there a way to write my own function in PTX and inject into an existing binary?
The feature I'm looking for is getting the value of %smid
回答1:
The answer:
__noinline__ __device__ uint get_smid(void)
{
uint ret;
asm("mov.u32 %0, %smid;" : "=r"(ret) );
return ret;
}
来源:https://stackoverflow.com/questions/2983553/cuda-injecting-my-own-ptx-function