dlpack icon indicating copy to clipboard operation
dlpack copied to clipboard

Smaller fixups for "versioned" struct/docs and clarifications

Open seberg opened this issue 1 year ago • 0 comments

When implementing things for NumPy, I noticed a few things:

  • All other structs are also typedef'd, the new ...Versioned is not.
  • In our discussions at some point we had a large comment in place for how far DLTensorVersioned is ABI stable. This is missing (i.e. we want everything up to and including the flags to be ABI stable, after that all bets are off for major versions).
  • When the major version changes, we may need a new struct. I am wondering if it might still make sense to just rip the band-aid off and remove dl_tensor from the ...Versioned struct and introduce a ...V1 which includes it. That would make it abundantly clear that you need to cast. If v2 doesn't need a new struct, could make it an alias or just document that?

On the Python side, copy=True and espeically copy=None behavior could be clarified. I did the lazy path in NumPy and just always copied with copy=True. In very rare cases that might make an array exportable, which isn't without copy=True (due to odd strides).

It may make sense to clarify that copy=None is only required to do copies to make device requests work (if they are supported).

seberg avatar May 23 '24 18:05 seberg