22 #ifdef __SYCL_DEVICE_ONLY__
27 #ifdef XPTI_ENABLE_INSTRUMENTATION
28 #include <xpti/xpti_data_types.h>
29 #include <xpti/xpti_trace_framework.hpp>
37 inline namespace _V1 {
40 namespace experimental {
49 __SYCL_EXPORT
static std::string
get_pipe_name(
const void *HostPipePtr);
53 template <
class _name,
class _dataT, int32_t _min_capacity = 0,
59 #ifdef __SYCL_DEVICE_ONLY__
60 [[__sycl_detail__::add_ir_attributes_global_variable(
61 "sycl-host-pipe",
"sycl-host-pipe-size",
nullptr,
62 sizeof(_dataT))]] [[__sycl_detail__::sycl_type(host_pipe)]]
65 #ifdef __SYCL_DEVICE_ONLY__
85 bool IsPipeSupported =
87 if (!IsPipeSupported) {
91 void *DataPtr = &Data;
92 const void *HostPipePtr = &m_Storage;
96 CGH.ext_intel_read_host_pipe(PipeName, DataPtr,
101 Success = wait_non_blocking(E) &&
102 E.
get_info<sycl::info::event::command_execution_status>() ==
103 sycl::info::event_command_status::complete;
105 return Success ? *(_dataT *)DataPtr : _dataT();
108 static void write(
queue &Q,
const _dataT &Data,
bool &Success,
114 bool IsPipeSupported =
116 if (!IsPipeSupported) {
120 const void *HostPipePtr = &m_Storage;
122 void *DataPtr =
const_cast<_dataT *
>(&Data);
125 CGH.ext_intel_write_host_pipe(PipeName, DataPtr,
130 Success = wait_non_blocking(E) &&
131 E.
get_info<sycl::info::event::command_execution_status>() ==
132 sycl::info::event_command_status::complete;
137 template <
typename _functionPropertiesT>
138 static _dataT
read(
bool &Success, _functionPropertiesT) {
139 #ifdef __SYCL_DEVICE_ONLY__
149 static constexpr int32_t _anchor_id = _latency_anchor_id_prop::value;
152 _latency_constraint_prop::type;
153 static constexpr int32_t _relative_cycle = _latency_constraint_prop::cycle;
155 int32_t _control_type_code = 0;
157 _control_type_code = 1;
159 _control_type_code = 2;
161 _control_type_code = 3;
164 __ocl_RPipeTy<_dataT> _RPipe =
165 __spirv_CreatePipeFromPipeStorage_read<_dataT>(&m_Storage);
167 Success = !
static_cast<bool>(__latency_control_nb_read_wrapper(
168 _RPipe, &TempData, _anchor_id, _target_anchor, _control_type_code,
175 "Device-side API are not supported on a host device. Please use "
176 "host-side API instead.");
180 static _dataT
read(
bool &Success) {
186 template <
typename _functionPropertiesT>
187 static void write(
const _dataT &Data,
bool &Success, _functionPropertiesT) {
188 #ifdef __SYCL_DEVICE_ONLY__
198 static constexpr int32_t _anchor_id = _latency_anchor_id_prop::value;
201 _latency_constraint_prop::type;
202 static constexpr int32_t _relative_cycle = _latency_constraint_prop::cycle;
204 int32_t _control_type_code = 0;
206 _control_type_code = 1;
208 _control_type_code = 2;
210 _control_type_code = 3;
213 __ocl_WPipeTy<_dataT> _WPipe =
214 __spirv_CreatePipeFromPipeStorage_write<_dataT>(&m_Storage);
215 Success = !
static_cast<bool>(__latency_control_nb_write_wrapper(
216 _WPipe, &Data, _anchor_id, _target_anchor, _control_type_code,
223 "Device-side API are not supported on a host device. Please use "
224 "host-side API instead.");
228 static void write(
const _dataT &Data,
bool &Success) {
242 bool IsPipeSupported =
244 if (!IsPipeSupported) {
248 void *DataPtr = &Data;
249 const void *HostPipePtr = &m_Storage;
252 CGH.ext_intel_read_host_pipe(PipeName, DataPtr,
sizeof(_dataT),
256 return *(_dataT *)DataPtr;
265 bool IsPipeSupported =
267 if (!IsPipeSupported) {
270 const void *HostPipePtr = &m_Storage;
272 void *DataPtr =
const_cast<_dataT *
>(&Data);
274 CGH.ext_intel_write_host_pipe(PipeName, DataPtr,
sizeof(_dataT),
282 template <
typename _functionPropertiesT>
283 static _dataT
read(_functionPropertiesT) {
284 #ifdef __SYCL_DEVICE_ONLY__
294 static constexpr int32_t _anchor_id = _latency_anchor_id_prop::value;
297 _latency_constraint_prop::type;
298 static constexpr int32_t _relative_cycle = _latency_constraint_prop::cycle;
300 int32_t _control_type_code = 0;
302 _control_type_code = 1;
304 _control_type_code = 2;
306 _control_type_code = 3;
309 __ocl_RPipeTy<_dataT> _RPipe =
310 __spirv_CreatePipeFromPipeStorage_read<_dataT>(&m_Storage);
312 __latency_control_bl_read_wrapper(_RPipe, &TempData, _anchor_id,
313 _target_anchor, _control_type_code,
319 "Device-side API are not supported on a host device. Please use "
320 "host-side API instead.");
328 template <
typename _functionPropertiesT>
329 static void write(
const _dataT &Data, _functionPropertiesT) {
330 #ifdef __SYCL_DEVICE_ONLY__
340 static constexpr int32_t _anchor_id = _latency_anchor_id_prop::value;
343 _latency_constraint_prop::type;
344 static constexpr int32_t _relative_cycle = _latency_constraint_prop::cycle;
346 int32_t _control_type_code = 0;
348 _control_type_code = 1;
350 _control_type_code = 2;
352 _control_type_code = 3;
355 __ocl_WPipeTy<_dataT> _WPipe =
356 __spirv_CreatePipeFromPipeStorage_write<_dataT>(&m_Storage);
357 __latency_control_bl_write_wrapper(_WPipe, &Data, _anchor_id,
358 _target_anchor, _control_type_code,
364 "Device-side API are not supported on a host device. Please use "
365 "host-side API instead.");
369 static void write(
const _dataT &Data) {
374 static constexpr int32_t m_Size =
sizeof(_dataT);
375 static constexpr int32_t m_Alignment =
alignof(_dataT);
376 static constexpr int32_t m_Capacity = _min_capacity;
378 static constexpr int32_t m_ready_latency =
381 static constexpr int32_t m_bits_per_symbol =
384 static constexpr
bool m_uses_valid =
387 static constexpr
bool m_first_symbol_in_high_order_bits =
392 ValueOrDefault<_propertiesT, protocol_key>::template get<protocol_name>(
397 #ifdef __SYCL_DEVICE_ONLY__
398 {m_Size, m_Alignment, m_Capacity},
403 m_first_symbol_in_high_order_bits,
406 #ifdef __SYCL_DEVICE_ONLY__
410 template <
typename _T>
411 static int32_t __latency_control_nb_read_wrapper(
412 __ocl_RPipeTy<_T> Pipe, _T *Data, int32_t ,
413 int32_t , int32_t , int32_t ) {
414 return __spirv_ReadPipe(Pipe, Data, m_Size, m_Alignment);
419 template <
typename _T>
420 static int32_t __latency_control_nb_write_wrapper(
421 __ocl_WPipeTy<_T> Pipe,
const _T *Data, int32_t ,
422 int32_t , int32_t , int32_t ) {
423 return __spirv_WritePipe(Pipe, Data, m_Size, m_Alignment);
428 template <
typename _T>
429 static void __latency_control_bl_read_wrapper(
430 __ocl_RPipeTy<_T> Pipe, _T *Data, int32_t ,
431 int32_t , int32_t , int32_t ) {
432 return __spirv_ReadPipeBlockingINTEL(Pipe, Data, m_Size, m_Alignment);
437 template <
typename _T>
438 static void __latency_control_bl_write_wrapper(
439 __ocl_WPipeTy<_T> Pipe,
const _T *Data, int32_t ,
440 int32_t , int32_t , int32_t ) {
441 return __spirv_WritePipeBlockingINTEL(Pipe, Data, m_Size, m_Alignment);
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
bool has_extension(const std::string &extension_name) const
Check SYCL extension support by device.
An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barrie...
detail::is_event_info_desc< Param >::return_type get_info() const
Queries this SYCL event for information.
static bool wait_non_blocking(const event &E)
static std::string get_pipe_name(const void *HostPipePtr)
static _dataT read(queue &Q, bool &Success, memory_order Order=memory_order::seq_cst)
static void write(const _dataT &Data, bool &Success, _functionPropertiesT)
static void write(const _dataT &Data)
static _dataT read(bool &Success)
static void write(queue &Q, const _dataT &Data, bool &Success, memory_order Order=memory_order::seq_cst)
static void write(const _dataT &Data, bool &Success)
static _dataT read(bool &Success, _functionPropertiesT)
static void write(const _dataT &Data, _functionPropertiesT)
static const void * get_host_ptr()
static _dataT read(_functionPropertiesT)
static void write(queue &Q, const _dataT &Data, memory_order Order=memory_order::seq_cst)
static _dataT read(queue &Q, memory_order Order=memory_order::seq_cst)
Command group handler class.
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
device get_device() const
std::enable_if_t< std::is_invocable_r_v< void, T, handler & >, event > submit(T CGF, const detail::code_location &CodeLoc=detail::code_location::current())
Submits a command group function object to the queue, in order to be scheduled for execution on the d...
@ avalon_streaming_uses_ready
std::error_code make_error_code(sycl::errc E) noexcept
Constructs an error code using e and sycl_category()
bool _FirstSymInHighOrderBits