| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
feat: 新增chunk_kda_fwd_intra的A5特性适配 Co-authored-by: Sousuk<251028619@qq.com> # message auto-generated for no-merge-commit merge: !186 merge master into master feat: 新增chunk_kda_fwd_intra的A5特性适配 Created-by: Sousuk Commit-by: Sousuk Merged-by: ascend-robot Description: ## What this PR does / why we need it? 新增chunk_kda_fwd_intra的arch35实现,以及API调用路由 ## Does this PR introduce any user-facing change? no ## How was this patch tested? 可运行chunk_kda_fwd_intra的ut测试或atk测试进行测试。 See merge request: Ascend/MindSpeed-Ops!186 | 1 个月前 | |
feat(triton): clipped swiglu bwd Co-authored-by: LinMingZhe<linmingzhe3@huawei.com> # message auto-generated for no-merge-commit merge: !119 merge feat0811 into master feat(triton): clipped swiglu bwd Created-by: LinMingZhe Commit-by: LinMingZhe Merged-by: ascend-robot Description: ## What this PR does / why we need it? add clipped swiglu bwd ## Does this PR introduce any user-facing change? NA ## How was this patch tested? +-------+----------+------------------+------------------+--------------+----------------------+--------+--------------+ | 名称 | 总用例数 | 执行成功用例个数 | 执行失败用例个数 | 通过用例个数 | 错误信息匹配用例个数 | 通过率 | 精度是否达标 | +-------+----------+------------------+------------------+--------------+----------------------+--------+--------------+ | cpu_0 | 60 | 60 | 0 | 60 | 0 | 100.0 | Pass | +-------+----------+------------------+------------------+--------------+----------------------+--------+--------------+ +-------+----------+------------------+------------------+--------------------+ | 名称 | 总用例数 | device性能通过率 | 平均device性能比 | device性能是否达标 | +-------+----------+------------------+------------------+--------------------+ | npu_0 | 60 | 96.6667 | 6.5894 | Pass | +-------+----------+------------------+------------------+--------------------+ A3 ==== bwd ==== shape dtype triton(ms) eager(ms) speedup bw(GB/s) 4x4096x24576 fp32 4.0549 - - 993.0 A100 ==== bwd ==== shape dtype triton(ms) eager(ms) speedup bw(GB/s) 4x4096x24576 fp32 2.5439 - - 1582.8 See merge request: Ascend/MindSpeed-Ops!119 | 1 个月前 | |
feat: 新增chunk_kda_fwd_intra的A5特性适配 Co-authored-by: Sousuk<251028619@qq.com> # message auto-generated for no-merge-commit merge: !186 merge master into master feat: 新增chunk_kda_fwd_intra的A5特性适配 Created-by: Sousuk Commit-by: Sousuk Merged-by: ascend-robot Description: ## What this PR does / why we need it? 新增chunk_kda_fwd_intra的arch35实现,以及API调用路由 ## Does this PR introduce any user-facing change? no ## How was this patch tested? 可运行chunk_kda_fwd_intra的ut测试或atk测试进行测试。 See merge request: Ascend/MindSpeed-Ops!186 | 1 个月前 | |
feat(atb): add MatmulAdd operators for fused wgrad accumulation Co-authored-by: Liz<lizhi166@huawei.com> # message auto-generated for no-merge-commit merge: !182 merge master into master feat(atb): add MatmulAdd operators for fused wgrad accumulation Created-by: Liz_ Commit-by: Liz Merged-by: ascend-robot Description: ## What this PR does / why we need it? Megatron gradient accumulation updates the main weight-gradient buffer as grad += grad_output.T @ total_input. The previous decomposed path materializes an [N, K] intermediate and launches a separate add kernel, increasing allocation and memory traffic. This PR adapts the MindSpeed MatmulAdd implementation to MindSpeed-Ops and provides: - npu_matmul_add_fp32 for bf16/fp16 operands accumulated into an fp32 grad; it uses the ATB fused MatmulAdd path on A2/A3 and addmm_ on A5. - npu_matmul_add_fp16 for bf16/fp16 operands and a matching half-precision grad; it replaces matmul + add_ with one in-place addmm_ call. - zero-sized-input protection, chip dispatch, builder integration, public documentation, and expanded unit coverage. - reproducible ATK case definitions and execution plugin for accuracy, device performance, and device memory validation. Generated cases, reports, and logs stay ignored; the final result summary is retained at tests/atk_tests/atb/matmul_add/atk_output/console/SUMMARY.md. This is feature enablement, not a bug fix. Related issue: N/A. ## Does this PR introduce any user-facing change? Yes. NPU callers can import npu_matmul_add_fp32 or npu_matmul_add_fp16 from mindspeed_ops.api.atb.npu_matmul_add. Both APIs mutate grad in place and return None. Inputs must be 2-D tensors with shapes total_input=[M,K], grad_output=[M,N], and grad=[N,K]. Operand dtypes must match and be bf16 or fp16. The fp32 API requires an fp32 grad buffer; the fp16 API requires grad to match the operand dtype. Empty inputs are a no-op. Usage and benchmark documentation: docs/zh/atb/matmul_add.md. ATK reproduction guide: tests/atk_tests/atb/matmul_add/README.md. ## How was this patch tested? Unit test in the 018 environment: - conda activate lz_py312_018 - python -m pytest tests/unit_tests/atb/test_npu_matmul_add.py -q -rs - Result: 8 passed, 7 skipped. The skipped cases require cann-nnal/ATB and were skipped because ATB_HOME_PATH was not set in this environment. ATK 26.4.30 was run on Ascend 910B3 (A2) with CANN 9.0.0 + ATB, Python 3.10, torch 2.7.1, and torch_npu 2.7.1.post4. Each API used 8 cases covering {bf16, fp16} operands across four shape tuples. - Accuracy, NPU vs CPU high-precision reference: fp32 8/8 Pass; fp16 8/8 Pass. - Device performance, fused dev0 vs decomposed dev1: fp32 average ratio 1.3662 with 100% case pass rate; fp16 average ratio 1.0007 with 87.5% case pass rate and overall Pass. - Device memory, fused dev0 vs decomposed dev1: fp32 and fp16 both 8/8 Pass with 100% memory pass rate under the fused/reference <= 1.1 criterion. The A2/A3 fp32 path requires cann-nnal and ATB_HOME_PATH. Its first invocation JIT-builds the C++ extension and takes about 30 seconds; performance measurements must use warmed, cache-hit runs. The public APIs are Ascend NPU-specific and do not provide a CUDA fallback. [RFC](https://gitcode.com/Ascend/MindSpeed-Ops/issues/80) See merge request: Ascend/MindSpeed-Ops!182 | 1 个月前 | |
feat(atb): add MatmulAdd operators for fused wgrad accumulation Co-authored-by: Liz<lizhi166@huawei.com> # message auto-generated for no-merge-commit merge: !182 merge master into master feat(atb): add MatmulAdd operators for fused wgrad accumulation Created-by: Liz_ Commit-by: Liz Merged-by: ascend-robot Description: ## What this PR does / why we need it? Megatron gradient accumulation updates the main weight-gradient buffer as grad += grad_output.T @ total_input. The previous decomposed path materializes an [N, K] intermediate and launches a separate add kernel, increasing allocation and memory traffic. This PR adapts the MindSpeed MatmulAdd implementation to MindSpeed-Ops and provides: - npu_matmul_add_fp32 for bf16/fp16 operands accumulated into an fp32 grad; it uses the ATB fused MatmulAdd path on A2/A3 and addmm_ on A5. - npu_matmul_add_fp16 for bf16/fp16 operands and a matching half-precision grad; it replaces matmul + add_ with one in-place addmm_ call. - zero-sized-input protection, chip dispatch, builder integration, public documentation, and expanded unit coverage. - reproducible ATK case definitions and execution plugin for accuracy, device performance, and device memory validation. Generated cases, reports, and logs stay ignored; the final result summary is retained at tests/atk_tests/atb/matmul_add/atk_output/console/SUMMARY.md. This is feature enablement, not a bug fix. Related issue: N/A. ## Does this PR introduce any user-facing change? Yes. NPU callers can import npu_matmul_add_fp32 or npu_matmul_add_fp16 from mindspeed_ops.api.atb.npu_matmul_add. Both APIs mutate grad in place and return None. Inputs must be 2-D tensors with shapes total_input=[M,K], grad_output=[M,N], and grad=[N,K]. Operand dtypes must match and be bf16 or fp16. The fp32 API requires an fp32 grad buffer; the fp16 API requires grad to match the operand dtype. Empty inputs are a no-op. Usage and benchmark documentation: docs/zh/atb/matmul_add.md. ATK reproduction guide: tests/atk_tests/atb/matmul_add/README.md. ## How was this patch tested? Unit test in the 018 environment: - conda activate lz_py312_018 - python -m pytest tests/unit_tests/atb/test_npu_matmul_add.py -q -rs - Result: 8 passed, 7 skipped. The skipped cases require cann-nnal/ATB and were skipped because ATB_HOME_PATH was not set in this environment. ATK 26.4.30 was run on Ascend 910B3 (A2) with CANN 9.0.0 + ATB, Python 3.10, torch 2.7.1, and torch_npu 2.7.1.post4. Each API used 8 cases covering {bf16, fp16} operands across four shape tuples. - Accuracy, NPU vs CPU high-precision reference: fp32 8/8 Pass; fp16 8/8 Pass. - Device performance, fused dev0 vs decomposed dev1: fp32 average ratio 1.3662 with 100% case pass rate; fp16 average ratio 1.0007 with 87.5% case pass rate and overall Pass. - Device memory, fused dev0 vs decomposed dev1: fp32 and fp16 both 8/8 Pass with 100% memory pass rate under the fused/reference <= 1.1 criterion. The A2/A3 fp32 path requires cann-nnal and ATB_HOME_PATH. Its first invocation JIT-builds the C++ extension and takes about 30 seconds; performance measurements must use warmed, cache-hit runs. The public APIs are Ascend NPU-specific and do not provide a CUDA fallback. [RFC](https://gitcode.com/Ascend/MindSpeed-Ops/issues/80) See merge request: Ascend/MindSpeed-Ops!182 | 1 个月前 | |
fix: 商发wheel安全编译扫描整改(rpath/RELRO/栈保护/strip) Co-authored-by: Raining__<wangruining5@huawei.com> # message auto-generated for no-merge-commit merge: !173 merge master into master fix: 商发wheel安全编译扫描整改(rpath/RELRO/栈保护/strip) Created-by: Raining__ Commit-by: Raining__ Merged-by: ascend-robot Description: ## 背景 商发 wheel 包华为安全编译扫描整改。本 PR 修复扫描命中的 4 类问题,覆盖 wheel 内全部 host 侧 ELF 产物(pybind 扩展 + CATLASS 子库 + 设备 kernel .o)。设备 kernel .o 的 PIE/RELRO/栈保护/FS/strip 项因 CANN 设备二进制格式所限不适用,单独走豁免说明。 ## 修改明细 ### 1. 禁止 rpath(c781b17,另含 037ba4c+a57dfd5 的 kernel 侧修复) - mindspeed_ops/csrc/CMakeLists.txt:OPS_COMPILE_OPTIONS 追加 -fno-rtlib-add-rpath,消除 ccec 驱动默认 -frtlib-add-rpath 给设备 kernel .o 写入的 DT_RPATH - CMakeLists.txt:删除 mindspeed_ops_C 的 BUILD_RPATH/INSTALL_RPATH "$ORIGIN:$ORIGIN/lib" - mindspeed_ops/csrc/catlass/{basic_matmul,chunk_loss}/CMakeLists.txt:删除 INSTALL_RPATH "$ORIGIN" - mindspeed_ops/__init__.py:新增 _preload_catlass_libraries()(置于引导序列首位)——以绝对路径 ctypes.CDLL(..., RTLD_GLOBAL) 预载 mindspeed_ops/lib/*.so,利用 SONAME 注册机制使扩展的 NEEDED 依赖在不带 RPATH 的情况下正常解析,功能与原 $ORIGIN/lib RPATH 等价;与文件内既有 _preload_custom_opapi_library 同一模式,CATLASS 未使能(无 lib/ 目录)时为空操作 ### 2. GOT 重定位只读 (全 RELRO)与立即绑定(BIND_NOW)(39354c4、0706d44) - CMakeLists.txt:mindspeed_ops_C 追加链接选项 -Wl,-z,relro,-z,now - 两个 CATLASS 子库 target_link_options 追加 -Wl,-z,relro,-z,now(bisheng 默认仅 -z relro 部分 RELRO,补 -z now 到全 RELRO) - 验证:产物均出现 GNU_RELRO 段 + DT_BIND_NOW + FLAGS_1 NOW ### 3. 栈保护(3de5382) - CMakeLists.txt:mindspeed_ops_C 追加编译选项 -fstack-protector-all(选 -all 而非 -strong,确保所有函数插桩、确定性产生 __stack_chk_fail 引用) - 验证:产物动态符号表出现 __stack_chk_fail@GLIBC_2.4 ### 4. strip(fe649b5) - 两个 CATLASS 子库 target_link_options 追加 -Wl,-s - 验证:.symtab/.strtab 去除,.dynsym 完整保留(动态链接不受影响),file 判定 stripped ## 验证 - 每轮均在 py3.12 + CANN 9.1.0 标准构建镜像内全量重建 wheel,解包对全部 10 个 ELF 逐个 readelf 核验,已修复项无回归(rpath 全为 0) - 容器内 pip install 后 import mindspeed_ops 正常,CATLASS 预载链路日志确认生效 ## 兼容性 - 全部为编译/链接选项与装载顺序调整,无 API/行为变更;-fstack-protector-all 有常规量级运行时开销(每函数 canary 检查),对 host 侧绑定层可忽略 - 不带 CATLASS 的构建(MINDSPEED_BUILD_CATLASS=0)不受影响 See merge request: Ascend/MindSpeed-Ops!173 | 1 个月前 | |
feat: prepare_wy_repr ops Co-authored-by: liuxi_<liuxi75@huawei.com> # message auto-generated for no-merge-commit merge: !20 merge prepare_wy_repr into master feat: prepare_wy_repr ops Created-by: liuxi_ Commit-by: liuxi_ Merged-by: ascend-robot Description: ## What this PR does / why we need it? prepare_wy_repr ops [#1](https://gitcode.com/Ascend/MindSpeed-Ops/issues/1) ## Does this PR introduce any user-facing change? 不涉及 ## How was this patch tested? TA 3.2.1 ut  atk   See merge request: Ascend/MindSpeed-Ops!20 | 5 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 5 个月前 |