From 35187a00df54ea5239ed448f5ec5d43b0e175db0 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 15 Oct 2024 16:52:00 +0000 Subject: [PATCH] rocr: Add executable flag for memory allocations Change-Id: I8307cd3562c3ab9c12fef8c457a59916e33b7923 [ROCm/ROCR-Runtime commit: d58c9dea0a1bc004a11ae4e139f59c24998c6496] --- .../runtime/hsa-runtime/core/runtime/hsa_ext_amd.cpp | 3 +++ projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa_ext_amd.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa_ext_amd.cpp index 55f16d8f06..615eee7f63 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa_ext_amd.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa_ext_amd.cpp @@ -792,6 +792,9 @@ hsa_status_t hsa_amd_memory_pool_allocate(hsa_amd_memory_pool_t memory_pool, siz if (flags & HSA_AMD_MEMORY_POOL_CONTIGUOUS_FLAG) alloc_flag |= core::MemoryRegion::AllocateContiguous; + if (flags & HSA_AMD_MEMORY_POOL_EXECUTABLE_FLAG) + alloc_flag |= core::MemoryRegion::AllocateExecutable; + #ifdef SANITIZER_AMDGPU alloc_flag |= core::MemoryRegion::AllocateAsan; #endif diff --git a/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h b/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h index 38b34b8b44..2f3b48c1d8 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h @@ -1574,6 +1574,10 @@ typedef enum hsa_amd_memory_pool_flag_s { * Allocates physically contiguous memory */ HSA_AMD_MEMORY_POOL_CONTIGUOUS_FLAG = (1 << 1), + /** + * Allocates executable memory + */ + HSA_AMD_MEMORY_POOL_EXECUTABLE_FLAG = (1 << 2), } hsa_amd_memory_pool_flag_t;