From a7db31c5d1a0335411474969cd74e6fb64f321c8 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Thu, 7 Jul 2022 12:35:40 -0400 Subject: [PATCH] Expose memory executable bit for SVM ranges Add support to expose executable bit. Change-Id: I054f5c3173822c369dd9908eec5c449459600ce1 Signed-off-by: David Yat Sin --- runtime/hsa-runtime/core/runtime/runtime.cpp | 8 ++++++++ runtime/hsa-runtime/inc/hsa_ext_amd.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/runtime/hsa-runtime/core/runtime/runtime.cpp b/runtime/hsa-runtime/core/runtime/runtime.cpp index bd6a2d8e6c..8412561608 100644 --- a/runtime/hsa-runtime/core/runtime/runtime.cpp +++ b/runtime/hsa-runtime/core/runtime/runtime.cpp @@ -1826,6 +1826,14 @@ hsa_status_t Runtime::SetSvmAttrib(void* ptr, size_t size, clear_flags |= HSA_SVM_FLAG_GPU_READ_MOSTLY; break; } + case HSA_AMD_SVM_ATTRIB_GPU_EXEC: { + Check(attrib); + if (value) + set_flags |= HSA_SVM_FLAG_GPU_EXEC; + else + clear_flags |= HSA_SVM_FLAG_GPU_EXEC; + break; + } case HSA_AMD_SVM_ATTRIB_AGENT_ACCESSIBLE: { Agent* agent = Convert(value); ConfirmNew(agent); diff --git a/runtime/hsa-runtime/inc/hsa_ext_amd.h b/runtime/hsa-runtime/inc/hsa_ext_amd.h index 9c9ef3d773..b59642ea6c 100644 --- a/runtime/hsa-runtime/inc/hsa_ext_amd.h +++ b/runtime/hsa-runtime/inc/hsa_ext_amd.h @@ -2280,6 +2280,9 @@ typedef enum hsa_amd_svm_attribute_s { // range will be read operations. // Type of this attribute is bool. HSA_AMD_SVM_ATTRIB_READ_MOSTLY = 6, + // Allows the execution on GPU. + // Type of this attribute is bool. + HSA_AMD_SVM_ATTRIB_GPU_EXEC = 7, // This attribute can not be used in ::hsa_amd_svm_attributes_get. // Enables an agent for access to the range. Access may incur a page fault // and associated memory migration. Either this or