已合并
feat: support attributes1~attributes9 extension columns, merged into attributes with last-wins override semantics #89
FishPotatoChen创建于 11 天前
feat: support attributes1~attributes9 extension columns, merged into attributes with last-wins override semantics #89
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 FishPotatoChen 的贡献)11 天前 创建了 pull request,commit b48d17f5
atomgit-bot
11 天前 评论:
11 天前 评论:
变更摘要
此 PR 为 CSV 用例新增 attributes1~attributes9 共 9 个扩展属性列,允许将算子属性拆分到多个列中写入,提升可读性和编辑体验。在 TestcaseBase.validate() 阶段通过新增的 _merge_extended_attributes() 方法按 attributes → attributes1 → … → attributes9 顺序合并,key 冲突时后续列覆盖前列(last-wins 语义),无效行跳过合并。三种测试模式类(TestcaseOp、TestcaseAclnn、TestcaseE2e)均声明了扩展字段,类型为可选 dict,默认值为 None 或 {},向后兼容。
主要改动
TestcaseBase._merge_extended_attributes()新增合并逻辑:在testcase_base.py的validate()中调用该新方法,遍历attributes1~attributes9并用dict.update()依次合并到attributes,实现后续列覆盖前列的 last-wins 语义;若is_valid=False则直接返回,不执行合并。TestcaseOp声明扩展列:在__slots__、complete_headers、attr_property_headers和__init__中新增attributes1~attributes9字段,类型均为Optional[dict],默认None,并通过**{f"attributes{i}": ...}字典解包方式在attr_property_headers中统一注册为FIELD_TYPES.DICT类型。TestcaseAclnn声明扩展列:在complete_headers、attr_property_headers和__init__中新增attributes1~attributes9,注册方式与TestcaseOp一致,扩展列继承自TensorApiTestcaseBase的base_attr属性体系。TestcaseE2e声明扩展列:在__slots__、attr_headers和__init__中新增attributes1~attributes9,初始化默认值为None,同样采用字典解包方式注册类型定义。- 新增测试文件
tests/test_extended_attributes.py:对三种 Testcase 类进行参数化测试,覆盖扩展列声明检查、基本合并、覆盖基础属性、跨扩展列覆盖、链式覆盖、多列无冲突合并、无扩展列保持原值、attributes为None时的合并、无效行跳过以及validate()自动触发合并共 10 个场景。


atomgit-bot
11 天前 评论:
11 天前 评论:
11 天前 添加了label:cann-cla/yes
CANN-robot
11 天前 评论:
11 天前 评论:
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/ops-test-kit | ✅ 陈琦, 王瑞 (2/2) | ✅ 王瑞, 陈琦 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
FishPotatoChen, thanks for your pull request. All authors of the commits have signed the CLA. 👍


此处折叠了62条消息 查看更多
3 天前 添加了label:approved
3 天前 添加了label:lgtm
3 天前 合入了pull request
当前PR是否有AI参与:
[x] 否
[ ] 是
__1. AI Agent 平台:
__2. AI 模型:
__3. Prompt上下文 :
PR功能描述 / 为什么需要这个合入**:
当前 CSV 用例中的
attributes列仅支持一个字段承载所有算子属性。当算子属性较多(如几十个 key)时,将所有属性挤在一个单元格中可读性差、编辑困难,且 CSV 单列承载大量 JSON 容易出错。本 PR 新增
attributes1~attributes9共 9 个扩展列,允许将算子属性拆分到多个列中写入。在用例validate()阶段,扩展列按attributes(即attributes0) -> attributes1 -> ... -> attributes9的顺序依次 merge 到attributes中,发生 key 冲突时后续列覆盖前列(last-wins 语义)。若用例为无效行则跳过合并。改动范围:
testcase_base.py:TestcaseBase.validate()中插入_merge_extended_attributes()调用,实现合并逻辑testcase_op.py/testcase_aclnn.py/testcase_e2e.py:三种测试模式的 Testcase 类均声明attributes1~attributes9字段(complete_headers、__slots__/__init__、类型头定义),新增字段均为可选的dict类型,默认值{}该PR关联的issue
https://gitcode.com/cann/ops-test-kit/issues/73
希望检视人员了解:
_merge_extended_attributes()仅在cases.is_valid=True时执行,无效行保持原始attributes不变。base_attr(testcase_aclnn.py和testcase_e2e.py通过TensorApiTestcaseBase继承),因此 base_attr 中设置的属性也会被扩展列覆盖。测试
tests/test_extended_attributes.py,对 Kernel / ACLNN / E2E 三种模式的 Testcase 类进行参数化测试,覆盖以下场景:attributes+attributes1~attributes9列在complete_headers中声明(test_headers_declared)attributes1追加到attributes(test_merge_basic)attributes中的同名 key(test_merge_override_with_base)attributes2覆盖attributes1中的 key(test_override_across_extended_columns)attributes9覆盖attributes5覆盖attributes1(test_override_chain_last_wins)test_multi_column_merge)attributes不变(test_no_extension_leaves_attributes)attributes为 None 时,扩展列直接成为attributes(test_merge_when_attributes_none)test_skip_when_invalid)validate()自动调用合并逻辑(test_validate_invokes_merge)文档更新
无
类型标签