restore the vgpr pool, modified in openSumAtLeastUnroll(), in closeSumAtLeastUnroll() instead of in endSummation()
or it would cause vgpr aliasing when one obtains temporary vgprs in the tail loop
@@ -5281,8 +5281,6 @@ class KernelWriterAssembly(KernelWriter):
kStr += self.comment1("endSummation: add vgpr %u...%u to pool" % \
(self.startVgprValuA, self.lastVgprForReads))
- if self.savedVgprPool != None:
- self.vgprPool = self.savedVgprPool # restore vgprPool before alternate path
self.vgprPool.add(self.startVgprValuA, \
self.lastVgprForReads - self.startVgprValuA, "endSummation")
@@ -5650,6 +5648,9 @@ class KernelWriterAssembly(KernelWriter):
else:
label = self.getLabelNum("PrefetchGlobalLastIterEnd")
kStr += "label_%04u:%s" % (label, self.endLine)
+ if self.savedVgprPool != None:
+ self.vgprPool = self.savedVgprPool # restore vgprPool before alternate path
+ self.savedVgprPool = None
return kStr
##############################################################################
