Skip to content

Commit dd4da9a

Browse files
weiyu-chengfxbot
authored andcommitted
add 64Byte wide media block r/w support for selected platforms
Change-Id: I0fcf343074db25a6c6e765dffed4ef9440391e72
1 parent 7886fe6 commit dd4da9a

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5173,6 +5173,7 @@ void EmitPass::emitSimdMediaBlockRead( llvm::Instruction* inst )
51735173
blockWidth = 32;
51745174
}
51755175

5176+
51765177
CVariable* pTempVar0 = nullptr;
51775178
CVariable* pTempVar = nullptr;
51785179

@@ -5199,6 +5200,8 @@ void EmitPass::emitSimdMediaBlockRead( llvm::Instruction* inst )
51995200
// mov( 1 ) r36.1<1>:d r13.1<0; 1, 0>:d{ Align1, NoMask }
52005201
// send( 8 ) r32.0<1>:ud r36 0xc 0x2490000:ud{ Align1, NoMask } // media block read
52015202

5203+
int scale = (blockWidth == 64) ? 2 : 1;
5204+
52025205
for ( pass = 0; pass < numPasses; pass++ )
52035206
{
52045207
m_encoder->SetSimdSize(SIMDMode::SIMD1);
@@ -5216,8 +5219,8 @@ void EmitPass::emitSimdMediaBlockRead( llvm::Instruction* inst )
52165219
}
52175220
else
52185221
{
5219-
m_encoder->Add(pTempVar0, pTempVar0, m_currShader->ImmToVariable(32, ISA_TYPE_UD));
5220-
dstSubReg = dstSubReg + blockHeight;
5222+
m_encoder->Add(pTempVar0, pTempVar0, m_currShader->ImmToVariable(blockWidth, ISA_TYPE_UD));
5223+
dstSubReg = dstSubReg + scale * blockHeight;
52215224
}
52225225
m_encoder->Push();
52235226

@@ -5271,10 +5274,12 @@ void EmitPass::emitSimdMediaBlockRead( llvm::Instruction* inst )
52715274
{
52725275
for (uint32_t pass = 0; pass < numPasses; pass++)
52735276
{
5274-
m_encoder->SetSimdSize(typeSizeInBytes == 8 ? SIMDMode::SIMD4 : SIMDMode::SIMD8);
5277+
SIMDMode mode = typeSizeInBytes == 8 && blockWidth != 64 ? SIMDMode::SIMD4 : SIMDMode::SIMD8;
5278+
m_encoder->SetSimdSize(mode);
52755279
m_encoder->SetNoMask();
5276-
m_encoder->SetSrcSubVar(0, i + (blockHeight * pass));
5277-
m_encoder->SetDstSubVar(dstSubReg++);
5280+
m_encoder->SetSrcSubVar(0, scale * (i + (blockHeight * pass)));
5281+
m_encoder->SetDstSubVar(dstSubReg);
5282+
dstSubReg += scale;
52785283
m_encoder->Copy(m_destination, pTempDest);
52795284
m_encoder->Push();
52805285
}
@@ -5336,14 +5341,16 @@ void EmitPass::emitSimdMediaBlockWrite( llvm::Instruction* inst )
53365341
blockWidth = 32;
53375342
}
53385343

5344+
53395345
CVariable* pTempVar0 = nullptr;
53405346
CVariable* pTempVar = nullptr;
53415347

53425348
uint32_t dstSubReg = 0;
53435349

5350+
int scale = (blockWidth == 64) ? 2 : 1;
53445351
for ( pass = 0; pass < numPasses; pass++ )
53455352
{
5346-
uint32_t srcSubVar = pass;
5353+
uint32_t srcSubVar = pass * scale;
53475354
uint32_t dstSubVar = 0;
53485355

53495356
CVariable* tempdst = m_currShader->GetNewVariable(
@@ -5359,12 +5366,14 @@ void EmitPass::emitSimdMediaBlockWrite( llvm::Instruction* inst )
53595366
if ( numPasses > 1 )
53605367
{
53615368
for ( uint i = 0; i < nbElements; ++i )
5362-
{
5363-
m_encoder->SetSimdSize(typeSizeInBytes == 8 ? SIMDMode::SIMD4 : SIMDMode::SIMD8);
5369+
{
5370+
SIMDMode mode = (typeSizeInBytes == 8 && blockWidth != 64) ? SIMDMode::SIMD4 : SIMDMode::SIMD8;
5371+
m_encoder->SetSimdSize(mode);
53645372
m_encoder->SetNoMask();
53655373
m_encoder->SetSrcSubVar( 0, srcSubVar );
5366-
m_encoder->SetDstSubVar( dstSubVar++ );
5367-
srcSubVar = srcSubVar + numPasses;
5374+
m_encoder->SetDstSubVar( dstSubVar );
5375+
dstSubVar += scale;
5376+
srcSubVar = srcSubVar + scale * numPasses;
53685377
m_encoder->Copy( tempdst, data );
53695378
m_encoder->Push();
53705379
}
@@ -5416,9 +5425,9 @@ void EmitPass::emitSimdMediaBlockWrite( llvm::Instruction* inst )
54165425
m_encoder->SetSimdSize( SIMDMode::SIMD1 );
54175426
m_encoder->SetNoMask();
54185427
m_encoder->SetSrcRegion( 0, 0, 1, 0 );
5419-
m_encoder->Add( pTempVar0, pTempVar0, m_currShader->ImmToVariable( 32, ISA_TYPE_UD ) );
5428+
m_encoder->Add( pTempVar0, pTempVar0, m_currShader->ImmToVariable( blockWidth, ISA_TYPE_UD ) );
54205429
m_encoder->Push();
5421-
dstSubReg = dstSubReg + blockHeight;
5430+
dstSubReg = dstSubReg + scale * blockHeight;
54225431
}
54235432

54245433
m_encoder->SetDstSubVar( dstSubReg );

0 commit comments

Comments
 (0)