diff --git a/include/RAJA/pattern/launch/launch_core.hpp b/include/RAJA/pattern/launch/launch_core.hpp index bfce94057c..ce3530004e 100644 --- a/include/RAJA/pattern/launch/launch_core.hpp +++ b/include/RAJA/pattern/launch/launch_core.hpp @@ -182,9 +182,11 @@ class LaunchContext // Bump style allocator used to // get memory from the pool size_t shared_mem_offset; - void* shared_mem_ptr; + size_t mem_arena_offset; + void* mem_arena_ptr; + #if defined(RAJA_ENABLE_SYCL) mutable ::sycl::nd_item<3>* itm; #endif @@ -208,6 +210,26 @@ class LaunchContext return static_cast(mem_ptr); } + template + RAJA_HOST_DEVICE createMemoryArena(T *ptr, size_t bytes) + { + void * mem_arena_ptr = static_cast(&ptr[0]); + } + + // TODO handle alignment + template + RAJA_HOST_DEVICE T* getArenaMemory(size_t bytes) + { + + // Calculate offset in bytes with a char pointer + void* mem_ptr = static_cast(mem_arena_ptr) + mem_arena_offset; + + arena_mem_offset += bytes * sizeof(T); + + // convert to desired type + return static_cast(mem_ptr); + } + /* //Odd dependecy with atomics is breaking CI builds template