Pull Request has been successfully merged by CANN-robot.
(Thank you for shangdf's contribution.)变更摘要
本 PR 为 GE 侧新增 DT_HIFLOAT4_SCALE(hifloat4 带缩放因子的 4bit 浮点)数据类型支持,与 metadef 仓 C_DT_HIFLOAT4_SCALE = 43 配套,覆盖 proto 枚举、atc 输出类型映射、单算子解析、编译 pass、Host CPU 引擎、dump/序列化映射以及 pyge Python API 等全链路登记。其中 constant_clip_pass 的 clip 上下限按原方案暂不适配 hif4_scale,仅在函数处注释标记。
主要改动
- proto 枚举定义:
ge_ir.proto与dump_task.proto的DataType/OutputDataType枚举新增DT_HIFLOAT4_SCALE = 42,为序列化与 dump 提供协议层支持。 - atc 输出类型映射:
omg.cc、option_utils.cc、net_output_pass.cc的字符串到ge::DataType映射表新增HIF4SCALE -> ge::DT_HIFLOAT4_SCALE,option_utils.cc中kOutputTypeSupport校验提示文案同步补充HIF4SCALE。 - 单算子解析与编译 pass:
single_op_parser.cc的kDataTypeDict新增hifloat4_scale字符串映射;cond_remove_pass.cc与switch_dead_branch_elimination.cc的 1 字节判值分支、atomic_memory_assigner.h的IsFloatType均登记新类型。 - dump/序列化与大小映射:
datatype_util.cc、ge_tensor.cc、serialization_util.cc、type_utils_inner.cc新增双向映射;ge_api.cc/ge_api_v2.cc的CONST_OPDATA_TYPE_SIZE_MAP按kGesizefloat登记其大小,PrintOutputResult增加按 float 打印输出的分支。 - Host CPU 引擎与 Python API:
host_cpu_engine.cc的PrepareOutputs支持类型集合加入DT_HIFLOAT4_SCALE;pygetypes.py的DataType新增DT_HIFLOAT4_SCALE = 43并将DT_MAX调整为 44,types_test.py断言同步更新。


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.
You can self-configure the PR merge rules for this repository. For more details, please refer to 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/ge | ✅ yangyongqiang0606, Mexyy, zhanj (3/2) | ✅ yangyongqiang0606 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
shangdf, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/check-pr


The following label is not ready.
approved: Please wait for committers to review the code.


/approve


Pull Request
描述
新增 DT_HIFLOAT4_SCALE(hifloat4 带缩放因子的 4bit 浮点)数据类型支持,与 metadef 仓
C_DT_HIFLOAT4_SCALE = 43配套。GE 侧登记内容包括:ge_ir.proto、dump_task.proto的 DataType 枚举新增DT_HIFLOAT4_SCALE = 42atc --output_type与 netoutput 的输出类型映射新增HIF4SCALE,option_utils校验提示文案同步single_op_parser的kDataTypeDict新增hifloat4_scale字符串映射cond_remove_pass、switch_dead_branch_elimination的 1 字节判值分支、IsFloatType(atomic_memory_assigner.h)登记新类型PrepareOutputs支持的数据类型集合登记datatype_utildump 数据类型映射、ge_tensor/serialization_util序列化双向映射、type_utils_inner字符串映射补充DataType枚举新增DT_HIFLOAT4_SCALE = 43,DT_MAX适配为 44,中英文 API 文档与 UT 断言同步constant_clip_pass的 clip 上下限尚未适配 hif4_scale,与原方案一致保持现状并在函数处注释标记变更类型
关联的Issue
无
如何测试
tests/ge/ut/ge/graph/pyge_tests/types_test.py(含 DT_HIFLOAT4_SCALE=43、DT_MAX=44 断言)--output_type=HIF4SCALE验证输出类型映射hifloat4_scale数据类型字符串验证解析核对清单
其他信息
依赖 metadef 仓头文件新增
C_DT_HIFLOAT4_SCALE = 43(metadef develop 已包含),GE 构建使用该发布包头文件,本仓不重复定义 C++ 枚举。原 diff 中IsFloatType位于graph_mem_assigner.h,当前 develop 上该函数已迁移至atomic_memory_assigner.h,本次修改跟随函数落位。