17 inline namespace _V1 {
21 const size_t,
event AvailableEvent,
22 std::unique_ptr<SYCLMemObjAllocator> Allocator)
23 :
SYCLMemObjT(MemObject, SyclContext, true, AvailableEvent,
24 std::move(Allocator)) {}
27 bool OwnNativeHandle,
event AvailableEvent,
28 std::unique_ptr<SYCLMemObjAllocator> Allocator)
29 : MAllocator(
std::move(Allocator)), MProps(),
32 MOpenCLInterop(true), MHostPtrReadOnly(false), MNeedWriteBack(true),
33 MUserPtr(nullptr), MShadowCopy(nullptr), MUploadDataFunctor(nullptr),
34 MSharedPtrStorage(nullptr), MHostPtrProvided(true),
35 MOwnNativeHandle(OwnNativeHandle) {
37 throw sycl::invalid_parameter_error(
38 "Creation of interoperability memory object using host context is "
40 PI_ERROR_INVALID_CONTEXT);
54 sizeof(Context), &Context,
nullptr);
57 throw sycl::invalid_parameter_error(
58 "Input context must be the same as the context of cl_mem",
59 PI_ERROR_INVALID_CONTEXT);
74 bool OwnNativeHandle,
event AvailableEvent,
75 std::unique_ptr<SYCLMemObjAllocator> Allocator,
80 : MAllocator(
std::move(Allocator)), MProps(),
83 MOpenCLInterop(true), MHostPtrReadOnly(false), MNeedWriteBack(true),
84 MUserPtr(nullptr), MShadowCopy(nullptr), MUploadDataFunctor(nullptr),
85 MSharedPtrStorage(nullptr), MHostPtrProvided(true),
86 MOwnNativeHandle(OwnNativeHandle) {
88 throw sycl::invalid_parameter_error(
89 "Creation of interoperability memory object using host context is "
91 PI_ERROR_INVALID_CONTEXT);
114 sizeof(Context), &Context,
nullptr);
117 throw sycl::invalid_parameter_error(
118 "Input context must be the same as the context of cl_mem",
119 PI_ERROR_INVALID_CONTEXT);
131 const id<3> Offset{0, 0, 0};
137 const int ElemSize = 1;
140 Dims, ElemSize,
size_t(0));
156 std::ignore = Result;
159 "removeMemoryObject should not return false in mem object destructor");
171 "Trying to get Plugin from SYCLMemObjT with nullptr ContextImpl.");
178 const PluginPtr &Plugin = Context->getPlugin();
181 detail::pi::cast<sycl::detail::pi::PiMem>(MemObject),
PI_MEM_SIZE,
182 sizeof(size_t), &BufSize,
nullptr);
189 bool InitFromUserData,
void *&HostPtr,
190 bool &HostPtrReadOnly) {
206 InitFromUserData =
true;
208 if (InitFromUserData) {
209 assert(!HostPtr &&
"Cannot init from user data and reuse host ptr provided "
214 HostPtrReadOnly =
false;
218 const std::shared_ptr<SYCLMemObjT> &Self)
const {
227 bool InteropObjectsUsed =
237 const auto InitialUserPtr =
MUserPtr;
241 for (
auto &it :
MRecord->MAllocaCommands) {
242 if (it->MMemAllocation == InitialUserPtr) {