@@ -52,12 +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- return PI->isKernelInstrumented (hKernel);
59- }
60-
6155} // namespace
6256
6357// /////////////////////////////////////////////////////////////////////////////
@@ -465,12 +459,6 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch(
465459
466460 getContext ()->logger .debug (" ==== urEnqueueKernelLaunch" );
467461
468- if (!isInstrumentedKernel (hKernel)) {
469- return pfnKernelLaunch (hQueue, hKernel, workDim, pGlobalWorkOffset,
470- pGlobalWorkSize, pLocalWorkSize,
471- numEventsInWaitList, phEventWaitList, phEvent);
472- }
473-
474462 USMLaunchInfo LaunchInfo (GetContext (hKernel), GetDevice (hQueue),
475463 pGlobalWorkSize, pLocalWorkSize, pGlobalWorkOffset,
476464 workDim);
@@ -1362,9 +1350,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreate(
13621350 getContext ()->logger .debug (" ==== urKernelCreate" );
13631351
13641352 UR_CALL (pfnCreate (hProgram, pKernelName, phKernel));
1365- if (isInstrumentedKernel (*phKernel)) {
1366- UR_CALL (getAsanInterceptor ()->insertKernel (*phKernel));
1367- }
1353+ UR_CALL (getAsanInterceptor ()->insertKernel (*phKernel));
13681354
13691355 return UR_RESULT_SUCCESS;
13701356}
@@ -1385,9 +1371,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelRetain(
13851371 UR_CALL (pfnRetain (hKernel));
13861372
13871373 auto KernelInfo = getAsanInterceptor ()->getKernelInfo (hKernel);
1388- if (KernelInfo) {
1389- KernelInfo->RefCount ++;
1390- }
1374+ KernelInfo->RefCount ++;
13911375
13921376 return UR_RESULT_SUCCESS;
13931377}
@@ -1407,10 +1391,8 @@ __urdlllocal ur_result_t urKernelRelease(
14071391 UR_CALL (pfnRelease (hKernel));
14081392
14091393 auto KernelInfo = getAsanInterceptor ()->getKernelInfo (hKernel);
1410- if (KernelInfo) {
1411- if (--KernelInfo->RefCount == 0 ) {
1412- UR_CALL (getAsanInterceptor ()->eraseKernel (hKernel));
1413- }
1394+ if (--KernelInfo->RefCount == 0 ) {
1395+ UR_CALL (getAsanInterceptor ()->eraseKernel (hKernel));
14141396 }
14151397
14161398 return UR_RESULT_SUCCESS;
@@ -1439,8 +1421,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgValue(
14391421 std::shared_ptr<KernelInfo> KernelInfo;
14401422 if (argSize == sizeof (ur_mem_handle_t ) &&
14411423 (MemBuffer = getAsanInterceptor ()->getMemBuffer (
1442- *ur_cast<const ur_mem_handle_t *>(pArgValue))) &&
1443- ( KernelInfo = getAsanInterceptor ()->getKernelInfo (hKernel))) {
1424+ *ur_cast<const ur_mem_handle_t *>(pArgValue)))) {
1425+ auto KernelInfo = getAsanInterceptor ()->getKernelInfo (hKernel);
14441426 std::scoped_lock<ur_shared_mutex> Guard (KernelInfo->Mutex );
14451427 KernelInfo->BufferArgs [argIndex] = std::move (MemBuffer);
14461428 } else {
@@ -1470,8 +1452,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgMemObj(
14701452
14711453 std::shared_ptr<MemBuffer> MemBuffer;
14721454 std::shared_ptr<KernelInfo> KernelInfo;
1473- if ((MemBuffer = getAsanInterceptor ()->getMemBuffer (hArgValue)) &&
1474- ( KernelInfo = getAsanInterceptor ()->getKernelInfo (hKernel))) {
1455+ if ((MemBuffer = getAsanInterceptor ()->getMemBuffer (hArgValue))) {
1456+ auto KernelInfo = getAsanInterceptor ()->getKernelInfo (hKernel);
14751457 std::scoped_lock<ur_shared_mutex> Guard (KernelInfo->Mutex );
14761458 KernelInfo->BufferArgs [argIndex] = std::move (MemBuffer);
14771459 } else {
@@ -1501,7 +1483,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgLocal(
15011483 " ==== urKernelSetArgLocal (argIndex={}, argSize={})" , argIndex,
15021484 argSize);
15031485
1504- if (auto KI = getAsanInterceptor ()->getKernelInfo (hKernel)) {
1486+ {
1487+ auto KI = getAsanInterceptor ()->getKernelInfo (hKernel);
15051488 std::scoped_lock<ur_shared_mutex> Guard (KI->Mutex );
15061489 // TODO: get local variable alignment
15071490 auto argSizeWithRZ = GetSizeAndRedzoneSizeForLocal (
@@ -1538,8 +1521,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgPointer(
15381521 pArgValue);
15391522
15401523 std::shared_ptr<KernelInfo> KI;
1541- if (getAsanInterceptor ()->getOptions ().DetectKernelArguments &&
1542- ( KI = getAsanInterceptor ()->getKernelInfo (hKernel))) {
1524+ if (getAsanInterceptor ()->getOptions ().DetectKernelArguments ) {
1525+ auto KI = getAsanInterceptor ()->getKernelInfo (hKernel);
15431526 std::scoped_lock<ur_shared_mutex> Guard (KI->Mutex );
15441527 KI->PointerArgs [argIndex] = {pArgValue, GetCurrentBacktrace ()};
15451528 }
0 commit comments