[llvm-dev] CUDA: get thread id in a pass
Gurunath Kadam via llvm-dev
llvm-dev at lists.llvm.org
Mon Nov 21 11:53:05 PST 2016
Hi,
I am writing my first pass in LLVM.
I need to collect the threadId in each kernel call and then associate that
with the corresponding load/store calls.
I am stuck at extracting the threadId.
LLVM intrinsic for thread ID declaration:
threadId @llvm.nvvm.read.ptx.sreg.tid.*
Actual call:
; What is my ID?
%id = tail call i32 @llvm.nvvm.read.ptx.sreg.tid.x() readnone nounwind
So in the above LLVM IR instruction *@llvm.nvvm.read.ptx.sreg.tid.** is the
operand 1, is that right? And then is *%id* operand 0?
So I need to check for an instruction with the operand type matching above
expression and then extract operand 0.
Is my understanding right?
Thank you.
Regards,
Gurunath
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161121/50ce1d0b/attachment.html>
More information about the llvm-dev
mailing list