logoalt Hacker News

articulatepang • today at 8:50 PM • 1 reply • view on HN

Correct, each thread in a GPU kernel launch has its threadIdx.x and so forth. It needs this just in order to know, "Which part of the work am I supposed to do?"

For example, if you're writing matrix multiplication, each thread needs to know which tile it's working on. If you're simulating particles, each thread might have some block of particles to work on. And so forth. Any GPU code always has this available.


Replies

loeg • today at 9:57 PM

The one more relevant to RMW PRNG state from the article is named "iterIdx."