Skip to content

Commit

Permalink
Add HSA tracing support for hsa_amd_vmem_address_reserve_align (#946)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
jrmadsen and bgopesh authored Jun 21, 2024
1 parent 79e81c9 commit 12785ad
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
3 changes: 3 additions & 0 deletions source/include/rocprofiler-sdk/hsa/amd_ext_api_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions source/include/rocprofiler-sdk/hsa/api_args.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
11 changes: 11 additions & 0 deletions source/lib/rocprofiler-sdk/hsa/hsa.def.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) && \
Expand Down
21 changes: 19 additions & 2 deletions source/lib/rocprofiler-sdk/hsa/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -173,8 +173,25 @@ struct table_size<ROCPROFILER_COMPUTE_VERSION(1, 13, 0)>
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<ROCPROFILER_COMPUTE_VERSION(1, 14, 0)>
{
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
};

Expand Down

0 comments on commit 12785ad

Please sign in to comment.