Skip to content
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

[SOT] Compile with graph size check #58538

Merged

Conversation

feifei-111
Copy link
Contributor

@feifei-111 feifei-111 commented Oct 31, 2023

PR types

Others

PR changes

Others

Description

the old start_compile api can not consider, fix it and speed up

说明:

  1. 使用原 opcode 的前半段替换 resume_fn 中的 compile_fn,在这种情况下会将原 opcode 的后半段放在构造好的 resume_fn 的末尾 (这是为了防止出现意外跳转的保险措施,尽管这种跳转应该不可能出现)

  2. 处理 NullVariable。必须要保证 origin code (resume_fn 本身也应该是 origin code)load NullVariable,而 new code load 真正的 null。原本只有 fallback 才会执行 origin code,现在 break 也有可能了,所以需要对返回的 new_code 进行一次处理(但是构造 resume fn还是需要 NullVariable)

  3. break 之后被 skip
    假如有 func 触发了 break,构造了 new_func_code 其中 call resume_0 ,且 resume_0 没有子图。如果触发了 resume_0 的eval_frame,就会导致错误(执行 resume_0 的origin code时,其中有一个 load NullVariable)。
    但是 new_func_code 既然走了本 PR 的分支,那么 resume_0 没有子图等价于 new_func_code 没有子图,它也不会执行 new_func_code,而是执行func 的 origin code,也就不会 call resume_0,最终这里的 NullVariable 也不会导致错误

image

PCard-66972

@paddle-bot paddle-bot bot added the contributor External developers label Oct 31, 2023
@feifei-111 feifei-111 changed the title Compile with graph size check [SOT] Compile with graph size check Nov 1, 2023
Copy link

paddle-bot bot commented Nov 2, 2023

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

Copy link
Contributor

@2742195759 2742195759 left a comment

Choose a reason for hiding this comment

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

LGTM


backup_iter_idx = iterator.idx

self._inline_call_for_loop(iterator, instr)
self._lasti = self.indexof(instr.jump_to)
except BreakGraphError as e:
log(3, f"{e}")
log(3, f"[FOR_ITER] sim for loop failed for: {e}\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

simulate

@2742195759 2742195759 merged commit a827e97 into PaddlePaddle:develop Nov 2, 2023
28 checks passed
@paddle-bot paddle-bot bot removed the contributor External developers label Nov 3, 2023
zeroRains pushed a commit to zeroRains/Paddle that referenced this pull request Nov 8, 2023
* update

* update

* update

* update

* update

* update

* add test

* update

* update
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
* update

* update

* update

* update

* update

* update

* add test

* update

* update
@feifei-111 feifei-111 deleted the compile_with_graph_size_check branch December 15, 2023 04:14
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.

None yet

2 participants