Skip to content

Conversation

SigureMo
Copy link
Member

@SigureMo SigureMo commented Mar 22, 2025

PR Category

Execute Infrastructure

PR Types

New features

Description

将 CINN 切为动转静默认后端,部分动转静单测尚有问题,暂时关掉 CINN,后续会看看具体问题

Before this PR After this PR
动转静 ENABLE_CINN_IN_DY2ST=0new
动转静+组合算子 FLAGS_prim_all=true
FLAGS_prim_enable_dynamic=true
ENABLE_CINN_IN_DY2ST=0new
FLAGS_prim_all=true
FLAGS_prim_enable_dynamic=true
动转静+组合算子+CINN FLAGS_use_cinn=1
FLAGS_prim_all=true
FLAGS_prim_enable_dynamic=true
无(当然左边的设不设置没有影响)

Related links

CINN 切默认系列 PR

Docs update

@SigureMo SigureMo requested review from zrr1999 and gouzil as code owners March 22, 2025 13:08
Copy link

paddle-bot bot commented Mar 22, 2025

你的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.

@SigureMo SigureMo requested review from Copilot and removed request for zrr1999 and gouzil March 22, 2025 13:08
@SigureMo SigureMo changed the title [Dy2St][CINN] Use CINN as default backend [WIP][Dy2St][CINN] Use CINN as default backend Mar 22, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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(

@SigureMo SigureMo force-pushed the dy2st/use-cinn-as-default-backend branch from 243f81f to 359a222 Compare March 24, 2025 08:58
@SigureMo SigureMo changed the title [WIP][Dy2St][CINN] Use CINN as default backend [Dy2St][CINN] Use CINN as default backend Mar 27, 2025
zyfncg
zyfncg previously approved these changes Mar 27, 2025
Copy link

paddle-ci-bot bot commented Apr 6, 2025

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.

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SigureMo SigureMo merged commit f3ff2ff into PaddlePaddle:develop Apr 10, 2025
32 checks passed
@SigureMo SigureMo deleted the dy2st/use-cinn-as-default-backend branch April 10, 2025 02:54
YqGe585 pushed a commit to YqGe585/Paddle that referenced this pull request May 7, 2025
---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants