Skip to content

Commit 4f5a5f0

Browse files
[SYCL] Fix WA for ocl query of CL_DEVICE_PROFILE (#13584)
Improves kernel_compiler WA for CL_DEVICE_PROFILE query. Currently ocl query returns some extra symbols we want to eliminate from final result returned to user. Removes all special symbols now. To be removed once ocl query is fixed. --------- Signed-off-by: Tikhomirova, Kseniya <[email protected]>
1 parent a780a8b commit 4f5a5f0

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

sycl/source/detail/kernel_compiler/kernel_compiler_opencl.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <sycl/detail/pi.hpp> // getOsLibraryFuncAddress
10-
#include <sycl/exception.hpp> // make_error_code
9+
#include <sycl/detail/pi.hpp> // getOsLibraryFuncAddress
10+
#include <sycl/exception.hpp> // make_error_code
1111

1212
#include "kernel_compiler_opencl.hpp"
1313

@@ -368,9 +368,11 @@ std::string OpenCLC_Profile(uint32_t IPVersion) {
368368
std::string result = InvokeOclocQuery(IPVersion, "CL_DEVICE_PROFILE");
369369
// NOTE: result has \n\n amended. Clean it up.
370370
// TODO: remove this once the ocloc query is fixed.
371-
while (result.back() == '\n') {
372-
result.pop_back();
373-
}
371+
result.erase(std::remove_if(result.begin(), result.end(),
372+
[](char c) {
373+
return !std::isprint(c) || std::isspace(c);
374+
}),
375+
result.end());
374376

375377
return result;
376378
} catch (sycl::exception &) {

sycl/test-e2e/KernelCompiler/opencl_queries.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
// REQUIRES: ocloc && (opencl || level_zero)
1010
// UNSUPPORTED: accelerator
1111

12-
// Fails with opencl and level_zero on linux, enable when fixed.
13-
// XFAIL: opencl || (linux && level_zero)
14-
1512
// RUN: %{build} -o %t.out
1613
// RUN: %{run} %t.out
1714

@@ -48,11 +45,16 @@ int main() {
4845
assert(d.ext_oneapi_cl_profile() == "FULL_PROFILE" &&
4946
"unexpected cl_profile");
5047

51-
assert(syclex::opencl_c_1_0.major == 1 && syclex::opencl_c_1_0.minor == 0 && syclex::opencl_c_1_0.patch == 0);
52-
assert(syclex::opencl_c_1_1.major == 1 && syclex::opencl_c_1_1.minor == 1 && syclex::opencl_c_1_1.patch == 0);
53-
assert(syclex::opencl_c_1_2.major == 1 && syclex::opencl_c_1_2.minor == 2 && syclex::opencl_c_1_2.patch == 0);
54-
assert(syclex::opencl_c_2_0.major == 2 && syclex::opencl_c_2_0.minor == 0 && syclex::opencl_c_2_0.patch == 0);
55-
assert(syclex::opencl_c_3_0.major == 3 && syclex::opencl_c_3_0.minor == 0 && syclex::opencl_c_3_0.patch == 0);
48+
assert(syclex::opencl_c_1_0.major == 1 && syclex::opencl_c_1_0.minor == 0 &&
49+
syclex::opencl_c_1_0.patch == 0);
50+
assert(syclex::opencl_c_1_1.major == 1 && syclex::opencl_c_1_1.minor == 1 &&
51+
syclex::opencl_c_1_1.patch == 0);
52+
assert(syclex::opencl_c_1_2.major == 1 && syclex::opencl_c_1_2.minor == 2 &&
53+
syclex::opencl_c_1_2.patch == 0);
54+
assert(syclex::opencl_c_2_0.major == 2 && syclex::opencl_c_2_0.minor == 0 &&
55+
syclex::opencl_c_2_0.patch == 0);
56+
assert(syclex::opencl_c_3_0.major == 3 && syclex::opencl_c_3_0.minor == 0 &&
57+
syclex::opencl_c_3_0.patch == 0);
5658

5759
return 0;
5860
}

0 commit comments

Comments
 (0)