Skip to content

Commit b4bc8c6

Browse files
authored
[libc] Implement efficient 'malloc' on the GPU (#140156)
Summary: This is the big patch that implements an efficient device-side `malloc` on the GPU. This is the first pass and many improvements will be made later. The scheme revolves around using a global reference counted pointer to hand out access to a dynamically created and destroyed slab interface. The slab is simply a large bitfield with one bit for each slab. All allocations are the same size in a slab, so different sized allocations are done through different slabs. Allocation is thus searching for or creating a slab for the desired slab, reserving space, and then searching for a free bit. Freeing is clearing the bit and then releasing the space. This interface allows memory to dynamically grow and shrink. Future patches will have different modes to allow fast first-time-use as well as a non-RPC version.
1 parent 11e804f commit b4bc8c6

File tree

7 files changed

+609
-7
lines changed

7 files changed

+609
-7
lines changed

libc/src/__support/GPU/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@ add_object_library(
1818
DEPENDS
1919
libc.src.__support.common
2020
libc.src.__support.RPC.rpc_client
21+
libc.src.__support.CPP.atomic
22+
libc.src.__support.CPP.bit
23+
libc.src.__support.CPP.new
2124
.utils
2225
)

0 commit comments

Comments
 (0)