For Python object suai_obj exposing __sycl_usm_array_interface__ the call dpctl.memory.MemoryUSMShared(suai_obj) currently requires that strides entry in the interface dictionary be empty (implying C-contiguous data).
This issue is to request that support for arbitrary 'strides' and 'offset' settings be added.
The dpctl.memory objects will then assume ownership of memory with
pointer = char_ptr + itemsize * minimum(offset + dot(element_strides, indexes), indexes for shape)
nbytes = itemsize*(1 + maximum(offset + dot(element_strides, indexes), indexes for shape) - minimum(offset + dot(element_strides, indexes), indexes for shape).
For example, for sua_obj which is a (2,2) view of (4, 5) array corresponding to starred elements of the table below:
|
0 |
1 |
2 |
3 |
4 |
| 0 |
|
|
|
|
|
| 1 |
|
* |
|
* |
|
| 2 |
|
|
|
|
|
| 3 |
|
* |
|
* |
|
The interface dictionary will have offset = 6 and strides=(10, 2) and data=(address_of(ar[0,0]), WRITEABLE).
The MemoryUSMShared(sual_obj) will map memory from a[1,1] to a[3, 3] including 13 elements, namely {a[1,1], a[1,2], a[1, 3], a[1,4], a[2, 0], a[2, 1], a[2,2], a[2, 3], a[2,4], a[3,0], a[3, 1], a[3,2], a[3,3]}.
For Python object
suai_objexposing__sycl_usm_array_interface__the calldpctl.memory.MemoryUSMShared(suai_obj)currently requires thatstridesentry in the interface dictionary be empty (implying C-contiguous data).This issue is to request that support for arbitrary
'strides'and'offset'settings be added.The
dpctl.memoryobjects will then assume ownership of memory withpointer = char_ptr + itemsize * minimum(offset + dot(element_strides, indexes), indexes for shape)nbytes = itemsize*(1 + maximum(offset + dot(element_strides, indexes), indexes for shape) - minimum(offset + dot(element_strides, indexes), indexes for shape).For example, for
sua_objwhich is a (2,2) view of (4, 5) array corresponding to starred elements of the table below:The interface dictionary will have
offset = 6andstrides=(10, 2)anddata=(address_of(ar[0,0]), WRITEABLE).The
MemoryUSMShared(sual_obj)will map memory froma[1,1]toa[3, 3]including 13 elements, namely{a[1,1], a[1,2], a[1, 3], a[1,4], a[2, 0], a[2, 1], a[2,2], a[2, 3], a[2,4], a[3,0], a[3, 1], a[3,2], a[3,3]}.