diff --git a/runtime/gtpin/gtpin_callbacks.cpp b/runtime/gtpin/gtpin_callbacks.cpp index 9ee0f8cf6a..1adb24d124 100644 --- a/runtime/gtpin/gtpin_callbacks.cpp +++ b/runtime/gtpin/gtpin_callbacks.cpp @@ -31,7 +31,6 @@ namespace OCLRT { extern gtpin::ocl::gtpin_events_t GTPinCallbacks; igc_init_t *pIgcInit = nullptr; -const igc_info_t *pIgcInfo = nullptr; std::atomic sequenceCount(1); CommandQueue *pCmdQueueForFlushTask = nullptr; std::deque kernelExecQueue; @@ -87,7 +86,7 @@ void gtpinNotifyKernelCreate(cl_kernel kernel) { paramsIn.buffer_desc.BTI = static_cast(gtpinBTI); paramsIn.igc_hash_id = kernelInfo.heapInfo.pKernelHeader->ShaderHashCode; paramsIn.kernel_name = (char *)kernelInfo.name.c_str(); - paramsIn.igc_info = pIgcInfo; + paramsIn.igc_info = kernelInfo.igcInfoForGtpin; paramsIn.debug_data = pKernel->getProgram()->getDebugData(); paramsIn.debug_data_size = static_cast(pKernel->getProgram()->getDebugDataSize()); instrument_params_out_t paramsOut = {0}; @@ -229,12 +228,4 @@ void gtpinNotifyPlatformShutdown() { void *gtpinGetIgcInit() { return pIgcInit; } - -void setIgcInfo(const void *igcInfo) { - pIgcInfo = reinterpret_cast(igcInfo); -} - -const void *gtpinGetIgcInfo() { - return pIgcInfo; -} } // namespace OCLRT diff --git a/runtime/gtpin/gtpin_notify.h b/runtime/gtpin/gtpin_notify.h index 5bf5c8d071..d72d382a09 100644 --- a/runtime/gtpin/gtpin_notify.h +++ b/runtime/gtpin/gtpin_notify.h @@ -22,6 +22,4 @@ void gtpinNotifyUpdateResidencyList(void *pKernel, void *pResidencyVector); void gtpinNotifyPlatformShutdown(); inline bool gtpinIsGTPinInitialized() { return isGTPinInitialized; } void *gtpinGetIgcInit(); -void setIgcInfo(const void *igcInfo); -const void *gtpinGetIgcInfo(); } // namespace OCLRT diff --git a/runtime/program/kernel_info.h b/runtime/program/kernel_info.h index a019966d3c..ec505ce18c 100644 --- a/runtime/program/kernel_info.h +++ b/runtime/program/kernel_info.h @@ -9,6 +9,7 @@ #include "CL/cl.h" #include "heap_info.h" #include "kernel_arg_info.h" +#include "ocl_igc_shared/gtpin/gtpin_driver_common.h" #include "patch_info.h" #include "runtime/helpers/hw_info.h" @@ -240,5 +241,6 @@ struct KernelInfo { GraphicsAllocation *kernelAllocation = nullptr; DebugData debugData; bool computeMode = false; + const gtpin::igc_info_t *igcInfoForGtpin = nullptr; }; } // namespace OCLRT diff --git a/runtime/program/process_gen_binary.cpp b/runtime/program/process_gen_binary.cpp index a27a29cde0..725bbd871f 100644 --- a/runtime/program/process_gen_binary.cpp +++ b/runtime/program/process_gen_binary.cpp @@ -14,7 +14,6 @@ #include "runtime/helpers/hash.h" #include "runtime/helpers/ptr_math.h" #include "runtime/helpers/string.h" -#include "runtime/kernel/kernel.h" #include "runtime/memory_manager/memory_manager.h" #include "runtime/gtpin/gtpin_notify.h" @@ -779,7 +778,8 @@ cl_int Program::parsePatchList(KernelInfo &kernelInfo) { "\n .PerThreadSystemThreadSurfaceSize", pPatchToken->PerThreadSystemThreadSurfaceSize); } break; case PATCH_TOKEN_GTPIN_INFO: { - setIgcInfo(ptrOffset(pCurPatchListPtr, sizeof(SPatchItemHeader))); + auto igcInfo = ptrOffset(pCurPatchListPtr, sizeof(SPatchItemHeader)); + kernelInfo.igcInfoForGtpin = static_cast(igcInfo); DBG_LOG(LogPatchTokens, "\n.PATCH_TOKEN_GTPIN_INFO", pPatch->Token, "\n .Size", pPatch->Size); diff --git a/unit_tests/gtpin/gtpin_tests.cpp b/unit_tests/gtpin/gtpin_tests.cpp index e3e05a6e6d..74b299915d 100644 --- a/unit_tests/gtpin/gtpin_tests.cpp +++ b/unit_tests/gtpin/gtpin_tests.cpp @@ -2327,11 +2327,11 @@ TEST_F(ProgramTests, givenGenBinaryWithGtpinInfoWhenProcessGenBinaryCalledThenGt pPatch->Token = iOpenCL::PATCH_TOKEN_GTPIN_INFO; pPatch->Size = sizeof(iOpenCL::SPatchItemHeader); binSize += sizeof(iOpenCL::SPatchItemHeader); - // Decode prepared program binary pProgram->storeGenBinary(&genBin[0], binSize); retVal = pProgram->processGenBinary(); - EXPECT_NE(gtpinGetIgcInfo(), nullptr); + auto kernelInfo = pProgram->getKernelInfo("TstCopy"); + EXPECT_NE(kernelInfo->igcInfoForGtpin, nullptr); ASSERT_EQ(CL_SUCCESS, retVal); } } // namespace ULT