DPC++ Runtime
Runtime libraries for oneAPI DPC++
opencl.hpp
Go to the documentation of this file.
1
2
//==---------------- opencl.hpp - SYCL OpenCL backend ----------------------==//
3
//
4
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
// See https://llvm.org/LICENSE.txt for license information.
6
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
//
8
//===----------------------------------------------------------------------===//
9
10
#pragma once
11
12
#include <
sycl/backend.hpp
>
13
14
#include <string>
15
16
namespace
sycl
{
17
__SYCL_INLINE_VER_NAMESPACE
(_V1) {
18
namespace
opencl
{
19
// Implementation of various "make" functions resides in SYCL RT because
20
// creating SYCL objects requires knowing details not accessible here.
21
// Note that they take opaque pi_native_handle that real OpenCL handles
22
// are casted to.
23
//
24
__SYCL_EXPORT
platform
make_platform
(
pi_native_handle
NativeHandle);
25
__SYCL_EXPORT
device
make_device
(
pi_native_handle
NativeHandle);
26
__SYCL_EXPORT context
make_context
(
pi_native_handle
NativeHandle);
27
__SYCL_EXPORT queue
make_queue
(
const
context &Context,
28
pi_native_handle
InteropHandle);
29
30
__SYCL_EXPORT
bool
has_extension
(
const
sycl::platform &SyclPlatform,
31
const
std::string &Extension);
32
__SYCL_EXPORT
bool
has_extension
(
const
sycl::device &SyclDevice,
33
const
std::string &Extension);
34
35
// Construction of SYCL platform.
36
template
<
typename
T,
typename
detail::enable_if_t
<
37
std::is_same<T, platform>::value> * =
nullptr
>
38
__SYCL_DEPRECATED
(
"Use SYCL 2020 sycl::make_platform free function"
)
39
T
make
(typename detail::
interop
<
backend
::opencl, T>::type Interop) {
40
return
make_platform
(detail::pi::cast<pi_native_handle>(Interop));
41
}
42
43
// Construction of SYCL device.
44
template
<
typename
T
,
typename
detail::enable_if_t
<
45
std::is_same<T, device>::value> * =
nullptr
>
46
__SYCL_DEPRECATED
(
"Use SYCL 2020 sycl::make_device free function"
)
47
T
make
(typename detail::interop<
backend
::opencl,
T
>::type Interop) {
48
return
make_device
(detail::pi::cast<pi_native_handle>(Interop));
49
}
50
51
// Construction of SYCL context.
52
template
<
typename
T,
typename
detail::enable_if_t
<
53
std::is_same<T, context>::value> * =
nullptr
>
54
__SYCL_DEPRECATED
(
"Use SYCL 2020 sycl::make_context free function"
)
55
T
make
(typename detail::interop<
backend
::opencl, T>::type Interop) {
56
return
make_context
(detail::pi::cast<pi_native_handle>(Interop));
57
}
58
59
// Construction of SYCL queue.
60
template
<
typename
T,
typename
detail::enable_if_t
<
61
std::is_same<T, queue>::value> * =
nullptr
>
62
__SYCL_DEPRECATED
(
"Use SYCL 2020 sycl::make_queue free function"
)
63
T
make
(const
context
&Context,
64
typename detail::
interop
<
backend
::opencl, T>::type Interop) {
65
return
make_queue
(Context, detail::pi::cast<pi_native_handle>(Interop));
66
}
67
}
// namespace opencl
68
}
// __SYCL_INLINE_VER_NAMESPACE(_V1)
69
}
// namespace sycl
sycl::_V1::errc::platform
@ platform
sycl::_V1::backend
backend
Definition:
backend_types.hpp:21
T
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition:
defines_elementary.hpp:11
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition:
access.hpp:14
sycl::_V1::opencl::make_context
context make_context(pi_native_handle NativeHandle)
Definition:
opencl.cpp:38
__SYCL_DEPRECATED
#define __SYCL_DEPRECATED(message)
Definition:
defines_elementary.hpp:46
sycl::_V1::detail::enable_if_t
typename std::enable_if< B, T >::type enable_if_t
Definition:
stl_type_traits.hpp:24
sycl::_V1::opencl::make_queue
queue make_queue(const context &Context, pi_native_handle InteropHandle)
Definition:
opencl.cpp:45
sycl::_V1::detail::interop
Definition:
backend_traits.hpp:18
sycl::_V1::opencl::has_extension
bool has_extension(const sycl::device &SyclDevice, const std::string &Extension)
Definition:
opencl.cpp:85
sycl::_V1::access::target::device
@ device
pi_native_handle
uintptr_t pi_native_handle
Definition:
pi.h:133
sycl::_V1::backend::opencl
@ opencl
sycl::_V1::opencl::make
T make(const context &Context, typename detail::interop< backend::opencl, T >::type Interop)
Definition:
opencl.hpp:63
backend.hpp
sycl::_V1::opencl::make_device
device make_device(pi_native_handle NativeHandle)
Definition:
opencl.cpp:32
sycl::_V1::opencl::make_platform
platform make_platform(pi_native_handle NativeHandle)
Definition:
opencl.cpp:26
sycl::_V1::context
The context class represents a SYCL context on which kernel functions may be executed.
Definition:
context.hpp:41
include
sycl
backend
opencl.hpp
Generated by
1.8.17