Skip to content

Commit dbfa7b9

Browse files
authored
[SYCL][E2E] Fix warnings in Graph e2e tests (#14227)
`sycl/test-e2e/Graph/Inputs/work_group_size_prop.cpp`: - Use SYCL 2020 exceptions. In cases where an exception is expected check errc to see that the correct one was caught. `sycl/test-e2e/Graph/UnsupportedDevice/device_query.cpp` - Remove extra parantheses from if statement
1 parent d05ff71 commit dbfa7b9

File tree

2 files changed

+14
-31
lines changed

2 files changed

+14
-31
lines changed

sycl/test-e2e/Graph/Inputs/work_group_size_prop.cpp

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,12 @@ int test(queue &Queue, PropertiesT Props, KernelType KernelFunc) {
6868

6969
Queue.submit([&](handler &CGH) { CGH.ext_oneapi_graph(ExecGraph); });
7070
Queue.wait_and_throw();
71-
} catch (nd_range_error &E) {
72-
std::cerr << "Test case failed: unexpected "
73-
"nd_range_error exception: "
74-
<< E.what() << std::endl;
75-
return 1;
76-
} catch (runtime_error &E) {
77-
std::cerr << "Test case failed: unexpected "
78-
"runtime_error exception: "
79-
<< E.what() << std::endl;
71+
} catch (exception &E) {
72+
std::cerr << "Test case failed: unexpected exception: " << E.what()
73+
<< std::endl;
8074
return 1;
8175
} catch (...) {
82-
std::cerr << "Test case failed: something unexpected "
83-
"has been caught"
76+
std::cerr << "Test case failed: something unexpected has been caught"
8477
<< std::endl;
8578
return 1;
8679
}
@@ -101,26 +94,21 @@ int test(queue &Queue, PropertiesT Props, KernelType KernelFunc) {
10194
std::cerr << "Test case ReqdWGSizeNegativeA failed: no exception has been "
10295
"thrown\n";
10396
return 1; // We shouldn't be here, exception is expected
104-
} catch (nd_range_error &E) {
105-
if (std::string(E.what()).find(
97+
} catch (exception &E) {
98+
if (E.code() != errc::nd_range ||
99+
std::string(E.what()).find(
106100
"The specified local size " + rangeToString(repeatRange<Dims>(8)) +
107101
" doesn't match the required " +
108102
"work-group size specified in the program source " +
109103
rangeToString(range<Dims>(Is...))) == std::string::npos) {
110104
std::cerr
111-
<< "Test case ReqdWGSizeNegativeA failed: unexpected nd_range_error "
112-
"exception: "
105+
<< "Test case ReqdWGSizeNegativeA failed: unexpected exception: "
113106
<< E.what() << std::endl;
114107
return 1;
115108
}
116-
} catch (runtime_error &E) {
117-
std::cerr << "Test case ReqdWGSizeNegativeA failed: unexpected "
118-
"nd_range_error exception: "
119-
<< E.what() << std::endl;
120-
return 1;
121109
} catch (...) {
122-
std::cerr << "Test case ReqdWGSizeNegativeA failed: something unexpected "
123-
"has been caught"
110+
std::cerr << "Test case ReqdWGSizeNegativeA failed: something "
111+
"unexpected has been caught"
124112
<< std::endl;
125113
return 1;
126114
}
@@ -144,23 +132,18 @@ int test(queue &Queue, PropertiesT Props, KernelType KernelFunc) {
144132
"has been "
145133
"thrown\n";
146134
return 1; // We shouldn't be here, exception is expected
147-
} catch (nd_range_error &E) {
148-
if (std::string(E.what()).find(
135+
} catch (exception &E) {
136+
if (E.code() != errc::nd_range ||
137+
std::string(E.what()).find(
149138
"The specified local size " + rangeToString(repeatRange<Dims>(8)) +
150139
" doesn't match the required " +
151140
"work-group size specified in the program source " +
152141
rangeToString(range<Dims>(Is...))) == std::string::npos) {
153142
std::cerr << "Test case ReqdWGSizeNegativeA shortcut failed: unexpected "
154-
"nd_range_error "
155143
"exception: "
156144
<< E.what() << std::endl;
157145
return 1;
158146
}
159-
} catch (runtime_error &E) {
160-
std::cerr << "Test case ReqdWGSizeNegativeA shortcut failed: unexpected "
161-
"nd_range_error exception: "
162-
<< E.what() << std::endl;
163-
return 1;
164147
} catch (...) {
165148
std::cerr << "Test case ReqdWGSizeNegativeA shortcut failed: something "
166149
"unexpected has been caught"

sycl/test-e2e/Graph/UnsupportedDevice/device_query.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ int main() {
1717
bool SupportsLimitedGraphs = Device.has(aspect::ext_oneapi_limited_graph);
1818
auto Backend = Device.get_backend();
1919

20-
if ((Backend == backend::ext_oneapi_level_zero)) {
20+
if (Backend == backend::ext_oneapi_level_zero) {
2121
// Full graph support is dependent on the Level Zero device & driver,
2222
// and cannot be asserted without diving into these details.
2323
assert(SupportsLimitedGraphs);

0 commit comments

Comments
 (0)