Skip to content

Commit 22973c3

Browse files
YuriPlyakhinigcbot
authored andcommitted
Implement predicated load/store
- Implement GenISA predicated load and store intrinsics - Implement pass which promotes llvm load and store to predicated GenISA load/store intrinsics
1 parent c6e8a20 commit 22973c3

21 files changed

+1428
-117
lines changed

IGC/AdaptorOCL/UnifyIROCL.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ SPDX-License-Identifier: MIT
131131
#include "Compiler/Optimizer/OpenCLPasses/MinimumValidAddressChecking/MinimumValidAddressChecking.hpp"
132132
#include "Compiler/Optimizer/OpenCLPasses/Spv2dBlockIOResolution/Spv2dBlockIOResolution.hpp"
133133
#include "Compiler/Optimizer/OpenCLPasses/SpvSubgroupMMAResolution/SpvSubgroupMMAResolution.hpp"
134+
#include "Compiler/Optimizer/PromoteToPredicatedMemoryAccess.hpp"
134135

135136
#include "common/debug/Debug.hpp"
136137
#include "common/igc_regkeys.hpp"
@@ -640,6 +641,12 @@ static void CommonOCLBasedPasses(OpenCLProgramContext* pContext)
640641

641642
mpm.add(new ScalarArgAsPointerAnalysis());
642643

644+
// Inserting Predicated Load If Conversion pass before OCL Scalaraizer to simplify pattern matching for the pass
645+
if (IGC_IS_FLAG_ENABLED(EnablePromoteToPredicatedMemoryAccess))
646+
{
647+
mpm.add(new PromoteToPredicatedMemoryAccess());
648+
}
649+
643650
if (IGC_IS_FLAG_DISABLED(DisableOCLScalarizer))
644651
{
645652
mpm.add(createScalarizerPass(SelectiveScalarizer::Auto));

IGC/Compiler/CISACodeGen/CShader.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4201,15 +4201,24 @@ Tristate CShader::shouldGenerateLSCQuery(
42014201
return Tristate::False;
42024202
}
42034203

4204-
// Geneate LSC for load/store instructions as Load/store emit can
4204+
// Generate LSC for load/store instructions as Load/store emit can
42054205
// handle full-payload uniform non-transpose LSC on PVC A0.
42064206
if (vectorLdStInst == nullptr
42074207
|| isa<LoadInst>(vectorLdStInst)
42084208
|| isa<StoreInst>(vectorLdStInst))
42094209
return Tristate::True;
4210-
// special checks for typed r/w
4210+
42114211
if (GenIntrinsicInst* inst = dyn_cast<GenIntrinsicInst>(vectorLdStInst))
42124212
{
4213+
// Generate LSC for predicated load/store instructions similar to
4214+
// simple load/store instructions.
4215+
if (inst->getIntrinsicID() == GenISAIntrinsic::GenISA_PredicatedLoad ||
4216+
inst->getIntrinsicID() == GenISAIntrinsic::GenISA_PredicatedStore)
4217+
{
4218+
return Tristate::True;
4219+
}
4220+
4221+
// special checks for typed r/w
42134222
if (inst->getIntrinsicID() == GenISAIntrinsic::GenISA_typedread ||
42144223
inst->getIntrinsicID() == GenISAIntrinsic::GenISA_typedwrite ||
42154224
inst->getIntrinsicID() == GenISAIntrinsic::GenISA_typedwriteMS ||

0 commit comments

Comments
 (0)