Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about API choices #115

Open
seberg opened this issue Dec 12, 2022 · 0 comments
Open

Question about API choices #115

seberg opened this issue Dec 12, 2022 · 0 comments

Comments

@seberg
Copy link
Contributor

seberg commented Dec 12, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant