Skip to content

MAINT: Clarify alignment in DLPack #20338

Closed

Description

@seberg

The DLpack code currently has this comment:

    /*
     * Note: the `dlpack.h` header suggests/standardizes that `data` must be
     * 256-byte aligned.  We ignore this intentionally, because `__dlpack__`
     * standardizes that `byte_offset` must be 0 (for now) to not break pytorch:
     * https://github.com/data-apis/array-api/issues/293#issuecomment-964111413
     *
     * We further assume that exporting fully unaligned data is OK even without
     * `byte_offset` since the standard does not reject it.
     * Presumably, pytorch will support importing `byte_offset != 0` and NumPy
     * can choose to use it starting about 2023.  At that point, it may be
     * that NumPy MUST use `byte_offset` to adhere to the standard (as
     * specified in the header)!
     */

It seems entirely possible that what NumPy should do changes sooner or later. This should either be reviewed or updated according to whatever is decided for dlpack.h and/or __dlpack__.

Marked as milestone, since this should – by my current understanding – be reviewed around 2023.

Activity

  1. added this to the 1.22.0 release milestone on Nov 9, 2021
  2. rgommers commented on Nov 12, 2021

    @rgommers
    Member

    Bumping this to the next release; good to revisit before then, but for 1.22.0 we're good.

  3. seberg commented on Jul 24, 2024

    @seberg
    MemberAuthor

    I am going to close this. It's still broken, but I don't feel like keeping a NumPy issue about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions