@@ -414,42 +414,6 @@ ur_result_t SanitizerInterceptor::registerProgram(ur_context_handle_t Context,
414414
415415 for (auto Device : Devices) {
416416 ManagedQueue Queue (Context, Device);
417- auto DeviceInfo = getDeviceInfo (Device);
418-
419- // Write global variable to program
420- auto EnqueueWriteGlobal = [&Queue, &Program](
421- const char *Name, const void *Value,
422- size_t Size, bool ReportWarning = true ) {
423- auto Result =
424- getContext ()->urDdiTable .Enqueue .pfnDeviceGlobalVariableWrite (
425- Queue, Program, Name, false , Size, 0 , Value, 0 , nullptr ,
426- nullptr );
427- if (ReportWarning && Result != UR_RESULT_SUCCESS) {
428- getContext ()->logger .warning (
429- " Failed to write device global \" {}\" : {}" , Name, Result);
430- return false ;
431- }
432- return true ;
433- };
434-
435- // Write debug
436- // We use "uint64_t" here because EnqueueWriteGlobal will fail when it's "uint32_t"
437- // Because EnqueueWriteGlobal is a async write, so
438- // we need to extend its lifetime
439- static uint64_t Debug = getOptions ().Debug ? 1 : 0 ;
440- EnqueueWriteGlobal (kSPIR_AsanDebug , &Debug, sizeof (Debug), false );
441-
442- // Write shadow memory offset for global memory
443- EnqueueWriteGlobal (kSPIR_AsanShadowMemoryGlobalStart ,
444- &DeviceInfo->Shadow ->ShadowBegin ,
445- sizeof (DeviceInfo->Shadow ->ShadowBegin ));
446- EnqueueWriteGlobal (kSPIR_AsanShadowMemoryGlobalEnd ,
447- &DeviceInfo->Shadow ->ShadowEnd ,
448- sizeof (DeviceInfo->Shadow ->ShadowEnd ));
449-
450- // Write device type
451- EnqueueWriteGlobal (kSPIR_DeviceType , &DeviceInfo->Type ,
452- sizeof (DeviceInfo->Type ));
453417
454418 uint64_t NumOfDeviceGlobal;
455419 auto Result =
@@ -687,6 +651,11 @@ ur_result_t SanitizerInterceptor::prepareLaunch(
687651 }
688652 }
689653
654+ LaunchInfo.Data ->GlobalShadowOffset = DeviceInfo->Shadow ->ShadowBegin ;
655+ LaunchInfo.Data ->GlobalShadowOffsetEnd = DeviceInfo->Shadow ->ShadowEnd ;
656+ LaunchInfo.Data ->DeviceTy = DeviceInfo->Type ;
657+ LaunchInfo.Data ->Debug = getOptions ().Debug ? 1 : 0 ;
658+
690659 if (LaunchInfo.LocalWorkSize .empty ()) {
691660 LaunchInfo.LocalWorkSize .resize (LaunchInfo.WorkDim );
692661 auto URes =
0 commit comments