-
-
Notifications
You must be signed in to change notification settings - Fork 55
EXPERIMENTAL: Implement a GC #419
base: master
Are you sure you want to change the base?
Conversation
Note: these changes depend on the 'configurable-lowering-2' branch of my fork of the julia repo (jonathanvdc/julia). The lowering scheme won't work unless that version of Julia is used.
The 'init' kwarg to '@cuda' allows users to define custom kernel initialization logic, which is run just prior to the kernel. The main use case for this kwarg right now is setting up globals.
I built these examples mostly as experiments. Their core logic ended up in 'interrupts.jl', which is cleverly designed to expose a high-level interface. The examples deleted by this commit are not: they're low-level and kind of hacky.
Great! Good to have this here as a PR. Would you mind factoring out the bump allocator? I'd prefer to merge something less complex first. It's also a strict improvement, whereas the complex GC might degrade performance. |
Wow, that was fast! The bump allocator's implementation is a bit intertwined with the GC's, but I'll see what I can do. With regard to performance, both the bump allocator and the GC are opt-in. So neither will affect the performance of existing CUDAnative kernels. |
Yeah, but I think we could reasonably try and default to the bump allocator in the short term, since the current allocator is so bad (both in terms of performance and usability). That would be easier if it doesn't depend on the rest of the functionality in this PR. |
17dfd92
to
3c9b279
Compare
Hi! Here's a PR that implements a garbage collector for CUDAnative. Major additions include:
gc.jl
). The GC is a non-moving, semi-conservative, stop-the-world GC that uses a free list for memory allocations.malloc
, which will leak memory perpetually, even across kernel invocations.