Skip to content

Commit 4582336

Browse files
committed
Add test of explicit OoO, style changes, and deprecated attr
Signed-off-by: James Brodman <[email protected]>
1 parent 8ba1d4e commit 4582336

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

sycl/include/CL/sycl/ordered_queue.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,46 +26,56 @@ class context;
2626
class device;
2727
class ordered_queue {
2828
public:
29+
[[deprecated("Replaced by the in_order property in queue")]]
2930
explicit ordered_queue(const property_list &propList = {})
3031
: ordered_queue(default_selector(), async_handler{}, propList) {}
3132

33+
[[deprecated("Replaced by the in_order property in queue")]]
3234
ordered_queue(const async_handler &asyncHandler,
3335
const property_list &propList = {})
3436
: ordered_queue(default_selector(), asyncHandler, propList) {}
3537

38+
[[deprecated("Replaced by the in_order property in queue")]]
3639
ordered_queue(const device_selector &deviceSelector,
3740
const property_list &propList = {})
3841
: ordered_queue(deviceSelector.select_device(), async_handler{},
3942
propList) {}
40-
43+
[[deprecated("Replaced by the in_order property in queue")]]
4144
ordered_queue(const device_selector &deviceSelector,
4245
const async_handler &asyncHandler,
4346
const property_list &propList = {})
4447
: ordered_queue(deviceSelector.select_device(), asyncHandler, propList) {}
4548

49+
[[deprecated("Replaced by the in_order property in queue")]]
4650
ordered_queue(const device &syclDevice, const property_list &propList = {})
4751
: ordered_queue(syclDevice, async_handler{}, propList) {}
4852

53+
[[deprecated("Replaced by the in_order property in queue")]]
4954
ordered_queue(const device &syclDevice, const async_handler &asyncHandler,
5055
const property_list &propList = {});
5156

57+
[[deprecated("Replaced by the in_order property in queue")]]
5258
ordered_queue(const context &syclContext,
5359
const device_selector &deviceSelector,
5460
const property_list &propList = {})
5561
: ordered_queue(syclContext, deviceSelector,
5662
detail::getSyclObjImpl(syclContext)->get_async_handler(),
5763
propList) {}
5864

65+
[[deprecated("Replaced by the in_order property in queue")]]
5966
ordered_queue(const context &syclContext,
6067
const device_selector &deviceSelector,
6168
const async_handler &asyncHandler,
6269
const property_list &propList = {});
6370

71+
[[deprecated("Replaced by the in_order property in queue")]]
6472
ordered_queue(cl_command_queue cl_Queue, const context &syclContext,
6573
const async_handler &asyncHandler = {});
6674

75+
[[deprecated("Replaced by the in_order property in queue")]]
6776
ordered_queue(const ordered_queue &rhs) = default;
6877

78+
[[deprecated("Replaced by the in_order property in queue")]]
6979
ordered_queue(ordered_queue &&rhs) = default;
7080

7181
ordered_queue &operator=(const ordered_queue &rhs) = default;

sycl/source/queue.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ namespace detail {
1919
QueueOrder getQueueOrder(const property_list &propList) {
2020
if (propList.has_property<property::queue::in_order>()) {
2121
return QueueOrder::Ordered;
22-
} else {
23-
return QueueOrder::OOO;
2422
}
23+
return QueueOrder::OOO;
2524
}
2625

2726
} // namespace detail

sycl/test/ordered_queue/prop.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// RUN: %clangxx -fsycl %s -o %t1.out -lOpenCL
2+
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
3+
// RUN: %GPU_RUN_PLACEHOLDER %t1.out
4+
5+
//==----------- ordered_dmemll.cpp - Device Memory Linked List test --------==//
6+
// It uses an ordered queue where explicit waiting is not necessary between
7+
// kernels
8+
//
9+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
10+
// See https://llvm.org/LICENSE.txt for license information.
11+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
12+
//
13+
//===----------------------------------------------------------------------===//
14+
15+
#include <CL/sycl.hpp>
16+
17+
using namespace cl::sycl;
18+
19+
constexpr int numNodes = 4;
20+
21+
bool getQueueOrder(cl_command_queue cq) {
22+
cl_command_queue_properties reportedProps;
23+
cl_int iRet = clGetCommandQueueInfo(
24+
cq, CL_QUEUE_PROPERTIES, sizeof(reportedProps), &reportedProps, nullptr);
25+
assert(CL_SUCCESS == iRet && "Failed to obtain queue info from ocl device");
26+
return (reportedProps & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) ? true
27+
: false;
28+
}
29+
30+
int main() {
31+
queue q{property::queue::out_of_order()};
32+
auto dev = q.get_device();
33+
34+
cl_command_queue cq = q.get();
35+
bool expected_result = dev.is_host() ? true : getQueueOrder(cq);
36+
if (!expected_result) {
37+
std::cout << "Resulting queue order is in order but expected order is OOO"
38+
<< std::endl;
39+
40+
return -1;
41+
}
42+
43+
return 0;
44+
}

0 commit comments

Comments
 (0)