3434#include " runtime/mem_obj/buffer.h"
3535#include " runtime/memory_manager/surface.h"
3636#include " runtime/platform/platform.h"
37+ #include " runtime/program/program.h"
3738#include " runtime/utilities/spinlock.h"
3839#include < deque>
3940#include < vector>
@@ -44,7 +45,8 @@ namespace OCLRT {
4445
4546extern gtpin::ocl::gtpin_events_t GTPinCallbacks;
4647
47- igc_init_t *pIgcInfo = nullptr ;
48+ igc_init_t *pIgcInit = nullptr ;
49+ const igc_info_t *pIgcInfo = nullptr ;
4850std::atomic<int > sequenceCount (1 );
4951CommandQueue *pCmdQueueForFlushTask = nullptr ;
5052std::deque<gtpinkexec_t > kernelExecQueue;
@@ -59,7 +61,7 @@ void gtpinNotifyContextCreate(cl_context context) {
5961 GTPinHwHelper >pinHelper = GTPinHwHelper::get (genFamily);
6062 gtpinPlatformInfo.gen_version = (gtpin::GTPIN_GEN_VERSION)gtpinHelper.getGenVersion ();
6163 gtpinPlatformInfo.device_id = static_cast <uint32_t >(pDevice->getHardwareInfo ().pPlatform ->usDeviceID );
62- (*GTPinCallbacks.onContextCreate )((context_handle_t )context, >pinPlatformInfo, &pIgcInfo );
64+ (*GTPinCallbacks.onContextCreate )((context_handle_t )context, >pinPlatformInfo, &pIgcInit );
6365 }
6466}
6567
@@ -90,7 +92,8 @@ void gtpinNotifyKernelCreate(cl_kernel kernel) {
9092 Context *pContext = &(pKernel->getContext ());
9193 cl_context context = (cl_context)pContext;
9294 auto &kernelInfo = pKernel->getKernelInfo ();
93- instrument_params_in_t paramsIn;
95+ instrument_params_in_t paramsIn = {};
96+
9497 paramsIn.kernel_type = GTPIN_KERNEL_TYPE_CS;
9598 paramsIn.simd = (GTPIN_SIMD_WIDTH)kernelInfo.getMaxSimdSize ();
9699 paramsIn.orig_kernel_binary = (uint8_t *)pKernel->getKernelHeap ();
@@ -99,7 +102,9 @@ void gtpinNotifyKernelCreate(cl_kernel kernel) {
99102 paramsIn.buffer_desc .BTI = static_cast <uint32_t >(gtpinBTI);
100103 paramsIn.igc_hash_id = kernelInfo.heapInfo .pKernelHeader ->ShaderHashCode ;
101104 paramsIn.kernel_name = (char *)kernelInfo.name .c_str ();
102- paramsIn.igc_info = nullptr ;
105+ paramsIn.igc_info = pIgcInfo;
106+ paramsIn.debug_data = pKernel->getProgram ()->getDebugData ();
107+ paramsIn.debug_data_size = static_cast <uint32_t >(pKernel->getProgram ()->getDebugDataSize ());
103108 instrument_params_out_t paramsOut = {0 };
104109 (*GTPinCallbacks.onKernelCreate )((context_handle_t )(cl_context)context, ¶msIn, ¶msOut);
105110 // Substitute ISA of created kernel with instrumented code
@@ -245,4 +250,15 @@ void gtpinNotifyPlatformShutdown() {
245250 kernelExecQueue.clear ();
246251 }
247252}
253+ void *gtpinGetIgcInit () {
254+ return pIgcInit;
255+ }
256+
257+ void setIgcInfo (const void *igcInfo) {
258+ pIgcInfo = reinterpret_cast <const igc_info_t *>(igcInfo);
259+ }
260+
261+ const void *gtpinGetIgcInfo () {
262+ return pIgcInfo;
263+ }
248264} // namespace OCLRT
0 commit comments