Skip to content

Commit 4a1eb53

Browse files
authored
[NFC][SYCL] Separate OpenCL specific constructs from lit tests. (#2147)
Adding 'opencl' requirement disabled several tests some of which have non-opencl constructs as well. This patch separates those tests to enable testing of SYCL core functionalities. Signed-off-by: rbegam <[email protected]>
1 parent 4c57d4d commit 4a1eb53

File tree

7 files changed

+310
-212
lines changed

7 files changed

+310
-212
lines changed

sycl/test/basic_tests/event.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
// REQUIRES: opencl
1+
// REQUIRES: opencl || level0
22

33
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -L %opencl_libs_dir -lOpenCL
44
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
5+
// RUN: %CPU_RUN_PLACEHOLDER %t.out
6+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
7+
58
//==--------------- event.cpp - SYCL event test ----------------------------==//
69
//
710
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.

sycl/test/inorder_queue/in_order_buffs.cpp

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// REQUIRES: opencl
2-
3-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -L %opencl_libs_dir -lOpenCL
1+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
42
// RUN: %ACC_RUN_PLACEHOLDER %t.out
53
// RUN: %CPU_RUN_PLACEHOLDER %t.out
64
// RUN: %GPU_RUN_PLACEHOLDER %t.out
@@ -18,14 +16,6 @@ using namespace cl::sycl;
1816

1917
const int dataSize = 32;
2018

21-
bool isQueueInOrder(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));
27-
}
28-
2919
int main() {
3020
int dataA[dataSize] = {0};
3121
int dataB[dataSize] = {0};
@@ -63,18 +53,6 @@ int main() {
6353
cgh.parallel_for<class ordered_reader>(myRange, myKernel);
6454
});
6555

66-
bool result = true;
67-
cl_command_queue cq = Queue.get();
68-
device dev = Queue.get_device();
69-
bool expected_result = dev.is_host() ? true : isQueueInOrder(cq);
70-
71-
if (expected_result != result) {
72-
std::cout << "Resulting queue order is OOO but expected order is inorder"
73-
<< std::endl;
74-
75-
return -1;
76-
}
77-
7856
auto readBufferB = bufB.get_access<access::mode::read>();
7957
for (size_t i = 0; i != dataSize; ++i) {
8058
if (readBufferB[i] != i) {
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// REQUIRES: opencl
2+
3+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -L %opencl_libs_dir -lOpenCL
4+
// RUN: %ACC_RUN_PLACEHOLDER %t.out
5+
// RUN: %CPU_RUN_PLACEHOLDER %t.out
6+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
7+
//==-------- ordered_buffs.cpp - SYCL buffers in ordered queues test--------==//
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+
#include <CL/sycl.hpp>
15+
#include <iostream>
16+
17+
using namespace cl::sycl;
18+
19+
const int dataSize = 32;
20+
21+
bool isQueueInOrder(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));
27+
}
28+
29+
int main() {
30+
int dataA[dataSize] = {0};
31+
int dataB[dataSize] = {0};
32+
33+
{
34+
queue Queue{property::queue::in_order()};
35+
36+
bool result = true;
37+
cl_command_queue cq = Queue.get();
38+
device dev = Queue.get_device();
39+
bool expected_result = dev.is_host() ? true : isQueueInOrder(cq);
40+
41+
if (expected_result != result) {
42+
std::cout << "Resulting queue order is OOO but expected order is inorder"
43+
<< std::endl;
44+
45+
return -1;
46+
}
47+
}
48+
49+
return 0;
50+
}

sycl/test/inorder_queue/in_order_dmemll.cpp

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// REQUIRES: opencl
2-
3-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out -L %opencl_libs_dir -lOpenCL
1+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
42
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
53
// RUN: %GPU_RUN_PLACEHOLDER %t1.out
4+
//
5+
// XFAIL: cuda
66
//==----------- ordered_dmemll.cpp - Device Memory Linked List test --------==//
77
// It uses an ordered queue where explicit waiting is not necessary between
88
// kernels
@@ -19,15 +19,6 @@ using namespace cl::sycl;
1919

2020
constexpr int numNodes = 4;
2121

22-
bool getQueueOrder(cl_command_queue cq) {
23-
cl_command_queue_properties reportedProps;
24-
cl_int iRet = clGetCommandQueueInfo(
25-
cq, CL_QUEUE_PROPERTIES, sizeof(reportedProps), &reportedProps, nullptr);
26-
assert(CL_SUCCESS == iRet && "Failed to obtain queue info from ocl device");
27-
return (reportedProps & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) ? false
28-
: true;
29-
}
30-
3122
struct Node {
3223
Node() : pNext(nullptr), Num(0xDEADBEEF) {}
3324

@@ -103,15 +94,5 @@ int main() {
10394
d_cur = h_cur.pNext;
10495
}
10596

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

0 commit comments

Comments
 (0)