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