DPC++ Runtime
Runtime libraries for oneAPI DPC++
opencl.cpp
Go to the documentation of this file.
1
//==------- opencl.cpp - SYCL OpenCL backend -------------------------------==//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include <
CL/sycl.hpp
>
10
#include <
detail/kernel_impl.hpp
>
11
#include <
detail/platform_impl.hpp
>
12
#include <
detail/plugin.hpp
>
13
#include <
detail/program_impl.hpp
>
14
#include <
detail/queue_impl.hpp
>
15
16
__SYCL_INLINE_NAMESPACE
(
cl
) {
17
namespace
sycl
{
18
namespace
opencl
{
19
using namespace
detail;
20
21
//----------------------------------------------------------------------------
22
// Implementation of opencl::make<platform>
23
__SYCL_EXPORT
platform
make_platform
(
pi_native_handle
NativeHandle) {
24
return
detail::make_platform
(NativeHandle, backend::opencl);
25
}
26
27
//----------------------------------------------------------------------------
28
// Implementation of opencl::make<device>
29
__SYCL_EXPORT
device
make_device
(
pi_native_handle
NativeHandle) {
30
return
detail::make_device
(NativeHandle, backend::opencl);
31
}
32
33
//----------------------------------------------------------------------------
34
// Implementation of opencl::make<context>
35
__SYCL_EXPORT
context
make_context
(
pi_native_handle
NativeHandle) {
36
return
detail::make_context
(NativeHandle,
async_handler
{}, backend::opencl);
37
}
38
39
//----------------------------------------------------------------------------
40
// Implementation of opencl::make<program>
41
__SYCL_EXPORT program
make_program
(
const
context
&Context,
42
pi_native_handle
NativeHandle) {
43
// Construct the SYCL program from native program.
44
// TODO: move here the code that creates PI program, and remove the
45
// native interop constructor.
46
return
detail::createSyclObjFromImpl<program>(
47
std::make_shared<program_impl>(
getSyclObjImpl
(Context), NativeHandle));
48
}
49
50
//----------------------------------------------------------------------------
51
// Implementation of opencl::make<queue>
52
__SYCL_EXPORT
queue
make_queue
(
const
context
&Context,
53
pi_native_handle
NativeHandle) {
54
const
auto
&ContextImpl =
getSyclObjImpl
(Context);
55
return
detail::make_queue
(NativeHandle, Context,
false
,
56
ContextImpl->get_async_handler(), backend::opencl);
57
}
58
}
// namespace opencl
59
}
// namespace sycl
60
}
// __SYCL_INLINE_NAMESPACE(cl)
cl::sycl::opencl::make_platform
platform make_platform(pi_native_handle NativeHandle)
Definition:
opencl.cpp:23
cl::sycl::backend::opencl
@ opencl
cl::sycl::opencl::make_device
device make_device(pi_native_handle NativeHandle)
Definition:
opencl.cpp:29
cl::sycl::opencl::make_program
program make_program(const context &Context, pi_native_handle NativeHandle)
Definition:
opencl.cpp:41
sycl
Definition:
invoke_simd.hpp:68
cl::sycl::opencl::make_context
context make_context(pi_native_handle NativeHandle)
Definition:
opencl.cpp:35
plugin.hpp
queue_impl.hpp
cl::sycl::queue
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
Definition:
queue.hpp:103
program_impl.hpp
sycl.hpp
platform_impl.hpp
cl::sycl::device
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition:
device.hpp:35
cl
We provide new interfaces for matrix muliply in this patch:
Definition:
access.hpp:13
pi_native_handle
uintptr_t pi_native_handle
Definition:
pi.h:76
cl::sycl::opencl::make_queue
queue make_queue(const context &Context, pi_native_handle InteropHandle)
Definition:
opencl.cpp:52
cl::sycl::detail::getSyclObjImpl
decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject)
Definition:
common.hpp:198
cl::sycl::platform
Encapsulates a SYCL platform on which kernels may be executed.
Definition:
platform.hpp:34
cl::sycl::context
The context class represents a SYCL context on which kernel functions may be executed.
Definition:
context.hpp:35
kernel_impl.hpp
cl::sycl::async_handler
std::function< void(cl::sycl::exception_list)> async_handler
Definition:
exception_list.hpp:53
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition:
defines_elementary.hpp:12
source
backend
opencl.cpp
Generated by
1.8.17