Skip to content

[WIP]Add Ascend NPU fallbacks for core ops#182

Open
bitdousi wants to merge 3 commits intodatabricks:mainfrom
bitdousi:npu-adapter
Open

[WIP]Add Ascend NPU fallbacks for core ops#182
bitdousi wants to merge 3 commits intodatabricks:mainfrom
bitdousi:npu-adapter

Conversation

@bitdousi
Copy link

@bitdousi bitdousi commented Mar 9, 2026

Provide pure-PyTorch implementations for histogram/cumsum/replicate/sort/topology when tensors are on NPU, while keeping the existing CUDA extension path for CUDA tensors.

Made-with: Cursor

What does this PR do?

What issue(s) does this change relate to?

Before submitting

  • [ Y] Have you read the contributor guidelines?
  • [ Y] Is this change a documentation change or typo fix? If so, skip the rest of this checklist.
  • [Y ] Was this change discussed/approved in a GitHub issue first? It is much more likely to be merged if so.
  • [ Y] Did you update any related docs and document your change?
  • [ Y] Did you update any related tests and add any new tests related to your change? (see testing)
  • [ Y] Did you run the tests locally to make sure they pass?
  • [Y ] Did you run pre-commit on your change? (see the pre-commit section of prerequisites)

Provide pure-PyTorch implementations for histogram/cumsum/replicate/sort/topology when tensors are on NPU, while keeping the existing CUDA extension path for CUDA tensors.

Made-with: Cursor
@bitdousi bitdousi changed the title Add Ascend NPU fallbacks for core ops [WIP]Add Ascend NPU fallbacks for core ops Mar 9, 2026
zhouyubuzhaozhong added 2 commits March 9, 2026 15:48
Route gather/scatter/padded and binned kernels to a pure-PyTorch backend on Ascend NPU (or when Triton isn't available), while keeping existing Triton implementations for CUDA.

Made-with: Cursor
Add Python implementations for cumsum/histogram/sort/indices/replicate under megablocks.backend.npu_ops to support Ascend NPU without shadowing the upstream megablocks_ops C++ extension.

Made-with: Cursor
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