-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
JitThroughputCLR JIT issues regarding speed of JIT itselfCLR JIT issues regarding speed of JIT itselfarea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone
Description
This issue proposes a series of changes to reduce the overhead and increase the fidelity of local variable reference counts in the jit. The main idea is to get rid of the current costly and buggy incremental count maintenance in favor of batch updates that are done just before accurate ref counts are needed.
See discussion in #8715 for background.
Expected impact is:
- 4-5% improvement in tier0 / minopts / debug throughput
- minimal impact to optimized jit throughput
- smaller frame sizes in some cases where reference counts are currently inflated
- removal of workarounds to artificially inflate reference counts to avoid asserts
The more accurate reference counts and weighted counts are likely to cause widespread codegen diffs. Hopefully these will mostly be improvements, but some regressions are certainly possible.
Proposed steps are:
- encapsulate accesses to
lvRefCntandlvRefCntWtdin an API, make backing fields private (Investigate preallocating space for ICollections/IIListProvider in SelectEnumerableIterator methods #18979) - characterize when ref count access and update is invalid, and update API to flag invalid access (System.Linq.Expressions factories throw NullReferenceException with global fields and global methods #19068)
- classify invalid accesses and figure out strategies for removing them (Add XmlSchema and Xslt test coverage for Non-Windows platforms #19012)
- once all invalid accesses are removed, add appropriate asserts to catch invalid accesses (System.Linq.Expressions factories throw NullReferenceException with global fields and global methods #19068)
- figure out what actions under
lvaMarkRefsare required for all compilations vs only needed when optimizing (WebUtility.HtmlDecode does not decode all HTML5 character entities #19103, JIT: refactor ref count computation into a reusable utility method coreclr#19240) - figure out minopts / debug codegen approach (WebUtility.HtmlDecode does not decode all HTML5 character entities #19103)
- ensure we have an algorithm that can properly recompute counts from scratch (NullReferenceException when calling Vector<float>.CopyTo in Release mode #19240)
- recompute counts after lower (Failed to cross build for ARM32 #19325)
- change from incremental updates to batched updates (System.Data.SqlClient.sln contains stresstest project that does not exist #19345)
- decide how often counts need to be made current (or track if they've possibly gone stale) (System.Data.SqlClient.sln contains stresstest project that does not exist #19345)
- sort through codegen diffs resulting from more accurate ref counts and fix what can be fixed (System.Data.SqlClient.sln contains stresstest project that does not exist #19345)
- try and clean up the logic in
lvaMarkRefsto split out ref counting from other activities
cc @dotnet/jit-contrib
category:implementation
theme:ir
skill-level:expert
cost:large
BruceForstall, mikedn, HFadeel and ikopylov
Metadata
Metadata
Assignees
Labels
JitThroughputCLR JIT issues regarding speed of JIT itselfCLR JIT issues regarding speed of JIT itselfarea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI