For random numbers on the GPU, encrypt a counter

(klauria.tech)

20 points | by evakhoury 3 days ago

2 comments

  • blintz 50 minutes ago
    If you ever need a lot of cryptographically random numbers on the GPU, you can do cool lattice stuff to do high throughput PRF evaluation. Basically, you can use ‘learning with rounding’ (https://latticeassumptionzoo.org/lwr/) to make the RNG (mostly) a big matmul, which GPUs are great at. This needs to use integers, so Hopper is way better than Blackwell for it. It’s also probably not better than AES in most cases (bc of available intrinsics), but it is way more fun.
  • hinkley 8 minutes ago
    The typical way a CSPRNG is to use cryptography to encrypt something and carving it up into the requested amount of output. This is just a less common variant. Educational perhaps, but newsworthy I don’t know.