Skip to content

Commit 7cbf3a1

Browse files
iwwuigcbot
authored andcommitted
Change L1 cache policy for RT/SW stack
For DXR workloads, the performance is better when RT/SW stack is cached in LSC. Make WB cache policy as POR for both loads and stores.
1 parent 8d73e16 commit 7cbf3a1

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

IGC/Compiler/CISACodeGen/Platform.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,5 +1658,11 @@ unsigned int roundUpTgsmSize(DWORD size) const
16581658
return iSTD::RoundPower2(size) * blockSize;
16591659
}
16601660

1661+
1662+
bool preferLSCCache() const
1663+
{
1664+
return isCoreChildOf(IGFX_XE2_LPG_CORE);
1665+
}
1666+
16611667
};
16621668
}//namespace IGC

IGC/Compiler/CISACodeGen/getCacheOpts.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ namespace IGC {
3838
LSC_L1_L3_CC RTStackStorePolicy()
3939
{
4040
LSC_L1_L3_CC cacheOpts = LSC_L1IAR_WB_L3C_WB;
41+
// Ctx.platform.preferLSCCache() also prefers LSC_L1IAR_WB_L3C_WB
4142

4243
if (IGC_IS_FLAG_ENABLED(ForceRTStackStoreCacheCtrl))
4344
{
@@ -73,7 +74,7 @@ LSC_L1_L3_CC SWStackStorePolicy(const CodeGenContext &Ctx)
7374
{
7475
LSC_L1_L3_CC cacheOpts = Ctx.platform.NeedsLSCFenceUGMBeforeEOT() ?
7576
LSC_L1S_L3C_WB :
76-
LSC_L1UC_L3C_WB;
77+
(Ctx.platform.preferLSCCache() ? LSC_L1IAR_WB_L3C_WB : LSC_L1UC_L3C_WB);
7778

7879
if (IGC_IS_FLAG_ENABLED(ForceSWStackStoreCacheCtrl))
7980
{
@@ -91,6 +92,7 @@ LSC_L1_L3_CC SWStackStorePolicy(const CodeGenContext &Ctx)
9192
LSC_L1_L3_CC RTStackLoadPolicy()
9293
{
9394
LSC_L1_L3_CC cacheOpts = LSC_L1C_WT_L3C_WB;
95+
// Ctx.platform.preferLSCCache() also prefers LSC_L1C_WT_L3C_WB
9496

9597
if (IGC_IS_FLAG_ENABLED(ForceRTStackLoadCacheCtrl))
9698
{
@@ -122,9 +124,9 @@ LSC_L1_L3_CC SWHotZoneLoadPolicy()
122124
/**
123125
* @return the load cache policy for the SWStack
124126
*/
125-
LSC_L1_L3_CC SWStackLoadPolicy()
127+
LSC_L1_L3_CC SWStackLoadPolicy(const CodeGenContext& Ctx)
126128
{
127-
LSC_L1_L3_CC cacheOpts = LSC_L1UC_L3C_WB;
129+
LSC_L1_L3_CC cacheOpts = Ctx.platform.preferLSCCache() ? LSC_L1C_WT_L3C_WB : LSC_L1UC_L3C_WB;
128130

129131
if (IGC_IS_FLAG_ENABLED(ForceSWStackLoadCacheCtrl))
130132
{
@@ -191,7 +193,7 @@ Optional<LSC_L1_L3_CC> getCacheOptsLoadPolicy(
191193
cacheOpts = RTStackLoadPolicy();
192194
break;
193195
case RTMemRegion::SWStack:
194-
cacheOpts = SWStackLoadPolicy();
196+
cacheOpts = SWStackLoadPolicy(Ctx);
195197
break;
196198
case RTMemRegion::SWHotZone:
197199
cacheOpts = SWHotZoneLoadPolicy();

IGC/Compiler/CISACodeGen/getCacheOpts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,6 @@ namespace IGC {
102102
/**
103103
* @return the load cache policy for the SWStack
104104
*/
105-
LSC_L1_L3_CC SWStackLoadPolicy();
105+
LSC_L1_L3_CC SWStackLoadPolicy(const CodeGenContext& Ctx);
106106
} // namespace IGC
107107

0 commit comments

Comments
 (0)