-
Notifications
You must be signed in to change notification settings - Fork 5.3k
JIT: update debug dumping for loop hoisting #59287
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
Conversation
I kept adding stuff like this whenever I wanted to understand why hosting was doing what it was doing, so figured it likely had lasting value.
|
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsI kept adding stuff like this whenever I wanted to understand why hosting was
|
|
@BruceForstall PTAL Sample jit dump fragment Note we skip hosting from the inner loop block BB03 because it is conditionally executed. Added todos to the code for this (echoing some of what's over in #35735). |
BruceForstall
left a comment
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.
Thanks for doing this!
src/coreclr/jit/optimizer.cpp
Outdated
| { | ||
| if (optLoopTable[lnum].lpFlags & LPFLG_REMOVED) | ||
| { | ||
| JITDUMP("\nLoop L%02u was removed\n", lnum); |
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.
We now have FMT_LP
src/coreclr/jit/optimizer.cpp
Outdated
| { | ||
| // Do this loop, then recursively do all nested loops. | ||
| CLANG_FORMAT_COMMENT_ANCHOR; | ||
| JITDUMP("\n%s L%02u\n", optLoopTable[lnum].lpParent == BasicBlock::NOT_IN_LOOP ? "Loop Nest" : "Nested Loop", lnum); |
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.
same
src/coreclr/jit/optimizer.cpp
Outdated
| if (pLoopDsc->lpFlags & LPFLG_ONE_EXIT) | ||
| { | ||
| assert(pLoopDsc->lpExit != nullptr); | ||
| JITDUMP(" Only considering hosting in blocks that dominate exit block " FMT_BB "\n", pLoopDsc->lpExit->bbNum); |
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.
typo: hosting
src/coreclr/jit/optimizer.cpp
Outdated
| // If we didn't reach the entry block, give up and *just* push the entry block. | ||
| if (cur != pLoopDsc->lpEntry) | ||
| { | ||
| JITDUMP(" -- odd, we didn't reach entry from exit via dominators. Only considering hosting in entry " |
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.
typo: hosting
src/coreclr/jit/optimizer.cpp
Outdated
| } | ||
| else // More than one exit | ||
| { | ||
| JITDUMP(" only considering hosting in entry block " FMT_BB "\n", pLoopDsc->lpEntry->bbNum); |
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.
typo: hosting
src/coreclr/jit/optimizer.cpp
Outdated
| // Don't hoist expressions that are not heavy: tree->GetCostEx() < (2*IND_COST_EX) | ||
| if (tree->GetCostEx() < (2 * IND_COST_EX)) | ||
| { | ||
| JITDUMP(" tree cost too low: %d < %d (lvc %u >= arc %u)\n", tree->GetCostEx(), 2 * IND_COST_EX, |
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.
IMO, spelling out the variables here would be better. (same below)
src/coreclr/jit/optimizer.cpp
Outdated
| if (!child.m_invariant) | ||
| { | ||
| treeIsInvariant = false; | ||
| INDEBUG(failReason = "variant child";); |
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.
nit: I presume you only need one of the semicolons (here and below)
|
Oh, I was going to use "Loop Hoisting" as an example of a jit area that needs more diagnostic info in my write-up 😐 |
I kept adding stuff like this whenever I wanted to understand why hosting was
doing what it was doing, so figured it likely had lasting value.