Skip to content

Add versioning support to DLPack APIs #602

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

Merged
merged 8 commits into from
Feb 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
nit: re-order
  • Loading branch information
leofang committed Feb 7, 2024
commit 8e208c98d9f08c9c204fed8a8d73c35783e665ac
14 changes: 7 additions & 7 deletions src/array_api_stubs/_draft/array_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ def __complex__(self: array, /) -> complex:

def __dlpack__(
self: array, /, *,
max_version: Optional[tuple[int, int]] = None,
stream: Optional[Union[int, Any]] = None
stream: Optional[Union[int, Any]] = None,
max_version: Optional[tuple[int, int]] = None
) -> PyCapsule:
"""
Exports the array for consumption by :func:`~array_api.from_dlpack` as a DLPack capsule.
Expand All @@ -299,11 +299,6 @@ def __dlpack__(
----------
self: array
array instance.
max_version: Optional[tuple[int, int]]
The maximum DLPack version that the consumer (i.e., the caller of
``__dlpack__``) supports, in the form ``(major, minor)``.
This method may return that maximum version (recommended if it does
support that), or a different version.
stream: Optional[Union[int, Any]]
for CUDA and ROCm, a Python integer representing a pointer to a stream, on devices that support streams. ``stream`` is provided by the consumer to the producer to instruct the producer to ensure that operations can safely be performed on the array (e.g., by inserting a dependency between streams via "wait for event"). The pointer must be a positive integer or ``-1``. If ``stream`` is ``-1``, the value may be used by the consumer to signal "producer must not perform any synchronization". The ownership of the stream stays with the consumer. On CPU and other device types without streams, only ``None`` is accepted.

Expand Down Expand Up @@ -335,6 +330,11 @@ def __dlpack__(
(ROCm) is preferred. ``None`` is a safe default for developers who do
not want to think about stream handling at all, potentially at the
cost of more synchronization than necessary.
max_version: Optional[tuple[int, int]]
The maximum DLPack version that the consumer (i.e., the caller of
``__dlpack__``) supports, in the form ``(major, minor)``.
This method may return that maximum version (recommended if it does
support that), or a different version.

Returns
-------
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy