Skip to content

Commit 148f0bd

Browse files
dburke4-inteligcbot
authored andcommitted
Enable Loads via LSC
enable loads via LSC
1 parent 0613f29 commit 148f0bd

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

IGC/AdaptorCommon/API/igc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ enum {
5151
BIT_CG_DO_SIMD16 = 0b0000000100000000,
5252
};
5353

54+
enum {
55+
LOADS_VIA_LSC_DEFAULT = 0, // Default based on platform
56+
LOADS_VIA_LSC_ENABLE = 1, // Force enable loads via LSC (covert to LD_L)
57+
LOADS_VIA_LSC_DISABLE = 2, // Force disable loads via LSC (do not covert to LD_L)
58+
};
59+
5460
typedef unsigned short CG_CTX_STATS_t;
5561

5662
// shader stat for opt customization

IGC/Compiler/CISACodeGen/Platform.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,5 +1345,9 @@ class CPlatform {
13451345
}
13461346

13471347
bool allowsMoviForType(VISA_Type type) const { return (type == ISA_TYPE_UD || type == ISA_TYPE_D); }
1348+
1349+
bool enableLscSamplerRouting() const {
1350+
return isCoreChildOf(IGFX_XE3_CORE);
1351+
}
13481352
};
13491353
} // namespace IGC

IGC/Compiler/SamplerPerfOptPass.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,14 @@ bool SamplerPerfOptPass::runOnFunction(Function &F) {
326326
}
327327
}
328328
if (SamplerLoadIntrinsic *loadInst = dyn_cast<SamplerLoadIntrinsic>(II)) {
329-
// EnableLscSamplerRouting key is true (default)
330-
// DisableLscSamplerRouting is from UMD AIL to turn off per shader
331-
if (ctx->platform.hasLSCSamplerRouting() && IGC_IS_FLAG_ENABLED(EnableLscSamplerRouting) &&
329+
// LscSamplerRouting is from UMD AIL to control per shader
330+
const unsigned int umdLscSamplerRouting = ctx->getModuleMetaData()->compOpt.LscSamplerRouting;
331+
const IGC::TriboolFlag regKeyValue = static_cast<IGC::TriboolFlag>(IGC_GET_FLAG_VALUE(EnableLscSamplerRouting));
332+
const bool defaultValue = (umdLscSamplerRouting == LOADS_VIA_LSC_DEFAULT) ? ctx->platform.enableLscSamplerRouting() : (umdLscSamplerRouting == LOADS_VIA_LSC_ENABLE);
333+
const bool enableLscSamplerRouting = (regKeyValue == IGC::TriboolFlag::Default) ? defaultValue : (regKeyValue == IGC::TriboolFlag::Enabled);
334+
335+
if (ctx->platform.hasLSCSamplerRouting() && !enableLscSamplerRouting &&
332336
ctx->m_DriverInfo.supportLscSamplerRouting() &&
333-
!ctx->getModuleMetaData()->compOpt.DisableLscSamplerRouting &&
334337
loadInst->getIntrinsicID() == GenISAIntrinsic::GenISA_ldptr) {
335338
changed = ConvertLdToLdl(loadInst);
336339
}

IGC/common/MDFrameWork.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ enum class ShaderTypeMD
502502
unsigned FastestS1Options = 0; // FCEXP_NO_EXPRIMENT. Can't access the enum here for some reason.
503503
bool DisableFastestForWaveIntrinsicsCS = false;
504504
bool ForceLinearWalkOnLinearUAV = false;
505-
bool DisableLscSamplerRouting = false;
505+
unsigned LscSamplerRouting = 0;
506506
bool UseBarrierControlFlowOptimization = false;
507507
bool EnableDynamicRQManagement = false;
508508
bool WaDisablePayloadCoalescing = false;

IGC/common/igc_flags.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,12 @@ DECLARE_IGC_REGKEY(
11571157
DECLARE_IGC_REGKEY(bool, DisableCorrectlyRoundedMacros, false,
11581158
"Tmp flag to disable correcly rounded macros for BMG+. This flag will be removed in the future.",
11591159
false)
1160-
DECLARE_IGC_REGKEY(bool, EnableLscSamplerRouting, true, "Enables conversion of LD to LD_L instructions.", false)
1160+
DECLARE_IGC_REGKEY_ENUM(EnableLscSamplerRouting, -1,
1161+
"Enables conversion of LD to LD_L instructions. Xe2+"
1162+
"-1 - Platform default"
1163+
" 0 - Force disable conversion to LD_L. Allow loads via LSC"
1164+
" 1 - Force enable conversion to LD_L. Disallow loads via LSC",
1165+
TRIBOOL_OPTIONS, false)
11611166
DECLARE_IGC_REGKEY(bool, EnableSIMD16ForXe2, false, "Enable CS SIMD16 for Xe2", false)
11621167
DECLARE_IGC_REGKEY(bool, EnableSIMD16ForNonWaveXe2, true, "Enable CS SIMD16 for Xe2 if the shader doesn't have wave",
11631168
false)

0 commit comments

Comments
 (0)