Skip to content

Commit

Permalink
Edges and Overlays Optimizations (#141)
Browse files Browse the repository at this point in the history
* graph startup collapsed, group overlay bug, collapsed NestedSDFG lod change

* added missing comment

* added code to layouter to order the connectors (much less edges intertwine)

* first code for summarised edges, adjusted nodesep & ranksep

* removed edge summary for tasklets, added summary symbol

* changed edge summary symbol, hovering nodes and connectors shows summarised edges

* fixed error when selecting memlet

* fixed fill_info to show memlet src/dst connectors

* fixed summary symbol toggled on when not applicable

* added shift+rightclick to expand, ctrl+scroll to verticalscroll

* memory overlays LOD threshold fixes

* overlays state LOD changes

* renderer loop region bugfix and overlay comment

* fixed LogicalGroupOverlay on by default but UI not updated, optimized code if logical groups array has length 0

* AvgParallelismOverlay reworked lod code based on new renderer

* STATE_LOD comment, changed all LOD threshold checks to strict inequalities

* DepthOverlay lod rework

* OpIntOverlay lod rework

* Overlays State lod rework, removed debug

* changed spelling to summarize

* moved Dagre layout options to sdfv.ts

* removed commented out section, formatting adjusted
  • Loading branch information
LeandroTreu authored May 3, 2024
1 parent 4a5fbc7 commit a4588fd
Show file tree
Hide file tree
Showing 12 changed files with 530 additions and 153 deletions.
22 changes: 11 additions & 11 deletions src/overlays/avg_parallelism_overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ export class AvgParallelismOverlay extends GenericSdfgOverlay {
))
return;

if (((ctx as any).lod && (ppp >= SDFV.STATE_LOD ||
block.width / ppp <= SDFV.STATE_LOD)) ||
const stateppp = Math.sqrt(block.width * block.height) / ppp;
if (((ctx as any).lod && (stateppp < SDFV.STATE_LOD)) ||
block.attributes()?.is_collapsed) {
this.shadeNode(block, ctx);
} else if (block instanceof State) {
Expand All @@ -245,20 +245,20 @@ export class AvgParallelismOverlay extends GenericSdfgOverlay {
visibleRect.y, visibleRect.w, visibleRect.h))
return;

if (node.data.node.attributes.is_collapsed ||
((ctx as any).lod && ppp >= SDFV.NODE_LOD)) {
this.shadeNode(node, ctx);
} else {
if (node instanceof NestedSDFG &&
node.attributes().sdfg &&
node.attributes().sdfg.type !== 'SDFGShell') {
if (node instanceof NestedSDFG && !node.data.node.attributes.is_collapsed) {
const nodeppp = Math.sqrt(node.width * node.height) / ppp;
if ((ctx as any).lod && nodeppp < SDFV.STATE_LOD) {
this.shadeNode(node, ctx);
}
else if (node.attributes().sdfg && node.attributes().sdfg.type !== 'SDFGShell') {
this.recursivelyShadeCFG(
node.data.graph, ctx, ppp, visibleRect
);
} else {
this.shadeNode(node, ctx);
}
}
else {
this.shadeNode(node, ctx);
}
});
}
} else if (block instanceof ControlFlowRegion) {
Expand Down
22 changes: 11 additions & 11 deletions src/overlays/depth_overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ export class DepthOverlay extends GenericSdfgOverlay {
))
return;

