Repository navigation
[WIP] Add initial Cambricon MLU provider under backends/mlu - #3
Draft
Nebulixeay wants to merge 4 commits into
Draft
Nebulixeay wants to merge 4 commits into
Nebulixeay wants to merge 4 commits into
Conversation
Register a PrivateUse1 backend named "mlu" through the provider layout that the repository already uses for external backends: backends/mlu supplies the runtime, the BANG C kernels, the host kernel integration, the GPT-2 example and its own pre-project SDK checks, so no InfiniTrain source file is modified. The backend keeps the existing semantics: FP32 accumulation inside kernels, POD metadata passed by value, deterministic gather for broadcast backward and a host GEMM fallback for linear/matmul (NOTE(MLU-FALLBACK)). Device GEMM, BF16, multi-card collectives and full GPT-2 training are not implemented here; see backends/mlu/docs/validation.md. The pinned framework revision does not declare DeviceGuardImpl::ExchangeStream, so the MLU guard no longer overrides it; the previous implementation had no caller.
mlu_op_test compares the MLU kernels against the CPU backend (35 small-shape FP32 cases, pow domain handling, controlled fatal path and probe cases) and exits non-zero on any mismatch. tests/math_selftest keeps its standalone cncc + g++ build for the device math functions. Both are opt-in for the provider: INFINITRAIN_MLU_BUILD_TEST_TOOLS=ON builds the operator tool, and BUILD_TEST=ON is rejected on purpose so CPU suites cannot stand in for MLU validation.
VERBATIM escapes the inner quotes of -I"...", so cncc received an include path carrying literal quotation marks and could not find kernels/mlu_kernel_api.h. The whole argument is quoted instead, which still keeps a path containing spaces intact.
List the 2026-11-03 fresh build and small-test results for the provider layout, keep the pre-migration observations as historical, and state the open items explicitly: the standard recursive-submodule download was not exercised, no MACA/CUDA regression was run, and full GPT-2 10-step precision is still unverified. Restore the original README.zh-CN section heading.
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.
This PR adds an initial Cambricon MLU provider under
backends/mlu, using InfiniTrain's PrivateUse1 interface and the repository's provider build entry point. It includes runtime integration, BANG C kernels, a GPT-2 example adapter and small operator regression tools. The root dispatcher, MACA provider and pinned framework revision are unchanged.Work in progress: full GPT-2 single-card training for 10 steps and the requested end-to-end precision targets have not been verified. GEMM still uses a CPU fallback; BF16 training and multi-card support remain unfinished.
Build and validation
mlu_gpt2andmlu_op_testsucceeded against the pinned InfiniTrain v0.7.0 content (c90338c); all nine BANG C sources compiled.gpt2 --helpsuccessfully printed usage. No model training step was run during this validation.Current limitations
BUILD_TEST=ONis explicitly rejected; use the included MLU regression tools.Model/data assets, build products, internal review scripts and development logs are excluded from this PR. Details and commands are in
backends/mlu/README.mdandbackends/mlu/docs/validation.md.