fp16 only: undo local tile assignment & acc-to-arch mapping from PR#800 (MI 32x32x2x1 F32)
this is a makeshift solution while figuring out how to generalize local tile assignment & acc-to-arch mapping for all types
@@ -4706,10 +4706,13 @@ class KernelWriterAssembly(KernelWriter):
self.commentSuffix, self.endLine)
divisor = kernel["SubGroup0"]
+ # TODO: generalize over different MIs
+ if kernel["MatrixInstruction"] and not kernel["ProblemType"]["DataType"].isHalf():
if kernel["MatrixInstruction"]:
divisor *= kernel["MatrixInstK"]
pack = 4 // tP["bpe"]
divisor //= pack
+ # end TODO
qReg = self.vgprPool.checkOut(1) # quotient
rReg = self.vgprPool.checkOut(1) # remainder
dividendReg = "Serial" # local serial
@@ -4758,9 +4761,12 @@ class KernelWriterAssembly(KernelWriter):
tc = tP["tensorChar"]
divisor = kernel["SubGroup0"]*kernel["SubGroup1"]
if kernel["MatrixInstruction"]:
+ # TODO: generalize over different MIs
+ if kernel["MatrixInstruction"] and not kernel["ProblemType"]["DataType"].isHalf():
divisor *= kernel["MatrixInstK"]
pack = 4 // tP["bpe"]
divisor //= pack
+ # end TODO
if tc == "B":
divisor //= 4 # 4 simds
qReg = self.vgprPool.checkOut(1) # quotient
@@ -4805,6 +4811,8 @@ class KernelWriterAssembly(KernelWriter):
vgpr(sgid), \
"sgid=sgid*(MT%u+PAD)"%tIdx )
+ # TODO: generalize over different MIs
+ if kernel["MatrixInstruction"] and not kernel["ProblemType"]["DataType"].isHalf():
if tc == "B" and "MatrixInstK" in kernel and kernel["MatrixInstK"] > 1 and tP["bpe"] == 4:
kDiv = kernel["MatrixInstN"]
kStr += vectorStaticDivide(rReg, dividendReg, kDiv, tmpVgpr, tmpSgpr)
@@ -4824,7 +4832,7 @@ class KernelWriterAssembly(KernelWriter):
vgpr(rReg), \
"koff")
kStr += inst("v_add_u32", vgpr(sgid), vgpr(rReg), vgpr(sgid), "k offset")
-
+ # end TODO
if kernel["VectorWidth"] > 1 and not kernel["MatrixInstruction"]:
kStr += staticMultiply(vgpr(tP["gpr"]["lro"]), vgpr(tP["gpr"]["lro"]), \
kernel["VectorWidth"], sgpr(tmpSgpr))
@@ -10655,12 +10663,20 @@ class KernelWriterAssembly(KernelWriter):
#only support option=0
assert(option==0)
+ # TODO: generalize over different MIs
+ if kernel["MatrixInstruction"] and not kernel["ProblemType"]["DataType"].isHalf():
pack = 1
if kernel["ProblemType"]["DataType"].isHalf() or kernel["ProblemType"]["DataType"].isBFloat16():
pack = 2
numRowsPerBlock = 4 if kernel["MatrixInstM"] == 4 else kernel["MatrixInstM"] // kernel["MatrixInstB"] * pack // kernel["MatrixInstK"]
numRowblocks = 1 if kernel["MatrixInstM"] == 4 else kernel["MIWG0"]//kernel["MatrixInstM"]
numColBlocks = 1 if kernel["MatrixInstM"] == 4 else globalParameters["WavefrontWidth"] // kernel["MIWG0"] * pack // kernel["MatrixInstK"]
+ # end TODO
+ else:
+ numRowsPerBlock = 4 if kernel["MatrixInstM"] == 4 else kernel["MatrixInstM"]//kernel["MatrixInstB"]
+ numRowblocks = 1 if kernel["MatrixInstM"] == 4 else kernel["MIWG0"]//kernel["MatrixInstM"]
+ numColBlocks = 1 if kernel["MatrixInstM"] == 4 else globalParameters["WavefrontWidth"] // kernel["MIWG0"]
+
numColInstructions = kernel["ThreadTile1"] // kernel["MatrixInstN"]
numRowInstructions = kernel["ThreadTile0"]
mfmaColStoreVw = 1 #Todo check it can be other case or not
