| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[Feature][ops]Add mul_add fused operator support Co-authored-by: wangwei<daviwang2026@qq.com> # message auto-generated for no-merge-commit merge: !481 merge feature/mul_add_ops_dev into dev [Feature][ops]Add mul_add fused operator support Created-by: daviwang Commit-by: wangwei Merged-by: ascend-robot Description: # Purpose 新增 mul_add 融合算子,支持在昇腾 NPU 上执行融合乘加计算: - 算子接口:mindiesd::mul_add(a, b, c) -> y - 计算公式:y = a + b * c - 输入 shape:a/b = [batch, seq_len, hidden_size],c = [batch, 1, hidden_size] - 支持数据类型:FP16、BF16 - 支持计算平台:ascend910b、ascend910_93、ascend950 主要变更: 1. 在 csrc/ops/mul_add/ 下新增算子定义(OpDef)、shape/dtype 推导(proto)、tiling 计算及 AscendC kernel 实现。 2. 在 csrc/plugin/ 下新增 mul_add PTA plugin,并在 register_ops.cpp 中注册到 mindiesd torch 库。 3. 更新 csrc/CMakeLists.txt,将 mul_add.cpp 加入 PTAExtensionOPS 编译。 4. 更新 build/build_ops.sh 默认算子列表,确保默认构建包含 mul_add。 5. 在 tests/ops/mul_add/ 下新增单元测试,覆盖基础 shape、典型 LLM shape、小 shape 边界及 FP16 精度场景。 # Test Plan > 设计了哪些测试内容,指导他人如何对你的PR进行测试\ > Apply information to show others your test design and how to test your Pull Request 1. 编译 AscendC 算子: bash cd build bash build_ops.sh 2. 编译 PTA plugin: bash cd build bash build_plugin.sh 3. 运行 mul_add 单元测试(需在 NPU 环境): bash cd tests/ops/mul_add python test_mul_add.py 4. 可选:通过环境变量指定 NPU 卡号: ``bash MINDIESD_TEST_NPU_ID=7 python test_mul_add.py # Test Report • 测试覆盖: • 基础小 shape:(1, 4, 128) • 典型 LLM shape:(1, 7200, 4608)、(1, 256, 4608)、(1, 7200, 3072)、(1, 256, 3072) • 多组小 shape 边界:(1, 1, 64) ~ (1, 64, 1024) • FP16 精度:(1, 256, 3072) • 参考实现:ref = a.float() + b.float() * c.float() • 精度阈值:rtol=1e-2, atol=1e-2 - 运行环境:CANN 9.1.T560, Ascend950PR NPU, Python 3.11, aarch64 - 所有新增测试用例均通过: - test_mul_add_basic PASSED - test_mul_add_typical PASSED - test_mul_add_small_shapes PASSED - test_mul_add_fp16` PASSED - 最大误差:BF16 < 1e-2,FP16 < 1e-2 See merge request: Ascend/MindIE-SD!481 | 3 天前 | |
[Feature][ops]Add mul_add fused operator support Co-authored-by: wangwei<daviwang2026@qq.com> # message auto-generated for no-merge-commit merge: !481 merge feature/mul_add_ops_dev into dev [Feature][ops]Add mul_add fused operator support Created-by: daviwang Commit-by: wangwei Merged-by: ascend-robot Description: # Purpose 新增 mul_add 融合算子,支持在昇腾 NPU 上执行融合乘加计算: - 算子接口:mindiesd::mul_add(a, b, c) -> y - 计算公式:y = a + b * c - 输入 shape:a/b = [batch, seq_len, hidden_size],c = [batch, 1, hidden_size] - 支持数据类型:FP16、BF16 - 支持计算平台:ascend910b、ascend910_93、ascend950 主要变更: 1. 在 csrc/ops/mul_add/ 下新增算子定义(OpDef)、shape/dtype 推导(proto)、tiling 计算及 AscendC kernel 实现。 2. 在 csrc/plugin/ 下新增 mul_add PTA plugin,并在 register_ops.cpp 中注册到 mindiesd torch 库。 3. 更新 csrc/CMakeLists.txt,将 mul_add.cpp 加入 PTAExtensionOPS 编译。 4. 更新 build/build_ops.sh 默认算子列表,确保默认构建包含 mul_add。 5. 在 tests/ops/mul_add/ 下新增单元测试,覆盖基础 shape、典型 LLM shape、小 shape 边界及 FP16 精度场景。 # Test Plan > 设计了哪些测试内容,指导他人如何对你的PR进行测试\ > Apply information to show others your test design and how to test your Pull Request 1. 编译 AscendC 算子: bash cd build bash build_ops.sh 2. 编译 PTA plugin: bash cd build bash build_plugin.sh 3. 运行 mul_add 单元测试(需在 NPU 环境): bash cd tests/ops/mul_add python test_mul_add.py 4. 可选:通过环境变量指定 NPU 卡号: ``bash MINDIESD_TEST_NPU_ID=7 python test_mul_add.py # Test Report • 测试覆盖: • 基础小 shape:(1, 4, 128) • 典型 LLM shape:(1, 7200, 4608)、(1, 256, 4608)、(1, 7200, 3072)、(1, 256, 3072) • 多组小 shape 边界:(1, 1, 64) ~ (1, 64, 1024) • FP16 精度:(1, 256, 3072) • 参考实现:ref = a.float() + b.float() * c.float() • 精度阈值:rtol=1e-2, atol=1e-2 - 运行环境:CANN 9.1.T560, Ascend950PR NPU, Python 3.11, aarch64 - 所有新增测试用例均通过: - test_mul_add_basic PASSED - test_mul_add_typical PASSED - test_mul_add_small_shapes PASSED - test_mul_add_fp16` PASSED - 最大误差:BF16 < 1e-2,FP16 < 1e-2 See merge request: Ascend/MindIE-SD!481 | 3 天前 | |
[dev]同步最新代码 Co-authored-by: mazhixin00_00<mazhixin7@huawei.com> | 8 个月前 | |
[Feature][ops]Add mul_add fused operator support Co-authored-by: wangwei<daviwang2026@qq.com> # message auto-generated for no-merge-commit merge: !481 merge feature/mul_add_ops_dev into dev [Feature][ops]Add mul_add fused operator support Created-by: daviwang Commit-by: wangwei Merged-by: ascend-robot Description: # Purpose 新增 mul_add 融合算子,支持在昇腾 NPU 上执行融合乘加计算: - 算子接口:mindiesd::mul_add(a, b, c) -> y - 计算公式:y = a + b * c - 输入 shape:a/b = [batch, seq_len, hidden_size],c = [batch, 1, hidden_size] - 支持数据类型:FP16、BF16 - 支持计算平台:ascend910b、ascend910_93、ascend950 主要变更: 1. 在 csrc/ops/mul_add/ 下新增算子定义(OpDef)、shape/dtype 推导(proto)、tiling 计算及 AscendC kernel 实现。 2. 在 csrc/plugin/ 下新增 mul_add PTA plugin,并在 register_ops.cpp 中注册到 mindiesd torch 库。 3. 更新 csrc/CMakeLists.txt,将 mul_add.cpp 加入 PTAExtensionOPS 编译。 4. 更新 build/build_ops.sh 默认算子列表,确保默认构建包含 mul_add。 5. 在 tests/ops/mul_add/ 下新增单元测试,覆盖基础 shape、典型 LLM shape、小 shape 边界及 FP16 精度场景。 # Test Plan > 设计了哪些测试内容,指导他人如何对你的PR进行测试\ > Apply information to show others your test design and how to test your Pull Request 1. 编译 AscendC 算子: bash cd build bash build_ops.sh 2. 编译 PTA plugin: bash cd build bash build_plugin.sh 3. 运行 mul_add 单元测试(需在 NPU 环境): bash cd tests/ops/mul_add python test_mul_add.py 4. 可选:通过环境变量指定 NPU 卡号: ``bash MINDIESD_TEST_NPU_ID=7 python test_mul_add.py # Test Report • 测试覆盖: • 基础小 shape:(1, 4, 128) • 典型 LLM shape:(1, 7200, 4608)、(1, 256, 4608)、(1, 7200, 3072)、(1, 256, 3072) • 多组小 shape 边界:(1, 1, 64) ~ (1, 64, 1024) • FP16 精度:(1, 256, 3072) • 参考实现:ref = a.float() + b.float() * c.float() • 精度阈值:rtol=1e-2, atol=1e-2 - 运行环境:CANN 9.1.T560, Ascend950PR NPU, Python 3.11, aarch64 - 所有新增测试用例均通过: - test_mul_add_basic PASSED - test_mul_add_typical PASSED - test_mul_add_small_shapes PASSED - test_mul_add_fp16` PASSED - 最大误差:BF16 < 1e-2,FP16 < 1e-2 See merge request: Ascend/MindIE-SD!481 | 3 天前 |