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
#define __SYCL_INLINE_VER_NAMESPACE(X)
void addHostAccessorAndWait(AccessorImplHost *Req)
std::shared_ptr< event_impl > EventImplPtr
Definition: cg.hpp:42
void constructorNotification(void *BufferObj, void *AccessorObj, sycl::access::target Target, sycl::access::mode Mode, const detail::code_location &CodeLoc)
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14