Skip to content

Add DLPack device types for Moore Threads MUSA - #196

Open
yangfengzzz wants to merge 1 commit into
dmlc:mainfrom
yangfengzzz:codex/add-musa-support
Open

yangfengzzz wants to merge 1 commit into
dmlc:mainfrom
yangfengzzz:codex/add-musa-support

Conversation

@yangfengzzz

@yangfengzzz yangfengzzz commented Nov 10, 2026 •

Copy link
Copy Markdown

Motivation

Frameworks need a shared device identifier to exchange tensors backed by Moore
Threads MUSA memory. Dedicated device types let consumers identify the MUSA
memory domain during DLPack import and export.

Device types and naming

The names use the MUSA platform name and follow the existing CUDA naming
pattern for device, pinned host, and managed memory.

  • kDLMUSA = 22 identifies MUSA GPU device memory.
  • kDLMUSAHost = 23 identifies pinned host memory allocated by
    musaMallocHost or musaHostAlloc.
  • kDLMUSAManaged = 24 identifies unified memory allocated by
    musaMallocManaged.

The new values are appended to DLDeviceType, preserving the existing enum
values and ABI layout. The Python specification also includes MUSA in its
description of stream handling. See the MUSA Runtime API reference.

Downstream adoption

After this PR is merged, we will update torch_musa
to use the new device types for DLPack import and export and handle MUSA stream
synchronization during tensor exchange.

Validation

  • The Make and CMake builds and the mock executable passed.
  • C11 and C++11 checks verified the new enum values and compared ABI layout
    against the base revision.
  • Both NumPy example tests passed.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant