reduce valu instructions for optSingleColVgpr case
@@ -9501,7 +9501,9 @@ class KernelWriterAssembly(KernelWriter):
elif self.optSingleColVgpr:
self.numAddrVgpr = 1
self.sharedColDVgprs = kernelWriter.vgprPool.checkOut(1, "sharedColDVgprs")
- if kernel["GroupLoadStore"] and kernel["ProblemType"]["UseBeta"]:
+ self.singleColDAddrUpdated = False
+ self.singleColCAddrUpdated = False
+ if kernel["ProblemType"]["UseBeta"]:
self.sharedColCVgprs = kernelWriter.vgprPool.checkOut(1, "sharedColCVgprs")
else:
self.sharedColCVgprs = self.sharedColDVgprs
@@ -9906,6 +9908,12 @@ class KernelWriterAssembly(KernelWriter):
assert (kw.coord0 == self.coord0Vgpr) # elementAddr assignment above assumes these are the same
if singleUpdate:
updatedAddr = True
+ singleColAddrUpdated = ss.singleColCAddrUpdated if (tc == 'C') else ss.singleColDAddrUpdated
+ if not singleColAddrUpdated or not ss.optSrdIncForRow:
+ if tc == 'C':
+ ss.singleColCAddrUpdated = True
+ else:
+ ss.singleColDAddrUpdated = True
kStr += inst("_v_add_lshl_u32", \
vgpr(addrVgpr), \
vgpr(rowPtr), \
@@ -10453,6 +10461,9 @@ class KernelWriterAssembly(KernelWriter):
# print("numVgprsPerAddr=%u, numVgprsPerDataPerVI=%u, numVgprPerValuC=%u"%(self.ss.cfg.numVgprsPerAddr, self.ss.cfg.numVgprsPerDataPerVI, self.ss.cfg.numVgprPerValuC))
numVgprsPerElement = self.ss.cfg.numVgprPerValuC*gwvw + self.ss.cfg.numVgprsPerAddr + int(ceil(self.ss.cfg.numVgprsPerDataPerVI * gwvw))
+ if kernel["GroupLoadStore"] and kernel["ProblemType"]["UseBeta"]:
+ numVgprsPerElement += self.ss.cfg.numVgprsPerAddr
+
#print self.vgprPool.state()
# Use VGPR up to next occupancy threshold:
maxVgprs = self.getMaxRegsForOccupancy(kernel["NumThreads"], self.vgprPool.size(), self.getLdsSize(kernel), self.agprPool.size())
@@ -11742,9 +11753,9 @@ class KernelWriterAssembly(KernelWriter):
for elementIdx in range(0, len(batchElements)):
if not ss.sharedColDVgprs:
addrDVgpr = ss.elementAddr[elementIdx].addrDVgpr
- self.vgprPool.checkIn(addrDVgpr)
- if kernel["GroupLoadStore"] and kernel["ProblemType"]["UseBeta"]:
addrCVgpr = ss.elementAddr[elementIdx].addrCVgpr
+ self.vgprPool.checkIn(addrDVgpr)
+ if addrCVgpr != addrDVgpr:
self.vgprPool.checkIn(addrCVgpr)
data = ss.elementData[elementIdx]
