Make Ion's regalloc debug output easier to read
Categories
(Core :: JavaScript Engine: JIT, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox99 | --- | fixed |
People
(Reporter: jseward, Assigned: jseward)
Details
Attachments
(3 files)
This is in some sense a followup to bug 1686658.
The backtracking allocator's debug printing of live ranges and bundles is hard
to read and occasionally misleading. This patch makes it somewhat less "busy"
whilst not taking any more space than it did before. There is no functional
change. Details/examples to follow.
Assignee | ||
Comment 1•4 years ago
|
||
Changes:
-
Instruction-point ranges were previously printed as
[first_index, last_index+1)
,
except when printing LIR, where the formatfirst_index,last_index
is used.
Both are replaced with, simply,first_index-last_index
. -
For live range and live bundle printing, the set of use points is enclosed
in{
and}
so as to make it easier to see where the range ends. -
For live range use/def points, the index is printed first, followed by
_
. -
LUse
policy printing has been changed to be less mysterious:- "register":
r
changed toR
- "fixed":
r<reg>
changed toF:reg
- "any":
r?
(which is misleading, since it includes stack) changed toA
- "keepalive":
*
changed toKA
- "recovered_input":
**
changed toRI
- "register":
Hence
[RegAlloc] Instructions:
[RegAlloc] Block 0 [successor 1] [successor 2]
[RegAlloc] [2,3 WasmParameter] [def v1<g>:x23]
[RegAlloc] [4,5 WasmLoadSlot] [def v2<i>] [use v1:r]
...
[RegAlloc] Live ranges by bundle (after grouping/queueing regs):
[RegAlloc] v1 [3,32) (def) v1:r@4 v1:x23@15 v1:x23@25 v1:x23@31
[RegAlloc] v2 [5,12) (def) v2:r@6 v2:r@6 v2:r@8 ## v2 [16,24) v2:r@23
becomes
[RegAlloc] Instructions:
[RegAlloc] Block 0 [successor 1] [successor 2]
[RegAlloc] 2-3 WasmParameter [def v1<g>:x23]
[RegAlloc] 4-5 WasmLoadSlot [def v2<i>] [use v1:R]
...
[RegAlloc] Live ranges by bundle (after grouping/queueing regs):
[RegAlloc] v1 3-31 { 3_def 4_v1:R 15_v1:F:x23 25_v1:F:x23 31_v1:F:x23 }
[RegAlloc] v2 5-11 { 5_def 6_v2:R 6_v2:R 8_v2:R } ## v2 16-23 { 23_v2:R }
Finally, in AllocationIntegrityState::checkIntegrity()
, there is an
assertion which checks that no definition has multiple conflicting
assignments. This patch also adds printing to assist diagnosis of such
failures. It is guarded by both #ifdef JS_JITSPEW
and IONFLAGS=regalloc
.
Updated•4 years ago
|
Assignee | ||
Comment 2•3 years ago
|
||
The backtracking allocator's debug printing of live ranges, bundles and passes
is hard to read and occasionally misleading. This patch has the following
goals:
-
make printing of instruction-point ranges, live ranges and bundles less
cluttered -
enable consistent printing of fixed-register constraints in LUse and
LDefinition -
give LiveBundles identities of the form
LB<number>
in what is printed -
be clearer and generally more elegant about when regalloc passes begin and
end
There are no functional changes, and for non-JS_JITSPEW builds, no storage
changes.
Changes in detail (may not be exhaustive):
-
Instruction-point ranges were previously printed as
[first_index, last_index+1)
, except when printing LIR, where the format
first_index,last_index
is used. Both are replaced with
first_index-last_index
. -
For live range and live bundle printing, the set of use points is enclosed
in{
and}
so as to make it easier to see where the range ends. -
For live range use/def points, the index is printed first, followed by
_
.
If a def has an associated fixed assignment, that is now printed too. -
For LIR
MoveGroup
s, the destinations are now printed on the left. That
fixes an inconsistency in LIR printing wherein "normal" nodes had
destinations on the left butMoveGroup
s had destinations on the right. -
LUse policy printing has been changed to be less mysterious:
- "register":
r
changed toR
- "fixed":
r<reg>
changed toF:reg
- "any":
r?
(which is misleading, since it includes stack)
changed toA
- "keepalive":
*
changed toKA
- "recovered_input":
**
changed toRI
- "register":
-
To make LiveBundle creation/splitting easier to follow, LiveBundles now have
a zero-based integer index associated with them. This gives them identities
in the debug output. Also, the spillParent of each bundle is shown, so as to
expose the spill-parent/child relationships:LB4(parent=LB2 v1 3-3 { 3_def:F:rdi }) LB5(parent=LB2 v1 6-7 { 7_v1:F:rax }) LB2(parent=none v1 4-7 { })
-
There is some new debug printing in fn
ResolveControlFlow
. -
The initial live ranges (prior to grouping) and initial live bundles (after
grouping) are printed differently, to make it obvious that these things are
different C++ types. FunctiondumpVregs
has accordingly been split into
dumpLiveRangesByVReg
anddumpLiveRangesByBundle
. -
Some finessing of blank lines to make the boundaries between passes clear.
Finally, in AllocationIntegrityState::checkIntegrity
, there is an existing
assertion which checks that no definition has multiple conflicting
assignments. This patch also adds printing to assist diagnosis of such
failures. It is guarded by both JS_JITSPEW and IONFLAGS=regalloc.
Updated•3 years ago
|
Assignee | ||
Comment 3•3 years ago
|
||
Assignee | ||
Comment 4•3 years ago
|
||
Comment 6•3 years ago
|
||
bugherder |
Description
•