[release/8.0] JIT: Fix exponential blowup of memory dependency arrays in VNForMapSelectWork #93388
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
ifstatements (or other control flow constructs) where eachifstatement 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
ifstatements then accesses a field that was written before all theifstatements. 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.