Repository navigation
Conversation
Mirror the MACA provider structure: PrivateUse1 backend registration (name "mlu", default autocast bf16) and a full DeviceGuardImpl over CNRT (device/stream/notifier-event/BLAS-via-CNNL/memory) with an allocation tracker standing in for CNRT memory-pool statistics. CNRT 7.x has no async allocation API, so MallocAsync/FreeAsync use the same sync fallback shape as MACA's workaround mode; collectives and device kernels land with the next milestone.
cnnlCreate returns cnnlStatus_t, not cnrtRet_t. The CNRT copy-direction enum is the anonymous typedef cnrtMemTransDir_t (shared by cnrtMemcpy and cnrtMemcpyAsync); cnrtMemcpyKind_t does not exist in CNRT 7.x.
Fixes the Format Check workflow (clang-format 16.0.6, -style=file).
VVycccc
force-pushed
the
feat/mlu-backend
branch
from
November 3, 2026 07:25
9311a32 to
5224434
Compare
- Cast: CNNL cnnlCastDataType with a full dtype-pair mapping (fp16/bf16/ fp32/fp64/int8-64/uint8-64/bool), identity cast served by a D2D copy - Fill: first BANG device kernel (fill.mlu, cncc compute_50) with 4-core chunked pattern fill covering all 13 framework dtypes via element-sized bit patterns; CMake wires the cncc build into the backend library - NoOpForward/NoOpBackward: host-side tensor views, same as CPU/MACA Registration self-check now passes on MLU590; the gpt2 example proceeds into model construction and reports the next missing kernel (EmbeddingForward), which starts the fill-out iteration.
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.
背景
InfiniTrain-Backends 已通过 MACA(PR #1)确立了
backends/<provider>的厂商后端扩展机制。本 PR 沿用同一架构,以寒武纪 MLU 作为第二个 provider 接入,验证该机制的通用性,并补齐国产加速器的第二个实现参考。当前状态 [WIP]
已完成:
mlu,经PrivateUse1BackendRegistration注册,上层--device mlu即可启用;INFINITRAIN_BACKEND=mlu一键构建;libinfini_train_backend_mlu.a与 gpt2 / llama3 / mixtral 三个 example 可执行文件全部链接成功;Cast),验证注册路径正确。下一步(按依赖顺序):
Cast/Fill/NoOpForward/NoOpBackward(参考cast.maca等 ~150 行);与 MACA Backend 的实现差异
MLU 侧软件栈与 MACA 不同构,实现上做了相应适配:
cnnlSetQueue);.mlu),host 侧 dispatch 用系统工具链编译;cnrtGetErrorStr/cnnlGetErrorString,检查宏区分 CNRT/CNNL。Baseline 设备验证(配套 InfiniTrain-Test 仓库日志)
后端尚未跑通模型前,先以 torch_mlu 层面的 baseline 验证了 MLU590 设备与软件栈的可用性(日志与脚本提交在 InfiniTrain-Test 仓库
baseline/{pytorch,megatron}/logs/mlu590_wangyichen_node2*/):当前约束
与 MACA PR 相同:一个 build tree 只选择一个 provider;一个进程最多注册一个
PrivateUse1provider。