intel/fs: Tweak default case of fs_inst::size_read()
authorCaio Oliveira <caio.oliveira@intel.com>
Tue, 3 Oct 2023 18:12:47 +0000 (11:12 -0700)
committerMarge Bot <emma+marge@anholt.net>
Fri, 6 Oct 2023 09:16:56 +0000 (09:16 +0000)
In the default case, there's a special case with a few conditions.
Prefer the cheapest conditions first, so we can take advantage of
short-circuiting.

Effect is a small but still significant reduce in shader compilation
times, as can be seen by:

- Fossil replay for Rise of the Tomb Raider

```
Difference at 95.0% confidence
-0.433333 +/- 0.028609
-1.42556% +/- 0.0941163%
(Student's t, pooled s = 0.0337886)
```

- Fossil replay for Batman Arkham City

```
Difference at 95.0% confidence
-8.84 +/- 0.146083
-1.65932% +/- 0.0274207%
(Student's t, pooled s = 0.125423)
```

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25549>

src/intel/compiler/brw_fs.cpp

index 02d8f56..1fdf6f0 100644 (file)
@@ -911,7 +911,7 @@ fs_inst::size_read(int arg) const
       break;
 
    default:
-      if (is_tex() && arg == 0 && src[0].file == VGRF)
+      if (arg == 0 && src[0].file == VGRF && is_tex())
          return mlen * REG_SIZE;
       break;
    }