DPC++ Runtime
Runtime libraries for oneAPI DPC++
accessor_impl.cpp
Go to the documentation of this file.
1 //==---------------- accessor_impl.cpp - SYCL standard source file ---------==//
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/buffer_impl.hpp>
11 #include <detail/event_impl.hpp>
13 #include <detail/xpti_registry.hpp>
14 
15 namespace sycl {
16 inline namespace _V1 {
17 namespace detail {
18 
20  try {
21  if (MBlockedCmd)
23  } catch (...) {
24  }
25 }
26 
27 void AccessorImplHost::resize(size_t GlobalSize) {
28  if (GlobalSize != 1) {
29  auto Bufi = static_cast<detail::buffer_impl *>(MSYCLMemObj);
30  MMemoryRange[0] *= GlobalSize;
31  MAccessRange[0] *= GlobalSize;
32  Bufi->resize(MMemoryRange[0] * MElemSize);
33  }
34 }
35 
37  detail::EventImplPtr Event =
39  Event->wait(Event);
40 }
41 
44 }
45 
48 }
49 
50 void constructorNotification(void *BufferObj, void *AccessorObj,
51  sycl::access::target Target,
53  const detail::code_location &CodeLoc) {
55  BufferObj, AccessorObj, (uint32_t)Target, (uint32_t)Mode, CodeLoc);
56 }
57 
59  void *ImageObj, void *AccessorObj,
60  const std::optional<image_target> &Target, access::mode Mode,
61  const void *Type, uint32_t ElemSize, const code_location &CodeLoc) {
62  if (Target)
64  ImageObj, AccessorObj, (uint32_t)*Target, (uint32_t)Mode, Type,
65  ElemSize, CodeLoc);
66  else
68  ImageObj, AccessorObj, (uint32_t)Mode, Type, ElemSize, CodeLoc);
69 }
70 
72  void *ImageObj, void *AccessorObj,
73  const std::optional<image_target> &Target, const void *Type,
74  uint32_t ElemSize, const code_location &CodeLoc) {
75  if (Target)
77  ImageObj, AccessorObj, (uint32_t)*Target, Type, ElemSize, CodeLoc);
78  else
80  Type, ElemSize, CodeLoc);
81 }
82 
83 } // namespace detail
84 } // namespace _V1
85 } // namespace sycl
void resize(size_t GlobalSize)
EventImplPtr addHostAccessor(Requirement *Req)
Adds nodes to the graph, that update the requirement with the pointer to the host memory.
Definition: scheduler.cpp:307
void releaseHostAccessor(Requirement *Req)
Unblocks operations with the memory object.
Definition: scheduler.cpp:346
static Scheduler & getInstance()
Definition: scheduler.cpp:261
static void sampledImageHostAccessorNotification(const void *, const void *, const void *, uint32_t, const detail::code_location &)
static void bufferAccessorNotification(const void *, const void *, uint32_t, uint32_t, const detail::code_location &)
static void unsampledImageAccessorNotification(const void *, const void *, uint32_t, uint32_t, const void *, uint32_t, const detail::code_location &)
static void unsampledImageHostAccessorNotification(const void *, const void *, uint32_t, const void *, uint32_t, const detail::code_location &)
static void sampledImageAccessorNotification(const void *, const void *, uint32_t, const void *, uint32_t, const detail::code_location &)
void unsampledImageConstructorNotification(void *ImageObj, void *AccessorObj, const std::optional< image_target > &Target, access::mode Mode, const void *Type, uint32_t ElemSize, const code_location &CodeLoc)
void addHostUnsampledImageAccessorAndWait(UnsampledImageAccessorImplHost *Req)
void addHostAccessorAndWait(AccessorImplHost *Req)
void addHostSampledImageAccessorAndWait(SampledImageAccessorImplHost *Req)
void constructorNotification(void *BufferObj, void *AccessorObj, access::target Target, access::mode Mode, const code_location &CodeLoc)
std::shared_ptr< event_impl > EventImplPtr
Definition: cg.hpp:43
void sampledImageConstructorNotification(void *ImageObj, void *AccessorObj, const std::optional< image_target > &Target, const void *Type, uint32_t ElemSize, const code_location &CodeLoc)
Definition: access.hpp:18