fix additional sync when PGR=0,PLR=1
@@ -1062,10 +1062,8 @@ class KernelWriter(metaclass=abc.ABCMeta):
self.localWriteACode = Code.Module()
self.localWriteBCode = Code.Module()
- # which iteration to perform the local writes
- # if scheduleLocalWrite=0, all local writes performed in this iteration
- # if scheduleLocalWrite=1, writes are scheduled backwards from this iteration
- # If PLR=0, the writes are placed in the last loop iteration
+ # localWriteEndIter is used to determine which iteration to put sync
+ # if PGR=0, GR,LW,sync,LR will put at front of loop.
localWriteEndIter = kernel["LoopIters"] - self.numItersPLR - 1
# Schedule the global read, global read inc, and writes:
@@ -1171,6 +1169,7 @@ class KernelWriter(metaclass=abc.ABCMeta):
waitLWCode = Code.Module()
syncCode = Code.Module()
# put barrier at localWriteEndIter+1
+ if kernel["PrefetchGlobalRead"]:
if u == localWriteEndIter+1:
if self.enable["Wait"]:
waitLWCode.addCode(self.wait(kernel, tensorParametersA, tensorParametersB, -1, 0, -1, \
