Skip to content

Commit 4ecb504

Browse files
authored
[SYCL] Separate opencl specific event constructs in the lit test. (#2396)
1 parent eec5541 commit 4ecb504

File tree

2 files changed

+43
-27
lines changed

2 files changed

+43
-27
lines changed

sycl/test/basic_tests/event.cpp

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// REQUIRES: opencl || level0
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: env SYCL_DEVICE_TYPE=HOST %t.out
53
// RUN: %CPU_RUN_PLACEHOLDER %t.out
64
// RUN: %GPU_RUN_PLACEHOLDER %t.out
@@ -16,30 +14,6 @@
1614
#include <iostream>
1715

1816
int main() {
19-
try {
20-
std::cout << "Create default event" << std::endl;
21-
cl::sycl::event e;
22-
} catch (cl::sycl::device_error e) {
23-
std::cout << "Failed to create device for event" << std::endl;
24-
}
25-
try {
26-
std::cout << "Try create OpenCL event" << std::endl;
27-
cl::sycl::context c;
28-
if (!c.is_host()) {
29-
::cl_int error;
30-
cl_event u_e = clCreateUserEvent(c.get(), &error);
31-
cl::sycl::event cl_e(u_e, c);
32-
std::cout << "OpenCL event: " << std::hex << cl_e.get()
33-
<< ((cl_e.get() == u_e) ? " matches " : " does not match ")
34-
<< u_e << std::endl;
35-
36-
} else {
37-
std::cout << "Failed to create OpenCL context" << std::endl;
38-
}
39-
} catch (cl::sycl::device_error e) {
40-
std::cout << "Failed to create device for context" << std::endl;
41-
}
42-
4317
{
4418
std::cout << "move constructor" << std::endl;
4519
cl::sycl::event Event;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// REQUIRES: opencl
2+
3+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -L %opencl_libs_dir -lOpenCL
4+
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
5+
// RUN: %CPU_RUN_PLACEHOLDER %t.out
6+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
7+
8+
//==--------------- event.cpp - SYCL event test ----------------------------==//
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+
#include <CL/sycl.hpp>
16+
#include <iostream>
17+
18+
int main() {
19+
try {
20+
std::cout << "Create default event" << std::endl;
21+
cl::sycl::event e;
22+
} catch (cl::sycl::device_error e) {
23+
std::cout << "Failed to create device for event" << std::endl;
24+
}
25+
try {
26+
std::cout << "Try create OpenCL event" << std::endl;
27+
cl::sycl::context c;
28+
if (!c.is_host()) {
29+
::cl_int error;
30+
cl_event u_e = clCreateUserEvent(c.get(), &error);
31+
cl::sycl::event cl_e(u_e, c);
32+
std::cout << "OpenCL event: " << std::hex << cl_e.get()
33+
<< ((cl_e.get() == u_e) ? " matches " : " does not match ")
34+
<< u_e << std::endl;
35+
36+
} else {
37+
std::cout << "Failed to create OpenCL context" << std::endl;
38+
}
39+
} catch (cl::sycl::device_error e) {
40+
std::cout << "Failed to create device for context" << std::endl;
41+
}
42+
}

0 commit comments

Comments
 (0)