4 ms·
> Pretty much. Even garbage collection can (theoretically lol) happen on the GPU. Oh, that's the plan. Semispace collection is very clearly a problem that can
by dragontamer 5y ago
> Pretty much. Even garbage collection can (theoretically lol) happen on the GPU.
Oh, that's the plan. Semispace collection is very clearly a problem that can be solved in parallel: https://en.wikipedia.org/wiki/Cheney%27s_algorithm https://en.wikipedia.org/wiki/Cheney%27s_algorithm
That's just a breadth-first traversal over the fromspace. That's like... GPU programming 101 level material there. Its obviously parallel.
That's why Java/Lisp is the model I'm using, because they use semispace malloc / semispace garbage collection. 100% GPU-side malloc / garbage collection.
Nothing that I'm working on for real, mostly just theory-craft. But fun to think about on my spare time. I would expect that semispace garbage collection and allocation of memory would be very efficient on GPUs, and serve as the basis of some higher-level abstraction.
-------
The "while loop" would need a custom compiler to emit the trampoline / continuation, so that the kernel knows how to "restart" itself in cases where the malloc() fails and garbage collection was run.
Kernels exiting serves as the innate synchronization point, the "synchronized stop" in the stop-the-world garbage collection schemes.
If I could write a routine that saves off every "malloc" as a possible "continuation" point (possibly saving that information in a queue-data structure or stack-data structure of some kind), then it probably would work.