From 12785ad365a7c3e539121e7d13bcb35f09c8104c Mon Sep 17 00:00:00 2001 From: "Jonathan R. Madsen" Date: Fri, 21 Jun 2024 11:58:39 -0500 Subject: [PATCH] Add HSA tracing support for `hsa_amd_vmem_address_reserve_align` (#946) * Add support for hsa_amd_vmem_address_reserve_align * Update lib/rocprofiler-sdk/hsa/types.hpp - support HSA_AMD_EXT_API_TABLE_STEP_VERSION == 0x2 for HSA v1.14.0 --------- Co-authored-by: Gopesh Bhardwaj --- .../rocprofiler-sdk/hsa/amd_ext_api_id.h | 3 +++ source/include/rocprofiler-sdk/hsa/api_args.h | 10 +++++++++ source/lib/rocprofiler-sdk/hsa/hsa.def.cpp | 11 ++++++++++ source/lib/rocprofiler-sdk/hsa/types.hpp | 21 +++++++++++++++++-- 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/source/include/rocprofiler-sdk/hsa/amd_ext_api_id.h b/source/include/rocprofiler-sdk/hsa/amd_ext_api_id.h index a4a6e0ad..4301c2ed 100644 --- a/source/include/rocprofiler-sdk/hsa/amd_ext_api_id.h +++ b/source/include/rocprofiler-sdk/hsa/amd_ext_api_id.h @@ -106,6 +106,9 @@ typedef enum // NOLINT(performance-enum-size) # if HSA_AMD_EXT_API_TABLE_STEP_VERSION >= 0x02 ROCPROFILER_HSA_AMD_EXT_API_ID_hsa_amd_queue_get_info, # endif +# if HSA_AMD_EXT_API_TABLE_STEP_VERSION >= 0x03 + ROCPROFILER_HSA_AMD_EXT_API_ID_hsa_amd_vmem_address_reserve_align, +# endif #endif ROCPROFILER_HSA_AMD_EXT_API_ID_LAST, diff --git a/source/include/rocprofiler-sdk/hsa/api_args.h b/source/include/rocprofiler-sdk/hsa/api_args.h index 67a8c80e..158eed53 100644 --- a/source/include/rocprofiler-sdk/hsa/api_args.h +++ b/source/include/rocprofiler-sdk/hsa/api_args.h @@ -1397,6 +1397,16 @@ typedef union rocprofiler_hsa_api_args_t void* value; } hsa_amd_queue_get_info; # endif +# if HSA_AMD_EXT_API_TABLE_STEP_VERSION >= 0x03 + struct + { + void** ptr; + size_t size; + uint64_t address; + uint64_t alignment; + uint64_t flags; + } hsa_amd_vmem_address_reserve_align; +# endif #endif } rocprofiler_hsa_api_args_t; diff --git a/source/lib/rocprofiler-sdk/hsa/hsa.def.cpp b/source/lib/rocprofiler-sdk/hsa/hsa.def.cpp index 1314a9fd..5e3dd6fa 100644 --- a/source/lib/rocprofiler-sdk/hsa/hsa.def.cpp +++ b/source/lib/rocprofiler-sdk/hsa/hsa.def.cpp @@ -444,6 +444,17 @@ HSA_API_INFO_DEFINITION_V(ROCPROFILER_HSA_TABLE_ID_AmdExt, attribute, value) # endif +# if HSA_AMD_EXT_API_TABLE_STEP_VERSION >= 0x03 +HSA_API_INFO_DEFINITION_V(ROCPROFILER_HSA_TABLE_ID_AmdExt, + ROCPROFILER_HSA_AMD_EXT_API_ID_hsa_amd_vmem_address_reserve_align, + hsa_amd_vmem_address_reserve_align, + hsa_amd_vmem_address_reserve_align_fn, + ptr, + size, + address, + alignment, + flags) +# endif # endif #elif defined(ROCPROFILER_LIB_ROCPROFILER_HSA_ASYNC_COPY_CPP_IMPL) && \ diff --git a/source/lib/rocprofiler-sdk/hsa/types.hpp b/source/lib/rocprofiler-sdk/hsa/types.hpp index aa38b140..7994393f 100644 --- a/source/lib/rocprofiler-sdk/hsa/types.hpp +++ b/source/lib/rocprofiler-sdk/hsa/types.hpp @@ -134,7 +134,7 @@ struct table_size; // latest version of hsa runtime that has been updated for support by rocprofiler // and the current version of hsa runtime during this compilation -constexpr size_t latest_version = ROCPROFILER_COMPUTE_VERSION(1, 13, 0); +constexpr size_t latest_version = ROCPROFILER_COMPUTE_VERSION(1, 14, 0); constexpr size_t current_version = ROCPROFILER_HSA_RUNTIME_VERSION; // aliases to the template specializations providing the table size info @@ -173,8 +173,25 @@ struct table_size static constexpr size_t amd_ext = 552; # elif HSA_AMD_EXT_API_TABLE_STEP_VERSION == 0x1 static constexpr size_t amd_ext = 560; -# else +# elif HSA_AMD_EXT_API_TABLE_STEP_VERSION == 0x2 static constexpr size_t amd_ext = 568; +# elif HSA_AMD_EXT_API_TABLE_STEP_VERSION > 0x2 + static constexpr size_t amd_ext = 576; +# endif +}; + +// specialization for v1.14 +template <> +struct table_size +{ + static constexpr size_t finalizer_ext = 64; + static constexpr size_t image_ext = 120; + static constexpr size_t core_api_ext = 1016; + static constexpr size_t amd_tool = 64; +# if HSA_AMD_EXT_API_TABLE_STEP_VERSION == 0x2 + static constexpr size_t amd_ext = 568; +# elif HSA_AMD_EXT_API_TABLE_STEP_VERSION > 0x2 + static constexpr size_t amd_ext = 576; # endif };