Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Make GT_LIST processing non-recursive to avoid StackOverflow. #7071

Merged
merged 1 commit into from
Sep 8, 2016

Conversation

erozenfeld
Copy link
Member

We had some internal cases where crossgen failed with StackOverflow exception
when compiling huge methods. In particular, the methods had GT_PHI nodes with
huge number of arguments.

StackOverflow was happening in multiple places. Recent LIR changes eliminated two of those places,
these changes eliminate two more: gtSetEvalOrder and fgDebugCheckFlags (debug only). We already had
gtSetListOrder but it was only used for call arg lists. I made gtSetListOrder non-recursive and also generalized
to handle other GT_LIST nodes.

With that with these changes the huge repros can now be crossgen'd.

I verified no assembly diffs in SuperPMI.

I'm verifying overall throughput effect.

@dotnet/jit-contrib PTAL


ftreg |= next->gtRsvdRegs;
// TODO: Do we have to compute costs differently for argument lists and
Copy link

Choose a reason for hiding this comment

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

@briansull any idea on this question?

Choose a reason for hiding this comment

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

I don't have any real insight into this, but in my experience you would get at least some asm diffs if you had changed the cost computation.


In reply to: 77853136 [](ancestors = 77853136)

Choose a reason for hiding this comment

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

These cost are just a best estimate of code size and execution time.

It can impact things such a places in the JIT where we would like to duplicate a piece of code.
The JIT will do so if the cost is low and omit the duplication if the cost is too high.

Other than that the costs can be off by a lot without having much impact on what code the JIT generates.

@pgavlin
Copy link

pgavlin commented Sep 7, 2016

The mechanics look good to me, but we should take care of those TODOs before merging.

@erozenfeld
Copy link
Member Author

The way I have it, the costs are calculated exactly the same way they were before my change. I'd like to keep this a no-diffs change. Whether we want to unify the way costs are calculated for arg lists vs. other lists is orthogonal to this change.

@pgavlin
Copy link

pgavlin commented Sep 7, 2016

@erozenfeld: let's file an issue to track this, then, and update the comment accordingly.

@CarolEidt
Copy link

It makes sense to me to file an issue on this, but it's not clear how critical an issue this would be. At this point, there aren't all that many non-call-arg uses of lists, and I suspect the costing ought to be similar, but also not sure how much it matters.


In reply to: 245333065 [](ancestors = 245333065)

@CarolEidt
Copy link

:shipit:

We had some internal cases where crossgen failed with StackOverflow exception
when compiling huge methods. In particular, the methods had GT_PHI nodes with
huge number of arguments.

StackOverflow was happening in multiple places. Recent LIR changes eliminated two of those places,
these changes eliminate two more: gtSetEvalOrder and fgDebugCheckFlags (debug only). We already had
gtSetListOrder but it was only used for call arg lists. I made gtSetListOrder non-recursive and also generalized
to handle other GT_LIST nodes.

With that with these changes the huge repros can now be crossgen'd.

I verified no assembly diffs in SuperPMI.

I'm verifying overall throughput effect.
@erozenfeld
Copy link
Member Author

I opened #7095 and updated the TODO comments.

@briansull
Copy link

LGTM

@erozenfeld
Copy link
Member Author

@dotnet-bot test OSX x64 Checked Build and Test

@erozenfeld
Copy link
Member Author

I verified no measurable throughput impact when ngen-ing desktop assemblies.

@erozenfeld erozenfeld merged commit 871bb90 into dotnet:master Sep 8, 2016
@erozenfeld erozenfeld deleted the StackOverflow branch September 8, 2016 22:28
Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/coreclr that referenced this pull request Mar 29, 2019
…ad (dotnet#7071)

* Change Timer implementation on Unixes to use only one scheduling thread

- Separated from dotnet/corert#7066

* Address feedback from dotnet/corert#7066

* Remove reference to s_lock

* Reduce work inside lock

* Move _id

* Fix duplicate timers in scheduled timer list, move info to TimerQueue

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
jkotas pushed a commit that referenced this pull request Mar 29, 2019
…ad (#7071)

* Change Timer implementation on Unixes to use only one scheduling thread

- Separated from dotnet/corert#7066

* Address feedback from dotnet/corert#7066

* Remove reference to s_lock

* Reduce work inside lock

* Move _id

* Fix duplicate timers in scheduled timer list, move info to TimerQueue

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
buyaa-n pushed a commit to buyaa-n/coreclr that referenced this pull request Apr 1, 2019
…ad (dotnet#7071)

* Change Timer implementation on Unixes to use only one scheduling thread

- Separated from dotnet/corert#7066

* Address feedback from dotnet/corert#7066

* Remove reference to s_lock

* Reduce work inside lock

* Move _id

* Fix duplicate timers in scheduled timer list, move info to TimerQueue

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Make GT_LIST processing non-recursive to avoid StackOverflow.

Commit migrated from dotnet/coreclr@871bb90
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…ad (dotnet/coreclr#7071)

* Change Timer implementation on Unixes to use only one scheduling thread

- Separated from dotnet/corert#7066

* Address feedback from dotnet/corert#7066

* Remove reference to s_lock

* Reduce work inside lock

* Move _id

* Fix duplicate timers in scheduled timer list, move info to TimerQueue

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>


Commit migrated from dotnet/coreclr@6e215e1
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants