cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

rexiaoyu
Journeyman III

Can I get the thread number in the kernel?

After the .br file was complied by brcc, I find the code below in the generated .hlsl file

 

struct csThreadInfo 

    int tid : SV_RelThreadId; 

    int atid : SV_AbsThreadId; 

    int gid : SV_ThreadGroupId; 

}

[NumThreads(64)]

void 

main (csThreadInfo __threadInfo)

{

int4 __indexof_c;

int4 __indexofoutput;

__indexofoutput = __getOutputIndex(__threadInfo.atid, __outputStreamShape, __outputBufferShape);

__indexof_c = __indexofoutput;

locate(

__indexof_c );

}

 

Can I get the tid, atid, gid information in the kernel, written in Brook+?



0 Likes
1 Reply
gaurav_garg
Adept I

You can use instance() and instanceInGroup() for the same purpose. The difference between instance() and atid is that atid is a linear index, but instance() can be 2D index in case you use 2D scatter stream.

0 Likes