Skip to content

[Feature Request] Abstract interface for data copy in Tensor. #328

Closed

Description

@jhlee525

We are currently refactoring our runtime using tvm-ffi.

Instead of building only tvm-ffi, we build the full tvm-runtime, which enables additional device APIs and global functions, allowing us to execute real LLM models.

While enabling the device API, we encountered an issue and wanted to confirm our understanding.

In tvm-ffi, the Tensor API provides an NDAllocator, which abstracts device tensor memory allocation and free.
However, we cannot find any abstract API for data copy, either host → device or device → host.

We are planning to add this in our ffi, but it would be more natural if Tensor exposed a dedicated data-copy interface, such as a Rust trait or a C++ mixin, rather than relying on raw void* buffer copy.

We are wondering is there any roadmap in tvm-ffi providing an abstract interface for data-copy in Tensor.

Activity

  1. added theissue type on Dec 11, 2025
  2. tqchen commented on Dec 12, 2025

    @tqchen
    Member

    Thanks a lot for the note, scope-wise we are explicitly avoiding DeviceAPI for now in the tvm-ffi layer, knowing that at the FFI ABI layer libraries may choose to implement device functions by explicitly using interface like cudaMemcpy.

    Agree this is also quite useful in some settings, as of now tvm-runtime comes with such device API features, and one thing we can do is to streamline packaging bring up some support via tvm-runtime

  3. jhlee525 commented on Dec 12, 2025

    @jhlee525
    Author

    Thank you for clarification!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions