array-api icon indicating copy to clipboard operation
array-api copied to clipboard

Minor clarification for conflicting information in `__dlpack__`

Open ndgrigorian opened this issue 7 months ago • 1 comments

The specification page for __dlpack__ requires the following two, conflicting things:

for the dlpack_device argument

The v2023.12 standard only mandates that a compliant library should offer a way for dlpack to return a capsule referencing an array whose underlying memory is accessible to the Python interpreter (represented by the kDLCPU enumerator in DLPack). If a copy must be made to enable this support but copy is set to False, the function must raise ValueError.

for the copy argument

If False, the function must never copy, and raise a BufferError in case a copy is deemed necessary (e.g. if a cross-device data movement is requested, and it is not possible without a copy).

These appear to be mutually exclusive and in direct conflict. It would be nice to clarify the correct intention

ndgrigorian avatar Aug 01 '24 15:08 ndgrigorian