[libc-commits] [libc] [libc] Partially implement 'rand' for the GPU (PR #66167)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Mon Sep 25 07:42:00 PDT 2023


jhuber6 wrote:

> I don't understand the comments about being unable to initialize the memory. Libc could have a per-kernel init function and document that languages that want to integrate libc need to splice that into the kernel prologue. Or we could bite the bullet and support trivial initialisers on shared memory, the blocker there was mostly disagreement about whether one lane in the warp or all of them should do the write.

Pushing stuff to global constructors isn't really desirable for `libc`, since most of these functions aren't intended to be really used with the `start.cpp` stuff we use for testing. It's certainly possible to make a big global state struct that someone writes to, but I'd like to avoid needing such things if at all possible. I don't think we really require it right now except for AMD's shortsighted handling of clock frequencies.

I'd love be able to support these non-trivial constructors if possible, we really shouldn't need to call a kernel (which is really slow in general) just to set something to 1.

https://github.com/llvm/llvm-project/pull/66167


More information about the libc-commits mailing list