Fix HSA_AMD_MEMORY_POOL_EXECUTABLE_FLAG for ROCm < 6.3 (#178)

Fix HSA_AMD_MEMORY_POOL_EXECUTABLE_FLAG for ROCm < 6.4

Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
This commit is contained in:
Madsen, Jonathan
2025-02-04 04:05:19 -06:00
committed by GitHub
parent 7fcd80f744
commit 72a27feb04
2 changed files with 25 additions and 2 deletions
@@ -234,9 +234,20 @@ public:
static void* hsa_malloc(size_t size, const Device::Memory& mem)
{
#define LOCAL_HSA_AMD_INTERFACE_VERSION \
(10000 * HSA_AMD_INTERFACE_VERSION_MAJOR) + (100 * HSA_AMD_INTERFACE_VERSION_MINOR)
#if LOCAL_HSA_AMD_INTERFACE_VERSION >= 10700
constexpr auto hsa_amd_memory_pool_executable_flag = HSA_AMD_MEMORY_POOL_EXECUTABLE_FLAG;
#elif LOCAL_HSA_AMD_INTERFACE_VERSION == 10600
constexpr auto hsa_amd_memory_pool_executable_flag = (1 << 2);
#else
constexpr auto hsa_amd_memory_pool_executable_flag = 0;
#endif
void* ret;
hsa_status_t err =
hsa_amd_memory_pool_allocate(mem.pool, size, HSA_AMD_MEMORY_POOL_EXECUTABLE_FLAG, &ret);
hsa_amd_memory_pool_allocate(mem.pool, size, hsa_amd_memory_pool_executable_flag, &ret);
RET_IF_HSA_ERR(err);
err = hsa_amd_agents_allow_access(