Reland "[turbolizer] Show basic block id in schedule phase"
This is a reland of commit 347142f647
This CL fix a bug for bolck onclick event, and improve compatibility
for old turbo-x.json files.
Original change's description:
> [turbolizer] Show basic block id in schedule phase
>
> In the schedule phase of turbolizer, there is only RPO number was
> shown, when we want to debug Builtin PGO or other modules, we
> would like to see the block id instead of RPO number.
>
> this CL add the support for displaying basic block id for schedule
> phase in turbolizer.
>
> Change-Id: I7a71f259230564400b683d598f68b6d064f1eb4d
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4068103
> Commit-Queue: Wenqin Yang <wenqin.yang@intel.com>
> Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#84625}
Change-Id: Ibaee4826678169d65e809bcad1e29587e480663f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4073861
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Wenqin Yang <wenqin.yang@intel.com>
Cr-Commit-Position: refs/heads/main@{#84645}
This commit is contained in:
parent
5a50750651
commit
3b4b217af2
@ -460,22 +460,14 @@ std::ostream& operator<<(std::ostream& os, const Schedule& s) {
|
||||
for (BasicBlock* block :
|
||||
((s.RpoBlockCount() == 0) ? *s.all_blocks() : *s.rpo_order())) {
|
||||
if (block == nullptr) continue;
|
||||
if (block->rpo_number() == -1) {
|
||||
os << "--- BLOCK id:" << block->id();
|
||||
} else {
|
||||
os << "--- BLOCK B" << block->rpo_number();
|
||||
}
|
||||
os << "--- BLOCK B" << block->rpo_number() << " id" << block->id();
|
||||
if (block->deferred()) os << " (deferred)";
|
||||
if (block->PredecessorCount() != 0) os << " <- ";
|
||||
bool comma = false;
|
||||
for (BasicBlock const* predecessor : block->predecessors()) {
|
||||
if (comma) os << ", ";
|
||||
comma = true;
|
||||
if (predecessor->rpo_number() == -1) {
|
||||
os << "id:" << predecessor->id();
|
||||
} else {
|
||||
os << "B" << predecessor->rpo_number();
|
||||
}
|
||||
os << "B" << predecessor->rpo_number();
|
||||
}
|
||||
os << " ---\n";
|
||||
for (Node* node : *block) {
|
||||
@ -498,11 +490,7 @@ std::ostream& operator<<(std::ostream& os, const Schedule& s) {
|
||||
for (BasicBlock const* successor : block->successors()) {
|
||||
if (comma) os << ", ";
|
||||
comma = true;
|
||||
if (successor->rpo_number() == -1) {
|
||||
os << "id:" << successor->id();
|
||||
} else {
|
||||
os << "B" << successor->rpo_number();
|
||||
}
|
||||
os << "B" << successor->rpo_number();
|
||||
}
|
||||
os << "\n";
|
||||
}
|
||||
|
@ -61,10 +61,11 @@ export class SchedulePhase extends Phase {
|
||||
const blockIdStrings = blockIdsString.split(",");
|
||||
predecessors = blockIdStrings.map(n => Number.parseInt(n, 10));
|
||||
}
|
||||
const blockRpo = Number.parseInt(match.groups.rpo, 10);
|
||||
const blockId = Number.parseInt(match.groups.id, 10);
|
||||
const block = new ScheduleBlock(blockId, match.groups.deferred !== undefined,
|
||||
const block = new ScheduleBlock(blockRpo, blockId, match.groups.deferred !== undefined,
|
||||
predecessors.sort());
|
||||
this.data.blocks[block.id] = block;
|
||||
this.data.blocks_rpo[block.rpo] = block;
|
||||
}
|
||||
|
||||
private setGotoSuccessor = match => {
|
||||
@ -82,7 +83,10 @@ export class SchedulePhase extends Phase {
|
||||
process: this.createNode
|
||||
},
|
||||
{
|
||||
lineRegexps: [/^\s*---\s*BLOCK\ B(?<id>\d+)\s*(?<deferred>\(deferred\))?(\ <-\ )?(?<in>[^-]*)?\ ---$/],
|
||||
lineRegexps: [
|
||||
/^\s*---\s*BLOCK\ B(?<rpo>\d+)\ id(?<id>\d+)\s*(?<deferred>\(deferred\))?(\ <-\ )?(?<in>[^-]*)?\ ---$/,
|
||||
/^\s*---\s*BLOCK\ B(?<rpo>\d+)\s*(?<deferred>\(deferred\))?(\ <-\ )?(?<in>[^-]*)?\ ---$/
|
||||
],
|
||||
process: this.createBlock
|
||||
},
|
||||
{
|
||||
@ -109,13 +113,15 @@ export class ScheduleNode {
|
||||
}
|
||||
|
||||
export class ScheduleBlock {
|
||||
rpo: number;
|
||||
id: number;
|
||||
deferred: boolean;
|
||||
predecessors: Array<number>;
|
||||
successors: Array<number>;
|
||||
nodes: Array<ScheduleNode>;
|
||||
|
||||
constructor(id: number, deferred: boolean, predecessors: Array<number>) {
|
||||
constructor(rpo: number, id: number, deferred: boolean, predecessors: Array<number>) {
|
||||
this.rpo = rpo;
|
||||
this.id = id;
|
||||
this.deferred = deferred;
|
||||
this.predecessors = predecessors;
|
||||
@ -126,15 +132,15 @@ export class ScheduleBlock {
|
||||
|
||||
export class ScheduleData {
|
||||
nodes: Array<ScheduleNode>;
|
||||
blocks: Array<ScheduleBlock>;
|
||||
blocks_rpo: Array<ScheduleBlock>;
|
||||
|
||||
constructor() {
|
||||
this.nodes = new Array<ScheduleNode>();
|
||||
this.blocks = new Array<ScheduleBlock>();
|
||||
this.blocks_rpo = new Array<ScheduleBlock>();
|
||||
}
|
||||
|
||||
public lastBlock(): ScheduleBlock {
|
||||
if (this.blocks.length == 0) return null;
|
||||
return this.blocks[this.blocks.length - 1];
|
||||
if (this.blocks_rpo.length == 0) return null;
|
||||
return this.blocks_rpo[this.blocks_rpo.length - 1];
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ export class ScheduleView extends TextView {
|
||||
public initializeContent(schedule: SchedulePhase, rememberedSelection: SelectionStorage): void {
|
||||
this.divNode.innerHTML = "";
|
||||
this.schedule = schedule;
|
||||
this.addBlocks(schedule.data.blocks);
|
||||
this.addBlocks(schedule.data.blocks_rpo);
|
||||
this.show();
|
||||
if (rememberedSelection) {
|
||||
const adaptedSelection = this.adaptSelection(rememberedSelection);
|
||||
@ -85,15 +85,15 @@ export class ScheduleView extends TextView {
|
||||
scheduleBlock.classList.toggle("deferred", block.deferred);
|
||||
|
||||
const [start, end] = this.sourceResolver.instructionsPhase
|
||||
.getInstructionRangeForBlock(block.id);
|
||||
.getInstructionRangeForBlock(block.rpo);
|
||||
const instrMarker = this.createElement("div", "instr-marker com", "⊙");
|
||||
instrMarker.setAttribute("title", `Instructions range for this block is [${start}, ${end})`);
|
||||
instrMarker.onclick = this.mkBlockLinkHandler(block.id);
|
||||
instrMarker.onclick = this.mkBlockLinkHandler(block.rpo);
|
||||
scheduleBlock.appendChild(instrMarker);
|
||||
|
||||
const blockId = this.createElement("div", "block-id com clickable", String(block.id));
|
||||
blockId.onclick = this.mkBlockLinkHandler(block.id);
|
||||
scheduleBlock.appendChild(blockId);
|
||||
const blockRpo_Id = this.createElement("div", "block-id com clickable", String(block.rpo) + " Id:" + String(block.id));
|
||||
blockRpo_Id.onclick = this.mkBlockLinkHandler(block.rpo);
|
||||
scheduleBlock.appendChild(blockRpo_Id);
|
||||
const blockPred = this.createElement("div", "predecessor-list block-list comma-sep-list");
|
||||
for (const pred of block.predecessors) {
|
||||
const predEl = this.createElement("div", "block-id com clickable", String(pred));
|
||||
@ -114,7 +114,7 @@ export class ScheduleView extends TextView {
|
||||
blockSucc.appendChild(succEl);
|
||||
}
|
||||
if (block.successors.length) scheduleBlock.appendChild(blockSucc);
|
||||
this.addHtmlElementForBlockId(block.id, scheduleBlock);
|
||||
this.addHtmlElementForBlockId(block.rpo, scheduleBlock);
|
||||
return scheduleBlock;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user