DPC++ Runtime
Runtime libraries for oneAPI DPC++
interop_handler.cpp
Go to the documentation of this file.
1 //==------- interop_handler.cpp - Argument for codeplay_introp_task --------==//
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 <CL/sycl/detail/pi.hpp>
12 #include <detail/queue_impl.hpp>
13 
15 namespace sycl {
16 
17 pi_native_handle interop_handler::GetNativeQueue() const {
18  return MQueue->getNative();
19 }
20 
21 pi_native_handle interop_handler::GetNativeMem(detail::Requirement *Req) const {
22  auto Iter = std::find_if(std::begin(MMemObjs), std::end(MMemObjs),
23  [=](ReqToMem Elem) { return (Elem.first == Req); });
24 
25  if (Iter == std::end(MMemObjs)) {
26  throw("Invalid memory object used inside interop");
27  }
28 
29  auto Plugin = MQueue->getPlugin();
30  pi_native_handle Handle;
31  Plugin.call<detail::PiApiKind::piextMemGetNativeHandle>(Iter->second,
32  &Handle);
33  return Handle;
34 }
35 
36 } // namespace sycl
37 } // __SYCL_INLINE_NAMESPACE(cl)
sycl
Definition: invoke_simd.hpp:68
queue_impl.hpp
pi.hpp
cl::sycl::detail::Requirement
AccessorImplHost Requirement
Definition: accessor_impl.hpp:218
defines.hpp
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
pi_native_handle
uintptr_t pi_native_handle
Definition: pi.h:76
piextMemGetNativeHandle
pi_result piextMemGetNativeHandle(pi_mem mem, pi_native_handle *nativeHandle)
Gets the native handle of a PI mem object.
Definition: pi_esimd_emulator.cpp:1277
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:12
interop_handler.hpp