| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
feat: combine offline and remote XPU output workflows Co-authored-by: gcw_YBIAEfqJ<wangweidong15@huawei.com> # message auto-generated for no-merge-commit merge: !221 merge feature/xpu-offline-dump-combined into master feat: combine offline and remote XPU output workflows Created-by: gcw_YBIAEfqJ Commit-by: gcw_YBIAEfqJ Merged-by: cann-robot Description: ### 当前PR是否有AI参与: [ ] 否 [x] 是 __1. AI Agent 平台: OpenCode __2. AI 模型: GPT-5.6 __3. Prompt上下文: 合并 PR #162 与 PR #217,并将离线 XPU 输出字段统一命名为 manual_xpu_binaries ### PR功能描述 / 为什么需要这个合入**: 本 PR 合并原 #162 和 #217 的相关功能,并基于当前 master 重新整理: - 支持 Kernel 使用 manual_xpu_binaries 回放本地 XPU 输出文件进行 cross_check,校验输入、Golden 和输出数量后跳过远端 dispatch。 - 将远端 XPU 输出落盘整合为 --dump xpu,可与 in,out,golden 组合,复用 --dump-format,覆盖多 provider、多输出和嵌套 TensorList。 - XPU dump 状态归入 DumpConfig.xpu,统一由 _apply_dump_config 解析;删除独立 --dump-xpu 参数。 - 保持 --dump full 原有 input/output/golden 语义,只有显式包含 xpu 才请求远端输出。 - 补齐 E2E/ACLNN XPU 调度路径、资源清理、CLI 文档及回归测试。 - 旧字段 manual_third_party_binaries 已统一改为 manual_xpu_binaries。 该组合 PR supersedes 原 PR #162 和 #217,避免两个 PR 分别修改相同的 XPU 处理链路。 ### 该PR关联的issue 无 ### 希望检视人员了解: 组合分支从当前 master 重新构造,未携带原 PR 的旧分支历史。 检视意见修复提交:9524dd9b9 fix: fold XPU output into dump options。 pre-commit 格式与合规修复提交:72f668e0e fix: resolve PR 221 precommit findings。 ## 测试 - pytest -q: 1386 passed, 24 skipped - pre-commit run --show-diff-on-failure --files ...: 全部通过(含 OAT) - tests/cli/test_xpu_perf_collect.py 等 XPU/CLI targeted tests: passed - ruff check --ignore E501 --select E,F,I,B(变更代码和测试): passed - python3 -m compileall -q ttk tests: passed - git diff --check: passed - python3 -m ttk kernel --help: 仅展示 --dump [DUMP],类别包含 xpu ## 文档更新 已同步更新 CLAUDE.md、运行 Skill、Dump 指南、任务执行参数和 XPU 使用指南,所有资料均使用 --dump xpu,无 --dump-xpu 残留。 ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-test-kit!221 | 9 天前 | |
fix: pre-commit code Co-authored-by: wangrui<wangrui124@huawei.com> # message auto-generated for no-merge-commit merge: !199 merge br_geir into master fix: pre-commit code Created-by: wangrui_ Commit-by: wangrui Merged-by: cann-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 [ ] 是 __1. AI Agent 平台: __2. AI 模型: __3. Prompt上下文 : ### PR功能描述 / 为什么需要这个合入**: 让全仓代码通过 pre-commit 全套 hook(ruff check + ruff format + codespell + trailing-whitespace / end-of-file-fixer / check-yaml 等基础 hook),共涉及 255 个文件(+9975/-7615)。 #### 修复内容分类 | 类别 | 规则 | 处理方式 | 数量 | |------|------|---------|------| | 真 bug | F821 | 字符串前向注解补 TYPE_CHECKING 导入;删死代码 del cas_mm | 13 | | | F811 | 删 testcase_op.py 被覆盖的重复 @property | 2 | | | B012 | profiling.py finally 内 return 重构为 try/except 后顺序执行 | 1 | | | hccl_cascade timeout | 主线笔误 timeout 未定义(10 处 F821),提取 _get_timeout() 为变量 | 10 | | 设计类豁免 | B027/B024 | 可选 hook / 抽象基类加 # noqa | 9 | | | E402 | backend 文件调换 docstring↔__future__ 顺序;延迟导入加 # noqa | 16 | | | F405/F403 | import * 展开为显式 import | 55 | | 异常处理 | E722 | 裸 except: → except Exception: | 37 | | | B904 | raise X → raise X from e(链式)/ from None(有意屏蔽) | 9 | | 未用代码 | F401 | re-export 导入加冗余别名 import x as x(不改 import * 行为) | 35 | | | F841 | 删确未使用的局部变量赋值 | 25 | | | B007 | 未用循环变量 → _ | 15 | | 格式化 | UP031 | % 格式化 → f-string(用 float()/str() 强转保留 printf 语义) | 88 | | | E712/E741/E731/B005 等 | != True→~、模糊名 l→ci、lambda→def、rstrip 多字符精确化 | 6 | | | trailing-ws / eof | 自动修复 | 23 | #### codespell 修复 - .gitcode/ISSUE_TEMPLATE/feature-request.yml:Backgroud → Background(真错字) - codespell 忽略列表加 dOut(数据术语 derivative output,误报) ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes # ### 希望检视人员了解: - **非纯格式化**:除格式化外混入了 37 处 except:→except Exception: + 9 处 from e/from None 的异常处理变更(E722/B904,ruff 无自动修复,手动逐处确认语义安全),以及 10 处 hccl_cascade timeout bug 修复。 - **F841/B007 为 unsafe fix**:项目 pre-commit 配置未启用 --unsafe-fixes,这些删除/改名是手动执行并逐一确认变量确实未使用。 - **printf→f-string 保语义**:%-14.18f → {float(x):<14.18f}(加 float() 强转,因为 ml_dtypes.int4 的 printf 会强转但 f-string :f 不会),输出逐字节一致。 - **re-export 用冗余别名**:11 个 __init__.py / shim 模块的 F401 修复用 import x as x 而非 __all__,完全不改 from module import * 行为。 ## 测试 - pre-commit 9 hook 全 Passed - ruff check / ruff format 全绿 - 1321 个非设备测试通过(0 失败,20 skip 为预存在的 torch_npu/tf 冲突) - ttk 全模块 walk-import 冒烟通过(唯一失败 executor_main 为预存在的运行时依赖) ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:代码质量清理 / lint 规范化 See merge request: cann/ops-test-kit!199 | 27 天前 | |
fix: geir 结果列去除 testcase_name/op_name,消除输出表头重复列 | 3 天前 | |
fix: aclnn 执行失败收集 plog tiling 拦截信息进 result 并计 FAIL (issue #178) Co-authored-by: lichunxiang8<lichunxiang8@huawei.com> # message auto-generated for no-merge-commit merge: !255 merge fix/aclnn-execute-error-collection into master fix: aclnn 执行失败收集 plog tiling 拦截信息进 result 并计 FAIL (issue #178) Created-by: lichunxiang8 Commit-by: lichunxiang8 Merged-by: cann-robot Description: ## 问题 (issue #178) ttk aclnn 跑异常用例(tiling 拦截)时: - tiling 拦截信息仅打印到控制台,result CSV 中 precision/precision_status 均为 N/A,错误信息丢失 - 汇总误计为 SKIP/NA 而非 FAIL ## 根因 1. _acl_sequence() 捕获 aclnn 执行异常后,plog 错误仅 logging.error,返回值只回传 status == "OK" 布尔值,错误详情丢弃 2. ApiProfilingResult 无错误字段,result 无处承载 3. prof_result.failed() 分支统一置 N/A,_update_summary 将其计入 SKIP/NA ## 修复 - ApiProfilingResult 新增 execute_error 字段(尾参带默认值,兼容全部现存调用点) - _acl_sequence(): - 异常分支捕获 plog tiling 拦截信息 / 异常文本,随返回值带出(控制台日志不变) - 补充 phase-2 状态字符串失败路径(acl_execute 内部捕获、不抛异常)的错误提取 - plog 提取窗口 5→10 条:executor 级联报错恰好占 5 条,默认窗口会把真正的 tiling 校验根因挤出 - 失败分支:precision 写入 ACLNN_EXECUTE_FAILED: <错误>(换行折叠为 | ,保证 result CSV 一个用例一行),precision_status 置 FAIL - 无 execute_error 的失败(如用例非法 ApiProfilingResult.fail())维持原 N/A 行为,多卡路径不动 ## 验证 环境:Ascend950DT_9582 + CANN 9.2.0,用 issue #178 评论区用例 sFA_exception_000189: | 项 | 修复前 | 修复后 | |---|---|---| | result precision | N/A | ACLNN_EXECUTE_FAILED: ... CheckSinks ... incorrect shape [127]. It should be [128]. ... | | precision_status | N/A | FAIL | | 汇总 | SKIP/NA: 1 | FAIL: 1, SKIP/NA: 0 | | result 行数 | 1 用例占 6 行 | 1 用例 1 行 | - 正常用例 aclnn_add 回归 PASS 100% - 单测 1338 passed(tests/remote/test_executor.py 1 个失败为 master 存量问题,未改动代码上同样失败) Closes #178 See merge request: cann/ops-test-kit!255 | 8 天前 | |
feat:生态算子开源精度标准 Co-authored-by: chenqianyu<chenqianyu1@h-partners.com> # message auto-generated for no-merge-commit merge: !214 merge mix_tol into master feat:生态算子开源精度标准 Created-by: FishPotatoChen Commit-by: chenqianyu Merged-by: cann-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 [ ] 是 __1. AI Agent 平台: __2. AI 模型: __3. Prompt上下文 : ### PR功能描述 / 为什么需要这个合入**: 引入生态算子开源精度标准(混合容差 mix_tolerance),并作为浮点输出的默认精度比对方法,替换原默认的统计相对误差 stat_rel_err。 **主要改动:** 1. **新增 mix_tolerance 比对判据**(ttk/core_modules/comparison/mix_tolerance.py) - 逐元素通过条件:|a - g| <= atol + rtol * |g|(atol 兜底小值场景,天然避免除零;rtol 保证大值相对精度) - 整体通过条件:matched_ratio >= required_matched_ratio(0.99) 且 max_abs_error <= max_abs_error_limit(硬上限拦灾难性离群点) - NaN/Inf 特殊处理:双方同 NaN / 同号 Inf 视为一致;NaN/Inf 位置不一致视为无界误差,直接 FAIL 2. **按 dtype 的阈值表**(ttk/core_modules/comparison/resolve.py) - 覆盖 float16 / bfloat16 / float32 / hifloat32 / float8_e4m3fn / float8_e5m2,max_abs_error_limit 取 1e-X 与 32*ULP 满足任一;表外浮点 dtype(如 float64)回落 float32 档 - Spec.tolerance 中可按 dtype 覆盖 rtol / atol / required_matched_ratio / max_abs_error_limit 3. **默认路由切换**:未指定 --compare 且无 Spec.tolerance 时,普通浮点输出从 stat_rel_err 切换到 mix_tolerance;float8_e5m2/float8_e4m3fn 不再默认走 requant(requant 自动路由收窄至 hifloat8),可通过 --compare requant / --compare stat_rel_err 显式回退 4. **配置冲突护栏**:Spec.tolerance 只配 threshold(stat_rel_err 专属参数)而实际解析到 mix_tolerance 时,当场报错而非静默丢弃阈值,避免宽松阈值误报 / 严格阈值漏报 5. **CLI / Spec 接入**:--compare 新增 mix_tolerance 取值;Spec.tolerance 的 standard 字段新增 mix_tolerance 为官方标准 ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes [#144](https://gitcode.com/cann/ops-test-kit/issues/144) ### 希望检视人员了解: - **行为变更**:默认精度判据由 stat_rel_err 变为 mix_tolerance,已有用例若未显式指定比对方法,精度结果可能发生变化;需要旧行为请显式 --compare stat_rel_err - CSV 的 precision_tolerances / absolute_precision 为 legacy 字段,仅 close/cosine 读取;默认 mix_tolerance 的容差调整需在 TestSpec tolerance 中覆盖(需 --plugin) - resolve.py 仍是容差解析唯一入口,比对类不查表,只消费解析好的最终值 ## 测试 <!--描述进行了哪些测试来验证你的改动。--> - 新增单元测试 tests/core_modules/comparison/test_mix_tolerance.py:覆盖逐元素通过条件、atol/rtol 各自兜底场景、matched_ratio 边界、max_abs_error 硬上限、NaN/Inf 真值表、size 不一致 - 扩展 tests/core_modules/comparison/test_resolve_tolerance.py:默认路由切换(float32/float8 → mix_tolerance)、多输出混合 dtype 路由、阈值表默认值、表外 dtype 回落、Spec 覆盖、threshold 与 mix_tolerance 冲突报错护栏 - 更新 test_compare_integration.py / test_validator_tolerance.py 适配新默认值 - 全量单测通过(pytest tests/) ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> - docs/Precision_Comparison.md:新增混合容差章节(公式、dtype 阈值表、NaN/Inf 处理、使能方式),全文方法编号与默认值说明更新 - docs/FAQ/faq_guide.md:精度方法推荐表、容差调整说明(含 legacy CSV 字段生效范围提示) - ttk/test_spec/README.md:tolerance standard 表新增 mix_tolerance 及可覆盖参数说明 - README.md / README-EN.md / CLAUDE.md / .claude/skills/* / docs/NPUSim/* / docs/Task_Execution.md / docs/Test_Case_Generation.md / docs/XPU_Cross_Check.md:默认比对方法描述同步更新 - ttk/test_spec/examples/04_golden_tolerance_compare.py / 05_pre_compare_customize_inputs.py:示例同步 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-test-kit!214 | 18 天前 | |
perf: 大数组比对提速 —— isclose 抬 fp32、binary_equal 改逐字节 Co-authored-by: tangpingchuan<tangpingchuan@huawei.com> # message auto-generated for no-merge-commit merge: !264 merge fix/int64-input-generation into master perf: 大数组比对提速 —— isclose 抬 fp32、binary_equal 改逐字节 Created-by: zl_hw Commit-by: tangpingchuan Merged-by: cann-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 [] 是 __1. AI Agent 平台: __2. AI 模型: __3. Prompt上下文 : ### PR功能描述 / 为什么需要这个合入**: 两个问题都来自"大 tensor 跑批"这一条路径: 1. **造数静默截断(fix,e6112c5)**: _gen_exponential_data 对全值域浮点一次性构造 uniform + randint + power 三个与输出等大的 float64 临时量。10.7 亿元素的用例峰值约 34GB,进程被 OOM 杀掉,而跑批返回码仍是 0 —— 结果条数少于输入条数却照样报 PASS。改为按 400 万元素分块生成;元素数不超过两个分块的走原有单次路径,逐位不变。 2. **比对耗时(perf,345d8ae)**: - isclose:np.isclose 内部约 8 趟全数组运算,fp16 还会在 float16 上逐趟运算。改为分块,且 fp16 先抬到 fp32 再比,非有限值按 (a==b) | (isnan(a)&isnan(b)) 处理 —— 与 equal_nan=True 的 np.isclose 语义一致。 - binary_equal:改为按 uint8 视图分块 array_equal,保持逐字节语义(含 ±0、NaN 的字节级区分)。 ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes # ### 希望检视人员了解: - 两处改动都以"语义不变"为前提:造数在小规模下走原路径逐位不变;binary_equal 仍是字节比较,没有退化成数值比较。 - isclose 对 fp16 抬到 fp32 计算,是为了避免在 float16 上做 atol + rtol*|b| 时自身溢出/截断;判定边界不变。 - ruff 在 compare_impl 中把嵌套 if/else 合并为 if isinstance(...) or (1 - p) > ptol:,已核对与原逻辑等价。 ## 测试 - 新增 tests/core_modules/comparison/test_compare_fastpath.py(17 个用例):覆盖 fp16/fp32/fp64、NaN/±Inf/±0、分块边界(恰好一块、跨块、尾块)、以及新旧实现在随机数据上的逐元素一致性。 - tests/utilities/test_data.py 新增 5 个用例:覆盖走单次路径与走分块路径两侧,校验分块路径的 dtype/shape/取值范围,以及同 seed 下的可复现性。 - 实测(本机 Ascend 环境):比对环节 isclose 约 5.4 倍、binary_equal 约 22 倍;单算子跑批端到端约 2.75 倍。 - 原先触发静默截断的 10.7 亿元素用例现可正常完成,结果条数与输入条数一致。 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> 无。 ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [x] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-test-kit!264 | 7 天前 | |
fix: pre-commit code Co-authored-by: wangrui<wangrui124@huawei.com> # message auto-generated for no-merge-commit merge: !199 merge br_geir into master fix: pre-commit code Created-by: wangrui_ Commit-by: wangrui Merged-by: cann-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 [ ] 是 __1. AI Agent 平台: __2. AI 模型: __3. Prompt上下文 : ### PR功能描述 / 为什么需要这个合入**: 让全仓代码通过 pre-commit 全套 hook(ruff check + ruff format + codespell + trailing-whitespace / end-of-file-fixer / check-yaml 等基础 hook),共涉及 255 个文件(+9975/-7615)。 #### 修复内容分类 | 类别 | 规则 | 处理方式 | 数量 | |------|------|---------|------| | 真 bug | F821 | 字符串前向注解补 TYPE_CHECKING 导入;删死代码 del cas_mm | 13 | | | F811 | 删 testcase_op.py 被覆盖的重复 @property | 2 | | | B012 | profiling.py finally 内 return 重构为 try/except 后顺序执行 | 1 | | | hccl_cascade timeout | 主线笔误 timeout 未定义(10 处 F821),提取 _get_timeout() 为变量 | 10 | | 设计类豁免 | B027/B024 | 可选 hook / 抽象基类加 # noqa | 9 | | | E402 | backend 文件调换 docstring↔__future__ 顺序;延迟导入加 # noqa | 16 | | | F405/F403 | import * 展开为显式 import | 55 | | 异常处理 | E722 | 裸 except: → except Exception: | 37 | | | B904 | raise X → raise X from e(链式)/ from None(有意屏蔽) | 9 | | 未用代码 | F401 | re-export 导入加冗余别名 import x as x(不改 import * 行为) | 35 | | | F841 | 删确未使用的局部变量赋值 | 25 | | | B007 | 未用循环变量 → _ | 15 | | 格式化 | UP031 | % 格式化 → f-string(用 float()/str() 强转保留 printf 语义) | 88 | | | E712/E741/E731/B005 等 | != True→~、模糊名 l→ci、lambda→def、rstrip 多字符精确化 | 6 | | | trailing-ws / eof | 自动修复 | 23 | #### codespell 修复 - .gitcode/ISSUE_TEMPLATE/feature-request.yml:Backgroud → Background(真错字) - codespell 忽略列表加 dOut(数据术语 derivative output,误报) ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes # ### 希望检视人员了解: - **非纯格式化**:除格式化外混入了 37 处 except:→except Exception: + 9 处 from e/from None 的异常处理变更(E722/B904,ruff 无自动修复,手动逐处确认语义安全),以及 10 处 hccl_cascade timeout bug 修复。 - **F841/B007 为 unsafe fix**:项目 pre-commit 配置未启用 --unsafe-fixes,这些删除/改名是手动执行并逐一确认变量确实未使用。 - **printf→f-string 保语义**:%-14.18f → {float(x):<14.18f}(加 float() 强转,因为 ml_dtypes.int4 的 printf 会强转但 f-string :f 不会),输出逐字节一致。 - **re-export 用冗余别名**:11 个 __init__.py / shim 模块的 F401 修复用 import x as x 而非 __all__,完全不改 from module import * 行为。 ## 测试 - pre-commit 9 hook 全 Passed - ruff check / ruff format 全绿 - 1321 个非设备测试通过(0 失败,20 skip 为预存在的 torch_npu/tf 冲突) - ttk 全模块 walk-import 冒烟通过(唯一失败 executor_main 为预存在的运行时依赖) ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:代码质量清理 / lint 规范化 See merge request: cann/ops-test-kit!199 | 27 天前 | |
TTK init repo | 4 个月前 | |
fix: avoid truncating ASCEND_OPP_PATH (issue #139) Co-authored-by: atlasleong<2235102484@qq.com> # message auto-generated for no-merge-commit merge: !222 merge fix/issue-139-opp-path into master fix: avoid truncating ASCEND_OPP_PATH (issue #139) Created-by: atlasleong Commit-by: atlasleong Merged-by: cann-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [ ] 否 [x] 是 __1. AI Agent 平台: OpenAI Codex __2. AI 模型: GPT-5 __3. Prompt上下文: 分析并修复 Issue #139 中 ASCEND_OPP_PATH 使用 str.rstrip 导致路径误截断的问题;补充回归测试,并在 CANN 9.0.0 环境中验证。 ### PR功能描述 / 为什么需要这个合入**: str.rstrip("/opp") 会把参数当作字符集合,而不是精确后缀,因此会错误截断以 o 或 p 结尾的合法路径。 本 PR 使用 os.path.normpath 规范化路径,并仅在最后一个路径组件严格等于 opp 时取其父目录。同时补充回归测试,覆盖普通路径名以及 opp 路径有无尾随分隔符的场景。 ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes #139 ### 希望检视人员了解: 项目支持 Python 3.8,因此未采用 Python 3.9 才提供的 str.removesuffix。全量非 device/e2e 测试在本地容器收集阶段因缺少可选依赖 torch 和 jinja2 未完成;本次改动相关用例与邻接测试均已通过。 ## 测试 - python -m pytest tests/test_env.py tests/cli/test_kernel_config.py -q: 8 passed - python -m ruff check ttk/_env.py tests/test_env.py: passed - python -m compileall -q ttk tests/test_env.py: passed - CANN 9.0.0 实际环境验证:ASCEND_OPP_PATH=/usr/local/Ascend/cann-9.0.0/opp 正确解析为 /usr/local/Ascend/cann-9.0.0 ## 文档更新 无。 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-test-kit!222 | 16 天前 | |
fix: pre-commit code Co-authored-by: wangrui<wangrui124@huawei.com> # message auto-generated for no-merge-commit merge: !199 merge br_geir into master fix: pre-commit code Created-by: wangrui_ Commit-by: wangrui Merged-by: cann-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 [ ] 是 __1. AI Agent 平台: __2. AI 模型: __3. Prompt上下文 : ### PR功能描述 / 为什么需要这个合入**: 让全仓代码通过 pre-commit 全套 hook(ruff check + ruff format + codespell + trailing-whitespace / end-of-file-fixer / check-yaml 等基础 hook),共涉及 255 个文件(+9975/-7615)。 #### 修复内容分类 | 类别 | 规则 | 处理方式 | 数量 | |------|------|---------|------| | 真 bug | F821 | 字符串前向注解补 TYPE_CHECKING 导入;删死代码 del cas_mm | 13 | | | F811 | 删 testcase_op.py 被覆盖的重复 @property | 2 | | | B012 | profiling.py finally 内 return 重构为 try/except 后顺序执行 | 1 | | | hccl_cascade timeout | 主线笔误 timeout 未定义(10 处 F821),提取 _get_timeout() 为变量 | 10 | | 设计类豁免 | B027/B024 | 可选 hook / 抽象基类加 # noqa | 9 | | | E402 | backend 文件调换 docstring↔__future__ 顺序;延迟导入加 # noqa | 16 | | | F405/F403 | import * 展开为显式 import | 55 | | 异常处理 | E722 | 裸 except: → except Exception: | 37 | | | B904 | raise X → raise X from e(链式)/ from None(有意屏蔽) | 9 | | 未用代码 | F401 | re-export 导入加冗余别名 import x as x(不改 import * 行为) | 35 | | | F841 | 删确未使用的局部变量赋值 | 25 | | | B007 | 未用循环变量 → _ | 15 | | 格式化 | UP031 | % 格式化 → f-string(用 float()/str() 强转保留 printf 语义) | 88 | | | E712/E741/E731/B005 等 | != True→~、模糊名 l→ci、lambda→def、rstrip 多字符精确化 | 6 | | | trailing-ws / eof | 自动修复 | 23 | #### codespell 修复 - .gitcode/ISSUE_TEMPLATE/feature-request.yml:Backgroud → Background(真错字) - codespell 忽略列表加 dOut(数据术语 derivative output,误报) ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes # ### 希望检视人员了解: - **非纯格式化**:除格式化外混入了 37 处 except:→except Exception: + 9 处 from e/from None 的异常处理变更(E722/B904,ruff 无自动修复,手动逐处确认语义安全),以及 10 处 hccl_cascade timeout bug 修复。 - **F841/B007 为 unsafe fix**:项目 pre-commit 配置未启用 --unsafe-fixes,这些删除/改名是手动执行并逐一确认变量确实未使用。 - **printf→f-string 保语义**:%-14.18f → {float(x):<14.18f}(加 float() 强转,因为 ml_dtypes.int4 的 printf 会强转但 f-string :f 不会),输出逐字节一致。 - **re-export 用冗余别名**:11 个 __init__.py / shim 模块的 F401 修复用 import x as x 而非 __all__,完全不改 from module import * 行为。 ## 测试 - pre-commit 9 hook 全 Passed - ruff check / ruff format 全绿 - 1321 个非设备测试通过(0 失败,20 skip 为预存在的 torch_npu/tf 冲突) - ttk 全模块 walk-import 冒烟通过(唯一失败 executor_main 为预存在的运行时依赖) ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:代码质量清理 / lint 规范化 See merge request: cann/ops-test-kit!199 | 27 天前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 9 天前 | ||
| 27 天前 | ||
| 3 天前 | ||
| 8 天前 | ||
| 18 天前 | ||
| 7 天前 | ||
| 27 天前 | ||
| 4 个月前 | ||
| 16 天前 | ||
| 27 天前 |