dmlc / dmlc/dlpack

Question about API choices

Open
#115 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.2k
Forks
169
PR merge metrics
No merged PRs in 30d

Description

I have a couple of question, about what might be useful to include or modify.

1. What is the purpose of `lanes`? Lanes seems like a way to describe access of data (i.e. alignment) and not the data itself. But since it affects the shape it is very limiting to use `lanes != 1` (none of the Py-libs do or support it, I think)?

Unless lanes don't affect shape/strides, in which case they could convey other information.
2. How about adding `alignment=256` or `pow2_alignment=8`? An alignment larger than itemsize could indicate that it is valid to do vectorized reads of that size (may require the use of `byte_offset` if the first reads starts at an offset?).
3. The current stream exchange allows the consumer to synchronize with the producer at time of consumption. If all the consumer wants to do is a computation like:
```
@compile_for_dlpack
def update_simulation(dlpack_array):
data = dlpack_array.__dlpack__(stream=s2) # synchronizes with "s2"
# launch work on s2
return # returns without synch of original stream.

# user code:
arr = MyArray()
for i in range(1000):
update_simulation(arr)
do_analysis(arr) # cannot be auto-synch'ed
```
cannot guarantee `do_analysis` waits, unless `update_simulation` does a full synchronization? (Maybe this is just not important?)

Is stream lifetime management difficult? I can see `mylib.from_dlpack(arr)` synchronizing only once (although it might be nicer to be safer by default, but I don't know). But for the computational library use-case seems more relevant?
(I have read the the thread about introducing the `stream=` API, but it is not really clear to me why the current scheme is much simpler)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.