File tree Expand file tree Collapse file tree 2 files changed +43
-27
lines changed Expand file tree Collapse file tree 2 files changed +43
-27
lines changed Original file line number Diff line number Diff line change 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
1614#include < iostream>
1715
1816int 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;
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments