DPC++ Runtime
Runtime libraries for oneAPI DPC++
handler_impl.hpp
Go to the documentation of this file.
1 //==---------------- handler_impl.hpp - SYCL handler -----------------------==//
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 #pragma once
10 
11 #include "sycl/handler.hpp"
13 #include <memory>
15 
16 namespace sycl {
17 inline namespace _V1 {
18 namespace ext::oneapi::experimental::detail {
19 class dynamic_parameter_impl;
20 }
21 namespace detail {
22 
23 using KernelBundleImplPtr = std::shared_ptr<detail::kernel_bundle_impl>;
24 
25 enum class HandlerSubmissionState : std::uint8_t {
26  NO_STATE = 0,
29 };
30 
31 class handler_impl {
32 public:
33  handler_impl(std::shared_ptr<queue_impl> SubmissionPrimaryQueue,
34  std::shared_ptr<queue_impl> SubmissionSecondaryQueue)
35  : MSubmissionPrimaryQueue(std::move(SubmissionPrimaryQueue)),
36  MSubmissionSecondaryQueue(std::move(SubmissionSecondaryQueue)){};
37 
38  handler_impl() = default;
39 
42  throw sycl::exception(
44  "Kernel bundle cannot be explicitly set after a specialization "
45  "constant has been set");
47  }
48 
50  if (MSubmissionState ==
53  "Specialization constants cannot be set after "
54  "explicitly setting the used kernel bundle");
56  }
57 
59  return MSubmissionState ==
61  }
62 
65 
69  std::shared_ptr<queue_impl> MSubmissionPrimaryQueue;
70 
75  std::shared_ptr<queue_impl> MSubmissionSecondaryQueue;
76 
77  // Stores auxiliary resources used by internal operations.
78  std::vector<std::shared_ptr<const void>> MAuxiliaryResources;
79 
80  std::shared_ptr<detail::kernel_bundle_impl> MKernelBundle;
81 
83 
84  // 2D memory operation information.
85  size_t MSrcPitch;
86  size_t MDstPitch;
87  size_t MWidth;
88  size_t MHeight;
89 
91  size_t MOffset = 0;
94  bool MIsDeviceImageScoped = false;
95 
96  // Program scope pipe information.
97 
98  // Pipe name that uniquely identifies a pipe.
99  std::string HostPipeName;
100  // Pipe host pointer, the address of its constexpr __pipe member.
101  void *HostPipePtr = nullptr;
102  // Host pipe read write operation is blocking.
103  bool HostPipeBlocking = false;
104  // The size of returned type for each read.
105  size_t HostPipeTypeSize = 0;
106  // If the pipe operation is read or write, 1 for read 0 for write.
107  bool HostPipeRead = true;
108 
111 
112  bool MKernelIsCooperative = false;
113 
114  // Extra information for bindless image copy
118 
123 
124  // Extra information for semaphore interoperability
126 
127  // The user facing node type, used for operations which are recorded to a
128  // graph. Since some operations may actually be a different type than the user
129  // submitted, e.g. a fill() which is performed as a kernel submission. This is
130  // used to pass the type that the user expects to graph nodes when they are
131  // created for later query by users.
134 
135  // Storage for any SYCL Graph dynamic parameters which have been flagged for
136  // registration in the CG, along with the argument index for the parameter.
137  std::vector<std::pair<
140 
141  // Track whether an NDRange was used when submitting a kernel (as opposed to a
142  // range), needed for graph update
143  bool MNDRangeUsed = false;
144 };
145 
146 } // namespace detail
147 } // namespace _V1
148 } // namespace sycl
std::shared_ptr< queue_impl > MSubmissionSecondaryQueue
Shared pointer to the secondary queue implementation.
std::vector< std::shared_ptr< const void > > MAuxiliaryResources
sycl::detail::pi::PiInteropSemaphoreHandle MInteropSemaphoreHandle
HandlerSubmissionState MSubmissionState
Registers mutually exclusive submission states.
bool MIsDeviceImageScoped
Boolean flag for whether the device_global had the device_image_scope property.
handler_impl(std::shared_ptr< queue_impl > SubmissionPrimaryQueue, std::shared_ptr< queue_impl > SubmissionSecondaryQueue)
std::shared_ptr< queue_impl > MSubmissionPrimaryQueue
Shared pointer to the primary queue implementation.
sycl::detail::pi::PiMemImageFormat MImageFormat
sycl::ext::oneapi::experimental::node_type MUserFacingNodeType
sycl::detail::pi::PiMemImageDesc MImageDesc
sycl::detail::pi::PiImageOffset MSrcOffset
sycl::detail::pi::PiImageCopyFlags MImageCopyFlags
std::shared_ptr< detail::kernel_bundle_impl > MKernelBundle
size_t MOffset
Offset into a device_global for copy operations.
sycl::detail::pi::PiImageOffset MDestOffset
sycl::detail::pi::PiImageRegion MCopyExtent
sycl::detail::pi::PiKernelCacheConfig MKernelCacheConfig
std::vector< std::pair< ext::oneapi::experimental::detail::dynamic_parameter_impl *, int > > MDynamicParameters
sycl::detail::pi::PiImageRegion MHostExtent
::pi_interop_semaphore_handle PiInteropSemaphoreHandle
Definition: pi.hpp:165
std::shared_ptr< detail::kernel_bundle_impl > KernelBundleImplPtr
std::error_code make_error_code(sycl::errc E) noexcept
Constructs an error code using e and sycl_category()
Definition: exception.cpp:93
Definition: access.hpp:18
_pi_kernel_cache_config
Definition: pi.h:830
@ PI_EXT_KERNEL_EXEC_INFO_CACHE_DEFAULT
Definition: pi.h:832
_pi_mem_advice
Definition: pi.h:621
_pi_image_copy_flags
Definition: pi.h:698