Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ void Runtime::RegisterDriver(std::unique_ptr<Driver> driver) {

void Runtime::DestroyAgents() {
agents_by_node_.clear();

std::for_each(gpu_agents_.begin(), gpu_agents_.end(), DeleteObject());
gpu_agents_.clear();

Expand All @@ -271,9 +270,6 @@ void Runtime::DestroyAgents() {
aie_agents_.clear();

region_gpu_ = NULL;

system_regions_fine_.clear();
system_regions_coarse_.clear();
}

void Runtime::DestroyDrivers() {
Expand Down Expand Up @@ -2486,6 +2482,11 @@ void Runtime::Unload() {
SharedSignalPool.clear();
EventPool.clear();

// Clear system regions before destroying agents to prevent use-after-free
// when agent destructors access region memory.
system_regions_fine_.clear();
system_regions_coarse_.clear();

DestroyAgents();

CloseTools();
Expand Down