-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Force 2 iterations of OptRepeat #100473
Force 2 iterations of OptRepeat #100473
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Ouch, quite expensive (@SingleAccretion predicted similar numbers)
But of course that is quite non-trivial to guess whether you might benefit from the 2nd iter or not. Maybe if we study these diffs we'll figure out what we benefit the most from in most cases? |
Code size improvement from about 3 to 4.5MB. TP cost of about 20%. |
Lots of good ideas here. I agree that we wouldn't want to run it unconditionally. But running on big methods might be the most beneficial. And maybe we'd be willing to take the 20% TP cost for NAOT compiles. |
cc @dotnet/jit-contrib Example of enabling JitOptRepeat always, with 2 iterations. Code size improvement from about 3 to 4.5MB. TP cost of about 20%. |
bea3f5f
to
19c5d79
Compare
19c5d79
to
2c9dbda
Compare
Here is a run of asmdiffs on win-x64 between JitOptRepeat 2 and 3 iterations, showing there is some benefit to be had to run more than twice. Diffs are based on 2,384,245 contexts (931,974 MinOpts, 1,452,271 FullOpts). MISSED contexts: base: 7,980 (0.33%), diff: 8,122 (0.34%) Base JIT options: JitOptRepeat#* Diff JIT options: JitOptRepeat#*;JitOptRepeatCount#3 Overall (-149,570 bytes)
FullOpts (-149,570 bytes)
|
Sounds like 2 iterations are enough? 🙂 It'd be nice to have a breakdown TP report like @jakobbotsch did here for example to know what is the most expensive thing |
Here's a run of asmdiffs on win-x64 between JitOptRepeat 3 and 4 iterations. There's still diffs. Diffs are based on 2,384,210 contexts (931,974 MinOpts, 1,452,236 FullOpts). MISSED contexts: base: 8,122 (0.34%), diff: 8,157 (0.34%) Base JIT options: JitOptRepeat#*;JitOptRepeatCount#3 Diff JIT options: JitOptRepeat#*;JitOptRepeatCount#4 Overall (-71,360 bytes)
FullOpts (-71,360 bytes)
|
Here's a run of asmdiffs on win-x64 between JitOptRepeat 4 and 5 iterations. Diffs are based on 2,384,205 contexts (931,974 MinOpts, 1,452,231 FullOpts). MISSED contexts: base: 8,157 (0.34%), diff: 8,162 (0.34%) Base JIT options: JitOptRepeat#*;JitOptRepeatCount#4 Diff JIT options: JitOptRepeat#*;JitOptRepeatCount#5 Overall (-14,538 bytes)
FullOpts (-14,538 bytes)
|
And just "for fun", here is asmdiffs on win-x64 between JitOptRepeat 8 and 9 iterations! Yes, there are still diffs. One question: are optimization changes somehow monotonic, or is it possible the optimizations are oscillating (e.g., one iteration creates a CSE, another removes it)? Diffs are based on 2,384,201 contexts (931,974 MinOpts, 1,452,227 FullOpts). MISSED contexts: 8,166 (0.34%) Base JIT options: JitOptRepeat#*;JitOptRepeatCount#8 Diff JIT options: JitOptRepeat#*;JitOptRepeatCount#9 Overall (+4,080 bytes)
FullOpts (+4,080 bytes)
|
No description provided.