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>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7fcd80f744
Коммит
72a27feb04
@@ -21,6 +21,7 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#include "lib/rocprofiler-sdk/aql/helpers.hpp"
|
||||
#include "lib/common/defines.hpp"
|
||||
#include "lib/common/logging.hpp"
|
||||
#include "lib/common/synchronized.hpp"
|
||||
#include "lib/common/utility.hpp"
|
||||
@@ -138,8 +139,19 @@ set_profiler_active_on_queue(hsa_amd_memory_pool_t pool,
|
||||
const size_t mask = 0x1000 - 1;
|
||||
auto size = (profile.command_buffer.size + mask) & ~mask;
|
||||
|
||||
#define HSA_AMD_INTERFACE_VERSION \
|
||||
ROCPROFILER_COMPUTE_VERSION(HSA_AMD_INTERFACE_VERSION_MAJOR, HSA_AMD_INTERFACE_VERSION_MINOR, 0)
|
||||
|
||||
#if HSA_AMD_INTERFACE_VERSION >= 10700
|
||||
constexpr auto hsa_amd_memory_pool_executable_flag = HSA_AMD_MEMORY_POOL_EXECUTABLE_FLAG;
|
||||
#elif 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
|
||||
|
||||
if(hsa::get_amd_ext_table()->hsa_amd_memory_pool_allocate_fn(
|
||||
pool, size, HSA_AMD_MEMORY_POOL_EXECUTABLE_FLAG, &profile.command_buffer.ptr) !=
|
||||
pool, size, hsa_amd_memory_pool_executable_flag, &profile.command_buffer.ptr) !=
|
||||
HSA_STATUS_SUCCESS)
|
||||
{
|
||||
ROCP_WARNING << "Failed to allocate memory to enable profile command on agent, some "
|
||||
|
||||
@@ -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(
|
||||
|
||||
Ссылка в новой задаче
Block a user