Insert scratch memory into scratch cache on full profile systems.

Scratch cache was not updated for IOMMUv2 systems previously.
This both negates the cache and causes segfault during scratch
release.

Change-Id: I71e81d6b642d65ca135868ff7225ea173529d458
This commit is contained in:
Sean Keely committed 2021-03-03 21:30:16 -05:00
1 parent 27ae854cda
commit 191664cd20
1 file changed
+7 -9
@@ -1136,15 +1136,13 @@ void GpuAgent::AcquireQueueScratch(ScratchInfo& scratch) {
assert(((!scratch.large) | use_reclaim) && "Large scratch used with reclaim disabled.");
if (scratch.queue_base != nullptr) {
if (profile_ == HSA_PROFILE_FULL) return;
if (profile_ == HSA_PROFILE_BASE) {
HSAuint64 alternate_va;
if (hsaKmtMapMemoryToGPU(scratch.queue_base, scratch.size, &alternate_va) ==
HSAKMT_STATUS_SUCCESS) {
if (scratch.large) scratch_used_large_ += scratch.size;
scratch_cache_.insert(scratch);
return;
}
HSAuint64 alternate_va;
if ((profile_ == HSA_PROFILE_FULL) ||
(hsaKmtMapMemoryToGPU(scratch.queue_base, scratch.size, &alternate_va) ==
HSAKMT_STATUS_SUCCESS)) {
if (scratch.large) scratch_used_large_ += scratch.size;
scratch_cache_.insert(scratch);
return;
}
}