-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
JIT: Propagate assertions into natural loops in global morph #110501
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Example diffs: var config = new Config { MaxSize = 4 };
var sum = 0;
for (var i = 0; i < config.MaxSize; i++) sum += 42;
return sum;
struct Config
{
public int MaxSize;
} Before: G_M24375_IG01: ;; offset=0x0000
;; size=0 bbWeight=0.25 PerfScore 0.00
G_M24375_IG02: ;; offset=0x0000
xor eax, eax
mov ecx, 4
;; size=7 bbWeight=0.25 PerfScore 0.12
G_M24375_IG03: ;; offset=0x0007
add eax, 42
dec ecx
jne SHORT G_M24375_IG03
;; size=7 bbWeight=4 PerfScore 6.00
G_M24375_IG04: ;; offset=0x000E
ret
;; size=1 bbWeight=1 PerfScore 1.00 After: G_M24375_IG01: ;; offset=0x0000
;; size=0 bbWeight=1 PerfScore 0.00
G_M24375_IG02: ;; offset=0x0000
mov eax, 168
;; size=5 bbWeight=1 PerfScore 0.25
G_M24375_IG03: ;; offset=0x0005
ret
;; size=1 bbWeight=1 PerfScore 1.00 Because now icon |
00efebf
to
decda0b
Compare
How can the library tests fail only on Linux-musl-arm while passing on all other targets? Does this ring any bells? |
Afair, that is the only target on our CI where we build everything on 64bit host (Linux-x64) so you need to be careful with |
This comment was marked as resolved.
This comment was marked as resolved.
The GenTree created on x64 is:
while on arm32 it's:
So we end up not clearing assertions for |
a76b7fc
to
4298c14
Compare
This is the same as #101763. I would pick that PR up and work off that as it had correctness fixes. It seems the same regressions still exist, so the real work here is to figure out why they happen and how to avoid them. |
d84fc00
to
dc8e022
Compare
New diffs after I increase the assertions limit to 2x Now regressions are mostly caused by newly unrolled loops, despite that the diff are majorly improvements. So the regressions we have before were caused by more assertions being created and unfortunately hit the limit, so that some assertions not being propagated anymore. We need to tune the limit if we want to make this go in. |
how do diffs look like if you increase the limit without your changes? As expected, the increased limit comes with a noticeable TP regression (~0.5%) |
@hez2010, the new change hides the perf regression. Please make the same change on base and rerun the diff and share with us.
|
I'm converting this into draft while finding out why the regression happens. |
Inspired by #109190, propagate assertions into natural loops in global morph as well, but don't publish the state.
Reuse the
m_loop
computed before.Also, track vector count flag in assertions becuase we can propagate a vector count constant into a loop bound to enable unrolling now.