From 9d1ce7a68f0b06c208653063bba725b70c96f8c1 Mon Sep 17 00:00:00 2001 From: Tao Sang Date: Thu, 24 Nov 2022 19:40:19 -0500 Subject: [PATCH] SWDEV-368280 - Fix crash in graph stream capture Fix crash in graph stream capture for hipExtModuleLaunchKernel. Change-Id: Ieaaed1d15b4d268193d8341d4b1609f83a9e4789 [ROCm/clr commit: 530ec02aaefcf8268e79113dcbc067ddca5640ea] --- projects/clr/hipamd/src/hip_graph_internal.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/clr/hipamd/src/hip_graph_internal.hpp b/projects/clr/hipamd/src/hip_graph_internal.hpp index 65ef7702ff..56fcdf6100 100644 --- a/projects/clr/hipamd/src/hip_graph_internal.hpp +++ b/projects/clr/hipamd/src/hip_graph_internal.hpp @@ -679,9 +679,14 @@ class hipGraphKernelNode : public hipGraphNode { unsigned int device) { hipFunction_t func = nullptr; hipError_t status = PlatformState::instance().getStatFunc(&func, params.func, device); - if (status != hipSuccess) { - ClPrint(amd::LOG_ERROR, amd::LOG_CODE,"[hipGraph] getStatFunc() Failed with err %d", + if (status == hipErrorInvalidSymbol) { + // capturehipExtModuleLaunchKernel() mixes host function with hipFunction_t, so we convert + // here. If it's wrong, later functions will fail + func = static_cast(params.func); + ClPrint(amd::LOG_INFO, amd::LOG_CODE,"[hipGraph] capturehipExtModuleLaunchKernel() should be called", status); + } else if (status != hipSuccess) { + ClPrint(amd::LOG_ERROR, amd::LOG_CODE,"[hipGraph] getStatFunc() failed with err %d", status); } return func; }