已合并
feat: run Python custom op infer_meta at compile time and RT2 #4414
lfz2812创建于 7 天前
feat: run Python custom op infer_meta at compile time and RT2 #4414
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 lfz2812 的贡献)atomgit-bot
7 天前 评论:
7 天前 评论:
🤖 正在生成合并请求摘要,请稍候…


atomgit-bot
7 天前 评论:
7 天前 评论:
🤖 AI 代码检视正在进行中,请稍候…


7 天前 添加了label:cann-cla/no
此处折叠了486条消息 查看更多
黄桂军
3 天前 评论:
3 天前 评论:
/lgtm


3 天前 添加了label:lgtm
3 天前 添加了label:approved
3 天前 合入了pull request
Pull Request
描述
在 Python 自定义算子原型注册、Bridge、Adapter 和 canonical IR 链路的基础上,接通 Python
infer_meta回调,使注册的 Python 原型可以参与编译期和 RT2 动态 Shape 推导。本次主要包含:
接通 Python
infer_meta回调:register_op装饰函数作为 Pythoninfer_meta函数使用。TensorDesc,将属性转换为 Python 参数。新增 InferShape native context:
接通编译期 Meta 推导:
CustomOpInferMetaProvider。infer_meta。OpDesc承载推导结果,所有校验成功后再提交到原始OpDesc。接通 RT2 动态 Shape 推导:
infer_meta回调。ShapeInferOpfallback 路径。扩展 Bridge、Adapter 和注册结构:
infer_metacallback。execute、schema-bound execute 和 legacyexecute(ctx)行为。补充测试和设计说明:
变更类型
请选择本次引入的变更类型:
关联的Issue
无。
如何测试
建议执行:
cmake --build build_ut \ --target install_ge_py_for_tests \ ut_exe_graph \ ut_libge_multiparts_utest \ ut_fast_runtime2_test \ -j4 python3 -m pytest \ tests/ge/ut/ge/graph/pyge_tests/python_custom_op_infer_meta_test.py \ -q ctest --test-dir build_ut \ -R 'ut_exe_graph|ut_libge_multiparts_utest|ut_fast_runtime2_test' \ --output-on-failure cmake --build build_st --target graph_engine_test -j4 ctest --test-dir build_st \ -R graph_engine_test \ --output-on-failure git diff --check核对清单
其他信息