Skip to content

InlineSDFG: verify that connectors have properly matching access nodes#2329

Merged
tbennun merged 2 commits intomainfrom
inline-ww-fix
Mar 26, 2026
Merged

InlineSDFG: verify that connectors have properly matching access nodes#2329
tbennun merged 2 commits intomainfrom
inline-ww-fix

Conversation

@tbennun
Copy link
Copy Markdown
Collaborator

@tbennun tbennun commented Mar 26, 2026

No description provided.

@tbennun tbennun requested review from acalotoiu and alexnick83 March 26, 2026 15:46
@tbennun tbennun enabled auto-merge March 26, 2026 18:32
@tbennun tbennun added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 0ec62e2 Mar 26, 2026
12 checks passed
@tbennun tbennun deleted the inline-ww-fix branch March 26, 2026 20:37
@romanc
Copy link
Copy Markdown
Contributor

romanc commented Mar 27, 2026

FWIW: we could probably make exceptions for these cases because there exists an explicit memlet path from the outer write access to the inlined write access. That's what StateFusion is doing:

# Write-Write hazard - data is output of both first and second
# states, without a read in between
write_write_candidates = ((fused_cc.first_outputs & fused_cc.second_outputs) - fused_cc.second_inputs)
# Find the leaf (topological) instances of the matches
order = [
x for x in reversed(list(nx.topological_sort(first_state._nx)))
if isinstance(x, nodes.AccessNode) and x.data in fused_cc.first_outputs
]
# Those nodes will be the connection points upon fusion
match_nodes: Dict[nodes.AccessNode, nodes.AccessNode] = {
next(n for n in order if n.data == match):
next(n for n in fused_cc.second_input_nodes if n.data == match)
for match in (fused_cc.first_outputs
& fused_cc.second_inputs)
}
# If we have potential candidates, check if there is a
# path from the first write to the second write (in that
# case, there is no hazard):
for cand in write_write_candidates:
nodes_first = [n for n in first_output if n.data == cand]
nodes_second = [n for n in second_output if n.data == cand]
# If there is a path for the candidate that goes through
# the match nodes in both states, there is no conflict
if not self._check_paths(first_state, second_state, match_nodes, nodes_first, nodes_second,
second_input, False, False):
return False
# End of write-write hazard check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants