Add support for MLU kernelize - #700
Closed
atri2549 wants to merge 1 commit into
Closed
Conversation
|
Hi @atri2549, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/huggingface/kernels/blob/main/CONTRIBUTING.md for more details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds runtime device support for Cambricon MLU accelerators to the
kernelsPython package and thekernels-dataRust library. This enables thekernelslibrary to recognize, route, and load kernels targeting MLU hardware.Motivation
Cambricon MLU is a custom AI accelerator used in several production environments. Currently, passing
device="mlu"tokernelize()raisesValueError: Unknown device type: mlu, preventing MLU users from participating in the kernel hub ecosystem. This follows the same pattern as PR #155 (NPU) and PR #285 (Neuron), adding runtime support for a third-party device.Changes
Python (
kernels/src/kernels/):layer/repos.py— Added_MLUReposclass and MLU branch inDeviceRepos.create_repo()layer/kernelize.py— Added"mlu"to the_validate_device_typesupported setbackends.py— AddedMLUbackend dataclass, parsing, and auto-detection viatorch.mlu.device_count()cli/benchmark.py— Added MLU backend display and device mappingRust (
kernels-data/):src/config/mod.rs— AddedBackend::Mluvariant to canonical enumsrc/config/v1.rs–v5.rs— AddedMluto all config versions'Backendenum and universal backends listsbindings/python/src/lib.rs— AddedMlutoPyBackendenum (exposed asBackend.MLUin Python)Tests (
kernels/tests/):conftest.py— Addedhas_mludetection andmlu_onlyskip logicpytest.ini— Registeredmlu_onlymarkertest_layer.py— Addedtest_hub_forward_mlu()(allows fallback since no MLU kernels exist yet)kernels-data/bindings/python/tests/test_kernels_data.py— Added MLU assertions forBackend.MLUConfiguration:
src/kernels/python_depends.json— Added empty"mlu": {}entryDocumentation:
nix-builder/README.md— Added MLU row to hardware support table (Tier 3)Checklist