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

JIT: more likelihood checking #99541

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

AndyAyersMS
Copy link
Member

@AndyAyersMS AndyAyersMS commented Mar 11, 2024

Check has likelihood and likelihood sum consistency all the way until rationalize.

Several phases required a bit of revision, notably the multi-guess type test expansion (similar to GDV) and optimize bools.

Fix carry-over issue from previous round where block and edge scaling in loop cloning used different factors.

Contributes to #93020

(Continuation of #99460)

Diffs

Check has likelihood and likelihood sum consistency all the way until
rationalize.

Several phases required a bit of revision, notably the multi-guess type
test expansion (similar to GDV) and optimize bools.

Fix carry-over issue from previous round where block and edge scaling
in loop cloning used different factors.

Contributes to dotnet#93020
@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 Mar 11, 2024
Copy link
Contributor

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

@AndyAyersMS
Copy link
Member Author

Arm failure:

Assert failure(PID 21 [0x00000015], Thread: 37 [0x0025]): (GetComponentSize() <= 2) || IsArray()
    File: /__w/1/s/src/coreclr/vm/methodtable.cpp:7024
    Image: /root/helix/work/correlation/dotnet

This PR passed in draft form, so issue is likely unrelated.

@AndyAyersMS
Copy link
Member Author

AndyAyersMS commented Mar 11, 2024

GetComponentSize

Seems like an instance of #86273, already known to build analysis.

Copy link
Member

@amanasifkhalid amanasifkhalid left a comment

Choose a reason for hiding this comment

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

LGTM, I'm excited to see how far along this is. I imagine flowgraph modifications after block layout aren't all that frequent?

FlowEdge* oldEdge = bSrc->GetFalseEdge();
jmpBlk = fgNewBBafter(BBJ_ALWAYS, bSrc, true);
FlowEdge* const oldEdge = bSrc->GetFalseEdge();
// Access the likelihood of oldEdge before
Copy link
Member

Choose a reason for hiding this comment

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

Good catch, I probably should've paid more attention to the diffs this likelihood weirdness would've caused when I changed SetTargetEdge to set the likelihood.


// review: we assume length check always succeeds??
trueEdge->setLikelihood(1.0);
falseEdge->setLikelihood(0.0);
Copy link
Member

Choose a reason for hiding this comment

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

cc @dotnet/jit-contrib -- what do you think?

// Predecessor is the nullcheck, control reaches on false.
//
curTypeCheckBb->inheritWeight(nullcheckBb);
curTypeCheckBb->scaleBBWeight(nullcheckBb->GetFalseEdge()->getLikelihood());
Copy link
Member

Choose a reason for hiding this comment

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

Once edge likelihood propagation is done, we'll probably want to combine these two methods into one, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

I will probably add a float overload for inherit weight. I might try and redo the old GDV likelihoods so they're [0..1] instead of [0..100].

@AndyAyersMS
Copy link
Member Author

LGTM, I'm exciting to see how far along this is. I imagine flowgraph modifications after block layout aren't all that frequent?

Not sure yet. There are some. Looking at lower's switch expansion now.

@AndyAyersMS
Copy link
Member Author

Only a handful of diffs.

@AndyAyersMS AndyAyersMS merged commit 64a061f into dotnet:main Mar 12, 2024
127 of 129 checks passed
janvorli pushed a commit to janvorli/runtime that referenced this pull request Mar 12, 2024
Check has likelihood and likelihood sum consistency all the way until
rationalize.

Several phases required a bit of revision, notably the multi-guess type
test expansion (similar to GDV) and optimize bools.

Fix carry-over issue from previous round where block and edge scaling
in loop cloning used different factors.

Contributes to dotnet#93020
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants