Fix multi-sum bug for >=3 summations
@@ -4145,8 +4145,9 @@ class KernelWriterAssembly(KernelWriter):
kStr += self.comment("compute globalReadInc for higher-level loop")
tmpSgpr = self.getTmpSgpr(3)
- unrollLoopCounter = "LoopCounters+%u"%self.unrollIdx
# Summations always appear in both A and B, can compute number of iterations just once:
+ if loopIdxPrev==self.unrollIdx:
+ unrollLoopCounter = "LoopCounters+%u"%self.unrollIdx
if tP["isA"]:
quotient = unrollLoopCounter
dividend = "SizesSum+%u"%self.unrollIdx
@@ -4160,9 +4161,11 @@ class KernelWriterAssembly(KernelWriter):
kStr += inst("s_mul_i32", sgpr(unrollLoopCounter), sgpr(unrollLoopCounter), \
kernel["GlobalSplitU"]*kernel["DepthU"], \
"=UnrollLoopCounter*DepthU")
-
kStr += inst("s_mul_i32", sgpr(graInc), stridePrev, sgpr(unrollLoopCounter), \
"<- stride%s%s * myWgUnrollIters" %(tc, loopCharPrev))
+ else:
+ kStr += inst("s_mul_i32", sgpr(graInc), stridePrev, self.size(tc, dimIdxPrev), \
+ "<- stride%s%s * size%s%s" %(tc, loopCharPrev, tc, loopCharPrev))
# subtract amount that previous inner loop will have already incremented:
kStr += inst("s_sub_i32", sgpr(graInc), \
@@ -6275,6 +6278,7 @@ class KernelWriterAssembly(KernelWriter):
if tmpLocalWriteAddr != -1:
self.vgprPool.checkIn(tmpLocalWriteAddr)
+
# localWriteDoCnt<=2 is prefetch if PrefetchGlobalRead:
if 0 and tP["isB"]: # post-lds-write
#if 0 and self.localWriteDoCnt >= 0:
