Remix.run Logo
▲ blaaarg123 2 hours ago

> prefer a stateless RNG that works by encrypting or hashing a counter.

isn't that the definition of stateful?

▲fc417fc802 an hour ago | parent | next [-]

From the perspective of the overall process, yes there is still state. However what is typically meant by a stateful RNG is a function which you first seed that has to persist data between calls (and usually generates a sequential stream).

▲loeg an hour ago | parent [-]

I think the answer is yes, a counter is state, but it's state that is already available anyway.

▲articulatepang an hour ago | parent [-]

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.

▲cowlevel an hour ago | parent | prev [-]

Not really, you can skip the counter forward.

▲rahimnathwani an hour ago | parent [-]

How do you determine how much to ship it forward?

▲cowlevel an hour ago | parent [-]

frame count * pixels per frame * max random calls per pixel