DPC++ Runtime
Runtime libraries for oneAPI DPC++
backend_traits_hip.hpp
Go to the documentation of this file.
1 //===------- backend_traits_hip.hpp - Backend traits for HIP ---*-C++ -*-===//
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 // This file defines the specializations of the sycl::detail::interop,
10 // sycl::detail::BackendInput and sycl::detail::BackendReturn class templates
11 // for the HIP backend but there is no sycl::detail::InteropFeatureSupportMap
12 // specialization for the HIP backend.
13 //===----------------------------------------------------------------------===//
14 
15 #pragma once
16 
17 #include <sycl/accessor.hpp>
18 #include <sycl/context.hpp>
20 #include <sycl/device.hpp>
21 #include <sycl/event.hpp>
22 #include <sycl/kernel_bundle.hpp>
23 #include <sycl/queue.hpp>
24 
25 typedef int HIPdevice;
26 typedef struct ihipCtx_t *HIPcontext;
27 typedef struct ihipStream_t *HIPstream;
28 typedef struct ihipEvent_t *HIPevent;
29 typedef struct ihipModule_t *HIPmodule;
30 typedef void *HIPdeviceptr;
31 
33 namespace sycl {
34 namespace detail {
35 
36 // TODO the interops for context, device, event, platform and program
37 // may be removed after removing the deprecated 'get_native()' methods
38 // from the corresponding classes. The interop<backend, queue> specialization
39 // is also used in the get_queue() method of the deprecated class
40 // interop_handler and also can be removed after API cleanup.
41 template <> struct interop<backend::ext_oneapi_hip, context> {
42  using type = HIPcontext;
43 };
44 
45 template <> struct interop<backend::ext_oneapi_hip, device> {
46  using type = HIPdevice;
47 };
48 
49 template <> struct interop<backend::ext_oneapi_hip, event> {
50  using type = HIPevent;
51 };
52 
53 template <> struct interop<backend::ext_oneapi_hip, queue> {
54  using type = HIPstream;
55 };
56 
57 #ifdef __SYCL_INTERNAL_API
58 template <> struct interop<backend::ext_oneapi_hip, program> {
59  using type = HIPmodule;
60 };
61 #endif
62 
63 // TODO the interops for accessor is used in the already deprecated class
64 // interop_handler and can be removed after API cleanup.
65 template <typename DataT, int Dimensions, access::mode AccessMode>
67  accessor<DataT, Dimensions, AccessMode, access::target::device,
68  access::placeholder::false_t>> {
69  using type = HIPdeviceptr;
70 };
71 
72 template <typename DataT, int Dimensions, access::mode AccessMode>
73 struct interop<
75  accessor<DataT, Dimensions, AccessMode, access::target::constant_buffer,
76  access::placeholder::false_t>> {
77  using type = HIPdeviceptr;
78 };
79 
80 template <typename DataT, int Dimensions, typename AllocatorT>
82  buffer<DataT, Dimensions, AllocatorT>> {
83  using type = HIPdeviceptr;
84 };
85 
86 template <typename DataT, int Dimensions, typename AllocatorT>
88  buffer<DataT, Dimensions, AllocatorT>> {
89  using type = HIPdeviceptr;
90 };
91 
92 template <> struct BackendInput<backend::ext_oneapi_hip, context> {
93  using type = HIPcontext;
94 };
95 
97  using type = HIPcontext;
98 };
99 
100 template <> struct BackendInput<backend::ext_oneapi_hip, device> {
101  using type = HIPdevice;
102 };
103 
105  using type = HIPdevice;
106 };
107 
108 template <> struct BackendInput<backend::ext_oneapi_hip, event> {
109  using type = HIPevent;
110 };
111 
112 template <> struct BackendReturn<backend::ext_oneapi_hip, event> {
113  using type = HIPevent;
114 };
115 
116 template <> struct BackendInput<backend::ext_oneapi_hip, queue> {
117  using type = HIPstream;
118 };
119 
120 template <> struct BackendReturn<backend::ext_oneapi_hip, queue> {
121  using type = HIPstream;
122 };
123 
124 #ifdef __SYCL_INTERNAL_API
125 template <> struct BackendInput<backend::ext_oneapi_hip, program> {
126  using type = HIPmodule;
127 };
128 
129 template <> struct BackendReturn<backend::ext_oneapi_hip, program> {
130  using type = HIPmodule;
131 };
132 #endif
133 
134 } // namespace detail
135 } // namespace sycl
136 } // __SYCL_INLINE_NAMESPACE(cl)
cl::sycl::detail::BackendInput< backend::ext_oneapi_hip, event >::type
HIPevent type
Definition: backend_traits_hip.hpp:109
cl::sycl::backend
backend
Definition: backend_types.hpp:21
cl::sycl::detail::interop< backend::ext_oneapi_hip, event >::type
HIPevent type
Definition: backend_traits_hip.hpp:50
cl::sycl::detail::interop< backend::ext_oneapi_hip, context >::type
HIPcontext type
Definition: backend_traits_hip.hpp:42
HIPcontext
struct ihipCtx_t * HIPcontext
Definition: backend_traits_hip.hpp:26
cl::sycl::event
An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barrie...
Definition: event.hpp:38
device.hpp
context.hpp
cl::sycl::detail::interop< backend::ext_oneapi_hip, accessor< DataT, Dimensions, AccessMode, access::target::constant_buffer, access::placeholder::false_t > >::type
HIPdeviceptr type
Definition: backend_traits_hip.hpp:77
event.hpp
sycl
Definition: invoke_simd.hpp:68
cl::sycl::detail::interop< backend::ext_oneapi_hip, device >::type
HIPdevice type
Definition: backend_traits_hip.hpp:46
cl::sycl::detail::BackendInput< backend::ext_oneapi_hip, buffer< DataT, Dimensions, AllocatorT > >::type
HIPdeviceptr type
Definition: backend_traits_hip.hpp:83
cl::sycl::queue
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
Definition: queue.hpp:110
cl::sycl::buffer
Defines a shared array that can be used by kernels in queues.
Definition: buffer.hpp:78
backend_traits.hpp
cl::sycl::detail::interop< backend::ext_oneapi_hip, accessor< DataT, Dimensions, AccessMode, access::target::device, access::placeholder::false_t > >::type
HIPdeviceptr type
Definition: backend_traits_hip.hpp:69
cl::sycl::detail::BackendInput< backend::ext_oneapi_hip, device >::type
HIPdevice type
Definition: backend_traits_hip.hpp:101
HIPdeviceptr
void * HIPdeviceptr
Definition: backend_traits_hip.hpp:30
cl::sycl::backend::ext_oneapi_hip
@ ext_oneapi_hip
cl::sycl::detail::BackendInput< backend::ext_oneapi_hip, context >::type
HIPcontext type
Definition: backend_traits_hip.hpp:93
cl::sycl::device
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:47
kernel_bundle.hpp
cl::sycl::detail::BackendReturn< backend::ext_oneapi_hip, context >::type
HIPcontext type
Definition: backend_traits_hip.hpp:97
cl::sycl::accessor
Buffer accessor.
Definition: accessor.hpp:224
cl::sycl::detail::BackendInput< backend::ext_oneapi_hip, queue >::type
HIPstream type
Definition: backend_traits_hip.hpp:117
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
cl::sycl::detail::interop< backend::ext_oneapi_hip, queue >::type
HIPstream type
Definition: backend_traits_hip.hpp:54
queue.hpp
cl::sycl::detail::interop
Definition: backend_traits.hpp:18
HIPevent
struct ihipEvent_t * HIPevent
Definition: backend_traits_hip.hpp:28
accessor.hpp
cl::sycl::detail::BackendReturn< backend::ext_oneapi_hip, event >::type
HIPevent type
Definition: backend_traits_hip.hpp:113
cl::sycl::detail::BackendReturn< backend::ext_oneapi_hip, device >::type
HIPdevice type
Definition: backend_traits_hip.hpp:105
cl::sycl::detail::BackendReturn< backend::ext_oneapi_hip, queue >::type
HIPstream type
Definition: backend_traits_hip.hpp:121
HIPstream
struct ihipStream_t * HIPstream
Definition: backend_traits_hip.hpp:27
cl::sycl::context
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:39
HIPdevice
int HIPdevice
Definition: backend_traits_hip.hpp:25
HIPmodule
struct ihipModule_t * HIPmodule
Definition: backend_traits_hip.hpp:29
cl::sycl::detail::BackendReturn< backend::ext_oneapi_hip, buffer< DataT, Dimensions, AllocatorT > >::type
HIPdeviceptr type
Definition: backend_traits_hip.hpp:89
cl::sycl::detail::BackendReturn
Definition: backend_traits.hpp:22
cl::sycl::detail::BackendInput
Definition: backend_traits.hpp:20
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:11