CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[Dy2St][CINN] Use CINN as default backend #71838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Dy2St][CINN] Use CINN as default backend #71838
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
你的PR提交成功,感谢你对开源项目的贡献! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR switches the default backend for dygraph-to-static conversion to CINN and adjusts related flags and tests accordingly. Key changes include updating the backend guard and deprecation warnings in the utils and API modules, revising tests to directly assert the new backend behavior, and refactoring code to use the new Backend enum consistently.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
test/dygraph_to_static/test_jit_backend.py | Added tests to verify CINN and PHI backend behaviors. |
python/paddle/jit/dy2static/utils.py | Updated backend_guard, introduced infer_use_cinn_backend, and improved flag handling. |
python/paddle/jit/api.py | Removed deprecated backend check and shifted default backend to CINN. |
test/deprecated/prim/prim/flags/test_prim_flags_case_deprecated.py | Removed use_cinn parameter from to_static tests in line with backend refactoring. |
python/paddle/base/core.py | Replaced getenv-based flag retrieval with get_flags for prim control. |
test/dygraph_to_static/check_approval.py | Updated test approval list to include test_jit_backend.py. |
python/paddle/jit/dy2static/pir_partial_program.py | Refactored to use the Backend API and updated pass invocation logic. |
test/dygraph_to_static/test_partial_program_hook.py | Adjusted PirPrimHooker usage to explicitly pass Backend.PHI. |
python/paddle/jit/dy2static/partial_program.py | Replaced string-based backend checks with Backend's is_cinn() method. |
test/prim/pir_prim/test_prim_skip_dynamic.py | Switched from os.environ to paddle.set_flags for flag control. |
Comments suppressed due to low confidence (2)
python/paddle/jit/dy2static/utils.py:698
- [nitpick] Consider rephrasing the deprecation warning for clarity; for example, 'Setting build_strategy.build_cinn_pass is deprecated. Use backend="CINN" to enable CINN instead.' would provide clearer guidance.
warnings.warn("Use `build_strategy.build_cinn_pass = True` to enable CINN is deprecated, please use `backend = 'CINN'` instead.")
python/paddle/jit/dy2static/pir_partial_program.py:1084
- [nitpick] Ensure that the variable naming for the pre-process pass is consistent across the codebase; update any related comments or documentation referencing the old name fused_bn_add_act_pass if necessary.
full_graph_pre_process_pass = FullGraphPreProcessPass(
243f81f
to
359a222
Compare
Sorry to inform you that 79bca44's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
--------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
PR Category
Execute Infrastructure
PR Types
New features
Description
将 CINN 切为动转静默认后端,部分动转静单测尚有问题,暂时关掉 CINN,后续会看看具体问题
ENABLE_CINN_IN_DY2ST=0
newFLAGS_prim_all=true
FLAGS_prim_enable_dynamic=true
ENABLE_CINN_IN_DY2ST=0
newFLAGS_prim_all=true
FLAGS_prim_enable_dynamic=true
FLAGS_use_cinn=1
FLAGS_prim_all=true
FLAGS_prim_enable_dynamic=true
Related links
CINN 切默认系列 PR
build_strategy.build_cinn_pass
and replace it withbackend
option #71815FLAGS_use_cinn
viaos.getenv
#71817np.testing
module to get better error message and tolerance settings intest_ifelse
#71951Docs update
"CINN"
as default backend injit.to_static
docs#7242