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

Prevent domtree construction from overflowing for large functions #31531

Merged
merged 3 commits into from
Mar 29, 2019

Conversation

vchuravy
Copy link
Member

Backend's that perform aggressive inlining (e.g TPU/GPU) can produce
larger functions than normal Julia, which sometimes can trigger a
stack-overflow in domtree construction.

As an example see vchuravy/GPUifyLoops.jl#46 (comment)

This backports a commit from kf/tpu3 which switches from a recursive function
to a worklist. The assoicated test-case fails on master, but finishes with
these changes.

Keno and others added 2 commits March 28, 2019 18:32
One of the first things you learn when working on a production compiler
is that you should never do recursion over the structure of the input
(because the input tends to be significantly larger). Now, I ignored
that in a couple of places when writing the optimizer, because let's
face it, Julia functions don't tend to be THAAT big (for values of THAAT
around 200k basic blocks), because we limit inlining. The TPU backend
however, reuses the julia compiler infrastructure with much more aggressive
inlining settings, making function that large not uncommon. Switch
to a worklist.
@vchuravy vchuravy requested a review from Keno March 28, 2019 23:14
base/compiler/ssair/domtree.jl Outdated Show resolved Hide resolved
base/compiler/ssair/domtree.jl Outdated Show resolved Hide resolved
@vchuravy
Copy link
Member Author

Should squash on merge

@vchuravy vchuravy merged commit 5875d8c into master Mar 29, 2019
@vchuravy vchuravy deleted the vc/snca_worklist branch March 29, 2019 12:36
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.

2 participants