diff --git a/projects/rocprofiler-sdk/cmake/rocprofiler_config_interfaces.cmake b/projects/rocprofiler-sdk/cmake/rocprofiler_config_interfaces.cmake index 3f5476c1d2..9c18a0cfe6 100644 --- a/projects/rocprofiler-sdk/cmake/rocprofiler_config_interfaces.cmake +++ b/projects/rocprofiler-sdk/cmake/rocprofiler_config_interfaces.cmake @@ -117,7 +117,6 @@ endif() find_package( hip - 6.2 REQUIRED CONFIG HINTS @@ -126,6 +125,11 @@ find_package( PATHS ${rocm_version_DIR} ${ROCM_PATH}) + +if(hip_VERSION VERSION_LESS "6.2") + message(FATAL_ERROR "HIP version is ${hip_VERSION}, requires at least 6.2") +endif() + target_link_libraries(rocprofiler-sdk-hip INTERFACE hip::host) rocprofiler_config_nolink_target(rocprofiler-sdk-hip-nolink hip::host) diff --git a/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/hip/api_args.h b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/hip/api_args.h index 2d5b76ff2a..637373fa7d 100644 --- a/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/hip/api_args.h +++ b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/hip/api_args.h @@ -3063,6 +3063,78 @@ typedef union rocprofiler_hip_api_args_t const hipBatchMemOpNodeParams* nodeParams; } hipGraphExecBatchMemOpNodeSetParams; #endif +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 9 + struct + { + hipEvent_t event; + hipStream_t stream; + unsigned int flags; + } hipEventRecordWithFlags; +#endif +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 10 + struct + { + hipLinkState_t state; + hipJitInputType type; + void* data; + size_t size; + const char* name; + unsigned int numOptions; + hipJitOption* options; + void** optionValues; + } hipLinkAddData; + struct + { + hipLinkState_t state; + hipJitInputType type; + const char* path; + unsigned int numOptions; + hipJitOption* options; + void** optionValues; + } hipLinkAddFile; + struct + { + hipLinkState_t state; + void** hipBinOut; + size_t* sizeOut; + } hipLinkComplete; + struct + { + unsigned int numOptions; + hipJitOption* options; + void** optionValues; + hipLinkState_t* stateOut; + } hipLinkCreate; + struct + { + hipLinkState_t state; + } hipLinkDestroy; +#endif +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 11 + struct + { + const hipLaunchConfig_t* config; + const void* fPtr; + void** args; + } hipLaunchKernelExC; + struct + { + const HIP_LAUNCH_CONFIG* config; + hipFunction_t f; + void** params; + void** extra; + } hipDrvLaunchKernelEx; +#endif +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 12 + struct + { + void* handle; + hipDeviceptr_t dptr; + size_t size; + hipMemRangeHandleType handleType; + unsigned long long flags; + } hipMemGetHandleForAddressRange; +#endif } rocprofiler_hip_api_args_t; ROCPROFILER_EXTERN_C_FINI diff --git a/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/hip/runtime_api_id.h b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/hip/runtime_api_id.h index 16d2cdc910..bd5edbb61a 100644 --- a/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/hip/runtime_api_id.h +++ b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/hip/runtime_api_id.h @@ -513,6 +513,23 @@ typedef enum rocprofiler_hip_runtime_api_id_t // NOLINT(performance-enum-size) ROCPROFILER_HIP_RUNTIME_API_ID_hipGraphBatchMemOpNodeGetParams, ROCPROFILER_HIP_RUNTIME_API_ID_hipGraphBatchMemOpNodeSetParams, ROCPROFILER_HIP_RUNTIME_API_ID_hipGraphExecBatchMemOpNodeSetParams, +#endif +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 9 + ROCPROFILER_HIP_RUNTIME_API_ID_hipEventRecordWithFlags, +#endif +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 10 + ROCPROFILER_HIP_RUNTIME_API_ID_hipLinkAddData, + ROCPROFILER_HIP_RUNTIME_API_ID_hipLinkAddFile, + ROCPROFILER_HIP_RUNTIME_API_ID_hipLinkComplete, + ROCPROFILER_HIP_RUNTIME_API_ID_hipLinkCreate, + ROCPROFILER_HIP_RUNTIME_API_ID_hipLinkDestroy, +#endif +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 11 + ROCPROFILER_HIP_RUNTIME_API_ID_hipLaunchKernelExC, + ROCPROFILER_HIP_RUNTIME_API_ID_hipDrvLaunchKernelEx, +#endif +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 12 + ROCPROFILER_HIP_RUNTIME_API_ID_hipMemGetHandleForAddressRange, #endif ROCPROFILER_HIP_RUNTIME_API_ID_LAST, } rocprofiler_hip_runtime_api_id_t; diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/hip/abi.cpp b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/hip/abi.cpp index 112f175d03..cc9c3e9aea 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/hip/abi.cpp +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/hip/abi.cpp @@ -550,6 +550,27 @@ ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipGraphBatchMemOpNodeSetParams_fn, 466 ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipGraphExecBatchMemOpNodeSetParams_fn, 467) #endif +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 9 +ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipEventRecordWithFlags_fn, 468) +#endif + +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 10 +ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipLinkAddData_fn, 469) +ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipLinkAddFile_fn, 470) +ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipLinkComplete_fn, 471) +ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipLinkCreate_fn, 472) +ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipLinkDestroy_fn, 473) +#endif + +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 11 +ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipLaunchKernelExC_fn, 474) +ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipDrvLaunchKernelEx_fn, 475) +#endif + +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 12 +ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipMemGetHandleForAddressRange_fn, 476) +#endif + #if HIP_RUNTIME_API_TABLE_STEP_VERSION == 0 ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 442) #elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 1 @@ -568,6 +589,16 @@ ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 463) ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 464) #elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 8 ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 468) +#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 9 +ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 469) +#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 10 +ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 474) +#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 11 +ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 476) +#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 12 +ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 477) +#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 13 +ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 477) #else INTERNAL_CI_ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 0) #endif diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/hip/details/format.hpp b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/hip/details/format.hpp index e1e162de69..beef1ac6e9 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/hip/details/format.hpp +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/hip/details/format.hpp @@ -398,6 +398,36 @@ struct formatter : rocprofiler::hip::details::base_form } }; #endif + +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 11 +ROCP_SDK_HIP_FORMATTER( + hipLaunchConfig_st, + "{}gridDim={}, blockDim={}, dynamicSmemBytes={}, stream={}, attrs={}, numAttrs={}", + '{', + v.gridDim, + v.blockDim, + v.dynamicSmemBytes, + static_cast(v.stream), + static_cast(v.attrs), + v.numAttrs, + '}') + +ROCP_SDK_HIP_FORMATTER(HIP_LAUNCH_CONFIG_st, + "{}gridDimX={}, gridDimY={}, gridDimZ={}, blockDimX={}, blockDimY={}, " + "blockDimZ={}, sharedMemBytes={}, hStream={}, attrs={}, numAttrs={}", + '{', + v.gridDimX, + v.gridDimY, + v.gridDimZ, + v.blockDimX, + v.blockDimY, + v.blockDimZ, + v.sharedMemBytes, + static_cast(v.hStream), + static_cast(v.attrs), + v.numAttrs, + '}') +#endif } // namespace fmt #undef ROCP_SDK_HIP_FORMATTER diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/hip/hip.def.cpp b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/hip/hip.def.cpp index eaa70a4ab9..1dd61e493e 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/hip/hip.def.cpp +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/hip/hip.def.cpp @@ -576,6 +576,27 @@ HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNT HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipGraphBatchMemOpNodeSetParams, hipGraphBatchMemOpNodeSetParams, hipGraphBatchMemOpNodeSetParams_fn, hNode, nodeParams); HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipGraphExecBatchMemOpNodeSetParams, hipGraphExecBatchMemOpNodeSetParams, hipGraphExecBatchMemOpNodeSetParams_fn, hGraphExec, hNode, nodeParams); #endif + +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 9 +HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipEventRecordWithFlags, hipEventRecordWithFlags, hipEventRecordWithFlags_fn, event, stream, flags); +#endif + +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 10 +HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipLinkAddData, hipLinkAddData, hipLinkAddData_fn, state, type, data, size, name, numOptions, options, optionValues); +HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipLinkAddFile, hipLinkAddFile, hipLinkAddFile_fn, state, type, path, numOptions, options, optionValues); +HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipLinkComplete, hipLinkComplete, hipLinkComplete_fn, state, hipBinOut, sizeOut); +HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipLinkCreate, hipLinkCreate, hipLinkCreate_fn, numOptions, options, optionValues, stateOut); +HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipLinkDestroy, hipLinkDestroy, hipLinkDestroy_fn, state); +#endif + +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 11 +HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipLaunchKernelExC, hipLaunchKernelExC, hipLaunchKernelExC_fn, config, fPtr, args); +HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipDrvLaunchKernelEx, hipDrvLaunchKernelEx, hipDrvLaunchKernelEx_fn, config, f, params, extra); +#endif + +#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 12 +HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipMemGetHandleForAddressRange, hipMemGetHandleForAddressRange, hipMemGetHandleForAddressRange_fn, handle, dptr, size, handleType, flags); +#endif // clang-format on #else