已合并
【feat】: JIT 调度与切图解耦,开启自动融合时整图jit执行 #4566
chengyutao3创建于 10 天前
【feat】: JIT 调度与切图解耦,开启自动融合时整图jit执行 #4566
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 chengyutao3 的贡献)10 天前 添加了label:enhancement
10 天前 创建了 pull request,commit 2e3e1d89
atomgit-bot
10 天前 评论:
10 天前 评论:
变更摘要
本 PR 将 AutoFuse JIT 执行能力从「仅支持切片调度图」扩展为「整图 JIT」模式:新增统一的 EnableAutoFuse() 判断入口,AutoFuse 开启时所有图统一路由至 UserGraphsManager,由执行顺序决定走切片编译还是整图编译;扩展 UserGraphControl 以支持整图动态添加、编译、加载与执行,并在 Session/GeSession 接口层将相关路径统一收敛到 JIT 图管理,同时移除「不支持 Slice Schedule」的黑名单回退逻辑。
主要改动
- 新增
EnableAutoFuse()统一开关:在option_utils.cc/h中新增EnableAutoFuse()(仅判断--enable_autofuse=true),UserGraphsManager、UserGraphControl及 Session 接口的判断由EnableSliceSchedule()/黑名单切换为EnableAutoFuse(),AutoFuse 模式下图管理、编译、加载、执行统一走UserGraphsManager。 - 扩展
UserGraphControl支持整图 JIT:新增EnsureWholeGraphAdded、EnsureWholeGraphCompiled、EnsureWholeGraphLoaded以及ge::Tensor/gert::Tensor两个RunGraph重载和RunGraphWithStreamAsync,并支持RunGraphMode的获取与设置;Finalize()结束时清理临时创建的整图实例。 - 调整执行顺序生成逻辑:
ExecutionOrder::AddNewSlice对slice_supported为 true 的图继续符号推导与二分切图,对不支持切片的图直接以整图编译,并提前调用CreateOrUpdateNetoutput()校正输出大小;Dump 前缀区分WholeGraph_与SlicedGraph_,UserGraph.slice_supported字段在execution_order.h中新增。 - 移除黑名单并路由 Session 接口:删除
UserGraphsManager中的slice_schedule_unsupported_set_黑名单,新增RunGraph、RunGraphWithStreamAsync、GetRunGraphMode、SetRunGraphMode接口;InnerSession中RunGraph、RunGraphWithStreamAsync、GetRunGraphMode、SetRunGraphMode均改经user_graphs_manager_分发。 - 更新图内存接口限制与错误提示:
ge_api.cc/ge_api_v2.cc中SetGraphConstMemoryBase、UpdateGraphFeatureMemoryBase、SetGraphFixedFeatureMemoryBaseWithType、UpdateGraphRefreshableFeatureMemoryBase的判断由EnableSliceSchedule()改为EnableAutoFuse(),返回UNSUPPORTED时的提示信息由「slice scheduler」更新为「JIT executor」;GeSession::RunGraph在 AutoFuse 模式下跳过传统LoadGraph加载逻辑。


atomgit-bot
10 天前 评论:
10 天前 评论:
10 天前 添加了label:cann-cla/yes
此处折叠了51条消息 查看更多
chengyutao3
10 天前 评论:
10 天前 评论:
/check-pr


CANN-robot
10 天前 评论:
10 天前 评论:
The following label is not ready.
approved: Please wait for committers to review the code.


yangyongqiang
10 天前 评论:
10 天前 评论:
/approve


10 天前 添加了label:approved
10 天前 合入了pull request
Pull Request
描述
本 PR 将 AutoFuse JIT 执行能力从“支持切片调度的图”扩展为“整图 JIT”模式。
主要变更内容如下:
EnableAutoFuse(),统一判断 AutoFuse 是否启用,并将 AutoFuse 模式下的图管理、编译、加载、执行及运行模式设置统一路由至UserGraphsManager。UserGraphControl,支持整图的动态添加、编译、加载和执行:ge::Tensor和gert::Tensor两类输入输出。RunGraphMode。NetOutput,确保输出大小信息能够正确校正。WholeGraph_和SlicedGraph_图 Dump 前缀,便于区分调试产物。RunGraph、RunGraphWithStreamAsync、编译及加载流程统一使用 JIT 图管理路径。UserGraphControl,由执行顺序决定采用切片编译或整图编译。CompileGraph流程触发编译,并从 JIT 编译缓存中的图副本检查融合结果。GeTensor和gert::Tensor输入输出执行。RunGraphMode的获取与设置。变更类型
请选择本次引入的变更类型:
关联的Issue
暂无关联 Issue。
如何测试
描述测试此变更的步骤和前提条件:
前提条件:
AUTOFUSE_FLAGS,启用--enable_autofuse=true;涉及切片调度的测试还需要启用--experimental_enable_jit_executor_v2=true。编译 GE 相关组件及测试目标:
编译并运行 JIT Execution 相关单元测试,重点检查以下测试文件:
tests/ge/ut/ge/jit_execution/execution_order_unittest.cctests/ge/ut/ge/jit_execution/jit_executor_unittest.cctests/ge/ut/ge/jit_execution/user_graph_ctrl_unittest.cctests/ge/ut/ge/jit_execution/user_graph_manager_unittest.cc运行 Session V2 API 单元测试,重点验证 AutoFuse 模式下图执行及图内存接口行为:
tests/ge/ut/ge/session_v2/ge_api_v2_unittest.ccSliceSchedule_UnsupportedPaths运行 AutoFuse 系统测试:
tests/ge/st/testcase/autofuse/autofuse_canfuse_test.cc验证水平融合、垂直融合以及不同算子组合的融合结果,并确认测试通过
Session::CompileGraph触发真实 JIT 编译,从 JIT 编译图副本中检查AscBackend和融合属性。重点验证以下场景:
RunGraph、RunGraphAsync以及RunGraphWithStreamAsync路径均能正确路由。UNSUPPORTED,且日志提示为 JIT executor 不支持。核对清单
其他信息