Skip to content

Commit 9c30174

Browse files
zhaomaosuKornevNikita
authored andcommitted
[DevTSAN] Sync thread clocks before/after barrier call (#17900)
Barrier instructions will synchronize work items execution status, we need to sync thread clocks before/after barrier call to avoid false positive reports.
1 parent b9735c4 commit 9c30174

File tree

1 file changed

+24
-0
lines changed
  • unified-runtime/source/loader/layers/sanitizer/tsan

1 file changed

+24
-0
lines changed

unified-runtime/source/loader/layers/sanitizer/tsan/tsan_ddi.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,25 @@ __urdlllocal ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable(
535535
return UR_RESULT_SUCCESS;
536536
}
537537

538+
///////////////////////////////////////////////////////////////////////////////
539+
/// @brief Exported function for filling application's EnqueueExp table
540+
/// with current process' addresses
541+
///
542+
/// @returns
543+
/// - ::UR_RESULT_SUCCESS
544+
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
545+
__urdlllocal ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable(
546+
/// [in,out] pointer to table of DDI function pointers
547+
ur_enqueue_exp_dditable_t *pDdiTable) {
548+
if (nullptr == pDdiTable) {
549+
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
550+
}
551+
552+
pDdiTable->pfnCooperativeKernelLaunchExp =
553+
ur_sanitizer_layer::tsan::urEnqueueCooperativeKernelLaunchExp;
554+
return UR_RESULT_SUCCESS;
555+
}
556+
538557
} // namespace tsan
539558

540559
ur_result_t initTsanDDITable(ur_dditable_t *dditable) {
@@ -576,6 +595,11 @@ ur_result_t initTsanDDITable(ur_dditable_t *dditable) {
576595
&dditable->EnqueueExp);
577596
}
578597

598+
if (UR_RESULT_SUCCESS == result) {
599+
result = ur_sanitizer_layer::tsan::urGetEnqueueExpProcAddrTable(
600+
&dditable->EnqueueExp);
601+
}
602+
579603
if (result != UR_RESULT_SUCCESS) {
580604
getContext()->logger.error("Initialize TSAN DDI table failed: {}", result);
581605
}

0 commit comments

Comments
 (0)