jay/lower_scoreboard: use CFG for RegDist scoreboarding

this is now properly global.

Totals from 558 (21.08% of 2647) affected shaders:
CodeSize: 42098496 -> 42078256 (-0.05%); split: -0.05%, +0.00%

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41510>
This commit is contained in:
Alyssa Rosenzweig 2026-05-08 10:41:44 -04:00 committed by Marge Bot
parent c2a423b5b5
commit 89e33407e4

View file

@ -7,6 +7,7 @@
#include "compiler/brw/brw_eu_defines.h"
#include "util/bitscan.h"
#include "util/bitset.h"
#include "util/list.h"
#include "util/macros.h"
#include "util/u_math.h"
#include "jay_builder.h"
@ -411,7 +412,31 @@ jay_lower_scoreboard(jay_shader *shader)
lower_send_local(f, block);
}
/* RegDist scoreboarding is global but requires no dataflow analysis,
* because taking a branch stalls all ALU pipelines. Therefore, it
* suffices to propagate scoreboard state along fallthrough edges. We
* implement that backwards: state is preserved (correctness), except we
* clear access[] when entering blocks that are unreachable by falling
* through from the previous source-order block and hence must be branch
* targets coming in with a clear scoreboard. next[] tracks the
* fallthrough block for the logical & physical CFGs respectively.
*/
jay_block *next[UGPR + 1] = { NULL };
jay_foreach_block(f, block) {
/* Clear access[] for GPRs according to the logical CFG and for UGPRs
* according to the physical CFG. This is a bit pedantic but it ensures
* we keep the dependencies for UGPRs across halves of if-else.
*/
for (unsigned f = GPR; f <= UGPR; f++) {
if (!list_is_empty(&block->instructions) && next[f] != block) {
memset(access + (f ? shader->num_regs[GPR] : 0), 0,
sizeof(access[0]) * shader->num_regs[f]);
}
next[f] = jay_successors(block, f)[0];
}
jay_foreach_inst_in_block_safe(block, I) {
if (I->op == JAY_OPCODE_SYNC) {
state.last_sync = I;