1
+ // REQUIRES: opencl
2
+
3
+ // RUN: %clangxx -fsycl %s -o %t.run
4
+ // RUN: %GPU_RUN_PLACEHOLDER %t.run
5
+ // RUN: %CPU_RUN_PLACEHOLDER %t.run
6
+ // RUN: %ACC_RUN_PLACEHOLDER %t.run
7
+
8
+ // ==------------------- device_platform_interop.cpp ------------------------==//
9
+ // The test for SYCL device and platform interop constructors
10
+ //
11
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
12
+ // See https://llvm.org/LICENSE.txt for license information.
13
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
14
+ //
15
+ // ===----------------------------------------------------------------------===//
16
+
17
+ #include < CL/sycl.hpp>
18
+ #include < CL/sycl/backend/opencl.hpp>
19
+ #include < iostream>
20
+ #include < memory>
21
+ #include < unordered_map>
22
+ using namespace cl ::sycl;
23
+
24
+ int main () {
25
+ default_selector device_selector;
26
+
27
+ device D1 (device_selector);
28
+ cl_device_id cl_device;
29
+ {
30
+ device D2 (device_selector);
31
+ cl_device = D2.get_native <backend::opencl>();
32
+ }
33
+ device D3 (cl_device);
34
+ assert (D1 == D3 && " Device impls are different" );
35
+
36
+ platform P1 (device_selector);
37
+ cl_platform_id cl_platform;
38
+ {
39
+ platform P2 (device_selector);
40
+ cl_platform = P2.get_native <backend::opencl>();
41
+ }
42
+ platform P3 (cl_platform);
43
+ assert (P1 == P3 && " Platform impls are different" );
44
+
45
+ return 0 ;
46
+ }
0 commit comments