Yes... so what's the point of allowing `device_buffer(obj=None, size=...)` in 
addition to `allocate(size)`?

APIs with multiple ways of doing the same thing impose a cognitive burden. When 
I see this, I don't know if there's any difference between the two APIs, which 
one is recommended and why. Further more, one is a single verb ("allocate"), 
another a bunch of names ("device_buffer"). I would like to see this simplified 
and made more consistent. For example "new_buffer" for the uninitialized case 
and "buffer_from_data" for the case where we copy something.

Finally, I don't think something that generally returns a _new_ buffer should 
sometimes return a logical slice. It's a recipe for confusion.

> For a better API, I propose introducing context keyword to py_buffer so that 
> users could use `pa.py_buffer(<obj>, context=pa.cuda.Context())`.

That's a bad idea. `py_buffer` creates a logical buffer, it doesn't copy data 
around.


[ Full content available at: https://github.com/apache/arrow/pull/2536 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to