DPC++ Runtime
Runtime libraries for oneAPI DPC++
spirv_ops.cpp
Go to the documentation of this file.
1 //===------------- spirv_ops.cpp - SPIRV operations -----------------------===//
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 
10 #include <detail/platform_util.hpp>
12 #include <sycl/exception.hpp>
13 
14 #include <atomic>
15 
16 // This operation is NOP on HOST as all operations there are blocking and
17 // by the moment this function was called, the operations generating
18 // the __ocl_event_t objects had already been finished.
19 __SYCL_EXPORT void __spirv_GroupWaitEvents(__spv::Scope Execution,
20  uint32_t NumEvents,
21  __ocl_event_t *WaitEvents) noexcept {
22  (void)Execution;
23  (void)NumEvents;
24  (void)WaitEvents;
25 }
26 
27 __SYCL_EXPORT void __spirv_ControlBarrier(__spv::Scope Execution,
28  __spv::Scope Memory,
29  uint32_t Semantics) noexcept {
30  (void)Execution;
31  (void)Memory;
32  (void)Semantics;
33  std::cerr << "Barrier is not supported on the host device yet.\n";
34  abort();
35 }
36 
37 __SYCL_EXPORT void __spirv_MemoryBarrier(__spv::Scope Memory,
38  uint32_t Semantics) noexcept {
39  // 1. The 'Memory' parameter is ignored on HOST because there is no memory
40  // separation to global and local there.
41  // 2. The 'Semantics' parameter is ignored because there is no need
42  // to distinguish the classes of memory (workgroup/cross-workgroup/etc).
43  (void)Memory;
44  (void)Semantics;
45  atomic_thread_fence(std::memory_order_seq_cst);
46 }
47 
48 __SYCL_EXPORT void __spirv_ocl_prefetch(const char *Ptr,
49  size_t NumBytes) noexcept {
51 }
__SYCL_EXTERN_STREAM_ATTRS ostream cerr
Linked to standard error (unbuffered)
prefetch_impl< _B > prefetch
Definition: fpga_lsu.hpp:45
constexpr auto memory_order_seq_cst
void __spirv_MemoryBarrier(__spv::Scope Memory, uint32_t Semantics) noexcept
Definition: spirv_ops.cpp:37
void __spirv_ControlBarrier(__spv::Scope Execution, __spv::Scope Memory, uint32_t Semantics) noexcept
Definition: spirv_ops.cpp:27
void __spirv_GroupWaitEvents(__spv::Scope Execution, uint32_t NumEvents, __ocl_event_t *WaitEvents) noexcept
Definition: spirv_ops.cpp:19
void __spirv_ocl_prefetch(const char *Ptr, size_t NumBytes) noexcept
Definition: spirv_ops.cpp:48
void * __ocl_event_t
_Abi const simd< _Tp, _Abi > & noexcept
Definition: simd.hpp:1324