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(),
56 ur_native_handle_t NativeHandle = 0;
59 Handles.push_back(NativeHandle);
64 std::vector<ur_native_handle_t>
66 std::vector<ur_native_handle_t> Handles{};
72 for (
auto &Cmd :
MRecord->MAllocaCommands) {
73 ur_mem_handle_t NativeMem =
74 ur::cast<ur_mem_handle_t>(Cmd->getMemAllocation());
75 auto Ctx = Cmd->getWorkerContext();
81 assert(Platform &&
"Platform must be present for device context");
82 if (Platform->getBackend() != BackendName)
85 auto Plugin = Platform->getPlugin();
88 Plugin->call(urMemRetain, NativeMem);
91 ur_native_handle_t Handle = 0;
95 Plugin->call(urMemGetNativeHandle, NativeMem,
nullptr, &Handle);
96 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
void determineHostPtr(bool InitFromUserData, void *&HostPtr, bool &HostPtrReadOnly)
ContextImplPtr MInteropContext
size_t getSizeInBytes() const noexcept override
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.