diff --git a/SYCL/Basic/device_platform_interop.cpp b/SYCL/Basic/device_platform_interop.cpp new file mode 100644 index 0000000000..3f5e9e0818 --- /dev/null +++ b/SYCL/Basic/device_platform_interop.cpp @@ -0,0 +1,46 @@ +// REQUIRES: opencl + +// RUN: %clangxx -fsycl %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 +#include +#include +#include +#include +using namespace cl::sycl; + +int main() { + default_selector device_selector; + + device D1(device_selector); + cl_device_id cl_device; + { + device D2(device_selector); + cl_device = D2.get_native(); + } + device D3(cl_device); + assert(D1 == D3 && "Device impls are different"); + + platform P1(device_selector); + cl_platform_id cl_platform; + { + platform P2(device_selector); + cl_platform = P2.get_native(); + } + platform P3(cl_platform); + assert(P1 == P3 && "Platform impls are different"); + + return 0; +} \ No newline at end of file