Update HSA ABI checks for tracing (#1027)

* Update HSA ABI checks for tracing

* Update lib/common/abi.hpp

- perform ABI versioning checks even when `ROCPROFILER_CI` is not defined (or ROCPROFILER_CI=0)

* Enforce versioning size for various HSA AmdExt step versions + hsa_amd_enable_logging support

* Minor HIP abi.cpp updates

[ROCm/rocprofiler-sdk commit: 7a639f3439]
This commit is contained in:
Jonathan R. Madsen
2024-08-20 01:08:34 -05:00
committed by GitHub
parent 4d3708a6fc
commit 8ed4980b3f
9 changed files with 363 additions and 226 deletions
@@ -56,7 +56,7 @@ compute_table_offset(size_t num_funcs)
// sure these versioning values are appropriately updated -- so commenting out this check, only
// updating the size field in ROCP_SDK_ENFORCE_ABI_VERSIONING, etc. will result in the
// rocprofiler-sdk failing to build and you will be forced to do the work anyway.
#if !defined(ROCPROFILER_UNSAFE_NO_VERSION_CHECK) && (defined(ROCPROFILER_CI) && ROCPROFILER_CI > 0)
#if !defined(ROCPROFILER_UNSAFE_NO_VERSION_CHECK)
# define ROCP_SDK_ENFORCE_ABI_VERSIONING(TABLE, NUM) \
static_assert( \
sizeof(TABLE) == ::rocprofiler::common::abi::compute_table_offset(NUM), \
@@ -72,3 +72,21 @@ compute_table_offset(size_t num_funcs)
# define ROCP_SDK_ENFORCE_ABI_VERSIONING(TABLE, NUM)
# define ROCP_SDK_ENFORCE_ABI(TABLE, ENTRY, NUM)
#endif
// These are guarded by ROCPROFILER_CI=1
#if !defined(ROCPROFILER_UNSAFE_NO_VERSION_CHECK) && (defined(ROCPROFILER_CI) && ROCPROFILER_CI > 0)
# define INTERNAL_CI_ROCP_SDK_ENFORCE_ABI_VERSIONING(TABLE, NUM) \
static_assert( \
sizeof(TABLE) == ::rocprofiler::common::abi::compute_table_offset(NUM), \
"size of the API table struct has changed. Update the STEP_VERSION number (or " \
"in rare cases, the MAJOR_VERSION number)");
# define INTERNAL_CI_ROCP_SDK_ENFORCE_ABI(TABLE, ENTRY, NUM) \
static_assert( \
offsetof(TABLE, ENTRY) == ::rocprofiler::common::abi::compute_table_offset(NUM), \
"ABI break for " #TABLE "." #ENTRY \
". Only add new function pointers to end of struct and do not rearrange them");
#else
# define INTERNAL_CI_ROCP_SDK_ENFORCE_ABI_VERSIONING(TABLE, NUM)
# define INTERNAL_CI_ROCP_SDK_ENFORCE_ABI(TABLE, ENTRY, NUM)
#endif