If LdcEqualsLdd, use same SGPR for StridesD
@@ -1390,6 +1390,10 @@ class KernelWriterAssembly(KernelWriter):
self.numSgprStridesB -= 1
self.numSgprSizesSum = kernel["ProblemType"]["NumIndicesSummation"]
+ # Number of D strides to actually load into SGPR
+ # Save some SGPR if LdcEqualsLdd
+ self.numSgprStridesDToLoad = 0 if kernel["LdcEqualsLdd"] else self.numSgprStridesD
+
self.numSgprSizesFree = kernel["ProblemType"]["NumIndicesC"]
self.numSgprAddressDbg = self.rpga if globalParameters["DebugKernel"] else 0
@@ -1451,7 +1455,7 @@ class KernelWriterAssembly(KernelWriter):
self.defineSgpr("GSUSumIdx", 2 if kernel["GlobalSplitU"] > 1 else 0)
self.defineSgpr("AddressD", numSgprAddressD)
self.defineSgpr("AddressC", numSgprAddressC)
- self.defineSgpr("StridesD", self.numSgprStridesD)
+ self.defineSgpr("StridesD", self.numSgprStridesDToLoad)
self.defineSgpr("StridesC", self.numSgprStridesC)
# doubles need to be aligned to even
@@ -2802,6 +2806,10 @@ class KernelWriterAssembly(KernelWriter):
kStr += "\n"
kStr += self.comment1("Stride Assignments")
for tc in ('D','C'):
+ if tc=='D' and not kernel["LdcEqualsLdd"]:
+ sourceTc = 'D'
+ else:
+ sourceTc = 'C'
for idx in range(0, problemType["NumIndicesC"]):
i = idx
idxChar= self.indexChars[idx]
@@ -2811,7 +2819,8 @@ class KernelWriterAssembly(KernelWriter):
if not kernel["ProblemType"]["UseInitialStridesCD"]:
i = i-1
kStr += self.macroRegister("sgprStride%s%s"%(tc,idxChar), \
- "sgprStrides%s+%u"%(tc, i))
+ "sgprStrides%s+%u"%(sourceTc, i))
+
for tc in ('A','B'):
for i, idx in enumerate(problemType["IndexAssignments%s"%tc]):
idxChar= self.indexChars[idx]
@@ -3222,7 +3231,7 @@ class KernelWriterAssembly(KernelWriter):
kStr += self.getKernArg("Beta+2")
kStr += self.getKernArg("Beta+3")
for i in range(0, self.numSgprStridesD):
- kStr += self.getKernArg("StridesD+%u"%i)
+ kStr += self.getKernArg("StridesD+%u"%i, not kernel["LdcEqualsLdd"])
for i in range(0, self.numSgprStridesC):
kStr += self.getKernArg("StridesC+%u"%i)
for i in range(0, self.numSgprStridesA):
