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 {
17 namespace detail {
18 
19 AccessorImplHost::~AccessorImplHost() {
20  try {
21  if (MBlockedCmd)
22  detail::Scheduler::getInstance().releaseHostAccessor(this);
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 =
38  detail::Scheduler::getInstance().addHostAccessor(Req);
39  Event->wait(Event);
40 }
41 
42 void constructorNotification(void *BufferObj, void *AccessorObj,
43  sycl::access::target Target,
44  sycl::access::mode Mode,
45  const detail::code_location &CodeLoc) {
46  XPTIRegistry::bufferAccessorNotification(
47  BufferObj, AccessorObj, (uint32_t)Target, (uint32_t)Mode, CodeLoc);
48 }
49 } // namespace detail
50 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
51 } // namespace sycl
event_impl.hpp
sycl::_V1::access::mode
mode
Definition: access.hpp:30
sycl::_V1::detail::AccessorImplHost
Definition: accessor_impl.hpp:42
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition: defines_elementary.hpp:11
xpti_registry.hpp
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14
scheduler.hpp
sycl::_V1::detail::addHostAccessorAndWait
void addHostAccessorAndWait(AccessorImplHost *Req)
Definition: accessor_impl.cpp:36
sycl::_V1::detail::buffer_impl::resize
void resize(size_t size)
Definition: buffer_impl.hpp:166
sycl::_V1::access::target
target
Definition: access.hpp:18
sycl::_V1::detail::EventImplPtr
std::shared_ptr< event_impl > EventImplPtr
Definition: cg.hpp:42
accessor_impl.hpp
sycl::_V1::detail::constructorNotification
void constructorNotification(void *BufferObj, void *AccessorObj, sycl::access::target Target, sycl::access::mode Mode, const detail::code_location &CodeLoc)
Definition: accessor_impl.cpp:42
sycl::_V1::detail::code_location
Definition: common.hpp:66
sycl::_V1::detail::buffer_impl
Definition: buffer_impl.hpp:41
buffer_impl.hpp