Skip to content

Commit 7055823

Browse files
committed
Merge branch 'amd-member-shards' into dev3
2 parents e97889f + d6732e4 commit 7055823

14 files changed

Lines changed: 519 additions & 226 deletions

File tree

‎src/tensorforge/backend/instructions/batch_loop.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ def _gen_grouped(self, writer) -> None:
10891089
f'{self._group_start()}; '
10901090
f'{self._group_batch()} < {self._stacks()}; '
10911091
f'{self._group_batch()} += {self._stride}',
1092-
uniform=uniform):
1092+
uniform=uniform, batch=True):
10931093
mask = self._declare_row_element(writer)
10941094
self._lookahead_bindings(writer)
10951095
with self._spelled_indices(writer), \

‎src/tensorforge/backend/instructions/compute/multilinear.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2684,7 +2684,9 @@ def A_wave(writer, i, k, mults):
26842684
a_uniform=uniform,
26852685
A_wave=A_wave if k_stride is not None else None,
26862686
lockstep=self.convergence_scope() is not None,
2687-
a_shared=self._ops[0].symbol.stype is SymbolType.SharedMem,
2687+
# in shared memory, or headed there a trip at a time
2688+
a_shared=(self._ops[0].symbol.stype is SymbolType.SharedMem
2689+
or self._ops[0].symbol.streamed),
26882690
a_resident=self._ops[0].symbol.stype in (SymbolType.Register,
26892691
SymbolType.Scratch),
26902692
mult_stride=self._ask_mult_stride,

‎src/tensorforge/backend/instructions/ptr_manip.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,9 +1249,8 @@ def regions(self):
12491249
def barrier_scope(self):
12501250
"""A loop containing a barrier synchronizes, seen from outside -- as
12511251
`BatchLoop` says of its own body, which asks this of its instructions.
1252-
Silent, it would leave a staged member's block barriers
1253-
(`Generator._stage_member`) invisible to the block sizing that has to
1254-
allow them."""
1252+
Silent, it would leave the barriers of its body invisible to the block
1253+
sizing that has to allow them."""
12551254
inner = [i.barrier_scope() for i in self._region]
12561255
return max((s for s in inner if s is not None), default=None)
12571256

‎src/tensorforge/backend/pir/build.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2332,9 +2332,14 @@ def If(self, expression, uniform: Optional[Uniformity] = None,
23322332
guard=guard)
23332333

23342334
def For(self, argument, unroll=False,
2335-
uniform: Optional[Uniformity] = None) -> '_RawBlock':
2335+
uniform: Optional[Uniformity] = None,
2336+
batch: bool = False) -> '_RawBlock':
2337+
"""A loop whose head is text. `batch` says it is the traversal of
2338+
the batch -- the block's group spelled as text (`BatchLoop`) -- which
2339+
the passes that place something ahead of that loop look for
2340+
(`shards.shard_loads`)."""
23362341
return _RawBlock(self, f'{_unroll_pragma(unroll)}for ({argument})',
2337-
uniform=uniform)
2342+
uniform=uniform, batch=batch)
23382343

23392344
def While(self, argument) -> '_RawBlock':
23402345
return _RawBlock(self, f'while ({argument})')
@@ -2426,12 +2431,13 @@ class _RawBlock:
24262431

24272432
def __init__(self, builder: IRBuilder, text: str, pragma: Optional[str] = None,
24282433
uniform: Optional[Uniformity] = None,
2429-
guard: Optional[str] = None):
2434+
guard: Optional[str] = None, batch: bool = False):
24302435
self.builder = builder
24312436
self.text = text
24322437
self.pragma = pragma
24332438
self.uniform = uniform
24342439
self.guard = guard
2440+
self.batch = batch
24352441

24362442
def __enter__(self):
24372443
self.builder.push(kind='rawblock')
@@ -2446,6 +2452,8 @@ def __exit__(self, exc_type, exc, tb):
24462452
attrs = attrs + (('uniform', self.uniform),)
24472453
if self.guard is not None:
24482454
attrs = attrs + (('guard', self.guard),)
2455+
if self.batch:
2456+
attrs = attrs + (('batch', True),)
24492457
self.builder.emit(Stmt(op=Op.RAWBLOCK, regions=(region,), text=self.text,
24502458
pure=False, movable=False, effect=Effect.NONE,
24512459
attrs=attrs))

0 commit comments

Comments
 (0)