Skip to content

Commit

Permalink
add code so that the connection between GLB and dense scanner is remo…
Browse files Browse the repository at this point in the history
…ved only if the opal workaround option is set
  • Loading branch information
bobcheng15 committed May 7, 2024
1 parent cefe8b0 commit 152ac8e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sam/onyx/parse_dot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, *args: object) -> None:
class SAMDotGraph():

def __init__(self, filename=None, local_mems=True, use_fork=False,
use_fa=False, unroll=1, collat_dir=None) -> None:
use_fa=False, unroll=1, collat_dir=None, opal_workaround=False) -> None:
assert filename is not None, "filename is None"
self.graphs = pydot.graph_from_dot_file(filename)
self.graph = self.graphs[0]
Expand All @@ -31,6 +31,7 @@ def __init__(self, filename=None, local_mems=True, use_fork=False,
self.use_fa = use_fa
self.fa_color = 0
self.collat_dir = collat_dir
self.opal_workaround = opal_workaround

self.alu_nodes = []
self.shared_writes = {}
Expand Down Expand Up @@ -952,7 +953,7 @@ def rewrite_lookup(self):
# dense scanner is basically a counter that counts up to the dimension size
# and does not rely on the GLB tile to supply any data
glb_write = None
if not is_dense:
if not is_dense or not self.opal_workaround:
if f'{tensor}_{mode}_fiberlookup' in self.shared_writes and \
self.shared_writes[f'{tensor}_{mode}_fiberlookup'][1] is not None:
glb_write = self.shared_writes[f'{tensor}_{mode}_fiberlookup'][1]
Expand All @@ -975,7 +976,7 @@ def rewrite_lookup(self):
self.graph.add_node(memory)
# Glb to WR
# Dense scanner doesn't need data from the GLB, hence no connection to the GLB
if not is_dense:
if not is_dense or not self.opal_workaround:
glb_to_wr = pydot.Edge(src=glb_write, dst=wr_scan, label=f"glb_to_wr_{self.get_next_seq()}",
style="bold")
self.graph.add_edge(glb_to_wr)
Expand Down

0 comments on commit 152ac8e

Please sign in to comment.