@@ -52,15 +52,6 @@ ur_result_t setupContext(ur_context_handle_t Context, uint32_t numDevices,
5252 return UR_RESULT_SUCCESS;
5353}
5454
55- bool isInstrumentedKernel (ur_kernel_handle_t hKernel) {
56- auto hProgram = GetProgram (hKernel);
57- auto PI = getAsanInterceptor ()->getProgramInfo (hProgram);
58- if (PI == nullptr ) {
59- return false ;
60- }
61- return PI->isKernelInstrumented (hKernel);
62- }
63-
6455} // namespace
6556
6657// /////////////////////////////////////////////////////////////////////////////
@@ -470,15 +461,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch(
470461
471462 getContext ()->logger .debug (" ==== urEnqueueKernelLaunch" );
472463
473- if (!isInstrumentedKernel (hKernel)) {
474- return pfnKernelLaunch (hQueue, hKernel, workDim, pGlobalWorkOffset,
475- pGlobalWorkSize, pLocalWorkSize,
476- numEventsInWaitList, phEventWaitList, phEvent);
477- }
478-
479464 LaunchInfo LaunchInfo (GetContext (hQueue), GetDevice (hQueue),
480465 pGlobalWorkSize, pLocalWorkSize, pGlobalWorkOffset,
481466 workDim);
467+ UR_CALL (LaunchInfo.Data .syncToDevice (hQueue));
482468
483469 UR_CALL (getAsanInterceptor ()->preLaunchKernel (hKernel, hQueue, LaunchInfo));
484470
@@ -1366,9 +1352,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreate(
13661352 getContext ()->logger .debug (" ==== urKernelCreate" );
13671353
13681354 UR_CALL (pfnCreate (hProgram, pKernelName, phKernel));
1369- if (isInstrumentedKernel (*phKernel)) {
1370- UR_CALL (getAsanInterceptor ()->insertKernel (*phKernel));
1371- }
1355+ UR_CALL (getAsanInterceptor ()->insertKernel (*phKernel));
13721356
13731357 return UR_RESULT_SUCCESS;
13741358}
@@ -1389,9 +1373,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelRetain(
13891373 UR_CALL (pfnRetain (hKernel));
13901374
13911375 auto KernelInfo = getAsanInterceptor ()->getKernelInfo (hKernel);
1392- if (KernelInfo) {
1393- KernelInfo->RefCount ++;
1394- }
1376+ KernelInfo->RefCount ++;
13951377
13961378 return UR_RESULT_SUCCESS;
13971379}
@@ -1411,10 +1393,8 @@ __urdlllocal ur_result_t urKernelRelease(
14111393 UR_CALL (pfnRelease (hKernel));
14121394
14131395 auto KernelInfo = getAsanInterceptor ()->getKernelInfo (hKernel);
1414- if (KernelInfo) {
1415- if (--KernelInfo->RefCount == 0 ) {
1416- UR_CALL (getAsanInterceptor ()->eraseKernel (hKernel));
1417- }
1396+ if (--KernelInfo->RefCount == 0 ) {
1397+ UR_CALL (getAsanInterceptor ()->eraseKernel (hKernel));
14181398 }
14191399
14201400 return UR_RESULT_SUCCESS;
@@ -1440,11 +1420,10 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgValue(
14401420 getContext ()->logger .debug (" ==== urKernelSetArgValue" );
14411421
14421422 std::shared_ptr<MemBuffer> MemBuffer;
1443- std::shared_ptr<KernelInfo> KernelInfo;
14441423 if (argSize == sizeof (ur_mem_handle_t ) &&
14451424 (MemBuffer = getAsanInterceptor ()->getMemBuffer (
1446- *ur_cast<const ur_mem_handle_t *>(pArgValue))) &&
1447- ( KernelInfo = getAsanInterceptor ()->getKernelInfo (hKernel))) {
1425+ *ur_cast<const ur_mem_handle_t *>(pArgValue)))) {
1426+ auto KernelInfo = getAsanInterceptor ()->getKernelInfo (hKernel);
14481427 std::scoped_lock<ur_shared_mutex> Guard (KernelInfo->Mutex );
14491428 KernelInfo->BufferArgs [argIndex] = std::move (MemBuffer);
14501429 } else {
@@ -1473,9 +1452,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgMemObj(
14731452 getContext ()->logger .debug (" ==== urKernelSetArgMemObj" );
14741453
14751454 std::shared_ptr<MemBuffer> MemBuffer;
1476- std::shared_ptr<KernelInfo> KernelInfo;
1477- if ((MemBuffer = getAsanInterceptor ()->getMemBuffer (hArgValue)) &&
1478- (KernelInfo = getAsanInterceptor ()->getKernelInfo (hKernel))) {
1455+ if ((MemBuffer = getAsanInterceptor ()->getMemBuffer (hArgValue))) {
1456+ auto KernelInfo = getAsanInterceptor ()->getKernelInfo (hKernel);
14791457 std::scoped_lock<ur_shared_mutex> Guard (KernelInfo->Mutex );
14801458 KernelInfo->BufferArgs [argIndex] = std::move (MemBuffer);
14811459 } else {
@@ -1505,7 +1483,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgLocal(
15051483 " ==== urKernelSetArgLocal (argIndex={}, argSize={})" , argIndex,
15061484 argSize);
15071485
1508- if (auto KI = getAsanInterceptor ()->getKernelInfo (hKernel)) {
1486+ {
1487+ auto KI = getAsanInterceptor ()->getKernelInfo (hKernel);
15091488 std::scoped_lock<ur_shared_mutex> Guard (KI->Mutex );
15101489 // TODO: get local variable alignment
15111490 auto argSizeWithRZ = GetSizeAndRedzoneSizeForLocal (
@@ -1542,8 +1521,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgPointer(
15421521 pArgValue);
15431522
15441523 std::shared_ptr<KernelInfo> KI;
1545- if (getAsanInterceptor ()->getOptions ().DetectKernelArguments &&
1546- ( KI = getAsanInterceptor ()->getKernelInfo (hKernel))) {
1524+ if (getAsanInterceptor ()->getOptions ().DetectKernelArguments ) {
1525+ auto KI = getAsanInterceptor ()->getKernelInfo (hKernel);
15471526 std::scoped_lock<ur_shared_mutex> Guard (KI->Mutex );
15481527 KI->PointerArgs [argIndex] = {pArgValue, GetCurrentBacktrace ()};
15491528 }
0 commit comments