We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e9a9633 commit 51fc1e6Copy full SHA for 51fc1e6
dpctl/_memory.pyx
@@ -244,6 +244,12 @@ cdef class Memory:
244
245
cdef _getbuffer(self, Py_buffer *buffer, int flags):
246
# memory_ptr is Ref which is pointer to SYCL type. For USM it is void*.
247
+ cdef SyclContext ctx = self._context
248
+ cdef const char * kind = DPPLUSM_GetPointerType(
249
+ self.memory_ptr,
250
+ ctx.get_context_ref())
251
+ if kind == b'device':
252
+ raise ValueError('USM Device memory is not host accessible')
253
buffer.buf = <char *>self.memory_ptr
254
buffer.format = 'B' # byte
255
buffer.internal = NULL # see References
0 commit comments