From 8b1235838e6256dbf1a209069f56640679c50bc6 Mon Sep 17 00:00:00 2001 From: Arturo Vargas Date: Sun, 13 Apr 2025 23:42:38 -0700 Subject: [PATCH 1/2] memory arena for launch --- include/RAJA/pattern/launch/launch_core.hpp | 37 +++++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/include/RAJA/pattern/launch/launch_core.hpp b/include/RAJA/pattern/launch/launch_core.hpp index bfce94057c..1ef1f02eda 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(arena_mem_ptr) + shared_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 Date: Tue, 15 Apr 2025 10:06:49 -0700 Subject: [PATCH 2/2] Update include/RAJA/pattern/launch/launch_core.hpp Co-authored-by: Yohann --- include/RAJA/pattern/launch/launch_core.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/RAJA/pattern/launch/launch_core.hpp b/include/RAJA/pattern/launch/launch_core.hpp index 1ef1f02eda..ce3530004e 100644 --- a/include/RAJA/pattern/launch/launch_core.hpp +++ b/include/RAJA/pattern/launch/launch_core.hpp @@ -222,7 +222,7 @@ class LaunchContext { // Calculate offset in bytes with a char pointer - void* mem_ptr = static_cast(arena_mem_ptr) + shared_arena_offset; + void* mem_ptr = static_cast(mem_arena_ptr) + mem_arena_offset; arena_mem_offset += bytes * sizeof(T);