forked from intel/llvm-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevice_platform_interop.cpp
More file actions
45 lines (38 loc) · 1.24 KB
/
device_platform_interop.cpp
File metadata and controls
45 lines (38 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// REQUIRES: opencl
// RUN: %clangxx -fsycl -D__SYCL_INTERNAL_API %s -o %t.run
// RUN: %GPU_RUN_PLACEHOLDER %t.run
// RUN: %CPU_RUN_PLACEHOLDER %t.run
// RUN: %ACC_RUN_PLACEHOLDER %t.run
//==------------------- device_platform_interop.cpp ------------------------==//
// The test for SYCL device and platform interop constructors
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <iostream>
#include <memory>
#include <sycl/backend/opencl.hpp>
#include <sycl/sycl.hpp>
#include <unordered_map>
using namespace sycl;
int main() {
device D1(default_selector_v);
cl_device_id cl_device;
{
device D2(default_selector_v);
cl_device = get_native<backend::opencl>(D2);
}
device D3(cl_device);
assert(D1 == D3 && "Device impls are different");
platform P1(default_selector_v);
cl_platform_id cl_platform;
{
platform P2(default_selector_v);
cl_platform = get_native<backend::opencl>(P2);
}
platform P3(cl_platform);
assert(P1 == P3 && "Platform impls are different");
return 0;
}