Ethan L.
Ethan L.

Reputation: 415

Is there a way to obtain the program counter value for a thread in CUDA? By modifying device driver or Compiler?

I would like to implement a runtime that allows a thread in GPU to obtain the value of the program counter. I have searched in Cuda Programming Guide and PTX guide as well.

With Independent Thread Scheduling, the GPU maintains execution state per thread, including a program counter and call stack, and can yield execution at a per-thread granularity.

May I know where the value of the program counter is stored? In what register assigned to that thread? Is there a way that allows the thread to obtain the value of the program counter?

If a thread cannot do it, then can we modify the driver, or compiler, or using inline assembly to achieve that?

Upvotes: 0

Views: 212

Answers (1)

talonmies
talonmies

Reputation: 72350

May I know where the value of the program counter is stored? In what register assigned to that thread?

The PTX virtual machine instruction only exposes a limited number of special registers.

At the time of writing, that doesn't include the program counter or the stack frame, as far as I am aware. This appears to be true whether the GPU architecture is using a block wide PC or an independent per-thread PC.

Is there a way that allows the thread to obtain the value of the program counter?

Not as far as I am aware.

Upvotes: 1

Related Questions