From 1a66409908c43d38b00dbce06f454f5d01f88e01 Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 30 Mar 2017 17:37:14 -0400
Subject: [PATCH] P4 to Git Change 1392885 by gandryey@gera-w8 on 2017/03/30
17:28:48
SWDEV-115408 - [Vega10] IB size mismatch in OCL submissions
- Incorrect result for OS event wait was causing this issue, because runtime could overwrite an incomplete IB. A workaround is to check TS value after a wait returned a successful code
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.hpp#18 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#266 edit
[ROCm/clr commit: 39290bb733a452144a57bb1d3be1e0eb56e83efd]
---
projects/clr/rocclr/runtime/device/pal/palvirtual.hpp | 8 ++++++++
projects/clr/rocclr/runtime/utils/flags.hpp | 2 ++
2 files changed, 10 insertions(+)
diff --git a/projects/clr/rocclr/runtime/device/pal/palvirtual.hpp b/projects/clr/rocclr/runtime/device/pal/palvirtual.hpp
index b53e77c434..b25d647494 100644
--- a/projects/clr/rocclr/runtime/device/pal/palvirtual.hpp
+++ b/projects/clr/rocclr/runtime/device/pal/palvirtual.hpp
@@ -106,6 +106,14 @@ public:
}
result = iDev_->WaitForFences(1, &iCmdFences_[cbId], true, WaitTimeoutInNsec);
if (Pal::Result::Success == result) {
+ // Note: This is a workaround for a timing sensitive issue when OS event
+ // succeeded without the actual GPU operation completion.
+ // The issue occurs under heavy GPU load with more than 1 OCL app running and
+ // HWS enabled under Win10
+ while (GPU_PAL_FENCE_VALIDATION &&
+ (Pal::Result::Success != iCmdFences_[cbId]->GetStatus())) {
+ amd::Os::yield();
+ }
break;
}
else if ((Pal::Result::NotReady == result) ||
diff --git a/projects/clr/rocclr/runtime/utils/flags.hpp b/projects/clr/rocclr/runtime/utils/flags.hpp
index 0dcbfdd03a..87ef4b5eab 100644
--- a/projects/clr/rocclr/runtime/utils/flags.hpp
+++ b/projects/clr/rocclr/runtime/utils/flags.hpp
@@ -181,6 +181,8 @@ release(uint, GPU_WAVES_PER_SIMD, 0, \
"Force the number of waves per SIMD (1-10)") \
release(bool, GPU_WAVE_LIMIT_ENABLE, false, \
"1 = Enable adaptive wave limiter") \
+release(bool, GPU_PAL_FENCE_VALIDATION, true, \
+ "1 = Enables PAL fence validation with TS") \
release_on_stg(uint, GPU_WAVE_LIMIT_CU_PER_SH, 0, \
"Assume the number of CU per SH for wave limiter") \
release_on_stg(uint, GPU_WAVE_LIMIT_MAX_WAVE, 10, \