You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册。
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR addresses a bug fix in the export process where repeated calls to paddle.jit.save eventually led to segmentation faults by ensuring that the InplaceMap gets cleared upon program completion.
Added a pop method to clear the parameters associated with a program in the InplaceMap.
Modified the program translator to call _global_inplace_map.pop(main_program) after handling parameters.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Execute Infrastructure
PR Types
Bug fixes
Description
TL;NR
在动态图转静态图(动转静)模型导出流程中,
paddle.jit.save
会在组网过程中将部分中间内容缓存于_global_inplace_map
,并以id(program)
作为 key。由于该缓存未在组网结束后及时清理,若 program 被复用,则可能出现缓存指向已被释放内存的情况,导致访问非法内存并最终触发段错误(Segmentation fault)。本 PR 针对这一问题,在组网流程结束后增加了对_global_inplace_map
的相应清理,确保缓存与内存状态一致,消除悬垂指针隐患,提升导出流程的稳定性。在 PaddleSeg 中,即使是以动态图形式运行,但依旧会执行导出过程(会进行动转静)
在
jit.save
过程中,多次执行(>50次)之后会出现段错误在
paddle.jit.save
中会进行组网,组网过程中会缓存一部分内容,存在_global_inplace_map
与_global_parameter_recorder
中_global_parameter_recorder
在组网结束后会自动释放其中内容,而_global_inplace_map
不会释放由于是以
id(program)
为 key,所以如果某个program
被复用,则存在访问已被释放变量的风险,导致段错误本PR添加释放过程
PCard-66972