File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -194,8 +194,18 @@ namespace vISA
194
194
auto change = before^after;
195
195
if (change)
196
196
{
197
- double delta = vars[id]->getDeclare ()->getByteSize () < 32 ?
198
- vars[id]->getDeclare ()->getByteSize () / 32.0 : (double ) vars[id]->getDeclare ()->getNumRows ();
197
+ // For <1 GRF variable we have to take alignment into consideration as well when computing register pressure.
198
+ // For now we double each <1GRF variable's size if its alignment also exceeds its size.
199
+ // Alternative is to simply take the alignment as the size, but it might cause performance regressions
200
+ // due to being too conservative (i.e., a GRF-aligned variable may share physical GRF with several other
201
+ auto dclSize = vars[id]->getDeclare ()->getByteSize ();
202
+ if (dclSize < getGRFSize () && dclSize < static_cast <uint32_t >(vars[id]->getDeclare ()->getSubRegAlign ()) * 2 )
203
+ {
204
+ dclSize *= 2 ;
205
+ }
206
+
207
+ double delta = dclSize < getGRFSize () ?
208
+ dclSize / (double ) getGRFSize () : (double ) vars[id]->getDeclare ()->getNumRows ();
199
209
if (before & change)
200
210
{
201
211
if (regPressure < delta)
You can’t perform that action at this time.
0 commit comments