SWDEV-421021 - Add hipDrvmemsetnode for graph
Signed-off-by: sdashmiz <shadi.dashmiz@amd.com>
Change-Id: I0240a162a16e61549d46b5d086c831404550e833
[ROCm/clr commit: b8e820f835]
Этот коммит содержится в:
коммит произвёл
Shadi Dashmiz
родитель
7fb95958d9
Коммит
5e1985996c
@@ -209,6 +209,9 @@ typedef hipError_t (*t_hipGraphAddDependencies)(hipGraph_t graph, const hipGraph
|
||||
typedef hipError_t (*t_hipGraphAddEmptyNode)(hipGraphNode_t* pGraphNode, hipGraph_t graph,
|
||||
const hipGraphNode_t* pDependencies,
|
||||
size_t numDependencies);
|
||||
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_hipGraphAddEventRecordNode)(hipGraphNode_t* pGraphNode, hipGraph_t graph,
|
||||
const hipGraphNode_t* pDependencies,
|
||||
size_t numDependencies, hipEvent_t event);
|
||||
@@ -1001,6 +1004,7 @@ struct HipDispatchTable {
|
||||
t_hipGraphAddChildGraphNode hipGraphAddChildGraphNode_fn;
|
||||
t_hipGraphAddDependencies hipGraphAddDependencies_fn;
|
||||
t_hipGraphAddEmptyNode hipGraphAddEmptyNode_fn;
|
||||
t_hipDrvGraphAddMemsetNode hipDrvGraphAddMemsetNode_fn;
|
||||
t_hipGraphAddEventRecordNode hipGraphAddEventRecordNode_fn;
|
||||
t_hipGraphAddEventWaitNode hipGraphAddEventWaitNode_fn;
|
||||
t_hipGraphAddHostNode hipGraphAddHostNode_fn;
|
||||
|
||||
@@ -449,3 +449,4 @@ hipGraphMemAllocNodeGetParams
|
||||
hipGraphAddMemFreeNode
|
||||
hipGraphMemFreeNodeGetParams
|
||||
hipDrvGraphAddMemcpyNode
|
||||
hipDrvGraphAddMemsetNode
|
||||
|
||||
@@ -330,6 +330,9 @@ hipError_t hipImportExternalMemory(hipExternalMemory_t* extMem_out,
|
||||
const hipExternalMemoryHandleDesc* memHandleDesc);
|
||||
hipError_t hipImportExternalSemaphore(hipExternalSemaphore_t* extSem_out,
|
||||
const hipExternalSemaphoreHandleDesc* semHandleDesc);
|
||||
hipError_t hipDrvGraphAddMemsetNode(hipGraphNode_t* phGraphNode, hipGraph_t hGraph,
|
||||
const hipGraphNode_t* dependencies, size_t numDependencies,
|
||||
const HIP_MEMSET_NODE_PARAMS* memsetParams, hipCtx_t ctx);
|
||||
hipError_t hipInit(unsigned int flags);
|
||||
hipError_t hipIpcCloseMemHandle(void* devPtr);
|
||||
hipError_t hipIpcGetEventHandle(hipIpcEventHandle_t* handle, hipEvent_t event);
|
||||
@@ -1193,6 +1196,8 @@ void UpdateHipDispatchTable(HipDispatchTable* ptrDispatchTable) {
|
||||
ptrDispatchTable->hipStreamGetCaptureInfo_v2_spt_fn = hip::hipStreamGetCaptureInfo_v2_spt;
|
||||
ptrDispatchTable->hipLaunchHostFunc_spt_fn = hip::hipLaunchHostFunc_spt;
|
||||
ptrDispatchTable->hipGetStreamDeviceId_fn = hip::hipGetStreamDeviceId;
|
||||
ptrDispatchTable->hipDrvGraphAddMemsetNode_fn = hip::hipDrvGraphAddMemsetNode;
|
||||
|
||||
}
|
||||
|
||||
namespace hip {
|
||||
|
||||
@@ -160,7 +160,6 @@ hipError_t ihipGraphAddMemsetNode(hip::GraphNode** pGraphNode, hip::Graph* graph
|
||||
pMemsetParams->elementSize != sizeof(int32_t)) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
|
||||
hipError_t status;
|
||||
status = ihipGraphMemsetParams_validate(pMemsetParams);
|
||||
if (status != hipSuccess) {
|
||||
@@ -1138,6 +1137,31 @@ hipError_t hipGraphAddMemsetNode(hipGraphNode_t* pGraphNode, hipGraph_t graph,
|
||||
HIP_RETURN(status);
|
||||
}
|
||||
|
||||
hipError_t hipDrvGraphAddMemsetNode(hipGraphNode_t* phGraphNode, hipGraph_t hGraph,
|
||||
const hipGraphNode_t* dependencies, size_t numDependencies,
|
||||
const HIP_MEMSET_NODE_PARAMS* memsetParams, hipCtx_t ctx) {
|
||||
HIP_INIT_API(hipDrvGraphAddMemsetNode, phGraphNode, hGraph, dependencies, numDependencies,
|
||||
memsetParams, ctx);
|
||||
if (phGraphNode == nullptr || hGraph == nullptr ||
|
||||
(numDependencies > 0 && dependencies == nullptr)) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
hip::GraphNode* node;
|
||||
hipMemsetParams pmemsetParams;
|
||||
pmemsetParams.dst = reinterpret_cast<void*>(memsetParams->dst);
|
||||
pmemsetParams.elementSize = memsetParams->elementSize;
|
||||
pmemsetParams.height = memsetParams->height;
|
||||
pmemsetParams.pitch = memsetParams->pitch;
|
||||
pmemsetParams.value = memsetParams->value;
|
||||
pmemsetParams.width = memsetParams->width;
|
||||
hipError_t status =
|
||||
ihipGraphAddMemsetNode(&node, reinterpret_cast<hip::Graph*>(hGraph),
|
||||
reinterpret_cast<hip::GraphNode* const*>(dependencies),
|
||||
numDependencies, &pmemsetParams, false);
|
||||
*phGraphNode = reinterpret_cast<hipGraphNode_t>(node);
|
||||
HIP_RETURN(status);
|
||||
}
|
||||
|
||||
hipError_t hipGraphAddEmptyNode(hipGraphNode_t* pGraphNode, hipGraph_t graph,
|
||||
const hipGraphNode_t* pDependencies, size_t numDependencies) {
|
||||
HIP_INIT_API(hipGraphAddEmptyNode, pGraphNode, graph, pDependencies, numDependencies);
|
||||
|
||||
@@ -1668,7 +1668,6 @@ class GraphMemcpyNodeToSymbol : public GraphMemcpyNode1D {
|
||||
memcpyNode->kind_);
|
||||
}
|
||||
};
|
||||
|
||||
class GraphMemsetNode : public GraphNode {
|
||||
hipMemsetParams memsetParams_;
|
||||
|
||||
@@ -1749,7 +1748,16 @@ class GraphMemsetNode : public GraphNode {
|
||||
std::memcpy(params, &memsetParams_, sizeof(hipMemsetParams));
|
||||
}
|
||||
|
||||
hipError_t SetParams(const hipMemsetParams* params, bool isExec = false) {
|
||||
void GetParams(HIP_MEMSET_NODE_PARAMS* params) {
|
||||
params->dst = memsetParams_.dst;
|
||||
params->elementSize = memsetParams_.elementSize;
|
||||
params->height = memsetParams_.height;
|
||||
params->pitch = memsetParams_.pitch;
|
||||
params->value = memsetParams_.value;
|
||||
params->width = memsetParams_.width;
|
||||
}
|
||||
|
||||
hipError_t SetParamsInternal(const hipMemsetParams* params, bool isExec) {
|
||||
hipError_t hip_error = hipSuccess;
|
||||
hip_error = ihipGraphMemsetParams_validate(params);
|
||||
if (hip_error != hipSuccess) {
|
||||
@@ -1811,7 +1819,19 @@ class GraphMemsetNode : public GraphNode {
|
||||
std::memcpy(&memsetParams_, params, sizeof(hipMemsetParams));
|
||||
return hipSuccess;
|
||||
}
|
||||
|
||||
hipError_t SetParams(const hipMemsetParams* params, bool isExec = false) {
|
||||
return SetParamsInternal(params, isExec);
|
||||
}
|
||||
hipError_t SetParams(const HIP_MEMSET_NODE_PARAMS* params, bool isExec = false) {
|
||||
hipMemsetParams pmemsetParams;
|
||||
pmemsetParams.dst = params->dst;
|
||||
pmemsetParams.elementSize = params->elementSize;
|
||||
pmemsetParams.height = params->height;
|
||||
pmemsetParams.pitch = params->pitch;
|
||||
pmemsetParams.value = params->value;
|
||||
pmemsetParams.width = params->width;
|
||||
return SetParamsInternal(&pmemsetParams, isExec);
|
||||
}
|
||||
hipError_t SetParams(GraphNode* node) {
|
||||
const GraphMemsetNode* memsetNode = static_cast<GraphMemsetNode const*>(node);
|
||||
return SetParams(&memsetNode->memsetParams_);
|
||||
|
||||
@@ -526,6 +526,7 @@ global:
|
||||
hipArrayGetDescriptor;
|
||||
hipArray3DGetDescriptor;
|
||||
hipDrvGraphAddMemcpyNode;
|
||||
hipDrvGraphAddMemsetNode;
|
||||
local:
|
||||
*;
|
||||
} hip_5.5;
|
||||
|
||||
@@ -798,6 +798,12 @@ hipError_t hipImportExternalSemaphore(hipExternalSemaphore_t* extSem_out,
|
||||
const hipExternalSemaphoreHandleDesc* semHandleDesc) {
|
||||
return hip::GetHipDispatchTable()->hipImportExternalSemaphore_fn(extSem_out, semHandleDesc);
|
||||
}
|
||||
hipError_t hipDrvGraphAddMemsetNode(hipGraphNode_t* phGraphNode, hipGraph_t hGraph,
|
||||
const hipGraphNode_t* dependencies, size_t numDependencies,
|
||||
const HIP_MEMSET_NODE_PARAMS* memsetParams, hipCtx_t ctx) {
|
||||
return hip::GetHipDispatchTable()->hipDrvGraphAddMemsetNode_fn(phGraphNode, hGraph,
|
||||
dependencies, numDependencies, memsetParams, ctx);
|
||||
}
|
||||
hipError_t hipInit(unsigned int flags) { return hip::GetHipDispatchTable()->hipInit_fn(flags); }
|
||||
hipError_t hipIpcCloseMemHandle(void* devPtr) {
|
||||
return hip::GetHipDispatchTable()->hipIpcCloseMemHandle_fn(devPtr);
|
||||
|
||||
Ссылка в новой задаче
Block a user