| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
test: align ut expectations with current quant behavior Co-authored-by: guowenna1<guowenna1@huawei.com> # message auto-generated for no-merge-commit merge: !373 merge dev into dev test: align ut expectations with current quant behavior Created-by: weixin_44144262 Commit-by: guowenna1 Merged-by: ascend-robot Description: # Purpose 修改在A2上部分用例执行失败的情况 # Test Plan 运行全量ut # Test Report  See merge request: Ascend/MindIE-SD!373 | 1 个月前 | |
[bugfix]解决测试用例导包失败的问题 Co-authored-by: mazhixin00_00<mazhixin7@huawei.com> # message auto-generated for no-merge-commit merge: !199 merge init into dev [bugfix]解决测试用例导包失败的问题 Created-by: mazhixin00_00 Commit-by: mazhixin00_00 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20251224 --> # Which issue(s) this PR fixes or accomplishes 有些环境,跑测试用例导包失败的问题  # Test Plan 全量测试 # Test Report  See merge request: Ascend/MindIE-SD!199 | 4 个月前 | |
[Test]Standardize test infrastructure and fix lint compliance across test suite Co-authored-by: changetheway<guotaoyuan1@h-partners.com> # message auto-generated for no-merge-commit merge: !340 merge test_correct_0608 into dev [Test]Standardize test infrastructure and fix lint compliance across test suite Created-by: changetheway Commit-by: changetheway Merged-by: ascend-robot Description: # Which issue(s) this PR fixes or accomplishes > Fix part of #179 # Purpose 1. **统一测试基础设施** - 新增 tests/conftest.py,通过 pytest 内置机制配置 sys.path 和 ASCEND_CUSTOM_OPP_PATH,替代各测试文件中散落的 sys.path.append / sys.path.insert - 同时将各测试文件中散落的 sys.path.append / sys.path.insert和 ASCEND_CUSTOM_OPP_PATH添加到run.py中和run_test.sh中 - 新增 tests/utils/utils/torch_npu_mock.py,抽取统一的 mock_torch_npu() 工具函数,替代 tests/run.py 和 tests/UT/run.py 中重复的内联 mock 逻辑 2. **修复 lint 合规性** - 移除所有测试文件中手动的 sys.path 操作(由 conftest.py 统一接管) - 添加 # pylint: disable=no-name-in-module 消除 NPU 模块 import 告警 - 统一 @unittest.skipIf 装饰器为多行格式 - 修复 import 排序、去除多余空行和尾逗号 3. **Pre-commit 配置对齐** - pre-commit/pyproject.toml:pylint disable 列表新增 duplicate-code ## 运行测试 ### 全量测试 ** 使用 run_test.sh(推荐,含覆盖率报告)** bash cd tests # 运行全量测试(含覆盖率报告) bash run_test.sh # 仅运行 CPU 兼容测试(无需 NPU 环境) bash run_test.sh --cpu_only # 仅运行 NPU 依赖测试 bash run_test.sh --npu_only ### 执行单个测试用例 方式一:使用 run_test.sh 指定文件 bash cd tests # 运行单个测试文件 bash run_test.sh quantization/test_layer.py # 运行多个测试文件 bash run_test.sh layers/test_embedding.py quantization/test_mode.py # CPU 模式下运行单个文件 bash run_test.sh --cpu_only quantization/test_mode.py 方式二:使用 pytest 方式 bash # pytest 方式(支持更多过滤选项) python -m pytest tests/quantization/test_layer.py -v # Test Plan 1. CPU 模式验证:MINDIE_TEST_MODE=CPU python -m pytest tests/ -k "not NPU",确认 mock 机制正确加载 2. Lint 检查:pre-commit run --all-files,确认新增 disable 项生效且无新增告警 3. 构建验证:在 CANN 8.x 环境执行 bash build/build_ops.sh,确认 customize_transformer 目录自动创建 4. NPU 模式回归:python tests/run.py,确认全量测试无回归 # Test Report 全量UT测试:  See merge request: Ascend/MindIE-SD!340 | 1 个月前 | |
[Feature][compilation]Fix timing measurement and add MulAdd fusion pattern Co-authored-by: blian6<bin.lian@outlook.com> Co-authored-by: blian<lianbin@huawei.com> # message auto-generated for no-merge-commit merge: !270 merge dev into dev [Feature][compilation]Add muls_add Triton kernel fusion pattern, benchmark utilities, and framework fixes Created-by: blian Commit-by: blian6;blian Merged-by: ascend-robot Description: # Which issue(s) this PR fixes or accomplishes 修复compilation模块的benchmark方法,并添加triton算子的感知方案 # Purpose 本 PR 包含两部分工作: ## Part A: muls_add Triton kernel 融合 参考 vllm-ascend 的 muls_add 融合方案,将 mul_add_pattern.py 中的代数优化替换为 kernel 级融合: - **新增** mindiesd/layers/triton_utils.py — Triton Ascend 辅助函数,含 _TRITON_ON_ASCEND 运行时检测 - **新增** mindiesd/layers/muls_add.py — muls_add(x, y, scale) 逐元素融合 kernel(Triton 优先 + torch 自动降级),通过 torch.library.custom_op 注册为 torch.ops.mindiesd.muls_add - **重构** mindiesd/compilation/patterns/mul_add_pattern.py — 工厂函数 create(dtype, scale) + PatternBase 静态接口;pattern 从 mul(a,c)+mul(b,c) 改为 x * scale + y;replacement 从 mul(add(a,b),c) 改为 muls_add(x, y, scale) kernel 调用 - **修改** mindiesd/layers/__init__.py — 导出 muls_add - **新增** tests/layers/test_muls_add.py — 13 项 kernel 单元测试(dtype/shape/scale/边界/inplace/device 保真性) - **修改** tests/compilation/patterns/test_mul_add_pattern.py — 适配 2-输入 + scale pattern,仅保留正确性断言(cosine similarity ≥ 2^-7) ## Part B: benchmark 基础设施与框架修复 - **新增** tests/compilation/test_bench_utils.py — 公共 benchmark 函数(warmup + sync + 多迭代 + 后5平均),替代原有不准确的 time.perf_counter() 单次测量 - **修复** 4 个 pattern 测试文件接入新 benchmark,断言改为 compiled_time < original_time: - tests/compilation/patterns/test_adelayernorm_pattern.py - tests/compilation/patterns/test_gelu_pattern.py - tests/compilation/patterns/test_rmsnorm_pattern.py - tests/compilation/patterns/test_rope_pattern.py - **修复** passes/__init__.py 中 threading.Lock 误用(threading.Lock() → Lock 实例) - FusionPatterns 新增 enable_mul_add 开关 - passes/__init__.py 新增末尾换行符 - **移除** tests/compilation/test_backend.py(SamplePass 为数学恒等变换,不支持 CPU 运行) # Test Plan ### Kernel 层测试 tests/layers/test_muls_add.py — 13 项,覆盖 float32/float16/bfloat16 三种 dtype × 5 种 shape × 7 种 scale 组合,边界值(scale=0/1/-1),inplace 安全性,device/dtype 保真性,多次调用一致性。 ### Pattern 集成测试 tests/compilation/patterns/test_mul_add_pattern.py — 4 项(bfloat16, float16, float32, 32×8192),验证 torch.compile + MindieSDBackend 全链路,cosine similarity ≥ 2^-7。 ### Benchmark + 注册测试 - tests/compilation/test_pattern_registration.py — enable_mul_add 开关测试 - tests/compilation/test_bench_utils.py — benchmark 工具函数 - tests/compilation/patterns/test_adelayernorm_pattern.py - tests/compilation/patterns/test_gelu_pattern.py - tests/compilation/patterns/test_rmsnorm_pattern.py - tests/compilation/patterns/test_rope_pattern.py ### 远端验证命令 bash python -m pytest tests/layers/test_muls_add.py -v python -m pytest tests/compilation/patterns/ -v python -m pytest tests/compilation/test_pattern_registration.py -v Test Report 环境 Ascend 910B (175.99.1.3), torch 2.8.0, torch_npu 2.8.0, triton_ascend 3.2.0 Kernel 单元测试 13/13 passed, 15 subtests Pattern 集成测试 4/4 passed Benchmark + 注册测试 9/9 passed Triton 硬件 40 vector cores, 20 AI cores See merge request: Ascend/MindIE-SD!270 | 3 个月前 | |
[Feature][compilation]Fix timing measurement and add MulAdd fusion pattern Co-authored-by: blian6<bin.lian@outlook.com> Co-authored-by: blian<lianbin@huawei.com> # message auto-generated for no-merge-commit merge: !270 merge dev into dev [Feature][compilation]Add muls_add Triton kernel fusion pattern, benchmark utilities, and framework fixes Created-by: blian Commit-by: blian6;blian Merged-by: ascend-robot Description: # Which issue(s) this PR fixes or accomplishes 修复compilation模块的benchmark方法,并添加triton算子的感知方案 # Purpose 本 PR 包含两部分工作: ## Part A: muls_add Triton kernel 融合 参考 vllm-ascend 的 muls_add 融合方案,将 mul_add_pattern.py 中的代数优化替换为 kernel 级融合: - **新增** mindiesd/layers/triton_utils.py — Triton Ascend 辅助函数,含 _TRITON_ON_ASCEND 运行时检测 - **新增** mindiesd/layers/muls_add.py — muls_add(x, y, scale) 逐元素融合 kernel(Triton 优先 + torch 自动降级),通过 torch.library.custom_op 注册为 torch.ops.mindiesd.muls_add - **重构** mindiesd/compilation/patterns/mul_add_pattern.py — 工厂函数 create(dtype, scale) + PatternBase 静态接口;pattern 从 mul(a,c)+mul(b,c) 改为 x * scale + y;replacement 从 mul(add(a,b),c) 改为 muls_add(x, y, scale) kernel 调用 - **修改** mindiesd/layers/__init__.py — 导出 muls_add - **新增** tests/layers/test_muls_add.py — 13 项 kernel 单元测试(dtype/shape/scale/边界/inplace/device 保真性) - **修改** tests/compilation/patterns/test_mul_add_pattern.py — 适配 2-输入 + scale pattern,仅保留正确性断言(cosine similarity ≥ 2^-7) ## Part B: benchmark 基础设施与框架修复 - **新增** tests/compilation/test_bench_utils.py — 公共 benchmark 函数(warmup + sync + 多迭代 + 后5平均),替代原有不准确的 time.perf_counter() 单次测量 - **修复** 4 个 pattern 测试文件接入新 benchmark,断言改为 compiled_time < original_time: - tests/compilation/patterns/test_adelayernorm_pattern.py - tests/compilation/patterns/test_gelu_pattern.py - tests/compilation/patterns/test_rmsnorm_pattern.py - tests/compilation/patterns/test_rope_pattern.py - **修复** passes/__init__.py 中 threading.Lock 误用(threading.Lock() → Lock 实例) - FusionPatterns 新增 enable_mul_add 开关 - passes/__init__.py 新增末尾换行符 - **移除** tests/compilation/test_backend.py(SamplePass 为数学恒等变换,不支持 CPU 运行) # Test Plan ### Kernel 层测试 tests/layers/test_muls_add.py — 13 项,覆盖 float32/float16/bfloat16 三种 dtype × 5 种 shape × 7 种 scale 组合,边界值(scale=0/1/-1),inplace 安全性,device/dtype 保真性,多次调用一致性。 ### Pattern 集成测试 tests/compilation/patterns/test_mul_add_pattern.py — 4 项(bfloat16, float16, float32, 32×8192),验证 torch.compile + MindieSDBackend 全链路,cosine similarity ≥ 2^-7。 ### Benchmark + 注册测试 - tests/compilation/test_pattern_registration.py — enable_mul_add 开关测试 - tests/compilation/test_bench_utils.py — benchmark 工具函数 - tests/compilation/patterns/test_adelayernorm_pattern.py - tests/compilation/patterns/test_gelu_pattern.py - tests/compilation/patterns/test_rmsnorm_pattern.py - tests/compilation/patterns/test_rope_pattern.py ### 远端验证命令 bash python -m pytest tests/layers/test_muls_add.py -v python -m pytest tests/compilation/patterns/ -v python -m pytest tests/compilation/test_pattern_registration.py -v Test Report 环境 Ascend 910B (175.99.1.3), torch 2.8.0, torch_npu 2.8.0, triton_ascend 3.2.0 Kernel 单元测试 13/13 passed, 15 subtests Pattern 集成测试 4/4 passed Benchmark + 注册测试 9/9 passed Triton 硬件 40 vector cores, 20 AI cores See merge request: Ascend/MindIE-SD!270 | 3 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 个月前 | ||
| 4 个月前 | ||
| 1 个月前 | ||
| 3 个月前 | ||
| 3 个月前 |