4 ms·
This is pretty reasonable, I think, but can it be applied to GPU code? The fundamental challenge of CSPRNGs is that they tend to have high latency and each thr
by atq2119 3y ago
This is pretty reasonable, I think, but can it be applied to GPU code?
The fundamental challenge of CSPRNGs is that they tend to have high latency and each thread produces a lot of randomness at once, while typically you only need a little bit at a time. So either you throw away the extra bits, effectively wasting ALU, or you keep them around in storage somewhere, which is expensive as well.
I would love to see a CSPRNG that is designed to leverage subgroup/wave ops. (Hmm, now that I think about it, perhaps ChaCha can be spread reasonably across 4 lanes? That would give 4 dwords per thread and potentially cut latency quite a bit, much better tradeoff overall for most GPU applications)