From f675e61387dc003c2ead9adde955cf758bb76609 Mon Sep 17 00:00:00 2001 From: anusha GodavarthySurya Date: Wed, 17 Nov 2021 01:02:50 -0800 Subject: [PATCH] SWDEV-308983 - Fix hipGraphKernelNodeSetParams Change-Id: I8a57a4e33048931955b7ba5ed567631703bd6c5d [ROCm/clr commit: 9c8b6b65e06525782fb78dbddfc423661ed9e695] --- .../clr/hipamd/src/hip_graph_internal.hpp | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/projects/clr/hipamd/src/hip_graph_internal.hpp b/projects/clr/hipamd/src/hip_graph_internal.hpp index 360356c25a..f22eebb572 100644 --- a/projects/clr/hipamd/src/hip_graph_internal.hpp +++ b/projects/clr/hipamd/src/hip_graph_internal.hpp @@ -31,6 +31,7 @@ #include "hip_internal.hpp" #include "hip_graph_helper.hpp" #include "hip_event.hpp" +#include "hip_platform.hpp" typedef hipGraphNode* Node; hipError_t ihipValidateKernelParams(const hipKernelNodeParams* pNodeParams); @@ -400,7 +401,6 @@ class hipGraphKernelNode : public hipGraphNode { commands_.emplace_back(command); return status; } - void GetParams(hipKernelNodeParams* params) { std::memcpy(params, pKernelParams_, sizeof(hipKernelNodeParams)); } @@ -410,12 +410,27 @@ class hipGraphKernelNode : public hipGraphNode { if (hipSuccess != status) { return status; } + if (params->func != pKernelParams_->func) { + hipFunction_t func = nullptr; + hipError_t status = + PlatformState::instance().getStatFunc(&func, params->func, ihipGetDevice()); + if ((status != hipSuccess) || (func == nullptr)) { + return hipErrorInvalidDeviceFunction; + } + func_ = func; + } std::memcpy(pKernelParams_, params, sizeof(hipKernelNodeParams)); - return hipSuccess; + return status; } hipError_t SetCommandParams(const hipKernelNodeParams* params) { if (params->func != pKernelParams_->func) { - return hipErrorInvalidValue; + hipFunction_t func = nullptr; + hipError_t status = + PlatformState::instance().getStatFunc(&func, params->func, ihipGetDevice()); + if ((status != hipSuccess) || (func == nullptr)) { + return hipErrorInvalidDeviceFunction; + } + func_ = func; } // updates kernel params hipError_t status = ihipValidateKernelParams(params);