Skip to content

Commit 31c03f3

Browse files
authored
Merge pull request #1094 from KhronosGroup/khr_queue_flush
[khr_queue_flush] Add tests
2 parents ea1d62b + 0a56006 commit 31c03f3

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ add_cts_option(SYCL_CTS_ENABLE_KHR_WORK_ITEM_QUERIES_TESTS
152152
"Enable extension Khronos work_item_queries tests" OFF
153153
FORCE_ON ${SYCL_CTS_ENABLE_KHR_TESTS})
154154

155+
add_cts_option(SYCL_CTS_ENABLE_KHR_QUEUE_FLUSH_TESTS
156+
"Enable extension Khronos queue_flush tests" OFF
157+
FORCE_ON ${SYCL_CTS_ENABLE_KHR_TESTS})
158+
155159
# TODO: Deprecated - remove
156160
add_cts_option(SYCL_CTS_ENABLE_VERBOSE_LOG
157161
"Enable debug-level logs (deprecated)" OFF)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if(SYCL_CTS_ENABLE_KHR_QUEUE_FLUSH_TESTS)
2+
file(GLOB test_cases_list *.cpp)
3+
4+
add_cts_test(${test_cases_list})
5+
endif()
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*******************************************************************************
2+
//
3+
// SYCL 2020 Conformance Test Suite
4+
//
5+
// Copyright (c) 2025 The Khronos Group Inc.
6+
//
7+
// Licensed under the Apache License, Version 2.0 (the "License");
8+
// you may not use this file except in compliance with the License.
9+
// You may obtain a copy of the License at
10+
//
11+
// http://www.apache.org/licenses/LICENSE-2.0
12+
//
13+
// Unless required by applicable law or agreed to in writing, software
14+
// distributed under the License is distributed on an "AS IS" BASIS,
15+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
// See the License for the specific language governing permissions and
17+
// limitations under the License.
18+
//
19+
*******************************************************************************/
20+
21+
#include "../../common/common.h"
22+
#include <future>
23+
24+
namespace queue_flush::tests {
25+
26+
TEST_CASE(
27+
"the queue flush extension defines the "
28+
"SYCL_KHR_QUEUE_FLUSH macro",
29+
"[khr_queue_flush]") {
30+
#ifndef SYCL_KHR_QUEUE_FLUSH
31+
static_assert(false, "SYCL_KHR_QUEUE_FLUSH is not defined");
32+
#endif
33+
}
34+
35+
TEST_CASE("Flush and spin lock event", "[khr_queue_flush]") {
36+
sycl::queue q;
37+
auto e = q.single_task([] {});
38+
q.khr_flush();
39+
while (e.get_info<sycl::info::event::command_execution_status>() !=
40+
sycl::info::event_command_status::complete) {
41+
};
42+
}
43+
44+
TEST_CASE("Flush and host task", "[khr_queue_flush]") {
45+
sycl::queue q;
46+
std::promise<void> promise;
47+
48+
q.submit([&](sycl::handler& cgh) {
49+
cgh.host_task([&] { promise.get_future().wait(); });
50+
});
51+
q.khr_flush();
52+
promise.set_value();
53+
q.wait();
54+
}
55+
56+
} // namespace queue_flush::tests

0 commit comments

Comments
 (0)