Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions projects/hipblaslt/tensilelite/Tensile/Components/LocalRead.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ def __call__(self, writer, kernel, bufferIdx, iui, epsi, tP):

class LocalReadMFMA(LocalRead):
kernel = {"EnableMatrixInstruction": True}

# LDS size is increased on gfx950. const offset is still 16-bit.
# this function handles both LDS size < 64K and LDS size >= 64K
def cal_offset_srcAddr(self, maxLDSConstOffset, tc, offset):
num = offset // maxLDSConstOffset
offset_val = offset - num * maxLDSConstOffset
srcAddr = vgpr("LocalReadAddr%s+%u" %(tc, num))
return offset_val, srcAddr


"""
Local Read: Do It A/B
Expand Down Expand Up @@ -234,6 +243,7 @@ def __call__(self, writer, kernel, bufferIdx, iui, epsi, tP):
blockStride = elementsPerBlockSMFMA * threadGroups
blockOffsetSMFMA = blockStride - elementsPerBlockSMFMA

maxLDSConstOffset = writer.states.regCaps["maxLDSConstOffset"]
valufIdx = 0
if enableLDSTr:
numberMTilesPerWave = kernel["MIWaveTile"][tile01]
Expand All @@ -242,20 +252,19 @@ def __call__(self, writer, kernel, bufferIdx, iui, epsi, tP):
offset_val = (tP["localReadOffset"]+MIWaveGroupShape[tile01]*tIdx) * tP["bpeDS"]
if (kernel["LdsBlockSizePerPad%s"%tc] != 0) and (kernel["LdsPad%s"%tc] != 0):
offset_val = offset_val + (offset_val // kernel["LdsBlockSizePerPad%s"%tc]) * kernel["LdsPad%s"%tc] * tP["bpeDS"]
paramList = []
paramList.append(int(offset_val))
ds = DSModifiers(na=1, offset=paramList[0])
offset, srcAddr = self.cal_offset_srcAddr(maxLDSConstOffset, tc, offset_val)
ds = DSModifiers(na=1, offset=offset)
LocalReadX = instruction.getInst(highBits)
destVgpr = vgpr("Valu%s_X%u_I%u+%u+0"%(tc,bufferIdx,iui, 4*tIdx), 2)
comment = "LDS Transpose"
valuiIdx = int(valufIdx)
localReadCode = imod.add(Module("LocalRead%s Valu%u"%(tc,valuiIdx)))
localReadCode.add(LocalReadX(dst=destVgpr, src=vgpr("LocalReadAddr%s"%tc), ds=ds, comment=comment))
localReadCode.add(LocalReadX(dst=destVgpr, src=srcAddr, ds=ds, comment=comment))
destVgpr = vgpr("Valu%s_X%u_I%u+%u+2"%(tc,bufferIdx,iui,4*tIdx), 2)
offset_val = paramList[0]+UnrollStride*inputPerThread;
paramList.append(int(offset_val))
ds = DSModifiers(na=1, offset=paramList[1])
localReadCode.add(LocalReadX(dst=destVgpr, src=vgpr("LocalReadAddr%s"%tc), ds=ds, comment=comment))
offset_val += UnrollStride*inputPerThread;
offset, srcAddr = self.cal_offset_srcAddr(maxLDSConstOffset, tc, offset_val)
Comment thread
b-shi marked this conversation as resolved.
Resolved
ds = DSModifiers(na=1, offset=offset)
localReadCode.add(LocalReadX(dst=destVgpr, src=srcAddr, ds=ds, comment=comment))
else:
for vIdx in range(0, numVectorsPerTile):
for eIdx in range(0, numReadsPerVector):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,3 +786,66 @@ BenchmarkProblems:
- Exact: [512, 512, 1, 1088]
- Exact: [519, 519, 1, 1120]
- Exact: [2053, 2053, 1, 2053]

########################################
# HSS - Test LDS > 64K
########################################
-
- OperationType: GEMM
DataType: H
DestDataType: S
ComputeDataType: S
HighPrecisionAccumulate: true
TransposeA: False
TransposeB: False
#ComplexConjugateA: False
#ComplexConjugateB: False
UseBeta: True
#UseBias: 1
Batched: True
#Activation: True
#ActivationHPA: True
- InitialSolutionParameters:
BenchmarkCommonParameters:
- KernelLanguage: [Assembly]
ForkParameters:
- 1LDSBuffer: [1] # Default Value: [0] # Range: [-1, 0, 1]
- ClusterLocalRead: [1] # Default Value: [1] # Range: [0, 1]
- DepthU: [128] # Default Value: [-1] # Range: [-1, 2, ... ,1023, 1024]
- DirectToVgprA: [0] # Default Value: [False] # Range: [False, True]
- DirectToVgprB: [0] # Default Value: [False] # Range: [False, True]
- GlobalReadVectorWidthA: [8] # Default Value: [-1] # Range: [-2, -1, ... ,8, 16]
- GlobalReadVectorWidthB: [8] # Default Value: [-1] # Range: [-2, -1, ... ,8, 16]
- GlobalSplitUAlgorithm: ["MultipleBuffer"] # Default Value: [MultipleBuffer] # Range: [SingleBuffer, MultipleBuffer, MultipleBufferSingleKernel]
- LocalReadVectorWidth: [-1] # Default Value: [-1] # Range: [-1, 1, ... ,8, 16]
- MIArchVgpr: [1] # Default Value: [False] # Range: [False, True]
- NonTemporalA: [0] # Default Value: [0] # Range: [0, 1, ... ,6, 7]
- NumElementsPerBatchStore: [16] # Default Value: [0] # Range: [-1, 0, ... ,254, 255]
- PrefetchGlobalRead: [2] # Default Value: [1] # Range: [0, 1, 2]
- PrefetchLocalRead: [1] # Default Value: [1] # Range: [0, 1, ... ,127, 128]
- SourceSwap: [1] # Default Value: [False] # Range: [False, True]
- StaggerU: [8] # Default Value: [32] # Range: [0, 2, ... ,32, 64]
- StorePriorityOpt: [1] # Default Value: [False] # Range: [False, True]
- StoreSyncOpt: [4] # Default Value: [0] # Range: [0, 1, ... ,254, 255]
- StreamK: [3] # Default Value: [0] # Range: [0, 1, ... ,2, 3]
- StreamKXCCMapping: [8] # Default Value: [0] # Range: [0, 2, ... ,7, 8]
- UseSgprForGRO: [-1] # Default Value: [-1] # Range: [-1, 0, 1]
- VectorWidthA: [-1] # Default Value: [-1] # Range: [-1, 1, ... ,6, 8]
- VectorWidthB: [-1] # Default Value: [-1] # Range: [-1, 1, ... ,6, 8]
- WaveSeparateGlobalReadA: [0] # Default Value: [0] # Range: [0, 1, 2]
- WaveSeparateGlobalReadB: [0] # Default Value: [0] # Range: [0, 1, 2]
- WorkGroupMapping: [16] # Default Value: [8] # Range: [-1024, -1023, ... ,1023, 1024]
- WorkGroupMappingXCC: [1] # Default Value: [1] # Range: [1, 2, ... ,16, 32]
- Groups:
- - NonTemporalC: 4 # Default Value: [0] # Range: [0, 1, ... ,6, 7]
NonTemporalD: 4 # Default Value: [0] # Range: [0, 1, ... ,6, 7]
- - MatrixInstruction: [32, 32, 16, 1, 1, 5, 2, 2, 2] #MT 320x128 - TT 5x64 - WG 64x4 - MIBlockM 1 -- sizes [[(40960, 192, 1, 256)]]
MIArchVgpr: 0 # Default Value: [False] # Range: [False, True]
- - ClusterLocalRead: 0 # Default Value: [1] # Range: [0, 1]
LDSTrInst: 1 # Default Value: [False] # Range: [False, True]
#- ClusterLocalRead: 1 # Default Value: [1] # Range: [0, 1]
#LDSTrInst: 0 # Default Value: [False] # Range: [False, True]
BenchmarkJoinParameters:
BenchmarkFinalParameters:
- ProblemSizes:
- Exact: [ 40960, 192, 1, 256 ]