SWDEV-421027 - Add hipGraphAddNode
Signed-off-by: sdashmiz <shadi.dashmiz@amd.com> Change-Id: Ic8cf293ff483ee2547b52d2975062bcb9a6f5d17
Esse commit está contido em:
@@ -255,6 +255,7 @@ typedef hipError_t (*t_hipGraphAddMemsetNode)(hipGraphNode_t* pGraphNode, hipGra
|
||||
const hipGraphNode_t* pDependencies,
|
||||
size_t numDependencies,
|
||||
const hipMemsetParams* pMemsetParams);
|
||||
|
||||
typedef hipError_t (*t_hipGraphChildGraphNodeGetGraph)(hipGraphNode_t node, hipGraph_t* pGraph);
|
||||
typedef hipError_t (*t_hipGraphClone)(hipGraph_t* pGraphClone, hipGraph_t originalGraph);
|
||||
typedef hipError_t (*t_hipGraphCreate)(hipGraph_t* pGraph, unsigned int flags);
|
||||
@@ -870,24 +871,31 @@ typedef int (*t_hipGetStreamDeviceId)(hipStream_t stream);
|
||||
typedef hipError_t (*t_hipDrvGraphAddMemsetNode)(hipGraphNode_t* phGraphNode, hipGraph_t hGraph,
|
||||
const hipGraphNode_t* dependencies, size_t numDependencies,
|
||||
const HIP_MEMSET_NODE_PARAMS* memsetParams, hipCtx_t ctx);
|
||||
typedef hipError_t (*t_hipGraphAddExternalSemaphoresWaitNode)(hipGraphNode_t* pGraphNode, hipGraph_t graph,
|
||||
const hipGraphNode_t* pDependencies, size_t numDependencies,
|
||||
typedef hipError_t (*t_hipGraphAddExternalSemaphoresWaitNode)(hipGraphNode_t* pGraphNode,
|
||||
hipGraph_t graph, const hipGraphNode_t* pDependencies,
|
||||
size_t numDependencies,
|
||||
const hipExternalSemaphoreWaitNodeParams* nodeParams);
|
||||
typedef hipError_t (*t_hipGraphAddExternalSemaphoresSignalNode)(hipGraphNode_t* pGraphNode, hipGraph_t graph,
|
||||
const hipGraphNode_t* pDependencies, size_t numDependencies,
|
||||
typedef hipError_t (*t_hipGraphAddExternalSemaphoresSignalNode)(hipGraphNode_t* pGraphNode,
|
||||
hipGraph_t graph, const hipGraphNode_t* pDependencies,
|
||||
size_t numDependencies,
|
||||
const hipExternalSemaphoreSignalNodeParams* nodeParams);
|
||||
typedef hipError_t (*t_hipGraphExternalSemaphoresSignalNodeSetParams)(hipGraphNode_t hNode,
|
||||
const hipExternalSemaphoreSignalNodeParams* nodeParams);
|
||||
const hipExternalSemaphoreSignalNodeParams* nodeParams);
|
||||
typedef hipError_t (*t_hipGraphExternalSemaphoresWaitNodeSetParams)(hipGraphNode_t hNode,
|
||||
const hipExternalSemaphoreWaitNodeParams* nodeParams);
|
||||
const hipExternalSemaphoreWaitNodeParams* nodeParams);
|
||||
typedef hipError_t (*t_hipGraphExternalSemaphoresSignalNodeGetParams)(hipGraphNode_t hNode,
|
||||
hipExternalSemaphoreSignalNodeParams* params_out);
|
||||
hipExternalSemaphoreSignalNodeParams* params_out);
|
||||
typedef hipError_t (*t_hipGraphExternalSemaphoresWaitNodeGetParams)(hipGraphNode_t hNode,
|
||||
hipExternalSemaphoreWaitNodeParams* params_out);
|
||||
typedef hipError_t (*t_hipGraphExecExternalSemaphoresSignalNodeSetParams)(hipGraphExec_t hGraphExec, hipGraphNode_t hNode,
|
||||
const hipExternalSemaphoreSignalNodeParams* nodeParams);
|
||||
typedef hipError_t (*t_hipGraphExecExternalSemaphoresWaitNodeSetParams)(hipGraphExec_t hGraphExec, hipGraphNode_t hNode,
|
||||
const hipExternalSemaphoreWaitNodeParams* nodeParams);
|
||||
hipExternalSemaphoreWaitNodeParams* params_out);
|
||||
typedef hipError_t (*t_hipGraphExecExternalSemaphoresSignalNodeSetParams)(hipGraphExec_t hGraphExec,
|
||||
hipGraphNode_t hNode,
|
||||
const hipExternalSemaphoreSignalNodeParams* nodeParams);
|
||||
typedef hipError_t (*t_hipGraphExecExternalSemaphoresWaitNodeSetParams)(hipGraphExec_t hGraphExec,
|
||||
hipGraphNode_t hNode,
|
||||
const hipExternalSemaphoreWaitNodeParams* nodeParams);
|
||||
typedef hipError_t (*t_hipGraphAddNode)(hipGraphNode_t *pGraphNode, hipGraph_t graph,
|
||||
const hipGraphNode_t *pDependencies, size_t numDependencies,
|
||||
hipGraphNodeParams *nodeParams);
|
||||
|
||||
// HIP Compiler dispatch table
|
||||
struct HipCompilerDispatchTable {
|
||||
@@ -1347,4 +1355,5 @@ struct HipDispatchTable {
|
||||
t_hipGraphExternalSemaphoresWaitNodeGetParams hipGraphExternalSemaphoresWaitNodeGetParams_fn;
|
||||
t_hipGraphExecExternalSemaphoresSignalNodeSetParams hipGraphExecExternalSemaphoresSignalNodeSetParams_fn;
|
||||
t_hipGraphExecExternalSemaphoresWaitNodeSetParams hipGraphExecExternalSemaphoresWaitNodeSetParams_fn;
|
||||
t_hipGraphAddNode hipGraphAddNode_fn;
|
||||
};
|
||||
|
||||
@@ -397,7 +397,8 @@ enum hip_api_id_t {
|
||||
HIP_API_ID_hipGraphExternalSemaphoresWaitNodeGetParams = 377,
|
||||
HIP_API_ID_hipGraphExternalSemaphoresWaitNodeSetParams = 378,
|
||||
HIP_API_ID_hipExtGetLastError = 379,
|
||||
HIP_API_ID_LAST = 379,
|
||||
HIP_API_ID_hipGraphAddNode = 380,
|
||||
HIP_API_ID_LAST = 380,
|
||||
|
||||
HIP_API_ID_hipChooseDevice = HIP_API_ID_CONCAT(HIP_API_ID_,hipChooseDevice),
|
||||
HIP_API_ID_hipGetDeviceProperties = HIP_API_ID_CONCAT(HIP_API_ID_,hipGetDeviceProperties),
|
||||
@@ -431,7 +432,6 @@ enum hip_api_id_t {
|
||||
HIP_API_ID_hipTexRefGetBorderColor = HIP_API_ID_NONE,
|
||||
HIP_API_ID_hipTexRefGetFilterMode = HIP_API_ID_NONE,
|
||||
HIP_API_ID_hipTexRefGetMipmapFilterMode = HIP_API_ID_NONE,
|
||||
HIP_API_ID_hipTexRefGetMipmappedArray = HIP_API_ID_NONE,
|
||||
HIP_API_ID_hipTexRefSetAddressMode = HIP_API_ID_NONE,
|
||||
HIP_API_ID_hipTexRefSetFilterMode = HIP_API_ID_NONE,
|
||||
HIP_API_ID_hipTexRefSetMipmapFilterMode = HIP_API_ID_NONE,
|
||||
@@ -570,6 +570,7 @@ static inline const char* hip_api_name(const uint32_t id) {
|
||||
case HIP_API_ID_hipGraphAddMemcpyNodeFromSymbol: return "hipGraphAddMemcpyNodeFromSymbol";
|
||||
case HIP_API_ID_hipGraphAddMemcpyNodeToSymbol: return "hipGraphAddMemcpyNodeToSymbol";
|
||||
case HIP_API_ID_hipGraphAddMemsetNode: return "hipGraphAddMemsetNode";
|
||||
case HIP_API_ID_hipGraphAddNode: return "hipGraphAddNode";
|
||||
case HIP_API_ID_hipGraphChildGraphNodeGetGraph: return "hipGraphChildGraphNodeGetGraph";
|
||||
case HIP_API_ID_hipGraphClone: return "hipGraphClone";
|
||||
case HIP_API_ID_hipGraphCreate: return "hipGraphCreate";
|
||||
@@ -952,6 +953,7 @@ static inline uint32_t hipApiIdByName(const char* name) {
|
||||
if (strcmp("hipGraphAddMemcpyNodeFromSymbol", name) == 0) return HIP_API_ID_hipGraphAddMemcpyNodeFromSymbol;
|
||||
if (strcmp("hipGraphAddMemcpyNodeToSymbol", name) == 0) return HIP_API_ID_hipGraphAddMemcpyNodeToSymbol;
|
||||
if (strcmp("hipGraphAddMemsetNode", name) == 0) return HIP_API_ID_hipGraphAddMemsetNode;
|
||||
if (strcmp("hipGraphAddNode", name) == 0) return HIP_API_ID_hipGraphAddNode;
|
||||
if (strcmp("hipGraphChildGraphNodeGetGraph", name) == 0) return HIP_API_ID_hipGraphChildGraphNodeGetGraph;
|
||||
if (strcmp("hipGraphClone", name) == 0) return HIP_API_ID_hipGraphClone;
|
||||
if (strcmp("hipGraphCreate", name) == 0) return HIP_API_ID_hipGraphCreate;
|
||||
@@ -1906,6 +1908,16 @@ typedef struct hip_api_data_s {
|
||||
const hipMemsetParams* pMemsetParams;
|
||||
hipMemsetParams pMemsetParams__val;
|
||||
} hipGraphAddMemsetNode;
|
||||
struct {
|
||||
hipGraphNode_t* pGraphNode;
|
||||
hipGraphNode_t pGraphNode__val;
|
||||
hipGraph_t graph;
|
||||
const hipGraphNode_t* pDependencies;
|
||||
hipGraphNode_t pDependencies__val;
|
||||
size_t numDependencies;
|
||||
hipGraphNodeParams* nodeParams;
|
||||
hipGraphNodeParams nodeParams__val;
|
||||
} hipGraphAddNode;
|
||||
struct {
|
||||
hipGraphNode_t node;
|
||||
hipGraph_t* pGraph;
|
||||
@@ -3729,9 +3741,21 @@ typedef struct hip_api_data_s {
|
||||
};
|
||||
// hipDrvGraphAddMemcpyNode[('hipGraphNode_t*', 'phGraphNode'), ('hipGraph_t', 'hGraph'), ('const hipGraphNode_t*', 'dependencies'), ('size_t', 'numDependencies'), ('const HIP_MEMCPY3D*', 'copyParams'), ('hipCtx_t', 'ctx')]
|
||||
#define INIT_hipDrvGraphAddMemcpyNode_CB_ARGS_DATA(cb_data) { \
|
||||
cb_data.args.hipDrvGraphAddMemcpyNode.phGraphNode = (hipGraphNode_t*)phGraphNode; \
|
||||
cb_data.args.hipDrvGraphAddMemcpyNode.hGraph = (hipGraph_t)hGraph; \
|
||||
cb_data.args.hipDrvGraphAddMemcpyNode.dependencies = (const hipGraphNode_t*)dependencies; \
|
||||
cb_data.args.hipDrvGraphAddMemcpyNode.numDependencies = (size_t)numDependencies; \
|
||||
cb_data.args.hipDrvGraphAddMemcpyNode.copyParams = (const HIP_MEMCPY3D*)copyParams; \
|
||||
cb_data.args.hipDrvGraphAddMemcpyNode.ctx = (hipCtx_t)ctx; \
|
||||
};
|
||||
// hipDrvGraphAddMemsetNode[('hipGraphNode_t*', 'phGraphNode'), ('hipGraph_t', 'hGraph'), ('const hipGraphNode_t*', 'dependencies'), ('size_t', 'numDependencies'), ('const HIP_MEMSET_NODE_PARAMS*', 'memsetParams'), ('hipCtx_t', 'ctx')]
|
||||
#define INIT_hipDrvGraphAddMemsetNode_CB_ARGS_DATA(cb_data) { \
|
||||
cb_data.args.hipDrvGraphAddMemsetNode.phGraphNode = (hipGraphNode_t*)phGraphNode; \
|
||||
cb_data.args.hipDrvGraphAddMemsetNode.hGraph = (hipGraph_t)hGraph; \
|
||||
cb_data.args.hipDrvGraphAddMemsetNode.dependencies = (const hipGraphNode_t*)dependencies; \
|
||||
cb_data.args.hipDrvGraphAddMemsetNode.numDependencies = (size_t)numDependencies; \
|
||||
cb_data.args.hipDrvGraphAddMemsetNode.memsetParams = (const HIP_MEMSET_NODE_PARAMS*)memsetParams; \
|
||||
cb_data.args.hipDrvGraphAddMemsetNode.ctx = (hipCtx_t)ctx; \
|
||||
};
|
||||
// hipDrvGraphMemcpyNodeGetParams[('hipGraphNode_t', 'hNode'), ('HIP_MEMCPY3D*', 'nodeParams')]
|
||||
#define INIT_hipDrvGraphMemcpyNodeGetParams_CB_ARGS_DATA(cb_data) { \
|
||||
@@ -3791,6 +3815,9 @@ typedef struct hip_api_data_s {
|
||||
#define INIT_hipEventSynchronize_CB_ARGS_DATA(cb_data) { \
|
||||
cb_data.args.hipEventSynchronize.event = (hipEvent_t)event; \
|
||||
};
|
||||
// hipExtGetLastError[]
|
||||
#define INIT_hipExtGetLastError_CB_ARGS_DATA(cb_data) { \
|
||||
};
|
||||
// hipExtGetLinkTypeAndHopCount[('int', 'device1'), ('int', 'device2'), ('unsigned int*', 'linktype'), ('unsigned int*', 'hopcount')]
|
||||
#define INIT_hipExtGetLinkTypeAndHopCount_CB_ARGS_DATA(cb_data) { \
|
||||
cb_data.args.hipExtGetLinkTypeAndHopCount.device1 = (int)device1; \
|
||||
@@ -4094,6 +4121,14 @@ typedef struct hip_api_data_s {
|
||||
cb_data.args.hipGraphAddMemsetNode.numDependencies = (size_t)numDependencies; \
|
||||
cb_data.args.hipGraphAddMemsetNode.pMemsetParams = (const hipMemsetParams*)pMemsetParams; \
|
||||
};
|
||||
// hipGraphAddNode[('hipGraphNode_t*', 'pGraphNode'), ('hipGraph_t', 'graph'), ('const hipGraphNode_t*', 'pDependencies'), ('size_t', 'numDependencies'), ('hipGraphNodeParams*', 'nodeParams')]
|
||||
#define INIT_hipGraphAddNode_CB_ARGS_DATA(cb_data) { \
|
||||
cb_data.args.hipGraphAddNode.pGraphNode = (hipGraphNode_t*)pGraphNode; \
|
||||
cb_data.args.hipGraphAddNode.graph = (hipGraph_t)graph; \
|
||||
cb_data.args.hipGraphAddNode.pDependencies = (const hipGraphNode_t*)pDependencies; \
|
||||
cb_data.args.hipGraphAddNode.numDependencies = (size_t)numDependencies; \
|
||||
cb_data.args.hipGraphAddNode.nodeParams = (hipGraphNodeParams*)nodeParams; \
|
||||
};
|
||||
// hipGraphChildGraphNodeGetGraph[('hipGraphNode_t', 'node'), ('hipGraph_t*', 'pGraph')]
|
||||
#define INIT_hipGraphChildGraphNodeGetGraph_CB_ARGS_DATA(cb_data) { \
|
||||
cb_data.args.hipGraphChildGraphNodeGetGraph.node = (hipGraphNode_t)node; \
|
||||
@@ -5697,8 +5732,6 @@ typedef struct hip_api_data_s {
|
||||
#define INIT_hipTexRefGetFilterMode_CB_ARGS_DATA(cb_data) {};
|
||||
// hipTexRefGetMipmapFilterMode()
|
||||
#define INIT_hipTexRefGetMipmapFilterMode_CB_ARGS_DATA(cb_data) {};
|
||||
// hipTexRefGetMipmappedArray()
|
||||
#define INIT_hipTexRefGetMipmappedArray_CB_ARGS_DATA(cb_data) {};
|
||||
// hipTexRefSetAddressMode()
|
||||
#define INIT_hipTexRefSetAddressMode_CB_ARGS_DATA(cb_data) {};
|
||||
// hipTexRefSetFilterMode()
|
||||
@@ -6227,6 +6260,12 @@ static inline void hipApiArgsInit(hip_api_id_t id, hip_api_data_t* data) {
|
||||
if (data->args.hipGraphAddMemsetNode.pDependencies) data->args.hipGraphAddMemsetNode.pDependencies__val = *(data->args.hipGraphAddMemsetNode.pDependencies);
|
||||
if (data->args.hipGraphAddMemsetNode.pMemsetParams) data->args.hipGraphAddMemsetNode.pMemsetParams__val = *(data->args.hipGraphAddMemsetNode.pMemsetParams);
|
||||
break;
|
||||
// hipGraphAddNode[('hipGraphNode_t*', 'pGraphNode'), ('hipGraph_t', 'graph'), ('const hipGraphNode_t*', 'pDependencies'), ('size_t', 'numDependencies'), ('hipGraphNodeParams*', 'nodeParams')]
|
||||
case HIP_API_ID_hipGraphAddNode:
|
||||
if (data->args.hipGraphAddNode.pGraphNode) data->args.hipGraphAddNode.pGraphNode__val = *(data->args.hipGraphAddNode.pGraphNode);
|
||||
if (data->args.hipGraphAddNode.pDependencies) data->args.hipGraphAddNode.pDependencies__val = *(data->args.hipGraphAddNode.pDependencies);
|
||||
if (data->args.hipGraphAddNode.nodeParams) data->args.hipGraphAddNode.nodeParams__val = *(data->args.hipGraphAddNode.nodeParams);
|
||||
break;
|
||||
// hipGraphChildGraphNodeGetGraph[('hipGraphNode_t', 'node'), ('hipGraph_t*', 'pGraph')]
|
||||
case HIP_API_ID_hipGraphChildGraphNodeGetGraph:
|
||||
if (data->args.hipGraphChildGraphNodeGetGraph.pGraph) data->args.hipGraphChildGraphNodeGetGraph.pGraph__val = *(data->args.hipGraphChildGraphNodeGetGraph.pGraph);
|
||||
@@ -8151,6 +8190,18 @@ static inline const char* hipApiString(hip_api_id_t id, const hip_api_data_t* da
|
||||
else { oss << ", pMemsetParams="; roctracer::hip_support::detail::operator<<(oss, data->args.hipGraphAddMemsetNode.pMemsetParams__val); }
|
||||
oss << ")";
|
||||
break;
|
||||
case HIP_API_ID_hipGraphAddNode:
|
||||
oss << "hipGraphAddNode(";
|
||||
if (data->args.hipGraphAddNode.pGraphNode == NULL) oss << "pGraphNode=NULL";
|
||||
else { oss << "pGraphNode="; roctracer::hip_support::detail::operator<<(oss, data->args.hipGraphAddNode.pGraphNode__val); }
|
||||
oss << ", graph="; roctracer::hip_support::detail::operator<<(oss, data->args.hipGraphAddNode.graph);
|
||||
if (data->args.hipGraphAddNode.pDependencies == NULL) oss << ", pDependencies=NULL";
|
||||
else { oss << ", pDependencies="; roctracer::hip_support::detail::operator<<(oss, data->args.hipGraphAddNode.pDependencies__val); }
|
||||
oss << ", numDependencies="; roctracer::hip_support::detail::operator<<(oss, data->args.hipGraphAddNode.numDependencies);
|
||||
if (data->args.hipGraphAddNode.nodeParams == NULL) oss << ", nodeParams=NULL";
|
||||
else { oss << ", nodeParams="; roctracer::hip_support::detail::operator<<(oss, data->args.hipGraphAddNode.nodeParams__val); }
|
||||
oss << ")";
|
||||
break;
|
||||
case HIP_API_ID_hipGraphChildGraphNodeGetGraph:
|
||||
oss << "hipGraphChildGraphNodeGetGraph(";
|
||||
oss << "node="; roctracer::hip_support::detail::operator<<(oss, data->args.hipGraphChildGraphNodeGetGraph.node);
|
||||
|
||||
@@ -459,3 +459,4 @@ hipGraphExternalSemaphoresWaitNodeSetParams
|
||||
hipGraphExternalSemaphoresWaitNodeGetParams
|
||||
hipGraphExecExternalSemaphoresSignalNodeSetParams
|
||||
hipGraphExecExternalSemaphoresWaitNodeSetParams
|
||||
hipGraphAddNode
|
||||
|
||||
@@ -223,6 +223,9 @@ hipError_t hipGraphAddMemcpyNodeToSymbol(hipGraphNode_t* pGraphNode, hipGraph_t
|
||||
hipError_t hipGraphAddMemsetNode(hipGraphNode_t* pGraphNode, hipGraph_t graph,
|
||||
const hipGraphNode_t* pDependencies, size_t numDependencies,
|
||||
const hipMemsetParams* pMemsetParams);
|
||||
hipError_t hipGraphAddNode(hipGraphNode_t *pGraphNode, hipGraph_t graph,
|
||||
const hipGraphNode_t *pDependencies, size_t numDependencies,
|
||||
hipGraphNodeParams *nodeParams);
|
||||
hipError_t hipGraphChildGraphNodeGetGraph(hipGraphNode_t node, hipGraph_t* pGraph);
|
||||
hipError_t hipGraphClone(hipGraph_t* pGraphClone, hipGraph_t originalGraph);
|
||||
hipError_t hipGraphCreate(hipGraph_t* pGraph, unsigned int flags);
|
||||
@@ -885,6 +888,7 @@ void UpdateHipDispatchTable(HipDispatchTable* ptrDispatchTable) {
|
||||
ptrDispatchTable->hipGraphAddMemcpyNodeFromSymbol_fn = hip::hipGraphAddMemcpyNodeFromSymbol;
|
||||
ptrDispatchTable->hipGraphAddMemcpyNodeToSymbol_fn = hip::hipGraphAddMemcpyNodeToSymbol;
|
||||
ptrDispatchTable->hipGraphAddMemsetNode_fn = hip::hipGraphAddMemsetNode;
|
||||
ptrDispatchTable->hipGraphAddNode_fn = hip::hipGraphAddNode;
|
||||
ptrDispatchTable->hipGraphChildGraphNodeGetGraph_fn = hip::hipGraphChildGraphNodeGetGraph;
|
||||
ptrDispatchTable->hipGraphClone_fn = hip::hipGraphClone;
|
||||
ptrDispatchTable->hipGraphCreate_fn = hip::hipGraphCreate;
|
||||
|
||||
+140
-5
@@ -2624,15 +2624,150 @@ hipError_t hipGraphUpload(hipGraphExec_t graphExec, hipStream_t stream) {
|
||||
HIP_RETURN(hipSuccess);
|
||||
}
|
||||
|
||||
hipError_t hipGraphAddExternalSemaphoresSignalNode(hipGraphNode_t* pGraphNode, hipGraph_t graph,
|
||||
const hipGraphNode_t* pDependencies, size_t numDependencies,
|
||||
const hipExternalSemaphoreSignalNodeParams* nodeParams) {
|
||||
HIP_INIT_API(hipGraphAddExternalSemaphoresSignalNode, pGraphNode, graph, pDependencies,
|
||||
numDependencies, nodeParams);
|
||||
hipError_t hipGraphAddNode(hipGraphNode_t *pGraphNode, hipGraph_t graph,
|
||||
const hipGraphNode_t *pDependencies, size_t numDependencies,
|
||||
hipGraphNodeParams *nodeParams) {
|
||||
HIP_INIT_API(hipGraphAddNode, pGraphNode, graph, pDependencies, numDependencies, nodeParams);
|
||||
if (pGraphNode == nullptr || graph == nullptr ||
|
||||
(numDependencies > 0 && pDependencies == nullptr) || nodeParams == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
hipGraphNodeType nodeType = nodeParams->type;
|
||||
hip::GraphNode* node;
|
||||
hipError_t status = hipSuccess;
|
||||
hip::GraphMemAllocNode* mem_alloc_node;
|
||||
amd::Memory* memory;
|
||||
size_t offset;
|
||||
hipMemAllocNodeParams params;
|
||||
|
||||
switch(nodeType) {
|
||||
case hipGraphNodeTypeKernel:
|
||||
status = ihipGraphAddKernelNode(
|
||||
&node, reinterpret_cast<hip::Graph*>(graph),
|
||||
reinterpret_cast<hip::GraphNode* const*>(pDependencies), numDependencies,
|
||||
&nodeParams->kernel,
|
||||
nullptr, false);
|
||||
break;
|
||||
case hipGraphNodeTypeMemcpy:
|
||||
status = ihipGraphAddMemcpyNode(
|
||||
&node, reinterpret_cast<hip::Graph*>(graph),
|
||||
reinterpret_cast<hip::GraphNode* const*>(pDependencies), numDependencies,
|
||||
&nodeParams->memcpy.copyParams,
|
||||
false);
|
||||
break;
|
||||
case hipGraphNodeTypeMemset:
|
||||
status =
|
||||
ihipGraphAddMemsetNode(&node, reinterpret_cast<hip::Graph*>(graph),
|
||||
reinterpret_cast<hip::GraphNode* const*>(pDependencies),
|
||||
numDependencies, &nodeParams->memset, false);
|
||||
break;
|
||||
case hipGraphNodeTypeHost:
|
||||
if(nodeParams->host.fn == nullptr)
|
||||
{
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
node = new hip::GraphHostNode(&nodeParams->host);
|
||||
status = ihipGraphAddNode(node, reinterpret_cast<hip::Graph*>(graph),
|
||||
reinterpret_cast<hip::GraphNode* const*>(pDependencies),
|
||||
numDependencies, false);
|
||||
break;
|
||||
case hipGraphNodeTypeGraph:
|
||||
if(nodeParams->graph.graph == nullptr)
|
||||
{
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
node = new hip::ChildGraphNode(reinterpret_cast<hip::Graph*>(nodeParams->graph.graph));
|
||||
status = ihipGraphAddNode(node, reinterpret_cast<hip::Graph*>(graph),
|
||||
reinterpret_cast<hip::GraphNode* const*>(pDependencies),
|
||||
numDependencies, false);
|
||||
break;
|
||||
case hipGraphNodeTypeWaitEvent:
|
||||
if(nodeParams->eventWait.event == nullptr)
|
||||
{
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
node = new hip::GraphEventWaitNode(nodeParams->eventWait.event);
|
||||
status = ihipGraphAddNode(node, reinterpret_cast<hip::Graph*>(graph),
|
||||
reinterpret_cast<hip::GraphNode* const*>(pDependencies),
|
||||
numDependencies, false);
|
||||
break;
|
||||
case hipGraphNodeTypeEventRecord:
|
||||
if(nodeParams->eventRecord.event == nullptr)
|
||||
{
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
node = new hip::GraphEventRecordNode(nodeParams->eventRecord.event);
|
||||
status = ihipGraphAddNode(node, reinterpret_cast<hip::Graph*>(graph),
|
||||
reinterpret_cast<hip::GraphNode* const*>(pDependencies),
|
||||
numDependencies, false);
|
||||
break;
|
||||
case hipGraphNodeTypeExtSemaphoreSignal:
|
||||
status = hipSuccess;
|
||||
// to be added.
|
||||
break;
|
||||
case hipGraphNodeTypeExtSemaphoreWait:
|
||||
status = hipSuccess;
|
||||
// to be added.
|
||||
break;
|
||||
case hipGraphNodeTypeMemAlloc:
|
||||
params = nodeParams->alloc;
|
||||
if (params.bytesize == 0 ||
|
||||
params.poolProps.allocType != hipMemAllocationTypePinned ||
|
||||
params.poolProps.location.type != hipMemLocationTypeDevice) {
|
||||
params.dptr = nullptr;
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
if (params.poolProps.location.type == hipMemLocationTypeDevice) {
|
||||
if (params.poolProps.location.id < 0 ||
|
||||
params.poolProps.location.id >= g_devices.size()) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
}
|
||||
// Clear the pointer to allocated memory because it may contain stale/uninitialized data
|
||||
params.dptr = nullptr;
|
||||
mem_alloc_node = new hip::GraphMemAllocNode(¶ms);
|
||||
node = mem_alloc_node;
|
||||
status =
|
||||
ihipGraphAddNode(node, reinterpret_cast<hip::Graph*>(graph),
|
||||
reinterpret_cast<hip::GraphNode* const*>(pDependencies), numDependencies);
|
||||
// The address must be provided during the node creation time
|
||||
nodeParams->alloc.dptr =
|
||||
(HIP_MEM_POOL_USE_VM) ? mem_alloc_node->ReserveAddress() : mem_alloc_node->Execute();
|
||||
break;
|
||||
case hipGraphNodeTypeMemFree:
|
||||
if(nodeParams->free.dptr == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
// Is memory passed to be free'd valid
|
||||
offset = 0;
|
||||
memory = getMemoryObject(nodeParams->free.dptr, offset);
|
||||
if (memory == nullptr) {
|
||||
if (HIP_MEM_POOL_USE_VM) {
|
||||
// When VM is on the address must be valid and may point to a VA object
|
||||
memory = amd::MemObjMap::FindVirtualMemObj(nodeParams->free.dptr);
|
||||
}
|
||||
if (memory == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
}
|
||||
node = new hip::GraphMemFreeNode(nodeParams->free.dptr);
|
||||
status =
|
||||
ihipGraphAddNode(node, reinterpret_cast<hip::Graph*>(graph),
|
||||
reinterpret_cast<hip::GraphNode* const*>(pDependencies), numDependencies);
|
||||
break;
|
||||
default:
|
||||
status = hipErrorInvalidValue;
|
||||
break;
|
||||
}
|
||||
*pGraphNode = reinterpret_cast<hipGraphNode*>(node);
|
||||
HIP_RETURN(status);
|
||||
}
|
||||
|
||||
hipError_t hipGraphAddExternalSemaphoresSignalNode(hipGraphNode_t* pGraphNode, hipGraph_t graph,
|
||||
const hipGraphNode_t* pDependencies, size_t numDependencies,
|
||||
const hipExternalSemaphoreSignalNodeParams* nodeParams) {
|
||||
HIP_INIT_API(hipGraphAddExternalSemaphoresSignalNode, pGraphNode, graph, pDependencies,
|
||||
numDependencies, nodeParams);
|
||||
hip::GraphNode* node = new hip::hipGraphExternalSemSignalNode(nodeParams);
|
||||
hipError_t status = ihipGraphAddNode(node, reinterpret_cast<hip::Graph*>(graph),
|
||||
reinterpret_cast<hip::GraphNode* const*>(pDependencies), numDependencies);
|
||||
|
||||
@@ -2364,9 +2364,9 @@ class hipGraphExternalSemSignalNode : public GraphNode {
|
||||
for (unsigned int i = 0; i < numExtSems; i++) {
|
||||
if (externalSemaphorNodeParam_.extSemArray[i] != nullptr) {
|
||||
amd::ExternalSemaphoreCmd* command = new amd::ExternalSemaphoreCmd(*stream,
|
||||
externalSemaphorNodeParam_.extSemArray[i],
|
||||
externalSemaphorNodeParam_.paramsArray[i].params.fence.value,
|
||||
amd::ExternalSemaphoreCmd::COMMAND_SIGNAL_EXTSEMAPHORE);
|
||||
externalSemaphorNodeParam_.extSemArray[i],
|
||||
externalSemaphorNodeParam_.paramsArray[i].params.fence.value,
|
||||
amd::ExternalSemaphoreCmd::COMMAND_SIGNAL_EXTSEMAPHORE);
|
||||
if (command == nullptr) {
|
||||
return hipErrorOutOfMemory;
|
||||
}
|
||||
|
||||
@@ -524,6 +524,7 @@ global:
|
||||
hipGraphMemAllocNodeGetParams;
|
||||
hipGraphAddMemFreeNode;
|
||||
hipGraphMemFreeNodeGetParams;
|
||||
hipGraphAddNode;
|
||||
local:
|
||||
*;
|
||||
} hip_5.3;
|
||||
|
||||
@@ -537,6 +537,12 @@ hipError_t hipGraphAddMemsetNode(hipGraphNode_t* pGraphNode, hipGraph_t graph,
|
||||
return hip::GetHipDispatchTable()->hipGraphAddMemsetNode_fn(pGraphNode, graph, pDependencies,
|
||||
numDependencies, pMemsetParams);
|
||||
}
|
||||
hipError_t hipGraphAddNode(hipGraphNode_t *pGraphNode, hipGraph_t graph,
|
||||
const hipGraphNode_t *pDependencies, size_t numDependencies,
|
||||
hipGraphNodeParams *nodeParams) {
|
||||
return hip::GetHipDispatchTable()->hipGraphAddNode_fn(pGraphNode, graph,
|
||||
pDependencies, numDependencies, nodeParams);
|
||||
}
|
||||
hipError_t hipGraphChildGraphNodeGetGraph(hipGraphNode_t node, hipGraph_t* pGraph) {
|
||||
return hip::GetHipDispatchTable()->hipGraphChildGraphNodeGetGraph_fn(node, pGraph);
|
||||
}
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário