Skip to content

dlpack conversion for c++ mdspan #182

@JBludau

Description

@JBludau

I am currently looking into providing dlpack conversions to mdspan, specifically the device-portable version in https://github.com/kokkos/mdspan. This could help e.g. scipy to consolidate implementations, see scipy/scipy#21798

But for our Kokkos users, the more pressing usecase is calling python-based ML models from large c++ codes running in high performance computing environments.
Would you agree, that for the usecase of converting a mdspan via dlpack for passing data from c++ to python, the mutability should be in agreement with the const-ness of the producer? Meaning if c++ manages the memory and the mdspan is non-const, it should be a mutable dlpack? This is with the assumption that the c++ and python are in sequential order.
For potentially using mdspan in implementations in e.g. interpolate in scipy, the semantics that dlpack spells out in https://dmlc.github.io/dlpack/latest/python_spec.html#semantics are definitely the way to go.

Originated from a discussion with @rgommers in scipy/scipy#21798 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions