File tree 2 files changed +11
-0
lines changed
source/loader/layers/sanitizer/asan
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -431,6 +431,12 @@ ur_result_t AsanInterceptor::unregisterProgram(ur_program_handle_t Program) {
431
431
auto ProgramInfo = getProgramInfo (Program);
432
432
assert (ProgramInfo != nullptr && " unregistered program!" );
433
433
434
+ std::scoped_lock<ur_shared_mutex> Guard (m_AllocationMapMutex);
435
+ for (auto AI : ProgramInfo->AllocInfoForGlobals ) {
436
+ m_AllocationMap.erase (AI->AllocBegin );
437
+ }
438
+ ProgramInfo->AllocInfoForGlobals .clear ();
439
+
434
440
ProgramInfo->InstrumentedKernels .clear ();
435
441
436
442
return UR_RESULT_SUCCESS;
@@ -549,6 +555,10 @@ AsanInterceptor::registerDeviceGlobals(ur_program_handle_t Program) {
549
555
{}});
550
556
551
557
ContextInfo->insertAllocInfo ({Device}, AI);
558
+ ProgramInfo->AllocInfoForGlobals .emplace (AI);
559
+
560
+ std::scoped_lock<ur_shared_mutex> Guard (m_AllocationMapMutex);
561
+ m_AllocationMap.emplace (AI->AllocBegin , std::move (AI));
552
562
}
553
563
}
554
564
Original file line number Diff line number Diff line change @@ -112,6 +112,7 @@ struct ProgramInfo {
112
112
std::atomic<int32_t > RefCount = 1 ;
113
113
114
114
// Program is built only once, so we don't need to lock it
115
+ std::unordered_set<std::shared_ptr<AllocInfo>> AllocInfoForGlobals;
115
116
std::unordered_set<std::string> InstrumentedKernels;
116
117
117
118
explicit ProgramInfo (ur_program_handle_t Program) : Handle(Program) {
You can’t perform that action at this time.
0 commit comments