CUDA: injecting my own PTX function?

半世苍凉 提交于 2019-12-22 08:17:36

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!