Skip to content

Commit 5c876ee

Browse files
committed
Fix those LIT tests that require newer GPU driver after move to Gen12
Signed-off-by: Vyacheslav N Klochkov <vyacheslav.n.klochkov@intel.com>
1 parent 3149f46 commit 5c876ee

File tree

6 files changed

+183
-27
lines changed

6 files changed

+183
-27
lines changed

sycl/test-e2e/ESIMD/api/slm_gather_scatter_heavy.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,10 @@ int main() {
444444
esimd_test::printTestLabel(q);
445445

446446
// GPU driver had an error in handling of SLM aligned block_loads/stores,
447-
// which has been fixed only in "1.3.26816".
448-
if (!esimd_test::minLinuxDriver(q, "1.3.26816") ||
449-
!esimd_test::minWindowsDriver(q, "1.3.26816")) {
447+
// which has been fixed only in "1.3.26816", and in win/opencl version going
448+
// _after_ 101.4575.
449+
if (!esimd_test::isGPUDriverGE(Q, esimd_test::GPUDriverOS::LinuxAndWindows,
450+
"26816", "101.4576")) {
450451
std::cout << "Skipped. The test requires GPU driver 1.3.26816 or newer.\n";
451452
return 0;
452453
}

sycl/test-e2e/ESIMD/esimd_test_utils.hpp

Lines changed: 70 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -621,26 +621,78 @@ template <typename... ArgT> void printTestLabel(queue Q, ArgT &&...Args) {
621621
std::cout << std::endl;
622622
}
623623

624-
// Not Linux: return true;
625-
// Linux: return true iff GPU driver version >= MinDriver
626-
bool minLinuxDriver(queue Q, std::string MinDriver) {
627-
#ifdef __SYCL_RT_OS_LINUX
628-
auto Driver = Q.get_device().get_info<sycl::info::device::driver_version>();
629-
return Driver >= MinDriver;
630-
#else
631-
return true;
632-
#endif
633-
}
624+
enum GPUDriverOS { Linux = 1, Windows = 2, LinuxAndWindows = 3 };
625+
626+
/// This function returns true if it can detect the level-zero or opencl
627+
/// GPU driver and can determine that the current driver is same or newer
628+
/// than the one passed in \p RequiredVersion or \p WinOpenCLRequiredVersion.
629+
///
630+
/// Below are how driver versions look like:
631+
/// Linux/L0: [1.3.26370]
632+
/// Linux/opencl: [23.22.26370.18]
633+
/// Windows/L0: [1.3.26370]
634+
/// Windows/opencl: [31.0.101.4502]
635+
///
636+
/// This function uses only the part of the driver identification:
637+
/// - the second half of the driver id on win/opencl, e.g. 101.4502";
638+
/// - the 5-digit id for 3 other platforms, e.g. 26370.
639+
///
640+
/// Note: For the previous & new driver version and their release dates
641+
/// for win/opencl see the link:
642+
/// https://www.intel.com/content/www/us/en/download/726609/intel-arc-iris-xe-graphics-whql-windows.html
643+
bool isGPUDriverGE(queue Q, GPUDriverOS OSCheck, std::string RequiredVersion,
644+
std::string WinOpenCLRequiredVersion = "") {
645+
auto Dev = Q.get_device();
646+
if (!Dev.is_gpu())
647+
return false;
634648

635-
// Not Windows: return true;
636-
// Windows: return true iff GPU driver version >= MinDriver
637-
bool minWindowsDriver(queue Q, std::string MinDriver) {
638-
#ifdef __SYCL_RT_OS_WINDOWS
639-
auto Driver = Q.get_device().get_info<sycl::info::device::driver_version>();
640-
return Driver >= MinDriver;
641-
#else
642-
return true;
649+
bool IsLinux = false;
650+
#if defined(__SYCL_RT_OS_LINUX)
651+
IsLinux = true;
652+
#elif !defined(__SYCL_RT_OS_WINDOWS)
653+
return false;
643654
#endif
655+
656+
// A and B must have digits at the same positions.
657+
// Otherwise, A and B symbols must be equal, e.g. both be equal to '.'.
658+
auto verifyDriverVersionFormat = [](const std::string &A,
659+
const std::string &B) {
660+
if (A.size() != B.size())
661+
throw std::runtime_error(
662+
"Inconsistent expected & actual driver versions");
663+
for (int I = 0; I < A.size(); I++) {
664+
if ((A[I] >= '0' && A[I] <= '9' && !(B[I] >= '0' && B[I] <= '9')) &&
665+
A[I] != B[I])
666+
throw std::runtime_error(
667+
"Inconsistent expected & actual driver versions");
668+
}
669+
};
670+
671+
auto BE = Q.get_backend();
672+
int Length = 5; // extract 5 digits for 3 or 4 platforms
673+
int Start = 4; // start of the driver id for 2 of 4 platforms
674+
if (BE == backend::opencl) { // opencl has less-standard versioning
675+
if (IsLinux) {
676+
Start = 6;
677+
} else {
678+
Start = 5;
679+
Length = 8;
680+
RequiredVersion = WinOpenCLRequiredVersion;
681+
}
682+
}
683+
684+
bool IsGE = true;
685+
if (IsLinux && (OSCheck & GPUDriverOS::Linux) ||
686+
!IsLinux && (OSCheck & GPUDriverOS::Windows)) {
687+
auto CurrentVersion = Dev.get_info<sycl::info::device::driver_version>();
688+
CurrentVersion = CurrentVersion.substr(Start, Length);
689+
verifyDriverVersionFormat(CurrentVersion, RequiredVersion);
690+
std::cout << "RequiredVersion = " << RequiredVersion << ", Start=" << Start
691+
<< ", Length=" << Length << std::endl;
692+
std::cout << "CurrentVersion = " << CurrentVersion << std::endl;
693+
IsGE &= CurrentVersion >= RequiredVersion;
694+
}
695+
return IsGE;
644696
}
645697

646698
} // namespace esimd_test

sycl/test-e2e/ESIMD/local_accessor_block_load_store.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ int main() {
114114
Pass &= test<int, 16, Align16>(Q);
115115
Pass &= test<float, 16, Align16>(Q);
116116

117-
if (Dev.has(aspect::fp16) && esimd_test::minLinuxDriver(Q, "1.3.26032"))
117+
if (Dev.has(aspect::fp16) &&
118+
esimd_test::isGPUDriverGE(Q, esimd_test::GPUDriverOS::LinuxAndWindows,
119+
"26032", "101.4502"))
118120
Pass &= test<sycl::half, 16, Align16>(Q);
119121

120122
// Check SLM load/store with vector size that is not power of 2

sycl/test-e2e/ESIMD/slm_block_load_store.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
// RUN: %{build} -o %t.out
99
// RUN: %{run} %t.out
1010
//
11-
// TODO: Enable the test when GPU driver is ready/fixed.
12-
// XFAIL: opencl || windows || gpu-intel-pvc
13-
// TODO: add support for local_accessors to esimd_emulator.
1411
// UNSUPPORTED: esimd_emulator
1512

1613
// This test verifies usage of slm_block_load() and slm_block_store().
@@ -76,14 +73,15 @@ template <typename T, int VL, int Align = 16> bool test(queue Q) {
7673
}
7774

7875
bool Pass = true;
76+
int NumPrintedErorrs = 0;
7977
for (int I = 0; I < GlobalRange * VL; I++) {
8078
int GID = I / VL;
8179
int LID = GID % LocalRange;
8280
int VecElementIndex = I % VL;
8381

8482
T Expected = GID * 100 + VecElementIndex;
8583
T Computed = Out[I];
86-
if (Computed != Expected) {
84+
if (Computed != Expected && ++NumPrintedErorrs < 16) {
8785
std::cout << "Error: Out[" << I << "]:" << Computed << " != " << Expected
8886
<< ":[expected]" << std::endl;
8987
Pass = false;
@@ -100,6 +98,15 @@ int main() {
10098
auto DeviceSLMSize = Dev.get_info<sycl::info::device::local_mem_size>();
10199
esimd_test::printTestLabel(Q, "Local memory size available", DeviceSLMSize);
102100

101+
// GPU driver had an error in handling of SLM aligned block_loads/stores,
102+
// which has been fixed only in "1.3.26816", and in win/opencl version going
103+
// _after_ 101.4575.
104+
if (!esimd_test::isGPUDriverGE(Q, esimd_test::GPUDriverOS::LinuxAndWindows,
105+
"26816", "101.4576")) {
106+
std::cout << "Skipped. The test requires GPU driver 1.3.26816 or newer.\n";
107+
return 0;
108+
}
109+
103110
constexpr size_t Align4 = 4;
104111
constexpr size_t Align8 = 8;
105112
constexpr size_t Align16 = 16;
@@ -108,7 +115,7 @@ int main() {
108115
Pass &= test<int, 16, Align16>(Q);
109116
Pass &= test<float, 16, Align16>(Q);
110117

111-
if (Dev.has(aspect::fp16) && esimd_test::minLinuxDriver(Q, "1.3.26032"))
118+
if (Dev.has(aspect::fp16))
112119
Pass &= test<sycl::half, 16, Align16>(Q);
113120

114121
// Check SLM load/store with alignment smaller than 16-bytes.

sycl/test-e2e/InvokeSimd/Regression/slm_load_store.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* Test check basic support of local memory access in invoke_simd.
99
*/
1010

11+
#include "../invoke_simd_utils.hpp"
12+
1113
#include <sycl/ext/intel/esimd.hpp>
1214
#include <sycl/ext/oneapi/experimental/invoke_simd.hpp>
1315
#include <sycl/sycl.hpp>
@@ -76,6 +78,15 @@ int main(void) {
7678
auto Dev = Q.get_device();
7779
std::cout << "Running on " << Dev.get_info<sycl::info::device::name>()
7880
<< std::endl;
81+
82+
// GPU driver had an error in handling of SLM aligned block_loads/stores,
83+
// which has been fixed only in "1.3.26816", and in win/opencl version going
84+
// _after_ 101.4575.
85+
if (!isGPUDriverGE(Q, GPUDriverOS::LinuxAndWindows, "26816", "101.4576")) {
86+
std::cout << "Skipped. The test requires GPU driver 1.3.26816 or newer.\n";
87+
return 0;
88+
}
89+
7990
auto DeviceSLMSize = Dev.get_info<sycl::info::device::local_mem_size>();
8091
std::cout << "Local Memory Size: " << DeviceSLMSize << std::endl;
8192

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#pragma once
2+
3+
#include <string>
4+
#include <sycl/ext/intel/esimd.hpp>
5+
#include <sycl/sycl.hpp>
6+
7+
using namespace sycl::ext::oneapi::experimental;
8+
using namespace sycl;
9+
namespace esimd = sycl::ext::intel::esimd;
10+
11+
enum GPUDriverOS { Linux = 1, Windows = 2, LinuxAndWindows = 3 };
12+
13+
/// This function returns true if it can detect the level-zero or opencl
14+
/// GPU driver and can determine that the current driver is same or newer
15+
/// than the one passed in \p RequiredVersion or \p WinOpenCLRequiredVersion.
16+
///
17+
/// Below are how driver versions look like:
18+
/// Linux/L0: [1.3.26370]
19+
/// Linux/opencl: [23.22.26370.18]
20+
/// Windows/L0: [1.3.26370]
21+
/// Windows/opencl: [31.0.101.4502]
22+
///
23+
/// This function uses only the part of the driver identification:
24+
/// - the second half of the driver id on win/opencl, e.g. 101.4502";
25+
/// - the 5-digit id for 3 other platforms, e.g. 26370.
26+
///
27+
/// Note: For the previous & new driver version and their release dates
28+
/// for win/opencl see the link:
29+
/// https://www.intel.com/content/www/us/en/download/726609/intel-arc-iris-xe-graphics-whql-windows.html
30+
bool isGPUDriverGE(queue Q, GPUDriverOS OSCheck, std::string RequiredVersion,
31+
std::string WinOpenCLRequiredVersion = "") {
32+
auto Dev = Q.get_device();
33+
if (!Dev.is_gpu())
34+
return false;
35+
36+
bool IsLinux = false;
37+
#if defined(__SYCL_RT_OS_LINUX)
38+
IsLinux = true;
39+
#elif !defined(__SYCL_RT_OS_WINDOWS)
40+
return false;
41+
#endif
42+
43+
// A and B must have digits at the same positions.
44+
// Otherwise, A and B symbols must be equal, e.g. both be equal to '.'.
45+
auto verifyDriverVersionFormat = [](const std::string &A,
46+
const std::string &B) {
47+
if (A.size() != B.size())
48+
throw std::runtime_error(
49+
"Inconsistent expected & actual driver versions");
50+
for (int I = 0; I < A.size(); I++) {
51+
if ((A[I] >= '0' && A[I] <= '9' && !(B[I] >= '0' && B[I] <= '9')) &&
52+
A[I] != B[I])
53+
throw std::runtime_error(
54+
"Inconsistent expected & actual driver versions");
55+
}
56+
};
57+
58+
auto BE = Q.get_backend();
59+
int Length = 5; // extract 5 digits for 3 or 4 platforms
60+
int Start = 4; // start of the driver id for 2 of 4 platforms
61+
if (BE == backend::opencl) { // opencl has less-standard versioning
62+
if (IsLinux) {
63+
Start = 6;
64+
} else {
65+
Start = 5;
66+
Length = 8;
67+
RequiredVersion = WinOpenCLRequiredVersion;
68+
}
69+
}
70+
71+
bool IsGE = true;
72+
if (IsLinux && (OSCheck & GPUDriverOS::Linux) ||
73+
!IsLinux && (OSCheck & GPUDriverOS::Windows)) {
74+
auto CurrentVersion = Dev.get_info<sycl::info::device::driver_version>();
75+
CurrentVersion = CurrentVersion.substr(Start, Length);
76+
verifyDriverVersionFormat(CurrentVersion, RequiredVersion);
77+
std::cout << "RequiredVersion = " << RequiredVersion << ", Start=" << Start
78+
<< ", Length=" << Length << std::endl;
79+
std::cout << "CurrentVersion = " << CurrentVersion << std::endl;
80+
IsGE &= CurrentVersion >= RequiredVersion;
81+
}
82+
return IsGE;
83+
}

0 commit comments

Comments
 (0)