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/context.hpp>
19 #include <sycl/device.hpp>
20 #include <sycl/event.hpp>
21 #include <sycl/kernel_bundle.hpp>
22 #include <sycl/queue.hpp>
23 
24 typedef int HIPdevice;
25 typedef struct ihipCtx_t *HIPcontext;
26 typedef struct ihipStream_t *HIPstream;
27 typedef struct ihipEvent_t *HIPevent;
28 typedef struct ihipModule_t *HIPmodule;
29 typedef void *HIPdeviceptr;
30 
31 namespace sycl {
32 inline namespace _V1 {
33 namespace detail {
34 
35 // TODO the interops for context, device, event, platform and program
36 // may be removed after removing the deprecated 'get_native()' methods
37 // from the corresponding classes.
38 template <> struct interop<backend::ext_oneapi_hip, context> {
39  using type = HIPcontext;
40 };
41 
42 template <> struct interop<backend::ext_oneapi_hip, device> {
43  using type = HIPdevice;
44 };
45 
46 template <> struct interop<backend::ext_oneapi_hip, event> {
47  using type = HIPevent;
48 };
49 
50 template <> struct interop<backend::ext_oneapi_hip, queue> {
51  using type = HIPstream;
52 };
53 
54 template <typename DataT, int Dimensions, typename AllocatorT>
56  buffer<DataT, Dimensions, AllocatorT>> {
57  using type = HIPdeviceptr;
58 };
59 
60 template <typename DataT, int Dimensions, typename AllocatorT>
62  buffer<DataT, Dimensions, AllocatorT>> {
63  using type = HIPdeviceptr;
64 };
65 
66 template <> struct BackendInput<backend::ext_oneapi_hip, context> {
67  using type = HIPcontext;
68 };
69 
71  using type = HIPcontext;
72 };
73 
74 template <> struct BackendInput<backend::ext_oneapi_hip, device> {
75  using type = HIPdevice;
76 };
77 
78 template <> struct BackendReturn<backend::ext_oneapi_hip, device> {
79  using type = HIPdevice;
80 };
81 
82 template <> struct BackendInput<backend::ext_oneapi_hip, event> {
83  using type = HIPevent;
84 };
85 
86 template <> struct BackendReturn<backend::ext_oneapi_hip, event> {
87  using type = HIPevent;
88 };
89 
90 template <> struct BackendInput<backend::ext_oneapi_hip, queue> {
91  using type = HIPstream;
92 };
93 
94 template <> struct BackendReturn<backend::ext_oneapi_hip, queue> {
95  using type = HIPstream;
96 };
97 
99  static constexpr bool MakePlatform = false;
100  static constexpr bool MakeDevice = true;
101  static constexpr bool MakeContext = false;
102  static constexpr bool MakeQueue = true;
103  static constexpr bool MakeEvent = true;
104  static constexpr bool MakeBuffer = false;
105  static constexpr bool MakeKernel = false;
106  static constexpr bool MakeKernelBundle = false;
107  static constexpr bool MakeImage = false;
108 };
109 
110 } // namespace detail
111 } // namespace _V1
112 } // namespace sycl
struct ihipEvent_t * HIPevent
struct ihipModule_t * HIPmodule
struct ihipStream_t * HIPstream
void * HIPdeviceptr
struct ihipCtx_t * HIPcontext
int HIPdevice
Defines a shared array that can be used by kernels in queues.
Definition: buffer.hpp:169
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:51
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:64
An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barrie...
Definition: event.hpp:44
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
Definition: queue.hpp:111
Definition: access.hpp:18