-
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: Enable compaction of all BBJ_ALWAYS
blocks
#103785
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting (and impressive) that this has so much impact.
Can you see if this further improves the case in #4324? RBO was blocked there because of un-compacted blocks.
noway_assert((block->bbWeight == BB_ZERO_WEIGHT) || (bNext->bbWeight == BB_ZERO_WEIGHT)); | ||
block->bbSetRunRarely(); | ||
} | ||
if (hasProfileWeight) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ineheritWeight
already takes care of setting the flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was running into cases where we'd compact a block with BBF_PROF_WEIGHT
set, with a block without the flag, so inheritWeight
would unset the flag. I'm guessing we'd want to keep this flag set in such cases, so I added this workaround.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. If you remember the cases it might be worth seeing how we end up with a mixture of profiled and unprofiled blocks. Would be nice to systematically reduce how often this happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can take another look, but I first noticed this when we would compact a block with profile data with an internal block.
Codegen is identical with and without this change; not sure how much of this is driven by weird block layout decisions (without PGO data, ordering conditional blocks' successors is pretty arbitrary), but
|
Yeah, IG06/IG07 is a missed case for RBO. No need to retest a value we've just set to zero |
Part of #93020. Removes any reference to
bbNext
in block compaction, and instead considers compacting each block with its jump target regardless of their relative positions in the blocklist. This can churn the flowgraph significantly, but so long as this churn happens before block layout, we can rely onoptOptimizeLayout
to create a sensible layout regardless of the initial churn. However, since we can runfgUpdateFlowGraph
after we've reordered blocks (such as during lowering), I updatedfgUpdateFlowGraph
's signature to control whether we enable compaction of non-contiguous blocks to avoid changing the block layout.The logic for updating profile data during compaction looked like it could be simplified, though I'm not sure if my change is overly simplistic; this change seems to have churned
fgComputeBlockWeights
, hence the large PerfScore diffs. Diffs as a whole are dramatic, though they're inflated largely bylibraries_tests
.cc @dotnet/jit-contrib, @AndyAyersMS PTAL. Thanks!