From 9975a35f43eb3b19daa719e83f9c73feff71a4f7 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Fri, 8 May 2026 12:58:56 -0700 Subject: [PATCH] brw: Avoid unnecessary calls to size_read() in flags_read() Only ARF sources are relevant in this case, so check the file before calling size_read(). Below are fossil compilation times in a MTL machine compiling shaders for a BMG GPU: ``` // Differences at 95.0% confidence. // Rise of the Tomb Raider (n=20) No difference proven // Alan Wake (n=20) -0.0725 +/- 0.0139437 -2.30965276% +/- 0.438787% // Borderlands 3 (n=14) -0.248571429 +/- 0.135107 -1.76946153% +/- 0.954171% // Oblivion Remastered (n=14) -0.0735714286 +/- 0.0235712 -1.54770849% +/- 0.492117% // Baldur's Gate 3 (n=14) -0.832142857 +/- 0.23095 -1.98028217% +/- 0.545648% ``` Reviewed-by: Ian Romanick Part-of: --- src/intel/compiler/brw/brw_inst.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/intel/compiler/brw/brw_inst.cpp b/src/intel/compiler/brw/brw_inst.cpp index f76110a46a0..19a7b087ea6 100644 --- a/src/intel/compiler/brw/brw_inst.cpp +++ b/src/intel/compiler/brw/brw_inst.cpp @@ -707,7 +707,8 @@ brw_inst::flags_read(const intel_device_info *devinfo) const } else { unsigned mask = 0; for (int i = 0; i < sources; i++) { - mask |= brw_flag_mask(src[i], size_read(devinfo, i)); + if (src[i].file == ARF) + mask |= brw_flag_mask(src[i], size_read(devinfo, i)); } return mask; }