Merged
dsl: support l0c2l1 zN #1126
lavateinnAdd on Aug 18
dsl: support l0c2l1 zN #1126
Merged
lavateinnAdd on Aug 18
lavateinn
Aug 18

描述

增加 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

原因

测试

文档更新

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for lavateinn's contribution.)
Llavateinn
Aug 18 Created pull request, commit 597de17b
atomgit-bot
atomgit-bot
Aug 18 Comments:

变更摘要

本 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 中补充路径变量、存在性校验及运行说明
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Aug 18 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Aug 18 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Aug 18 Comments:

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 /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
96 messages are collapsed here。 See more
yuantaoyuantaoCollaborators
Sep 18 Removed label: RDV-SUCC
yuantaoyuantaoCollaborators
Sep 18 Added label: RDV-RUNNING
CANN-robotCANN-robotCollaborators
Sep 18 Removed label: ci-pipeline-passed
CANN-robot
CANN-robotCollaborators
Sep 18 Comments:

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.

likedislike
CANN-robot
CANN-robotCollaborators
Sep 18 Comments:

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.

likedislike