Pull Request has been successfully merged by CANN-robot.
(Thank you for lavateinn's contribution.)变更摘要
本 PR 为 DSL 新增「L0C 拷贝到 L1、L1 采用 zN 布局」的能力(l0c2l1 zN)。核心改动包括:新增 CopyL0CToL1Tla 模板及其 Ascend950 特化,实现 L0C→L1 的 DataCopy(目标布局 zN,源必须为 L0C/CO1,fp32 累加器可输出为 f32/f16/bf16);在 DSL 拷贝路由中增加 ("l0c", "l1") 并强制校验目标布局为 zN;在 MLIR 侧注册 copy_l0c_to_l1_zN_* runtime 调用并生成对应 callee;同时新增端到端用例 E = A(M,K) @ B(K,N) @ D(N,N) 并接入测试脚本。
主要改动
- 新增
CopyL0CToL1Tla模板及 Ascend950 特化:在copy_l0c_to_dst.hpp中声明通用模板(未匹配特化时static_assert报错),并在新增的ascend950/copy_l0c_to_l1.hpp中实现特化,通过DataCopyCO12DstParams与AscendC::DataCopy完成 L0C→L1 拷贝,且源/目标布局静态校验为 L0C(CO1)→L1 且目标为 zN;另新增架构条件包装头文件tile/copy_l0c_to_l1.hpp(仅CATLASS_ARCH == 3510时引入特化实现) - DSL 拷贝路由与布局校验:
core_api.py的_COPY_CUBE_ROUTES增加("l0c", "l1")路由,并在拷贝参数检查中新增约束——l0c 到 l1 时目标布局必须是zn,否则抛出TlaLoweringError - MLIR 侧注册 L0C→L1 runtime 调用:
dma.cpp新增设备函数copyL0CToL1(构造 L0C/L1 tensor 后调用CopyL0CToL1Tla)及REGISTER_L0C_TO_L1宏,注册_mlir_ciface_copy_l0c_to_l1_zN_*(float→float/half/bf16三种组合);TlaTensorToMemref.cpp的getCopyRouteCallee新增 L0C→L1 且布局为 zN 的路由(要求源元素类型为f32),并将该调用名加入isAicTemplateRuntimeCall识别列表 - 端到端用例与测试接入:新增
basic_matmul_l0c2l1.py用例,演示 cube-only 的E=(A@B)@D两级 mmad 流水,其中第一次 mmad 的 L0C 结果经 L0C→L1(zN)暂存后作为第二次 mmad 的 LHS;同时将该用例加入tests/dsl_battery/test_battery.py的mmad-l0c2l1用例组,并在tests/run_dsl_test.sh中补充路径变量、存在性校验及运行说明


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/catlass | ✅ 周建伟, 田行辉 (2/2) | ✅ 周建伟 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
lavateinn, thanks for your pull request. All authors of the commits have signed the CLA. 👍


The following label is not ready.
ci-pipeline-passed: The ci-pipeline-passed label is expired as added over 72 hours. Please use /compile to recompile.


The following label is not ready.
ci-pipeline-passed: The ci-pipeline-passed label is expired as added over 72 hours. Please use /compile to recompile.


描述
增加 copy l0c to l1, l1 layout zN,添加一个端到端用例E=A(M, K) @ B(K, N) @ D(N, N)
第一个mmad C=A@B -> L1(zN)
第二个mmad E=C@D -> GM
关联的Issue
原因
测试
文档更新
类型标签