Skip to content

Conversation

@SigureMo
Copy link
Member

@SigureMo SigureMo commented Apr 18, 2025

PR Category

Execute Infrastructure

PR Types

Bug fixes

Description

问题出现在子图大小低于 MIN_GRAPH_SIZE 的 partial fallback 处理处

_build_compile_fn_with_name_store 不同,这里传入的 stack_vars 是可能有重复的,因此当同一个变量在前面迭代分配了名字后并存到 store_var_info 后,后面迭代的时候就走到了 else 分支,就会走 gen_store,但这明明是 ___graph_fn_saved_orig_ 生成的,就无法在原来函数名字里找到,会挂掉,进而导致整个函数 fallback

因此,存过了就直接 POP_TOP 就好了

_build_compile_fn_with_name_store 不需要处理,因为不会重复

@SigureMo SigureMo requested review from gouzil and zrr1999 as code owners April 18, 2025 12:01
@paddle-bot
Copy link

paddle-bot bot commented Apr 18, 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 DrRyanHuang and Copilot April 18, 2025 12:04
Copy link
Contributor

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 addresses a bug in partial fallback handling when duplicate stack variables are encountered by skipping re-restoring variables that have already been processed. Key changes include:

  • Adding new test cases in test/sot/test_min_graph_size.py to validate the fallback mechanism.
  • Updating _restore_origin_opcode in function_graph.py to track and skip duplicate stack variable IDs using a set and calling gen_pop_top for duplicates.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
test/sot/test_min_graph_size.py Added test functions to verify proper recovery of duplicate args during fallback.
python/paddle/jit/sot/opcode_translator/executor/function_graph.py Introduced a check for duplicate stack variables to prevent fallback errors.
@SigureMo SigureMo merged commit 69cf71c into PaddlePaddle:develop Apr 18, 2025
39 checks passed
@SigureMo SigureMo deleted the sot/skip-restore-same-stack-arg-when-fallback branch April 18, 2025 17:38
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (develop@6d1a7c0). Learn more about missing BASE report.

Additional details and impacted files
@@ Coverage Diff @@ ## develop #72367 +/- ## ========================================== Coverage ? 91.42% ========================================== Files ? 1 Lines ? 455 Branches ? 0 ========================================== Hits ? 416 Misses ? 39 Partials ? 0 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
YqGe585 pushed a commit to YqGe585/Paddle that referenced this pull request May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants