Skip to content

Commit 1ca0735

Browse files
jhananitigcbot
authored andcommitted
Load and Store cache control shader support
Adding support for these Keys as part of IGC Create shader Interface LscLoadCacheControlOverride LscStoreCacheControlOverride TgmLoadCacheControlOverride TgmStoreCacheControlOverride
1 parent d293f10 commit 1ca0735

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21897,21 +21897,21 @@ EmitPass::cacheOptionsForConstantBufferLoads(Instruction* inst) const
2189721897
}
2189821898

2189921899
bool EmitPass::tryOverrideCacheOpts(LSC_CACHE_OPTS& cacheOpts, bool isLoad, bool isTGM,
21900-
const Value* warningContextValue) const
21900+
const Value* warningContextValue, CacheControlOverride m_CacheControlOption) const
2190121901
{
2190221902
uint32_t l1l3CacheVal = 0;
2190321903

2190421904
if (isTGM)
2190521905
{
2190621906
l1l3CacheVal = isLoad ?
21907-
IGC_GET_FLAG_VALUE(TgmLoadCacheControlOverride) :
21908-
IGC_GET_FLAG_VALUE(TgmStoreCacheControlOverride);
21907+
(m_CacheControlOption.TgmLoadCacheControlOverride | IGC_GET_FLAG_VALUE(TgmLoadCacheControlOverride)) :
21908+
(m_CacheControlOption.TgmStoreCacheControlOverride | IGC_GET_FLAG_VALUE(TgmStoreCacheControlOverride));
2190921909
}
2191021910
else
2191121911
{
2191221912
l1l3CacheVal = isLoad ?
21913-
IGC_GET_FLAG_VALUE(LscLoadCacheControlOverride) :
21914-
IGC_GET_FLAG_VALUE(LscStoreCacheControlOverride);
21913+
(m_CacheControlOption.LscLoadCacheControlOverride | IGC_GET_FLAG_VALUE(LscLoadCacheControlOverride)) :
21914+
(m_CacheControlOption.LscStoreCacheControlOverride | IGC_GET_FLAG_VALUE(LscStoreCacheControlOverride));
2191521915
}
2191621916

2191721917
if (l1l3CacheVal != 0)
@@ -21944,7 +21944,7 @@ LSC_CACHE_OPTS EmitPass::translateLSCCacheControlsFromMetadata(
2194421944
{
2194521945
if (m_pCtx->platform.supportsNonDefaultLSCCacheSetting())
2194621946
{
21947-
if (tryOverrideCacheOpts(cacheOpts, isLoad, isTGM, inst))
21947+
if (tryOverrideCacheOpts(cacheOpts, isLoad, isTGM, inst, m_currShader->m_ModuleMetadata->m_CacheControlOption))
2194821948
{
2194921949
// global override cache settings have highest priority
2195021950
return cacheOpts;
@@ -21998,7 +21998,7 @@ LSC_CACHE_OPTS EmitPass::translateLSCCacheControlsFromMetadata(
2199821998
}
2199921999
}
2200022000

22001-
if (tryOverrideCacheOpts(cacheOpts, isLoad, isTGM, inst))
22001+
if (tryOverrideCacheOpts(cacheOpts, isLoad, isTGM, inst, m_currShader->m_ModuleMetadata->m_CacheControlOption))
2200222002
{
2200322003
// global override cache settings have highest priority
2200422004
return cacheOpts;

IGC/Compiler/CISACodeGen/EmitVISAPass.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,8 @@ class EmitPass : public llvm::FunctionPass
539539
void emitHDCuncompressedwrite(llvm::GenIntrinsicInst* I);
540540
////////////////////////////////////////////////////////////////////
541541
// LSC related functions
542-
bool tryOverrideCacheOpts(LSC_CACHE_OPTS& cacheOpts, bool isLoad, bool isTGM, const llvm::Value* warningContextValue) const;
542+
bool tryOverrideCacheOpts(LSC_CACHE_OPTS& cacheOpts, bool isLoad,
543+
bool isTGM, const llvm::Value* warningContextValue, CacheControlOverride m_CacheControlOption) const;
543544
LSC_CACHE_OPTS translateLSCCacheControlsEnum(LSC_L1_L3_CC l1l3cc, bool isLoad, const llvm::Value* warningContextValue) const;
544545
LSC_CACHE_OPTS translateLSCCacheControlsFromValue(
545546
llvm::Value *value, bool isLoad) const;

IGC/common/MDFrameWork.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,13 @@ namespace IGC
665665
unsigned int numReplicas = 0;
666666
};
667667

668+
struct CacheControlOverride
669+
{
670+
uint8_t LscLoadCacheControlOverride = 0;
671+
uint8_t LscStoreCacheControlOverride = 0;
672+
uint8_t TgmLoadCacheControlOverride = 0;
673+
uint8_t TgmStoreCacheControlOverride = 0;
674+
};
668675
struct SrvMapData
669676
{
670677
unsigned int resourceRangeID = 0;
@@ -721,7 +728,6 @@ namespace IGC
721728
URBLayoutInfo URBInfo;
722729
bool UseBindlessImage = false;
723730
bool enableRangeReduce = false;
724-
725731
//when true, compiler enables MatchMad optimization for VS
726732
bool allowMatchMadOptimizationforVS = false;
727733

@@ -764,6 +770,8 @@ namespace IGC
764770

765771
uint8_t SIMD16_SpillThreshold = 0;
766772
uint8_t SIMD32_SpillThreshold = 0;
773+
774+
CacheControlOverride m_CacheControlOption;
767775
};
768776

769777
void serialize(const IGC::ModuleMetaData &moduleMD, llvm::Module* module);

0 commit comments

Comments
 (0)