Closed fjeremic closed 3 years ago
First order of business is the easiest. I'll go through the list of tracing options and deprecate ones which are totally unused.
Summarized list of trace options not encompassed by traceOptimization
:
Option | Number of uses | Can be deprecated | Notes |
---|---|---|---|
TR_TraceILDeadCodeBasic | 0 | :heavy_check_mark: | Never used |
TR_TraceSpillCostsBasic | 0 | :heavy_check_mark: | Never used |
TR_TraceEarlyStackMap | 1 | ||
TR_TraceILValidator | 1 | ||
TR_TraceKnownObjectGraph | 1 | ||
TR_TraceLookahead | 1 | ||
TR_TraceCGPostInstructionSelection | 1 | :heavy_check_mark: | Can be fused with TR_TraceCG |
TR_TraceCGPostRegisterAssignment | 1 | :heavy_check_mark: | Can be fused with TR_TraceCG |
TR_TracePREForOptimalSubNodeReplacement | 1 | :heavy_check_mark: | This one is weird because it is a tracing option that affects performing of PRE transformations? |
TR_TraceCGPreInstructionSelection | 1 | :heavy_check_mark: | Can be fused with TR_TraceCG |
TR_TraceRegisterState | 1 | :heavy_check_mark: | Can be fused with TR_TraceRA but I don't ever recall this being used so we should just deprecate |
TR_TraceSEL | 1 | :heavy_check_mark: | Can be made into a traceOptimization |
TR_TraceTempUsage | 1 | :heavy_check_mark: | Can be fused with TR_TraceOptDetails |
TR_TraceTempUsageMore | 1 | :heavy_check_mark: | Can be fused with TR_TraceOptDetails |
TR_TraceLiveMonitorMetadata | 2 | ||
TR_TraceScalarizeSSOps | 2 | :heavy_check_mark: | Can be fused with trace VP but actually the optimization is never ran because of TR_ScalarizeSSOps so it should likely be deprecated |
TR_TraceVIP | 2 | :heavy_check_mark: | Used only on Z for BCD and can get rolled into trace CG |
TR_TraceMarkingOfHotFields | 3 | ||
TR_TraceCGMixedModeDisassembly | 3 | ||
TR_TraceTreePatternMatching | 3 | ||
TR_TraceVFPSubstitution | 3 | :heavy_check_mark: | Used only on x86 and seems non-invasive so it can likely be fused with trace CG |
TR_TraceLabelTargetNOPs | 4 | ||
TR_TraceCGPostBinaryEncoding | 4 | :heavy_check_mark: | Can be fused with TR_TraceCG |
TR_TraceTrivialDeadTreeRemoval | 4 | :heavy_check_mark: | Can be made into a traceOptimization |
TR_TraceCGPostBinaryEncoding | 5 | ||
TR_TraceReachability | 5 | ||
_traceForCodeMining | 5 | :heavy_check_mark: | Code mining has not been used in almost a decade |
TR_TraceBC | 6 | ||
TR_TraceMethodIndex | 6 | ||
TR_TraceRABasic | 6 | :heavy_check_mark: | Can be fused with TR_TraceRA |
TR_TraceRelocatableDataCG | 6 | ||
TR_TraceReloCG | 6 | ||
TR_TraceTrees | 6 | :heavy_check_mark: | Can be fused with one of the other global tracing options |
TR_TraceCGEvaluation | 7 | ||
_traceSimplifier | 7 | :heavy_check_mark: | Only used for multiplication decomposition and can get rolled into trace simplification |
TR_TraceOptTrees | 8 | :heavy_check_mark: | Can be fused with TR_TraceOptDetails |
TR_TraceAliases | 10 | ||
TR_TraceNonLinearRegisterAssigner | 11 | ||
TR_TraceRelocatableDataDetailsCG | 20 | ||
TR_TraceAddAndRemoveEdge | 24 | ||
TR_TraceRegisterPressureDetails | 29 | ||
TR_TraceUnsafeInlining | 30 | :heavy_check_mark: | Can be fused with trace inlining |
TR_TraceOSR | 99 | ||
TR_TraceBFGeneration | 123 | ||
TR_TraceBBVA | ??? | ||
TR_TraceCGBinaryCodedDecimal | ??? | ||
TR_TraceBVA | ??? | ||
TR_TraceCG | ??? | ||
TR_TraceDominators | ??? | ||
TR_TraceExitExtraction | ??? | ||
TR_TraceAll | ??? | ||
TR_TraceILGen | ??? | ||
TR_TraceILWalks | ??? | ||
TR_TraceLastOpt | ??? | ||
TR_TraceLiveness | ??? | ||
TR_TraceNodeFlags | ??? | ||
TR_TraceOpts | ??? | ||
TR_TracePartialInlining | ??? | ||
TR_TraceRelocatableDataDetailsRT | ??? | ||
TR_TraceRelocatableDataRT | ??? | ||
TR_TraceSA | ??? | ||
TR_TraceUseDefs | ??? | ||
TR_TraceValueNumbers | ??? | ||
TR_TraceVPConstraints | ??? |
Here is the remaining list of tracing options not under a traceOptimization
:
{"traceAddAndRemoveEdge", "L\ttrace edge addition and removal", SET_OPTION_BIT(TR_TraceAddAndRemoveEdge), "P" },
{"traceAliases", "L\ttrace alias set generation", SET_OPTION_BIT(TR_TraceAliases), "P" },
{"traceBBVA", "L\ttrace backward bit vector analysis", SET_OPTION_BIT(TR_TraceBBVA), "P" },
{"traceBC", "L\tdump bytecodes", SET_OPTION_BIT(TR_TraceBC), "P" },
{"traceBlockFrequencyGeneration", "L\ttrace block frequency generation", SET_OPTION_BIT(TR_TraceBFGeneration), "P"},
{"traceBVA", "L\ttrace bit vector analysis", SET_OPTION_BIT(TR_TraceBVA), "P" },
{"traceCG", "L\tdump output of code generation passes", SET_OPTION_BIT(TR_TraceCG), "P" },
{"traceCodeGen", "L\tdump output of code generation passes", SET_OPTION_BIT(TR_TraceCG), "P" },
{"traceDominators", "L\ttrace dominators and post-dominators", SET_OPTION_BIT(TR_TraceDominators), "P" },
{"traceExitExtraction", "L\ttrace extraction of structure nodes that unconditionally exit to outer regions", SET_OPTION_BIT(TR_TraceExitExtraction), "F"},
{"traceFull", "L\tturn on all trace options", SET_OPTION_BIT(TR_TraceAll), "P"},
{"traceILGen", "L\ttrace IL generator", SET_OPTION_BIT(TR_TraceILGen), "F"},
{"traceILValidator", "L\ttrace validation over intermediate language constructs",SET_OPTION_BIT(TR_TraceILValidator), "F" },
{"traceILWalk", "L\tsynonym for traceILWalks", SET_OPTION_BIT(TR_TraceILWalks), "P" },
{"traceILWalks", "L\ttrace iteration over intermediate language constructs", SET_OPTION_BIT(TR_TraceILWalks), "P" },
{"traceKnownObjectGraph", "L\ttrace the relationships between objects in the known-object table", SET_OPTION_BIT(TR_TraceKnownObjectGraph), "P" },
{"traceLastOpt", "L\textra tracing for the opt corresponding to lastOptIndex; usually used with traceFull", SET_OPTION_BIT(TR_TraceLastOpt), "F"},
{"traceLiveMonitorMetadata", "L\ttrace live monitor metadata", SET_OPTION_BIT(TR_TraceLiveMonitorMetadata), "F" },
{"traceLiveness", "L\ttrace liveness analysis", SET_OPTION_BIT(TR_TraceLiveness), "P" },
{"traceLookahead", "O\ttrace class lookahead", SET_OPTION_BIT(TR_TraceLookahead), "P"},
{"traceMarkingOfHotFields", "M\ttrace marking of Hot Fields", SET_OPTION_BIT(TR_TraceMarkingOfHotFields), "F"},
{"traceMethodIndex", "L\treport every method symbol that gets created and consumes a methodIndex", SET_OPTION_BIT(TR_TraceMethodIndex), "F"},
{"traceNodeFlags", "L\ttrace setting/resetting of node flags", SET_OPTION_BIT(TR_TraceNodeFlags), "F"},
{"traceNonLinearRA", "L\ttrace non-linear RA", SET_OPTION_BIT(TR_TraceNonLinearRegisterAssigner), "F"},
{"traceOpts", "L\tdump each optimization name", SET_OPTION_BIT(TR_TraceOpts), "P" },
{"traceOpts=", "L{regex}\tlist of optimizations to trace", TR::Options::setRegex, offsetof(OMR::Options, _optsToTrace), 0, "P"},
{"traceOSR", "L\ttrace OSR", SET_OPTION_BIT(TR_TraceOSR), "P"},
{"tracePREForSubNodeReplacement", "L\ttrace partial redundancy elimination focussed on optimal subnode replacement", SET_OPTION_BIT(TR_TracePREForOptimalSubNodeReplacement), "P" },
{"traceRA", "L\ttrace register assignment", SET_OPTION_BIT(TR_TraceRA), "P" },
{"traceReachability", "L\ttrace all analyses based on the reachability engine", SET_OPTION_BIT(TR_TraceReachability), "P"},
{"traceRegisterPressureDetails", "L\tinclude extra register pressure annotations in register pressure simulation and tree evaluation traces", SET_OPTION_BIT(TR_TraceRegisterPressureDetails), "P" },
{"traceRelocatableDataCG", "L\ttrace relocation data when generating relocatable code", SET_OPTION_BIT(TR_TraceRelocatableDataCG), "P"},
{"traceRelocatableDataDetailsCG", "L\ttrace relocation data details when generating relocatable code", SET_OPTION_BIT(TR_TraceRelocatableDataDetailsCG), "P"},
{"traceRelocatableDataDetailsRT", "L\ttrace relocation data details when relocating relocatable code", SET_OPTION_BIT(TR_TraceRelocatableDataDetailsRT), "P"},
{"traceRelocatableDataRT", "L\ttrace relocation data when relocating relocatable code", SET_OPTION_BIT(TR_TraceRelocatableDataRT), "P"},
{"traceReloCG", "L\ttrace relocation data details with generation info when generating relocatable code", SET_OPTION_BIT(TR_TraceReloCG),"P"},
{"traceStructuralAnalysis", "L\ttrace structural analysis", SET_OPTION_BIT(TR_TraceSA), "P"},
{"traceTreePatternMatching", "L\ttrace the functioning of the TR_Pattern framework", SET_OPTION_BIT(TR_TraceTreePatternMatching), "F"},
{"traceTrees", "L\tdump trees after each compilation phase", SET_OPTION_BIT(TR_TraceTrees), "P" },
{"traceUseDefs", "L\ttrace use def info", SET_OPTION_BIT(TR_TraceUseDefs), "F"},
{"traceValueNumbers", "L\ttrace value number info", SET_OPTION_BIT(TR_TraceValueNumbers), "F"},
{"traceVPConstraints", "L\ttrace the execution of value propagation merging and intersecting", SET_OPTION_BIT(TR_TraceVPConstraints), "F"},
The only ones left that we could possibly clean up is the relocating tracing. We seem to have 5 options for this:
@dsouzai thoughts on merging all of these tracing options into one? (if so which one to merge into?)
At most you could only merge them into two, something like TR_TraceReloCG
and TR_TraceReloRT
; the former being used for tracing during an AOT compile, the latter is used for information during an AOT load. However, some thoughts after scanning through the code:
TR_TraceRelocatableDataRT
and TR_TraceRelocatableDataDetailsRT
are pretty much useless because it's only used in [1]; you could just use -Xaot:aotrtDebugLevel=<nnn>
instead.TR_TraceReloCG
and TR_TraceRelocatableDataCG
TR_TraceRelocatableDataDetailsCG
into the other CG
options, but it seems to be somewhat more verbose, so that could affect timing.So probably just merge TR_TraceReloCG
into TR_TraceRelocatableDataCG
, and delete TR_TraceRelocatableDataDetailsRT
/TR_TraceRelocatableDataRT
.
The optimizer has a neat API called
traceOptimization
[1] which is used in the options table (example in [2]) to set a bit in a bitvector corresponding to the optimization ID. This mechanism is used later to test the bitvector to determine if a specific optimization will be traced.Before the start of each optimization the optimization ID is encoded into the VM state value, such that if we crash during an optimization we can decode the optimization ID during the jitdump process and enable tracing of the failing opt. using the optimization ID and the
traceOptimization
API.This is a great concept, however today it does not apply to all tracing that can be enabled. For example we completely lack this notion for codegen phases and certain types of more fine grained tracing. Some tracing also seems to be unused and can be eliminated.
The following is a list of all 166 tracing options we currently support sorted by use of
traceOptimization
:In total 80 / 166 trace options are using
traceOptimization
. Ideally we would live in a world where every section of the JIT could be mapped programatically to a trace option.[1] https://github.com/eclipse/omr/blob/c4a6b90d2bb38b967afeef46c0f35255297d0fe3/compiler/control/OMROptions.cpp#L4917-L4923 [2] https://github.com/eclipse/omr/blob/c4a6b90d2bb38b967afeef46c0f35255297d0fe3/compiler/control/OMROptions.cpp#L1176