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

[release/8.0] JIT: Fix exponential blowup of memory dependency arrays in VNForMapSelectWork #93388

Merged
merged 5 commits into from Oct 12, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 12, 2023

Backport of #93344 to release/8.0

/cc @jakobbotsch

Customer Impact

Code of a particular shape may hit exponential blow-up when the JIT processes it as part of one of its optimizations. This can cause extreme memory usage (many gigabytes) and many orders of magnitude of slowdown, potentially showing up as a hang during JIT.

The affected code shape requires a long sequence of if statements (or other control flow constructs) where each if statement modifies memory in a way that the JIT is able to fully reason about it, for example by writing a particular class field and avoiding any calls to other functions.
The exponential behavior occurs if the code after this long sequence of if statements then accesses a field that was written before all the if statements. The PR includes a test case showing an example. The code shape may also be exposed after inlining performed by the JIT.

Reported by a customer with an issue opened on their behalf in #93342. Also hit by an internal customer.

Testing

Regression test is included. Also tested by internal customer and confirmed as fixing the issue. Stress testing also done as part of the original PR.

Risk

Low. The fix effectively replaces a dynamic array with a set.

…lectWork

Switch to sets when accumulating the memory dependencies found in
VNForMapSelectWork. Otherwise we might duplicate each memory dependency
for every path back to the store that induced it, and there can be an
exponential number of those.

Fix #93342
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Oct 12, 2023
@ghost
Copy link

ghost commented Oct 12, 2023

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

Backport of #93344 to release/8.0

/cc @jakobbotsch

Customer Impact

Testing

Risk

IMPORTANT: If this backport is for a servicing release, please verify that:

  • The PR target branch is release/X.0-staging, not release/X.0.

  • If the change touches code that ships in a NuGet package, you have added the necessary package authoring and gotten it explicitly reviewed.

Author: github-actions[bot]
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

Copy link
Member

@jeffschwMSFT jeffschwMSFT left a comment

Choose a reason for hiding this comment

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

approved. please get a code review. we will take for consideration in 8.0.x

@jeffschwMSFT jeffschwMSFT added the Servicing-consider Issue for next servicing release review label Oct 12, 2023
@jeffschwMSFT jeffschwMSFT added this to the 8.0.0 milestone Oct 12, 2023
@jeffschwMSFT jeffschwMSFT added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Oct 12, 2023
@carlossanlop carlossanlop merged commit 735d1ed into release/8.0 Oct 12, 2023
118 of 124 checks passed
@carlossanlop carlossanlop deleted the backport/pr-93344-to-release/8.0 branch October 12, 2023 22:10
@ghost ghost locked as resolved and limited conversation to collaborators Nov 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants