Skip to content

Commit 075afcd

Browse files
weiyu-chensys_zuul
authored andcommitted
Avoid hard-coding SIMD size for render target write with stencil
Change-Id: I339bfad6fbd8362ac7628589169f5c86625aa74f
1 parent 395bd13 commit 075afcd

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4180,7 +4180,7 @@ bool EmitPass::interceptRenderTargetWritePayloadCoalescing(
41804180
//Stencil is only supported in SIMD8 mode
41814181
if (inst->hasStencil())
41824182
{
4183-
IGC_ASSERT(m_currShader->m_SIMDSize == SIMDMode::SIMD8);
4183+
IGC_ASSERT(m_currShader->m_Platform->supportsStencil(m_currShader->m_SIMDSize));
41844184
IGC_ASSERT(vStencilOpnd == nullptr);
41854185

41864186
CVariable* temp = m_currShader->GetNewAlias(rootPayloadVar, ISA_TYPE_UB, (uint16_t)offset, 0);
@@ -4194,6 +4194,7 @@ bool EmitPass::interceptRenderTargetWritePayloadCoalescing(
41944194
m_encoder->SetSrcRegion(0, 32, 8, 4);
41954195
}
41964196
m_currShader->CopyVariable(temp, ubSrc, 0);
4197+
41974198
vStencilOpnd = temp;
41984199
}
41994200
return true;
@@ -4300,7 +4301,6 @@ void EmitPass::prepareRenderTargetWritePayload(
43004301
}
43014302
}
43024303

4303-
//Stencil is only supported in SIMD8 mode
43044304
if (inst->hasStencil())
43054305
{
43064306
varStencilOpnd = GetSymbol(inst->getStencil());

IGC/Compiler/CISACodeGen/PayloadMapping.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,8 @@ int PayloadMapping::GetRightReservedOffset_RTWrite(const Instruction* inst, SIMD
206206

207207
if (rtwi->hasStencil())
208208
{
209-
//Must not be set in simd16 mode.
210-
IGC_ASSERT(simdMode == SIMDMode::SIMD8);
211-
offset += 32; //256bits=1grf
209+
IGC_ASSERT(m_CodeGenContext->platform.supportsStencil(simdMode));
210+
offset += m_CodeGenContext->platform.getGRFSize();
212211
}
213212

214213
if (rtwi->hasDepth())

IGC/Compiler/CISACodeGen/PixelShaderCodeGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ namespace IGC
11181118
return false;
11191119
}
11201120

1121-
if (m_HasoStencil && simdMode != SIMDMode::SIMD8)
1121+
if (m_HasoStencil && !ctx->platform.supportsStencil(simdMode))
11221122
{
11231123
return false;
11241124
}

IGC/Compiler/CISACodeGen/Platform.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,11 @@ namespace IGC
294294
return m_platformInfo.eRenderCoreFamily <= IGFX_GEN11_CORE;
295295
}
296296

297+
bool supportsStencil(SIMDMode simdMode) const
298+
{
299+
return getMinDispatchMode() == SIMDMode::SIMD16 ? true : simdMode == SIMDMode::SIMD8;
300+
}
301+
297302
bool supportsSIMD16TypedRW() const
298303
{
299304
return false;

0 commit comments

Comments
 (0)