Skip to content

Commit

Permalink
Improve compatibility with hierarchical SDFGs
Browse files Browse the repository at this point in the history
  • Loading branch information
phschaad committed Jan 25, 2024
1 parent e4a9a5a commit 6988be1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/overlays/memory_location_overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class MemoryLocationOverlay extends GenericSdfgOverlay {
if (node instanceof SDFGNode) {
if (node.data?.node?.scope_entry !== undefined &&
node.parent_id !== null) {
scopeNode = node.sdfg.nodes[node.parent_id].nodes[
scopeNode = node.parentElem?.data.state.nodes[
node.data.node.scope_entry
];
parentId = node.parent_id;
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/renderer_elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,7 @@ export class ScopeNode extends SDFGNode {
public schedule_label(): string {
let attrs = this.attributes();
if (this.scopeend() && this.parent_id !== null) {
const entry = this.sdfg.nodes[this.parent_id].nodes[
const entry = this.parentElem?.data.state.nodes[
this.data.node.scope_entry
];
if (entry !== undefined)
Expand Down Expand Up @@ -1715,7 +1715,7 @@ export class ScopeNode extends SDFGNode {

let attrs = this.attributes();
if (this.scopeend() && this.parent_id !== null) {
const entry = this.sdfg.nodes[this.parent_id].nodes[
const entry = this.parentElem?.data.state.nodes[
this.data.node.scope_entry
];
if (entry !== undefined)
Expand Down Expand Up @@ -1753,7 +1753,7 @@ export class ScopeNode extends SDFGNode {

let result = '';
if (this.scopeend() && this.parent_id !== null) {
const entry = this.sdfg.nodes[this.parent_id].nodes[
const entry = this.parentElem?.data.state.nodes[
this.data.node.scope_entry
];
if (entry !== undefined)
Expand Down
8 changes: 5 additions & 3 deletions src/sdfv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class SDFV {

// If a scope has children, remove the name "Entry" from the type
if (node.type().endsWith('Entry') && node.parent_id && node.id) {
const state = node.sdfg.nodes[node.parent_id];
const state = node.parentElem?.data.state.nodes[node.parent_id];
if (state.scope_dict[node.id] !== undefined) {
node_type = node_type.slice(0, -5);
}
Expand All @@ -194,7 +194,9 @@ export class SDFV {
const nodes_to_display = [node];
if (node.type().endsWith('Entry') && node.parent_id &&
node.id) {
const state = node.sdfg.nodes[node.parent_id];
const state = node.parentElem?.data.state.nodes[
node.parent_id
];
if (state.scope_dict[node.id] !== undefined) {
for (const subnode_id of state.scope_dict[node.id])
nodes_to_display.push(parent.node(subnode_id));
Expand Down Expand Up @@ -241,7 +243,7 @@ export class SDFV {
contents.html('');

if (elem instanceof Memlet && elem.parent_id && elem.id) {
const sdfg_edge = elem.sdfg.nodes[elem.parent_id].edges[elem.id];
const sdfg_edge = elem.parentElem?.data.state.edges[elem.id];
contents.append($('<h4>', {
html: 'Connectors: ' + sdfg_edge.src_connector + ' &rarr; ' +
sdfg_edge.dst_connector,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/sdfg/traversal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import {
// Traverse scopes recursively (if scope_dict provided).
if (node.type().endsWith('Entry') && node.parent_id !== null &&
node.id !== null) {
const state = node.sdfg.nodes[node.parent_id];
const state = node.parentElem?.data.state;
if (state.scope_dict[node.id] !== undefined)
scopesRecursive(
graph, state.scope_dict[node.id], processedNodes
Expand Down

0 comments on commit 6988be1

Please sign in to comment.