for packed, set groOffsetInMacroTile=False
Packed needs to extract/massage the full packed index, see comment
@@ -751,7 +751,13 @@ class KernelWriterAssembly(KernelWriter):
# groOffsetInMacroTile doesn't work with pointer-shift because it sets the SRD to point to the
# start of the macro-tile - if we overhang by small number of elements (<GRVW) then can't shift
# back to get all the data.
- self.groOffsetInMacroTile = kernel["BufferLoad"]
+ # groOffsetInMacroTile doesn't work with packed dims since these need to set SRD to the tensor base
+ # then extract the packed dimensions from the flattened index (including the workgroup) and scale by strides
+ # - the index is per-work-item so can't put work-group into the SRD
+ if len(kernel["PackedC0IndicesX"])==1 and len(kernel["PackedC1IndicesX"])==1 and kernel["BufferLoad"]:
+ self.groOffsetInMacroTile = 1
+ else:
+ self.groOffsetInMacroTile = 0
# use 64-bit buffer limit shadow register
self.use64bPbcLimit = 1 and kernel["BufferLoad"]
@@ -5995,7 +6001,8 @@ class KernelWriterAssembly(KernelWriter):
#if 0 and self.localWriteDoCnt >= 0:
localWriteCode.addInst( "s_waitcnt lgkmcnt(0) & vmcnt(0)", "")
localWriteCode.addInst("s_barrier", "dump LDS" )
- localWriteCode.addText(self.assert_eq(sgpr("LoopCounters+0"), 1))
+ localWriteCode.addText(self.assert_ne(sgpr("WorkGroup0"),1))
+ #localWriteCode.addText(self.assert_eq(sgpr("LoopCounters+0"), 1))
#localWriteCode.addText(self.bomb())
return imod
@@ -6672,7 +6679,7 @@ class KernelWriterAssembly(KernelWriter):
sgpr("WorkGroup1"), \
"<- wg1*MT1")
- # Overall strategy is to set the SRD to the start of the row that contains the output tile.
+ # Overall strategy is to set the SRD to the top-left of the macro-tile.
# TT offsets are from this base (and include the column)
# In non-packed mode:
