File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
source/loader/layers/sanitizer/asan Expand file tree Collapse file tree 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) {
431431 auto ProgramInfo = getProgramInfo (Program);
432432 assert (ProgramInfo != nullptr && " unregistered program!" );
433433
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+
434440 ProgramInfo->InstrumentedKernels .clear ();
435441
436442 return UR_RESULT_SUCCESS;
@@ -549,6 +555,10 @@ AsanInterceptor::registerDeviceGlobals(ur_program_handle_t Program) {
549555 {}});
550556
551557 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));
552562 }
553563 }
554564
Original file line number Diff line number Diff line change @@ -112,6 +112,7 @@ struct ProgramInfo {
112112 std::atomic<int32_t > RefCount = 1 ;
113113
114114 // Program is built only once, so we don't need to lock it
115+ std::unordered_set<std::shared_ptr<AllocInfo>> AllocInfoForGlobals;
115116 std::unordered_set<std::string> InstrumentedKernels;
116117
117118 explicit ProgramInfo (ur_program_handle_t Program) : Handle(Program) {
You can’t perform that action at this time.
0 commit comments