SWDEV-311271 - Release freed memory from MemPools

Runtime has to release extra memory, held by the pools,
in synchronization points for event, stream or device.

Change-Id: Id533a5e1d137812aa72bdfe101b4b333c6a43d66
This commit is contained in:
German Andryeyev
2023-12-19 11:54:29 -05:00
committed by Rahul Garg
parent adf9406a16
commit 3fa4e31180
6 changed files with 23 additions and 13 deletions
+5 -3
View File
@@ -71,20 +71,22 @@ hipError_t Event::synchronize() {
return hipSuccess;
}
auto hip_device = g_devices[deviceId()];
// Check HW status of the ROCcrl event. Note: not all ROCclr modes support HW status
static constexpr bool kWaitCompletion = true;
if (!g_devices[deviceId()]->devices()[0]->IsHwEventReady(*event_, kWaitCompletion)) {
if (!hip_device->devices()[0]->IsHwEventReady(*event_, kWaitCompletion)) {
if (event_->HwEvent() != nullptr) {
amd::Command* command = nullptr;
hipError_t status = recordCommand(command, event_->command().queue(), flags);
command->enqueue();
g_devices[deviceId()]->devices()[0]->IsHwEventReady(command->event(), kWaitCompletion);
hip_device->devices()[0]->IsHwEventReady(command->event(), kWaitCompletion);
command->release();
} else {
event_->awaitCompletion();
}
}
// Release freed memory for all memory pools on the device
hip_device->ReleaseFreedMemory();
return hipSuccess;
}