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, \