Skip to content

Commit 059b69c

Browse files
jaladreipsigcbot
authored andcommitted
Disable dynamic rayquery management if we have to emulate SIMD32 for rayqueries
Disable dynamic rayquery management if we have to emulate SIMD32 for rayqueries
1 parent 6f63747 commit 059b69c

File tree

4 files changed

+38
-50
lines changed

4 files changed

+38
-50
lines changed

IGC/AdaptorCommon/RayTracing/DynamicRayManagementPass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,11 @@ bool DynamicRayManagementPass::runOnFunction(Function& F)
115115
// 1. RayTracing is not supported on this platform.
116116
// 2. Shader does not use RayQuery at all.
117117
// 3. There are more than 1 exit block.
118+
// 4. RayQuery needs splitting due to forced SIMD32
118119
if ((m_CGCtx->platform.supportRayTracing() == false) ||
119120
(!m_CGCtx->hasSyncRTCalls()) ||
120-
(getNumberOfExitBlocks(F) > 1))
121+
(getNumberOfExitBlocks(F) > 1) ||
122+
m_CGCtx->syncRTCallsNeedSplitting())
121123
{
122124
return false;
123125
}

IGC/AdaptorCommon/RayTracing/TraceRayInlineLoweringPass.cpp

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,31 +1040,6 @@ class RTGlobalsPointerLoweringPass : public FunctionPass
10401040

10411041
char RTGlobalsPointerLoweringPass::ID = 0;
10421042

1043-
bool RTGlobalsPointerLoweringPass::needsSplitting(const CodeGenContext* Ctx)
1044-
{
1045-
// In general, we don't want to compile SIMD32 for rayquery.
1046-
// Determine if we are forced to do so.
1047-
1048-
if (Ctx->type != ShaderType::COMPUTE_SHADER)
1049-
return false;
1050-
1051-
auto& csInfo = Ctx->getModuleMetaData()->csInfo;
1052-
1053-
if (IGC_IS_FLAG_ENABLED(ForceCSSIMD32) ||
1054-
IGC_GET_FLAG_VALUE(ForceCSSimdSize4RQ) == 32)
1055-
return true;
1056-
if (IGC_IS_FLAG_ENABLED(ForceCSSIMD16))
1057-
return false;
1058-
if (csInfo.forcedSIMDSize == 32)
1059-
return true;
1060-
if (csInfo.forcedSIMDSize == 16)
1061-
return false;
1062-
if (csInfo.waveSize == 32)
1063-
return true;
1064-
1065-
return false;
1066-
}
1067-
10681043
bool RTGlobalsPointerLoweringPass::runOnFunction(Function& F)
10691044
{
10701045
m_CGCtx = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
@@ -1085,7 +1060,7 @@ bool RTGlobalsPointerLoweringPass::runOnFunction(Function& F)
10851060
IGC_ASSERT_MESSAGE(nullptr != modMD,
10861061
"Invalid Module Metadata in RTGlobalsPointerLoweringPass");
10871062

1088-
const bool NeedsSplitting = needsSplitting(m_CGCtx);
1063+
const bool NeedsSplitting = m_CGCtx->syncRTCallsNeedSplitting();
10891064

10901065
for (auto* GBP : globalBuffPtrs)
10911066
{

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23671,9 +23671,6 @@ void EmitPass::emitRayQueryCheckRelease(
2367123671

2367223672
m_encoder->Lifetime(LIFETIME_START, dummySource);
2367323673

23674-
const uint32_t NumSend =
23675-
(m_currShader->m_SIMDSize == SIMDMode::SIMD32
23676-
) ? 2 : 1;
2367723674

2367823675
CVariable* flag = nullptr;
2367923676

@@ -23683,28 +23680,17 @@ void EmitPass::emitRayQueryCheckRelease(
2368323680
flag = GetSymbol(I->getOperand(0));
2368423681
}
2368523682

23686-
for (uint32_t Cnt = 0; Cnt < NumSend; Cnt++)
23687-
{
23688-
if (m_currShader->m_SIMDSize == SIMDMode::SIMD32
23689-
)
23690-
{
23691-
m_encoder->SetSimdSize(SIMDMode::SIMD16);
23692-
if (Cnt == 1)
23693-
m_encoder->SetMask(EMASK_H2);
23694-
}
23695-
23696-
m_encoder->SetPredicate(flag);
23683+
m_encoder->SetPredicate(flag);
2369723684

23698-
m_encoder->Sends(
23699-
nullptr,
23700-
header,
23701-
dummySource,
23702-
extDescriptor,
23703-
exDesc,
23704-
pMessDesc);
23685+
m_encoder->Sends(
23686+
nullptr,
23687+
header,
23688+
dummySource,
23689+
extDescriptor,
23690+
exDesc,
23691+
pMessDesc);
2370523692

23706-
m_encoder->Push();
23707-
}
23693+
m_encoder->Push();
2370823694

2370923695
// Insert a software fence after the send.rta so no IO operations get
2371023696
// scheduled across the send from below. We should be able to remove this

IGC/Compiler/CodeGenPublic.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,31 @@ namespace IGC
12401240

12411241
// For remarks
12421242
void initializeRemarkEmitter(const ShaderHash& hash);
1243+
1244+
bool syncRTCallsNeedSplitting()
1245+
{
1246+
// In general, we don't want to compile SIMD32 for rayquery.
1247+
// Determine if we are forced to do so.
1248+
1249+
if (type != ShaderType::COMPUTE_SHADER)
1250+
return false;
1251+
1252+
auto& csInfo = getModuleMetaData()->csInfo;
1253+
1254+
if (IGC_IS_FLAG_ENABLED(ForceCSSIMD32) ||
1255+
IGC_GET_FLAG_VALUE(ForceCSSimdSize4RQ) == 32)
1256+
return true;
1257+
if (IGC_IS_FLAG_ENABLED(ForceCSSIMD16))
1258+
return false;
1259+
if (csInfo.forcedSIMDSize == 32)
1260+
return true;
1261+
if (csInfo.forcedSIMDSize == 16)
1262+
return false;
1263+
if (csInfo.waveSize == 32)
1264+
return true;
1265+
1266+
return false;
1267+
}
12431268
};
12441269

12451270
struct SComputeShaderSecondCompileInput

0 commit comments

Comments
 (0)