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: don't set edge weights to zero for inconsistent profiles #87947

Merged

Conversation

AndyAyersMS
Copy link
Member

With the advent of scalable profile counters (or even with the old racing counters) counts might be approximate or inconsistent. When we run across a negative count during reconstruction, set the afflicted count to a small positive value instead of to zero, since zero has special meaning to the JIT.

The aim is to reduce some of the benchmark instability we are seeing in #87324. Depending on exact counter values, we can see different sets of edge weights (and hence block weights) from run to run.

With the advent of scalable profile counters (or even with the old racing
counters) counts might be approximate or inconsistent. When we run across a
negative count during reconstruction, set the afflicted count to a small
positive value instead of to zero, since zero has special meaning to the JIT.

The aim is to reduce some of the benchmark instability we are seeing in dotnet#87324.
Depending on exact counter values, we can see different sets of edge weights
(and hence block weights) from run to run.
@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 Jun 22, 2023
@ghost ghost assigned AndyAyersMS Jun 22, 2023
@ghost
Copy link

ghost commented Jun 22, 2023

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

Issue Details

With the advent of scalable profile counters (or even with the old racing counters) counts might be approximate or inconsistent. When we run across a negative count during reconstruction, set the afflicted count to a small positive value instead of to zero, since zero has special meaning to the JIT.

The aim is to reduce some of the benchmark instability we are seeing in #87324. Depending on exact counter values, we can see different sets of edge weights (and hence block weights) from run to run.

Author: AndyAyersMS
Assignees: AndyAyersMS
Labels:

area-CodeGen-coreclr

Milestone: -

@AndyAyersMS
Copy link
Member Author

@EgorBo PTAL
cc @dotnet/jit-contrib

Small number of diffs/missed contexts expected.

@AndyAyersMS AndyAyersMS requested a review from EgorBo June 22, 2023 23:07
// If we end up with negative edge weights because of inconsistent counts, we use this factor to
// substitute a small positive one.
//
weight_t const smallFactor = 0.001;
Copy link
Member

Choose a reason for hiding this comment

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

there is ProfileSynthesis.epsilon that probably can be used here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea, good idea. Updated.

@AndyAyersMS AndyAyersMS merged commit 5180e8a into dotnet:main Jun 24, 2023
127 checks passed
@ghost ghost locked as resolved and limited conversation to collaborators Jul 24, 2023
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