Move acc->vgpr copying after buffer_load's are issued
also:
occupancy check for vgpr/agpr pool; fix true vgpr count; add accvgpr count
@@ -1861,7 +1861,7 @@ class KernelWriterAssembly(KernelWriter):
# Register Pools
########################################
#print "TotalVgprs", self.totalVgprs
- self.vgprPool = RegisterPool(max(self.totalVgprs, self.totalAgprs), 'v', defaultPreventOverflow=False,
+ self.vgprPool = RegisterPool(self.totalVgprs, 'v', defaultPreventOverflow=False,
printRP=self.db["PrintRP"])
#print self.vgprPool.state()
self.savedVgprPool = None
@@ -2434,6 +2434,7 @@ class KernelWriterAssembly(KernelWriter):
self.startVgprAddressDbg)
#kStr += self.comment1("Occu: %u waves/simd" % self.numWavesPerSimd )
kStr += self.comment1("Num VGPR=%u"%self.vgprPool.size())
+ kStr += self.comment1("Num AccVGPR=%u"%self.agprPool.size())
########################################
@@ -10325,14 +10326,6 @@ class KernelWriterAssembly(KernelWriter):
if edge and self.db["AssertNoEdge"]:
kStr += self.bomb() # should not get here
- if codeAccVgprRead is not None:
- assert(self.serializedStore) # sanity check
- for elementIdx in range(0, len(batchElements)):
- for vi in range(0, gwvw):
- if len(codeAccVgprRead.items()) > 0:
- kStr += str(codeAccVgprRead.items().pop(0)).replace("__placeholder__", str(ss.elementSumIdx[elementIdx]+vi))
- kStr += inst("s_nop 1", "2 wait state required between accvgpr_read and buffer_load")
-
for elementIdx in range(0, len(batchElements)):
element = batchElements[elementIdx]
addr = ss.elementAddr[elementIdx].addrVgpr
@@ -10452,6 +10445,16 @@ class KernelWriterAssembly(KernelWriter):
if edge and (beta or atomic):
kStr += inst("s_mov_b64", "exec", -1, "full mask -1 -> exec" )
+ ########################################
+ # AccVgpr read
+ if codeAccVgprRead is not None:
+ assert(self.serializedStore) # sanity check
+ for elementIdx in range(0, len(batchElements)):
+ for vi in range(0, gwvw):
+ if len(codeAccVgprRead.items()) > 0:
+ kStr += str(codeAccVgprRead.items().pop(0)).replace("__placeholder__", str(ss.elementSumIdx[elementIdx]+vi))
+ kStr += inst("s_nop 1", "2 wait states required before reading vgpr")
+
########################################
# rC *= alpha
if not kernel["InterleaveAlpha"] and applyAlpha:
@@ -11056,7 +11059,7 @@ class KernelWriterAssembly(KernelWriter):
vgprPerCU = 65536
vgprPerThreadPerOccupancy = vgprPerCU // kernel["NumThreads"]
- numWorkGroupsPerCU = vgprPerThreadPerOccupancy // self.vgprPool.size()
+ numWorkGroupsPerCU = vgprPerThreadPerOccupancy // max(self.vgprPool.size(), self.agprPool.size())
if numWorkGroupsPerCU < 1:
self.overflowedResources = 4
