Pull Request has been successfully merged by CANN-robot.
(Thank you for esok11's contribution.)变更摘要
本 PR 为 activation/glu 算子补充图模式下的数据类型推导能力:新增 glu_graph_infer.cpp,在其中实现 InferDataTypeForGlu 函数,并通过 IMPL_OP(GLU).InferDataType(...) 将数据类型推导逻辑注册到 GLU 算子的算子实现注册表中,使 GLU 在整图编译阶段即可确定输出数据类型。
主要改动
- 新增数据类型推导入口: 新增
InferDataTypeForGlu,接收gert::InferDataTypeContext上下文,作为GLU算子InferDataType的实现函数。 - 输入输出索引常量定义: 在匿名命名空间中定义
GLU_IN_X = 0与GLU_OUT_Y = 0,用常量替代直接写死的输入/输出下标。 - 输出 dtype 与输入对齐: 读取输入
GLU_IN_X的数据类型,并通过SetOutputDataType将其设置为输出GLU_OUT_Y的数据类型,即输出数据类型随输入数据类型推导。 - 空上下文校验与日志: 通过
OP_CHECK_IF判断context为nullptr时返回ge::GRAPH_FAILED,并在推导前后使用OP_LOGD输出节点名日志;最终返回SetOutputDataType的执行结果。 - 算子注册声明: 使用
IMPL_OP(GLU).InferDataType(InferDataTypeForGlu)完成注册,使该推导逻辑接入图模式流程。
🧩 本次 Review 已使用自定义 Skill:




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 |
|---|---|---|
| activation | ✅ 王星, 黄迪 (2/2) | ✅ 王星, 黄迪 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
esok11, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


您好,pr合入已准备就绪,请尽快联系committer进行检视,谢谢!
@pingchuantang @Chen_HaoWen @wang-xing001 @yourealize @kevin_huang1234 @qianzehong


/lgtm
/approve


/lgtm
/approve


The MR can not be merged, because of this MR is work in process.
If you want to solve this problem, you can click here to do it in the FAQs.


/check-pr


描述
GLU 算子(
activation/glu)在 op_graph 目录下只有glu_proto.h(REG_OP 原型)与空的fusion_pass/,缺少图模式 InferDataType 推导注册;host 侧仅通过op_host/glu_infershape.cpp的IMPL_OP_INFERSHAPE(GLU)提供 InferShape。本 PR 为 RT2.0 图模式补齐 GLU 的 InferDataType 推导注册。改动方法
activation/glu/op_graph/glu_graph_infer.cpp,通过IMPL_OP(GLU).InferDataType(InferDataTypeForGlu)注册图侧 dtype 推导。InferDataTypeForGlu的实现:先对 context 判空(为空时OP_LOGE("GLU", "InferDataType context is nullptr.")并返回ge::GRAPH_FAILED),记录起始OP_LOGD;随后GetInputDataType(GLU_IN_X)取输入 x 的 dtype,SetOutputDataType(GLU_OUT_Y, dtype)直接作为输出 y 的 dtype,并返回该调用的状态;最后记录结束OP_LOGD。输出与输入同类型,与op_graph/glu_proto.h中 “y: Has the same type as x” 以及op_host/glu_def.cpp中 x/y 均注册DT_FLOAT16、DT_BF16、DT_FLOAT的契约一致。GLU_IN_X = 0(输入 x)、GLU_OUT_Y = 0(输出 y)。op_host/glu_def.cpp与op_host/glu_infershape.cpp,未新增 InferFormat 注册。op_graph/CMakeLists.txt:add_graph_plugin_sources()(cmake/func.cmake:1113)通过file(GLOB_RECURSE GRAPH_PLUGIN_SRCS ${SOURCE_DIR}/*.cpp)自动收集 op_graph 下的新增源文件。关联的Issue
测试
本 PR 仅新增图侧 InferDataType 推导注册,未新增 UT/ST 用例;
activation/glu/tests/ut/op_host下现有test_glu_infershape.cpp、test_glu_tiling.cpp仍覆盖 host 侧逻辑,tests/st下aclnnGlu、arch35用例覆盖执行通路。建议验证:图模式(GE IR)构造 GLU 节点,确认输出 y 的 dtype 与输入 x 一致(float16 / bfloat16 / float32)。文档更新
无文档变更。
类型标签
AI/Agent生成声明