if (((ctx as any).lod && (ppp >= SDFV.STATE_LOD ||
state.width / ppp <= SDFV.STATE_LOD)) ||
const stateppp = Math.sqrt(state.width * state.height) / ppp;
if (((ctx as any).lod && (stateppp < SDFV.STATE_LOD)) ||
state.data.state.attributes.is_collapsed) {
this.shade_node(state, ctx);
} else {
Expand All @@ -230,20 +230,20 @@ export class DepthOverlay extends GenericSdfgOverlay {
visible_rect.y, visible_rect.w, visible_rect.h))
return;

if (node.data.node.attributes.is_collapsed ||
((ctx as any).lod && ppp >= SDFV.NODE_LOD)) {
this.shade_node(node, ctx);
} else {
if (node instanceof NestedSDFG &&
node.attributes().sdfg &&
node.attributes().sdfg.type !== 'SDFGShell') {
if (node instanceof NestedSDFG && !node.data.node.attributes.is_collapsed) {
const nodeppp = Math.sqrt(node.width * node.height) / ppp;
if ((ctx as any).lod && nodeppp < SDFV.STATE_LOD) {
this.shade_node(node, ctx);
}
else if (node.attributes().sdfg && node.attributes().sdfg.type !== 'SDFGShell') {
this.recursively_shade_sdfg(
node.data.graph, ctx, ppp, visible_rect
);
} else {
this.shade_node(node, ctx);
}
}
else {
this.shade_node(node, ctx);
}
});
}
}
Expand Down
13 changes: 9 additions & 4 deletions src/overlays/logical_group_overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,13 @@ export class LogicalGroupOverlay extends GenericSdfgOverlay {
// In that case, we overlay the correct grouping color(s).
// If it's expanded or zoomed in close enough, we traverse inside.
const sdfgGroups = sdfg.attributes.logical_groups;
if (sdfgGroups === undefined)
if (sdfgGroups === undefined || sdfgGroups.length === 0) {
return;
}

if (!graph) {
return;
}

graph?.nodes().forEach(v => {
const block = graph.node(v);
Expand All @@ -101,8 +106,8 @@ export class LogicalGroupOverlay extends GenericSdfgOverlay {
))
return;

if (((ctx as any).lod && (ppp >= SDFV.STATE_LOD ||
block.width / ppp <= SDFV.STATE_LOD)) ||
const blockppp = Math.sqrt(block.width * block.height) / ppp;
if (((ctx as any).lod && (blockppp < SDFV.STATE_LOD)) ||
block.attributes().is_collapsed
) {
this.shadeNode(block, sdfgGroups, ctx);
Expand All @@ -121,7 +126,7 @@ export class LogicalGroupOverlay extends GenericSdfgOverlay {
return;

if (node.attributes().is_collapsed ||
((ctx as any).lod && ppp >= SDFV.NODE_LOD)) {
((ctx as any).lod && ppp > SDFV.NODE_LOD)) {
this.shadeNode(node, sdfgGroups, ctx);
} else {
if (node instanceof NestedSDFG &&
Expand Down
10 changes: 6 additions & 4 deletions src/overlays/memory_location_overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,10 @@ export class MemoryLocationOverlay extends GenericSdfgOverlay {
))
return;

if (((ctx as any).lod && (ppp >= SDFV.STATE_LOD ||
block.width / ppp <= SDFV.STATE_LOD)) ||
const stateppp = Math.sqrt(block.width * block.height) / ppp;
if (((ctx as any).lod && (stateppp < SDFV.STATE_LOD)) ||
block.attributes()?.is_collapsed) {
// The block is collapsed or invisible, so we don't need to
// The state is collapsed or too small, so we don't need to
// traverse its insides.
return;
} else if (block instanceof State) {
Expand All @@ -267,7 +267,9 @@ export class MemoryLocationOverlay extends GenericSdfgOverlay {
node.data.graph, ctx, ppp, visibleRect
);
} else if (node instanceof AccessNode) {
this.shadeNode(node, ctx);
if (!(ctx as any).lod || ppp < SDFV.NODE_LOD) {
this.shadeNode(node, ctx);
}
}
});
}
Expand Down
23 changes: 13 additions & 10 deletions src/overlays/memory_volume_overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,20 +173,19 @@ export class MemoryVolumeOverlay extends GenericSdfgOverlay {
graph.nodes().forEach(v => {
const block: ControlFlowBlock = graph.node(v);

// If we're zoomed out enough that the contents aren't visible, we
// skip the state.
if ((ctx as any).lod && (
ppp >= SDFV.STATE_LOD || block.width / ppp < SDFV.STATE_LOD
))
return;

// If the node's invisible, we skip it.
if ((ctx as any).lod && !block.intersect(
visibleRect.x, visibleRect.y,
visibleRect.w, visibleRect.h
) || block.attributes()?.is_collapsed)
return;

// If we're zoomed out enough that the contents aren't visible, we
// skip the state.
const stateppp = Math.sqrt(block.width * block.height) / ppp;
if ((ctx as any).lod && (stateppp < SDFV.STATE_LOD))
return;

if (block instanceof State) {
const state_graph = block.data.graph;
if (state_graph) {
Expand All @@ -203,7 +202,7 @@ export class MemoryVolumeOverlay extends GenericSdfgOverlay {
// If we're zoomed out enough that the node's contents
// aren't visible or the node is collapsed, we skip it.
if (node.data.node.attributes.is_collapsed ||
((ctx as any).lod && ppp >= SDFV.NODE_LOD))
((ctx as any).lod && ppp > SDFV.NODE_LOD))
return;

if (node instanceof NestedSDFG &&
Expand All @@ -218,8 +217,12 @@ export class MemoryVolumeOverlay extends GenericSdfgOverlay {
state_graph.edges().forEach((e: any) => {
const edge: Edge = state_graph.edge(e);

if ((ctx as any).lod && !edge.intersect(visibleRect.x,
visibleRect.y, visibleRect.w, visibleRect.h))
// Skip if edge is invisible, or zoomed out far
if ((ctx as any).lod
&& (!edge.intersect(visibleRect.x, visibleRect.y, visibleRect.w, visibleRect.h)
|| ppp > SDFV.EDGE_LOD
)
)
return;

this.shadeEdge(edge, ctx);
Expand Down
22 changes: 11 additions & 11 deletions src/overlays/operational_intensity_overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ export class OperationalIntensityOverlay extends GenericSdfgOverlay {
))
return;

if (((ctx as any).lod && (ppp >= SDFV.STATE_LOD ||
state.width / ppp <= SDFV.STATE_LOD)) ||
const stateppp = Math.sqrt(state.width * state.height) / ppp;
if (((ctx as any).lod && (stateppp < SDFV.STATE_LOD)) ||
state.data.state.attributes.is_collapsed) {
this.shade_node(state, ctx);
} else {
Expand All @@ -273,20 +273,20 @@ export class OperationalIntensityOverlay extends GenericSdfgOverlay {
visible_rect.y, visible_rect.w, visible_rect.h))
return;

if (node.data.node.attributes.is_collapsed ||
((ctx as any).lod && ppp >= SDFV.NODE_LOD)) {
this.shade_node(node, ctx);
} else {
if (node instanceof NestedSDFG &&
node.attributes().sdfg &&
node.attributes().sdfg.type !== 'SDFGShell') {
if (node instanceof NestedSDFG && !node.data.node.attributes.is_collapsed) {
const nodeppp = Math.sqrt(node.width * node.height) / ppp;
if ((ctx as any).lod && nodeppp < SDFV.STATE_LOD) {
this.shade_node(node, ctx);
}
else if (node.attributes().sdfg && node.attributes().sdfg.type !== 'SDFGShell') {
this.recursively_shade_sdfg(
node.data.graph, ctx, ppp, visible_rect
);
} else {
this.shade_node(node, ctx);
}
}
else {
this.shade_node(node, ctx);
}
});
}
}
Expand Down
22 changes: 11 additions & 11 deletions src/overlays/runtime_micro_seconds_overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ export class RuntimeMicroSecondsOverlay extends RuntimeReportOverlay {
))
return;

if (((ctx as any).lod && (ppp >= SDFV.STATE_LOD ||
state.width / ppp <= SDFV.STATE_LOD)) ||
const stateppp = Math.sqrt(state.width * state.height) / ppp;
if (((ctx as any).lod && (stateppp < SDFV.STATE_LOD)) ||
state.data.state.attributes.is_collapsed) {
this.shade_node(state, ctx);
} else {
Expand All @@ -146,20 +146,20 @@ export class RuntimeMicroSecondsOverlay extends RuntimeReportOverlay {
visible_rect.y, visible_rect.w, visible_rect.h))
return;

if (node.data.node.attributes.is_collapsed ||
((ctx as any).lod && ppp >= SDFV.NODE_LOD)) {
this.shade_node(node, ctx);
} else {
if (node instanceof NestedSDFG &&
node.attributes().sdfg &&
node.attributes().sdfg.type !== 'SDFGShell') {
if (node instanceof NestedSDFG && !node.data.node.attributes.is_collapsed) {
const nodeppp = Math.sqrt(node.width * node.height) / ppp;
if ((ctx as any).lod && nodeppp < SDFV.STATE_LOD) {
this.shade_node(node, ctx);
}
else if (node.attributes().sdfg && node.attributes().sdfg.type !== 'SDFGShell') {
this.recursively_shade_sdfg(
node.data.graph, ctx, ppp, visible_rect
);
} else {
this.shade_node(node, ctx);
}
}
else {
this.shade_node(node, ctx);
}
});
}
}
Expand Down
22 changes: 11 additions & 11 deletions src/overlays/simulated_operational_intensity_overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ export class SimulatedOperationalIntensityOverlay extends GenericSdfgOverlay {
))
return;

if (((ctx as any).lod && (ppp >= SDFV.STATE_LOD ||
state.width / ppp <= SDFV.STATE_LOD)) ||
const stateppp = Math.sqrt(state.width * state.height) / ppp;
if (((ctx as any).lod && (stateppp < SDFV.STATE_LOD)) ||
state.data.state.attributes.is_collapsed) {
this.shade_node(state, ctx);
} else {
Expand All @@ -236,20 +236,20 @@ export class SimulatedOperationalIntensityOverlay extends GenericSdfgOverlay {
visible_rect.y, visible_rect.w, visible_rect.h))
return;

if (node.data.node.attributes.is_collapsed ||
((ctx as any).lod && ppp >= SDFV.NODE_LOD)) {
this.shade_node(node, ctx);
} else {
if (node instanceof NestedSDFG &&
node.attributes().sdfg &&
node.attributes().sdfg.type !== 'SDFGShell') {
if (node instanceof NestedSDFG && !node.data.node.attributes.is_collapsed) {
const nodeppp = Math.sqrt(node.width * node.height) / ppp;
if ((ctx as any).lod && nodeppp < SDFV.STATE_LOD) {
this.shade_node(node, ctx);
}
else if (node.attributes().sdfg && node.attributes().sdfg.type !== 'SDFGShell') {
this.recursively_shade_sdfg(
node.data.graph, ctx, ppp, visible_rect
);
} else {
this.shade_node(node, ctx);
}
}
else {
this.shade_node(node, ctx);
}
});
}
}
Expand Down
22 changes: 11 additions & 11 deletions src/overlays/static_flops_overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ export class StaticFlopsOverlay extends GenericSdfgOverlay {
))
return;

if (((ctx as any).lod && (ppp >= SDFV.STATE_LOD ||
state.width / ppp <= SDFV.STATE_LOD)) ||
const stateppp = Math.sqrt(state.width * state.height) / ppp;
if (((ctx as any).lod && (stateppp < SDFV.STATE_LOD)) ||
state.data.state.attributes.is_collapsed) {
this.shade_node(state, ctx);
} else {
Expand All @@ -230,20 +230,20 @@ export class StaticFlopsOverlay extends GenericSdfgOverlay {
visible_rect.y, visible_rect.w, visible_rect.h))
return;

if (node.data.node.attributes.is_collapsed ||
((ctx as any).lod && ppp >= SDFV.NODE_LOD)) {
this.shade_node(node, ctx);
} else {
if (node instanceof NestedSDFG &&
node.attributes().sdfg &&
node.attributes().sdfg.type !== 'SDFGShell') {
if (node instanceof NestedSDFG && !node.data.node.attributes.is_collapsed) {
const nodeppp = Math.sqrt(node.width * node.height) / ppp;
if ((ctx as any).lod && nodeppp < SDFV.STATE_LOD) {
this.shade_node(node, ctx);
}
else if (node.attributes().sdfg && node.attributes().sdfg.type !== 'SDFGShell') {
this.recursively_shade_sdfg(
node.data.graph, ctx, ppp, visible_rect
);
} else {
this.shade_node(node, ctx);
}
}
else {
this.shade_node(node, ctx);
}
});
}
}
Expand Down
Loading

0 comments on commit a4588fd

Please sign in to comment.