From bd961e48280ce99cf77077e7014ecfe0b9742636 Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 21 Apr 2015 12:06:42 -0400
Subject: [PATCH] P4 to Git Change 1142817 by wchau@wchau_WINDOWS7_OCL on
2015/04/21 11:57:39
EPR #416903 - reduce maximum work load time to avoid BSOD/TDR when running the FlopsCL benchmarks on Kaveri
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.cpp#309 edit
[ROCm/clr commit: a52449cc343bb0b8096119619aad191d7c2f073a]
---
.../rocclr/runtime/device/gpu/gpusettings.cpp | 59 ++++++++++++++-----
1 file changed, 45 insertions(+), 14 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpusettings.cpp b/projects/clr/rocclr/runtime/device/gpu/gpusettings.cpp
index ce05989925..4cdfab71f4 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpusettings.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpusettings.cpp
@@ -12,6 +12,18 @@
namespace gpu {
+/*! \brief information for adjusting maximum workload time
+ *
+ * This structure contains the time and OS minor version for max workload time
+ * adjustment for Windows 7 or 8.
+ */
+struct ModifyMaxWorkload
+{
+ uint32_t time; //!< max work load time (10x ms)
+ uint32_t minorVersion; //!< OS minor version
+};
+
+
Settings::Settings()
{
// Initialize the GPU device default settings
@@ -162,6 +174,8 @@ Settings::create(
}
// Update GPU specific settings and info structure if we have any
+ ModifyMaxWorkload modifyMaxWorkload = {0};
+
switch (target) {
case CAL_TARGET_SUMO:
case CAL_TARGET_SUPERSUMO:
@@ -175,21 +189,9 @@ Settings::create(
// For the system that has APU and Win 8, the work load needs to be smaller
// This is because KMD doesn't have workaround for TDR in Win 8
// This is needed only for EG/NI because EG/NI is using graphics ring
-#if defined(_WIN32)
- {
- OSVERSIONINFOEX versionInfo = { 0 };
- versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
- versionInfo.dwMajorVersion = 6;
- versionInfo.dwMinorVersion = 2;
+ modifyMaxWorkload.time = 500; // 50ms
+ modifyMaxWorkload.minorVersion = 2; // Win 8
- DWORDLONG conditionMask = 0;
- VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
- VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
- if (VerifyVersionInfo(&versionInfo, VER_MAJORVERSION | VER_MINORVERSION, conditionMask)) {
- maxWorkloadTime_ = 500; // 50 ms
- }
- }
-#endif // defined(_WIN32)
// Add the caps for Trinity here ...
// Fall through ...
case CAL_TARGET_CAYMAN:
@@ -262,6 +264,9 @@ Settings::create(
if (!viPlus_) {
// APU systems for CI
apuSystem_ = true;
+ // Fix BSOD/TDR issues observed on Kaveri Win7 (EPR#416903)
+ modifyMaxWorkload.time = 2500; // 250ms
+ modifyMaxWorkload.minorVersion = 1; // Win 7
}
// Fall through ...
case CAL_TARGET_BONAIRE:
@@ -356,6 +361,32 @@ Settings::create(
return false;
}
+#if defined(_WIN32)
+ if (modifyMaxWorkload.time > 0) {
+ OSVERSIONINFOEX versionInfo = { 0 };
+ versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+ versionInfo.dwMajorVersion = 6;
+ versionInfo.dwMinorVersion = modifyMaxWorkload.minorVersion;
+
+ BYTE comparisonOps = 0;
+ switch (modifyMaxWorkload.minorVersion) {
+ case 1: // for Win7 only
+ comparisonOps = VER_EQUAL;
+ break;
+ case 2: // for Win8 and beyond
+ comparisonOps = VER_GREATER_EQUAL;
+ break;
+ }
+
+ DWORDLONG conditionMask = 0;
+ VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, comparisonOps);
+ VER_SET_CONDITION(conditionMask, VER_MINORVERSION, comparisonOps);
+ if (VerifyVersionInfo(&versionInfo, VER_MAJORVERSION | VER_MINORVERSION, conditionMask)) {
+ maxWorkloadTime_ = modifyMaxWorkload.time;
+ }
+ }
+#endif // defined(_WIN32)
+
// Enable atomics support
enableExtension(ClKhrGlobalInt32BaseAtomics);
enableExtension(ClKhrGlobalInt32ExtendedAtomics);