SWDEV-421020 - Adds hipGraphAddBatchMemOp, SetGetParams and execSetParams APIs

Change-Id: Ieccecfe6173cc68fd3c01f86c99f7cc09fe194a3
Bu işleme şunda yer alıyor:
Sourabh Betigeri committed 2024-12-13 06:23:39 +00:00
1 ebeveyn 93f1e8ff60
işleme f1c05e9026
8 files changed
+294 -8

No files matched your search

+4
Dosyayı Görüntüle
@@ -481,3 +481,7 @@ hipDrvGraphMemcpyNodeSetParams
hipDrvGraphMemcpyNodeGetParams
hipExtHostAlloc
hipStreamBatchMemOp
hipGraphAddBatchMemOpNode
hipGraphBatchMemOpNodeGetParams
hipGraphBatchMemOpNodeSetParams
hipGraphExecBatchMemOpNodeSetParams
+21 -4
Dosyayı Görüntüle
@@ -804,7 +804,15 @@ hipError_t hipExternalMemoryGetMappedMipmappedArray(
const hipExternalMemoryMipmappedArrayDesc* mipmapDesc);
hipError_t hipDrvGraphMemcpyNodeGetParams(hipGraphNode_t hNode, HIP_MEMCPY3D* nodeParams);
hipError_t hipDrvGraphMemcpyNodeSetParams(hipGraphNode_t hNode, const HIP_MEMCPY3D* nodeParams);
hipError_t hipGraphAddBatchMemOpNode(hipGraphNode_t* phGraphNode, hipGraph_t hGraph,
const hipGraphNode_t* dependencies, size_t numDependencies,
const hipBatchMemOpNodeParams* nodeParams);
hipError_t hipGraphBatchMemOpNodeGetParams(hipGraphNode_t hNode,
hipBatchMemOpNodeParams* nodeParams_out);
hipError_t hipGraphBatchMemOpNodeSetParams(hipGraphNode_t hNode,
hipBatchMemOpNodeParams* nodeParams);
hipError_t hipGraphExecBatchMemOpNodeSetParams(hipGraphExec_t hGraphExec, hipGraphNode_t hNode,
const hipBatchMemOpNodeParams* nodeParams);
} // namespace hip
namespace hip {
@@ -1301,6 +1309,11 @@ void UpdateDispatchTable(HipDispatchTable* ptrDispatchTable) {
hip::hipExternalMemoryGetMappedMipmappedArray;
ptrDispatchTable->hipDrvGraphMemcpyNodeGetParams_fn = hip::hipDrvGraphMemcpyNodeGetParams;
ptrDispatchTable->hipDrvGraphMemcpyNodeSetParams_fn = hip::hipDrvGraphMemcpyNodeSetParams;
ptrDispatchTable->hipGraphAddBatchMemOpNode_fn = hip::hipGraphAddBatchMemOpNode;
ptrDispatchTable->hipGraphBatchMemOpNodeGetParams_fn = hip::hipGraphBatchMemOpNodeGetParams;
ptrDispatchTable->hipGraphBatchMemOpNodeSetParams_fn = hip::hipGraphBatchMemOpNodeSetParams;
ptrDispatchTable->hipGraphExecBatchMemOpNodeSetParams_fn =
hip::hipGraphExecBatchMemOpNodeSetParams;
}
#if HIP_ROCPROFILER_REGISTER > 0
@@ -1892,7 +1905,11 @@ HIP_ENFORCE_ABI(HipDispatchTable, hipExtHostAlloc_fn, 461)
HIP_ENFORCE_ABI(HipDispatchTable, hipDeviceGetTexture1DLinearMaxWidth_fn, 462)
// HIP_RUNTIME_API_TABLE_STEP_VERSION == 7
HIP_ENFORCE_ABI(HipDispatchTable, hipStreamBatchMemOp_fn, 463);
// HIP_RUNTIME_API_TABLE_STEP_VERSION == 8
HIP_ENFORCE_ABI(HipDispatchTable, hipGraphAddBatchMemOpNode_fn, 464);
HIP_ENFORCE_ABI(HipDispatchTable, hipGraphBatchMemOpNodeGetParams_fn, 465);
HIP_ENFORCE_ABI(HipDispatchTable, hipGraphBatchMemOpNodeSetParams_fn, 466);
HIP_ENFORCE_ABI(HipDispatchTable, hipGraphExecBatchMemOpNodeSetParams_fn, 467);
// if HIP_ENFORCE_ABI entries are added for each new function pointer in the table, the number below
// will be +1 of the number in the last HIP_ENFORCE_ABI line. E.g.:
@@ -1900,9 +1917,9 @@ HIP_ENFORCE_ABI(HipDispatchTable, hipStreamBatchMemOp_fn, 463);
// HIP_ENFORCE_ABI(<table>, <functor>, 8)
//
// HIP_ENFORCE_ABI_VERSIONING(<table>, 9) <- 8 + 1 = 9
HIP_ENFORCE_ABI_VERSIONING(HipDispatchTable, 464)
HIP_ENFORCE_ABI_VERSIONING(HipDispatchTable, 468)
static_assert(HIP_RUNTIME_API_TABLE_MAJOR_VERSION == 0 && HIP_RUNTIME_API_TABLE_STEP_VERSION == 7,
static_assert(HIP_RUNTIME_API_TABLE_MAJOR_VERSION == 0 && HIP_RUNTIME_API_TABLE_STEP_VERSION == 8,
"If you get this error, add new HIP_ENFORCE_ABI(...) code for the new function "
"pointers and then update this check so it is true");
#endif
+54
Dosyayı Görüntüle
@@ -3427,4 +3427,58 @@ hipError_t hipDrvGraphMemcpyNodeSetParams(hipGraphNode_t hNode, const HIP_MEMCPY
HIP_RETURN(reinterpret_cast<hip::GraphDrvMemcpyNode*>(hNode)->SetParams(nodeParams));
}
hipError_t hipGraphAddBatchMemOpNode(hipGraphNode_t* phGraphNode, hipGraph_t hGraph,
const hipGraphNode_t* dependencies, size_t numDependencies,
const hipBatchMemOpNodeParams* nodeParams) {
HIP_INIT_API(hipGraphAddBatchMemOpNode, phGraphNode, hGraph, dependencies, numDependencies,
nodeParams);
if (phGraphNode == nullptr || hGraph == nullptr ||
(numDependencies > 0 && dependencies == nullptr) || nodeParams == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
hip::GraphNode* node = new hip::hipGraphBatchMemOpNode(nodeParams);
hipError_t status =
ihipGraphAddNode(node, reinterpret_cast<hip::Graph*>(hGraph),
reinterpret_cast<hip::GraphNode* const*>(dependencies), numDependencies);
*phGraphNode = reinterpret_cast<hipGraphNode_t>(node);
HIP_RETURN(status);
}
hipError_t hipGraphBatchMemOpNodeGetParams(hipGraphNode_t hNode,
hipBatchMemOpNodeParams* nodeParams_out) {
HIP_INIT_API(hipGraphBatchMemOpNodeGetParams, hNode, nodeParams_out);
hip::GraphNode* n = reinterpret_cast<hip::GraphNode*>(hNode);
if (!hip::GraphNode::isNodeValid(n) || nodeParams_out == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
reinterpret_cast<hip::hipGraphBatchMemOpNode*>(n)->GetParams(nodeParams_out);
HIP_RETURN(hipSuccess);
}
hipError_t hipGraphBatchMemOpNodeSetParams(hipGraphNode_t hNode,
hipBatchMemOpNodeParams* nodeParams) {
HIP_INIT_API(hipGraphBatchMemOpNodeSetParams, hNode, nodeParams);
hip::GraphNode* n = reinterpret_cast<hip::GraphNode*>(hNode);
if (!hip::GraphNode::isNodeValid(n) || nodeParams == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
HIP_RETURN(reinterpret_cast<hip::hipGraphBatchMemOpNode*>(n)->SetParams(nodeParams));
}
hipError_t hipGraphExecBatchMemOpNodeSetParams(hipGraphExec_t hGraphExec,
hipGraphNode_t hNode,
const hipBatchMemOpNodeParams* nodeParams) {
HIP_INIT_API(hipGraphExecBatchMemOpNodeSetParams, hGraphExec, hNode, nodeParams);
hip::GraphNode* n = reinterpret_cast<hip::GraphNode*>(hNode);
hip::GraphExec* graphExec = reinterpret_cast<hip::GraphExec*>(hGraphExec);
if (hGraphExec == nullptr || hNode == nullptr || !hip::GraphExec::isGraphExecValid(graphExec) ||
!hip::GraphNode::isNodeValid(n) || nodeParams == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
hip::GraphNode* clonedNode = reinterpret_cast<hip::GraphExec*>(graphExec)->GetClonedNode(n);
if (clonedNode == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
HIP_RETURN(reinterpret_cast<hip::hipGraphBatchMemOpNode*>(clonedNode)->SetParams(nodeParams));
}
} // namespace hip
+45
Dosyayı Görüntüle
@@ -2736,4 +2736,49 @@ class hipGraphExternalSemWaitNode : public GraphNode {
}
};
class hipGraphBatchMemOpNode : public GraphNode {
hipBatchMemOpNodeParams batchMemOpNodeParam_;
public:
hipGraphBatchMemOpNode(const hipBatchMemOpNodeParams* pNodeParams)
: GraphNode(hipGraphNodeTypeBatchMemOp, "solid", "rectangle", "BATCH_MEM_OP_NODE") {
batchMemOpNodeParam_ = *pNodeParams;
}
hipGraphBatchMemOpNode(const hipGraphBatchMemOpNode& rhs) : GraphNode(rhs) {
batchMemOpNodeParam_ = rhs.batchMemOpNodeParam_;
}
~hipGraphBatchMemOpNode() {}
GraphNode* clone() const {
return new hipGraphBatchMemOpNode(static_cast<hipGraphBatchMemOpNode const&>(*this));
}
hipError_t CreateCommand(hip::Stream* stream) {
hipError_t status = GraphNode::CreateCommand(stream);
if (status != hipSuccess) {
return status;
}
amd::Command::EventWaitList waitList;
amd::BatchMemoryOperationCommand* command = new amd::BatchMemoryOperationCommand(
*stream, ROCCLR_COMMAND_BATCH_STREAM, batchMemOpNodeParam_.count,
batchMemOpNodeParam_.flags, waitList, batchMemOpNodeParam_.paramArray,
sizeof(hipStreamBatchMemOpParams));
if (command == nullptr) {
return hipErrorOutOfMemory;
}
commands_.emplace_back(command);
return hipSuccess;
}
void GetParams(hipBatchMemOpNodeParams* pNodeParams) const {
std::memcpy(pNodeParams, &batchMemOpNodeParam_, sizeof(hipBatchMemOpNodeParams));
}
hipError_t SetParams(const hipBatchMemOpNodeParams* pNodeParams) {
std::memcpy(&batchMemOpNodeParam_, pNodeParams, sizeof(hipBatchMemOpNodeParams));
return hipSuccess;
}
};
} // namespace hip
+10 -1
Dosyayı Görüntüle
@@ -583,7 +583,16 @@ local:
hip_6.3 {
global:
hipExtHostAlloc;
hipStreamBatchMemOp;
local:
*;
} hip_6.2;
hip_6.4 {
global:
hipGraphAddBatchMemOpNode;
hipGraphBatchMemOpNodeGetParams;
hipGraphBatchMemOpNodeSetParams;
hipGraphExecBatchMemOpNodeSetParams;
local:
*;
} hip_6.3;
+20
Dosyayı Görüntüle
@@ -1823,3 +1823,23 @@ hipError_t hipGraphNodeSetParams(hipGraphNode_t node, hipGraphNodeParams *nodePa
hipError_t hipExtHostAlloc(void** ptr, size_t size, unsigned int flags) {
return hip::GetHipDispatchTable()->hipExtHostAlloc_fn(ptr, size, flags);
}
hipError_t hipGraphAddBatchMemOpNode(hipGraphNode_t* pGraphNode, hipGraph_t graph,
const hipGraphNode_t* dependencies, size_t numDependencies,
const hipBatchMemOpNodeParams* nodeParams) {
return hip::GetHipDispatchTable()->hipGraphAddBatchMemOpNode_fn(pGraphNode, graph, dependencies,
numDependencies, nodeParams);
}
hipError_t hipGraphBatchMemOpNodeGetParams(hipGraphNode_t hNode,
hipBatchMemOpNodeParams* nodeParams_out) {
return hip::GetHipDispatchTable()->hipGraphBatchMemOpNodeGetParams_fn(hNode, nodeParams_out);
}
hipError_t hipGraphBatchMemOpNodeSetParams(hipGraphNode_t hNode,
hipBatchMemOpNodeParams* nodeParams) {
return hip::GetHipDispatchTable()->hipGraphBatchMemOpNodeSetParams_fn(hNode, nodeParams);
}
hipError_t hipGraphExecBatchMemOpNodeSetParams(hipGraphExec_t hGraphExec,
hipGraphNode_t hNode,
const hipBatchMemOpNodeParams* nodeParams) {
return hip::GetHipDispatchTable()->hipGraphExecBatchMemOpNodeSetParams_fn(hGraphExec, hNode,
nodeParams);
}