Support new HIP APIs (#179)

* Adding New HIP APIs

* Format Fix

* Format Fix

* Removing changes from ostream and moving it to format

* Addressing Code Review Comments

* Versioning the new hip calls formatting

---------

Co-authored-by: Ammar ELWazir <aelwazir@amd.com>
This commit is contained in:
Elwazir, Ammar
2025-02-04 15:50:18 -06:00
gecommit door GitHub
bovenliggende b9ad800194
commit dd5c0ea257
5 gewijzigde bestanden met toevoegingen van 131 en 0 verwijderingen
@@ -3016,6 +3016,41 @@ typedef union rocprofiler_hip_api_args_t
int device;
} hipDeviceGetTexture1DLinearMaxWidth;
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 7
struct
{
hipStream_t stream;
unsigned int count;
hipStreamBatchMemOpParams* paramArray;
unsigned int flags;
} hipStreamBatchMemOp;
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 8
struct
{
hipGraphNode_t* phGraphNode;
hipGraph_t hGraph;
const hipGraphNode_t* dependencies;
size_t numDependencies;
const hipBatchMemOpNodeParams* nodeParams;
} hipGraphAddBatchMemOpNode;
struct
{
hipGraphNode_t hNode;
hipBatchMemOpNodeParams* nodeParams_out;
} hipGraphBatchMemOpNodeGetParams;
struct
{
hipGraphNode_t hNode;
hipBatchMemOpNodeParams* nodeParams;
} hipGraphBatchMemOpNodeSetParams;
struct
{
hipGraphExec_t hGraphExec;
hipGraphNode_t hNode;
const hipBatchMemOpNodeParams* nodeParams;
} hipGraphExecBatchMemOpNodeSetParams;
#endif
} rocprofiler_hip_api_args_t;
ROCPROFILER_EXTERN_C_FINI
@@ -506,6 +506,15 @@ typedef enum // NOLINT(performance-enum-size)
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 6
ROCPROFILER_HIP_RUNTIME_API_ID_hipDeviceGetTexture1DLinearMaxWidth,
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 7
ROCPROFILER_HIP_RUNTIME_API_ID_hipStreamBatchMemOp,
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 8
ROCPROFILER_HIP_RUNTIME_API_ID_hipGraphAddBatchMemOpNode,
ROCPROFILER_HIP_RUNTIME_API_ID_hipGraphBatchMemOpNodeGetParams,
ROCPROFILER_HIP_RUNTIME_API_ID_hipGraphBatchMemOpNodeSetParams,
ROCPROFILER_HIP_RUNTIME_API_ID_hipGraphExecBatchMemOpNodeSetParams,
#endif
ROCPROFILER_HIP_RUNTIME_API_ID_LAST,
} rocprofiler_hip_runtime_api_id_t;
@@ -539,6 +539,17 @@ ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipExtHostAlloc_fn, 461)
ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipDeviceGetTexture1DLinearMaxWidth_fn, 462)
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 7
ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipStreamBatchMemOp_fn, 463)
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 8
ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipGraphAddBatchMemOpNode_fn, 464)
ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipGraphBatchMemOpNodeGetParams_fn, 465)
ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipGraphBatchMemOpNodeSetParams_fn, 466)
ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipGraphExecBatchMemOpNodeSetParams_fn, 467)
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION == 0
ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 442)
#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 1
@@ -553,6 +564,10 @@ ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 461)
ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 462)
#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 6
ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 463)
#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 7
ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 464)
#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 8
ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 468)
#else
INTERNAL_CI_ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 0)
#endif
@@ -113,6 +113,7 @@ ROCP_SDK_HIP_OSTREAM_FORMATTER(hipHostNodeParams)
ROCP_SDK_HIP_OSTREAM_FORMATTER(hipExternalSemaphoreSignalNodeParams)
ROCP_SDK_HIP_OSTREAM_FORMATTER(hipExternalSemaphoreWaitNodeParams)
ROCP_SDK_HIP_OSTREAM_FORMATTER(hipMemPoolProps)
ROCP_SDK_HIP_OSTREAM_FORMATTER(hipCtx_t)
ROCP_SDK_HIP_FORMATTER(hipMemcpyNodeParams,
"{}flags={}, copyParams={}{}",
@@ -163,6 +164,41 @@ ROCP_SDK_HIP_FORMATTER(HIP_MEMSET_NODE_PARAMS,
v.height,
'}')
ROCP_SDK_HIP_FORMATTER(hipMemLocation, "{}type={}, id={}{}", '{', v.type, v.id, '}')
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 7
ROCP_SDK_HIP_FORMATTER(
hipStreamBatchMemOpParams,
"{}operation={}, waitValueOperation={}, waitValueAddress={}, waitValueValue={}, "
"waitValueValue64={}, waitValueFlags={}, writeValueOperation={}, writeValueAddress={}, "
"writeValueValue={}, writeValueValue64={}, writeValueFlags={}, flushRemoteWritesOperation={}, "
"flushRemoteWritesFlags={}, memoryBarrierOperation={}, memoryBarrierFlags={}{}",
'{',
v.operation,
v.waitValue.operation,
v.waitValue.address,
v.waitValue.value,
v.waitValue.value64,
v.waitValue.flags,
v.writeValue.operation,
v.writeValue.address,
v.writeValue.value,
v.writeValue.value64,
v.writeValue.flags,
v.flushRemoteWrites.operation,
v.flushRemoteWrites.flags,
v.memoryBarrier.operation,
v.memoryBarrier.flags,
'}')
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 8
ROCP_SDK_HIP_FORMATTER(hipBatchMemOpNodeParams,
"{}ctx={}, count={}, paramArray=[{}], flags={}{}",
'{',
static_cast<void*>(v.ctx),
v.count,
fmt::join(v.paramArray, v.paramArray + v.count, ", "),
v.flags,
'}')
#endif
template <>
struct formatter<hipGraphNodeType> : rocprofiler::hip::details::base_formatter
@@ -325,6 +361,9 @@ struct formatter<hipGraphNodeParams> : rocprofiler::hip::details::base_formatter
case hipGraphNodeTypeMemcpyFromSymbol:
case hipGraphNodeTypeMemcpyToSymbol:
case hipGraphNodeTypeEmpty:
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 8
case hipGraphNodeTypeBatchMemOp:
#endif
case hipGraphNodeTypeCount:
{
break;
@@ -333,6 +372,28 @@ struct formatter<hipGraphNodeParams> : rocprofiler::hip::details::base_formatter
return fmt::format_to(ctx.out(), "{}type={}{}", '{', v.type, '}');
}
};
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 7
template <>
struct formatter<hipStreamBatchMemOpType> : rocprofiler::hip::details::base_formatter
{
template <typename Ctx>
auto format(hipStreamBatchMemOpType v, Ctx& ctx) const
{
switch(v)
{
ROCP_SDK_HIP_FORMAT_CASE_STMT(hipStreamMemOp, WaitValue32);
ROCP_SDK_HIP_FORMAT_CASE_STMT(hipStreamMemOp, WriteValue32);
ROCP_SDK_HIP_FORMAT_CASE_STMT(hipStreamMemOp, WaitValue64);
ROCP_SDK_HIP_FORMAT_CASE_STMT(hipStreamMemOp, WriteValue64);
ROCP_SDK_HIP_FORMAT_CASE_STMT(hipStreamMemOp, Barrier);
ROCP_SDK_HIP_FORMAT_CASE_STMT(hipStreamMemOp, FlushRemoteWrites);
ROCP_SDK_HIP_FORMAT_DFLT_CASE(hipStreamMemOp);
}
return fmt::format_to(ctx.out(), "Unknown");
}
};
#endif
} // namespace fmt
#undef ROCP_SDK_HIP_FORMATTER
@@ -562,6 +562,17 @@ HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNT
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 6
HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipDeviceGetTexture1DLinearMaxWidth, hipDeviceGetTexture1DLinearMaxWidth, hipDeviceGetTexture1DLinearMaxWidth_fn, maxWidthInElements, fmtDesc, device)
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 7
HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipStreamBatchMemOp, hipStreamBatchMemOp, hipStreamBatchMemOp_fn, stream, count, paramArray, flags);
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 8
HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipGraphAddBatchMemOpNode, hipGraphAddBatchMemOpNode, hipGraphAddBatchMemOpNode_fn, phGraphNode, hGraph, dependencies, numDependencies, nodeParams);
HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipGraphBatchMemOpNodeGetParams, hipGraphBatchMemOpNodeGetParams, hipGraphBatchMemOpNodeGetParams_fn, hNode, nodeParams_out);
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
// clang-format on
#else