@@ -93,8 +93,7 @@ namespace IGC
9393 unsigned int m_unpaddedProgramSize; // <! program size without padding used for binary linking
9494 unsigned int m_startReg; // <! Which GRF to start with
9595 unsigned int m_scratchSpaceUsedBySpills; // <! amount of scratch space needed for shader spilling
96- unsigned int m_scratchSpaceUsedByShader; // <! amount of scratch space needed by shader if allocated in scratchspace
97- unsigned int m_scratchSpaceUsedByStateless; // <! amount of scratch space needed by shader if allocated in stateless surface
96+ unsigned int m_scratchSpaceUsedByShader; // <! amount of scratch space needed by shader
9897 unsigned int m_scratchSpaceUsedByGtpin; // <! amount of scratch space used by gtpin
9998 void * m_debugDataVISA; // <! VISA debug data (source -> VISA)
10099 unsigned int m_debugDataVISASize; // <! Number of bytes of VISA debug data
@@ -114,7 +113,8 @@ namespace IGC
114113 // false means all of them are together
115114 bool m_separatePvtSpill = false ;
116115 bool m_roundPower2KBytes = false ;
117-
116+ unsigned int m_scratchSpaceSizeLimit = 0 ;
117+
118118 void Destroy ()
119119 {
120120 if (m_programBin)
@@ -131,48 +131,48 @@ namespace IGC
131131 }
132132 }
133133
134- void setSeparatePvtSpill (bool setSeparatePvtSpillT, bool roundPower2KBytes)
134+ void init (bool setSeparatePvtSpillT, bool roundPower2KBytes, unsigned int scratchSpaceSizeLimitT )
135135 {
136136 m_separatePvtSpill = setSeparatePvtSpillT;
137137 m_roundPower2KBytes = roundPower2KBytes;
138+ m_scratchSpaceSizeLimit = scratchSpaceSizeLimitT;
138139 }
139140
140- unsigned int getScratchSpaceUsage () const
141+ // InSlot0
142+ // Todo: rename later
143+ unsigned int getScratchSpaceUsageInSlot0 () const
141144 {
142- unsigned int size = m_scratchSpaceUsedBySpills + m_scratchSpaceUsedByGtpin + (m_separatePvtSpill ? 0 : m_scratchSpaceUsedByShader);
143- if (m_roundPower2KBytes)
144- {
145- size = roundPower2KBbyte (size);
146- }
147- return size;
145+ return roundSize (m_scratchSpaceUsedBySpills + m_scratchSpaceUsedByGtpin + (m_separatePvtSpill ? 0 : m_scratchSpaceUsedByShader));
148146 }
149147
150- unsigned int getScratchPrivateUsage () const
148+ unsigned int getScratchSpaceUsageInSlot1 () const
151149 {
152- return ( m_separatePvtSpill ? m_scratchSpaceUsedByShader : 0 );
150+ return roundSize (( m_separatePvtSpill && m_scratchSpaceUsedByShader <= m_scratchSpaceSizeLimit) ? m_scratchSpaceUsedByShader : 0 );
153151 }
154152
155- void setScratchPrivateUsage ( unsigned int scratchPrivateUsage, unsigned int scratchSpaceSizeLimit)
153+ unsigned int getScratchSpaceUsageInStateless () const
156154 {
157- if (m_separatePvtSpill && scratchPrivateUsage > scratchSpaceSizeLimit)
158- {
159- m_scratchSpaceUsedByStateless = scratchPrivateUsage;
160- }
161- else
162- {
163- m_scratchSpaceUsedByShader = scratchPrivateUsage;
164- }
155+ return ((m_separatePvtSpill && m_scratchSpaceUsedByShader > m_scratchSpaceSizeLimit) ? m_scratchSpaceUsedByShader : 0 );
165156 }
166157
167- unsigned int getStatelessPrivateUsage () const
158+ void setScratchSpaceUsedByShader ( unsigned int scratchSpaceUsedByShader)
168159 {
169- return (m_separatePvtSpill ? m_scratchSpaceUsedByStateless : 0 ) ;
160+ m_scratchSpaceUsedByShader = scratchSpaceUsedByShader ;
170161 }
171- private:
172- unsigned int roundPower2KBbyte (unsigned int size) const
162+ private:
163+ unsigned int roundSize (unsigned int size) const
164+ {
165+ if (m_roundPower2KBytes)
173166 {
174- return ( size ? iSTD::RoundPower2 ( iSTD::Max (int_cast<DWORD>( size), static_cast <DWORD>( sizeof (KILOBYTE)))) : 0 );
167+ size = roundPower2KBbyte ( size);
175168 }
169+ return size;
170+ }
171+
172+ unsigned int roundPower2KBbyte (unsigned int size) const
173+ {
174+ return (size ? iSTD::RoundPower2 (iSTD::Max (int_cast<DWORD>(size), static_cast <DWORD>(sizeof (KILOBYTE)))) : 0 );
175+ }
176176
177177 };
178178
0 commit comments