18 inline namespace _V1 {
20 #ifdef XPTI_ENABLE_INSTRUMENTATION
21 uint8_t GBufferStreamID;
25 ur_event_handle_t &OutEventToWait) {
26 bool HostPtrReadOnly =
false;
29 "Internal error. Allocating memory on the host "
30 "while having use_host_ptr property");
32 std::move(Context),
this, HostPtr, HostPtrReadOnly,
37 void *UserObj,
const void *HostObj,
38 const void *Type, uint32_t Dim,
39 uint32_t ElemSize,
size_t Range[3]) {
41 Dim, ElemSize, Range);
49 std::vector<ur_native_handle_t> &Handles)
const {
51 if (std::find(Handles.begin(), Handles.end(),
55 Plugin->call<UrApiKind::urMemRetain>(
57 ur_native_handle_t NativeHandle = 0;
60 Handles.push_back(NativeHandle);
65 std::vector<ur_native_handle_t>
67 std::vector<ur_native_handle_t> Handles{};
73 for (
auto &Cmd :
MRecord->MAllocaCommands) {
74 ur_mem_handle_t NativeMem =
75 ur::cast<ur_mem_handle_t>(Cmd->getMemAllocation());
76 auto Ctx = Cmd->getWorkerContext();
82 assert(Platform &&
"Platform must be present for device context");
83 if (Platform->getBackend() != BackendName)
86 auto Plugin = Platform->getPlugin();
89 Plugin->call<UrApiKind::urMemRetain>(NativeMem);
92 ur_native_handle_t Handle = 0;
96 Plugin->call<UrApiKind::urMemGetNativeHandle>(NativeMem,
nullptr,
98 Handles.push_back(Handle);
static void * allocateMemBuffer(ContextImplPtr TargetContext, SYCLMemObjI *MemObj, void *UserPtr, bool HostPtrReadOnly, size_t Size, const EventImplPtr &InteropEvent, const ContextImplPtr &InteropContext, const sycl::property_list &PropsList, ur_event_handle_t &OutEventToWait)
std::shared_ptr< MemObjRecord > MRecord
const PluginPtr & getPlugin() const
ContextImplPtr MInteropContext
size_t getSizeInBytes() const noexcept override
void determineHostPtr(const ContextImplPtr &Context, bool InitFromUserData, void *&HostPtr, bool &HostPtrReadOnly)
ur_mem_handle_t MInteropMemObject
EventImplPtr MInteropEvent
static void bufferConstructorNotification(const void *, const detail::code_location &, const void *, const void *, uint32_t, uint32_t, size_t[3])
static void bufferDestructorNotification(const void *)
void destructorNotification(void *UserObj)
void constructorNotification(const detail::code_location &CodeLoc, void *UserObj, const void *HostObj, const void *Type, uint32_t Dim, uint32_t ElemType, size_t Range[3])
std::vector< ur_native_handle_t > getNativeVector(backend BackendName) const
void addInteropObject(std::vector< ur_native_handle_t > &Handles) const
void * allocateMem(ContextImplPtr Context, bool InitFromUserData, void *HostPtr, ur_event_handle_t &OutEventToWait) override
std::shared_ptr< sycl::detail::context_impl > ContextImplPtr
std::shared_ptr< plugin > PluginPtr
std::shared_ptr< detail::platform_impl > PlatformImplPtr
C++ utilities for Unified Runtime integration.