Skip to content

Conversation

@jakobbotsch
Copy link
Member

The physical promotion heuristic was basing all decisions on an estimate of execution cost. One problematic thing is that that estimate is scaled by block weights. This does not allow us to take into account that blocks that are never executed still has some cost associated with increased code size.

This changes the accounting pass to track unweighted counts and uses the unweighted counts as part of the heuristic. The new heuristic check is then that we improve the execution cost, but also that we only allow up to some amount of size regression depending on how many cycles we estimate to gain.

The physical promotion heuristic was basing all decisions on an estimate
of execution cost. One problematic thing is that that estimate is scaled
by block weights. This does not allow us to take into account that
blocks that are never executed still has some cost associated with
increased code size.

This changes the accounting pass to track unweighted counts and uses the
unweighted counts as part of the heuristic. The new heuristic check is
then that we improve the execution cost, but also that we only allow up
to some amount of size regression depending on how many cycles we
estimate to gain.
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jun 23, 2023
@ghost ghost assigned jakobbotsch Jun 23, 2023
@ghost
Copy link

ghost commented Jun 23, 2023

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

Issue Details

The physical promotion heuristic was basing all decisions on an estimate of execution cost. One problematic thing is that that estimate is scaled by block weights. This does not allow us to take into account that blocks that are never executed still has some cost associated with increased code size.

This changes the accounting pass to track unweighted counts and uses the unweighted counts as part of the heuristic. The new heuristic check is then that we improve the execution cost, but also that we only allow up to some amount of size regression depending on how many cycles we estimate to gain.

Author: jakobbotsch
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@jakobbotsch jakobbotsch marked this pull request as ready for review June 23, 2023 19:29
@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @AndyAyersMS

Diffs with physical promotion, diffs without old promotion.

@jakobbotsch jakobbotsch requested a review from AndyAyersMS June 23, 2023 19:30
@jakobbotsch jakobbotsch merged commit e2c1534 into dotnet:main Jun 23, 2023
@jakobbotsch jakobbotsch deleted the physical-promotion-size-heuristic branch June 23, 2023 22:41
@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