From 2a9f4618c52400115e05e8c30e3c32e5ab183078 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Fri, 14 Jun 2024 13:07:15 -0700 Subject: [PATCH] intel/brw: Make component_size() consistent between VGRF and FIXED_GRF Change so the size rounds up to the next multiple of the horizontal stride like is done for VGRF. This was causing an inconsistency in regs_read() -- The original component_size() calculation for FIXED_GRF excluded any padding at the end but it was still being discounted by regs_read(). Suggested by Curro. Fixes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11069 Reviewed-by: Francisco Jerez Part-of: --- src/intel/compiler/brw_fs.cpp | 5 ++++- src/intel/compiler/test_fs_scoreboard.cpp | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index 8edfec65369..79d6169e638 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -611,7 +611,10 @@ fs_reg::component_size(unsigned width) const const unsigned vs = vstride ? 1 << (vstride - 1) : 0; const unsigned hs = hstride ? 1 << (hstride - 1) : 0; assert(w > 0); - return ((MAX2(1, h) - 1) * vs + (w - 1) * hs + 1) * brw_type_size_bytes(type); + /* Note this rounds up to next horizontal stride to be consistent with + * the VGRF case below. + */ + return ((MAX2(1, h) - 1) * vs + MAX2(w * hs, 1)) * brw_type_size_bytes(type); } else { return MAX2(width * stride, 1) * brw_type_size_bytes(type); } diff --git a/src/intel/compiler/test_fs_scoreboard.cpp b/src/intel/compiler/test_fs_scoreboard.cpp index 141c94d1d8f..2a44f532bfc 100644 --- a/src/intel/compiler/test_fs_scoreboard.cpp +++ b/src/intel/compiler/test_fs_scoreboard.cpp @@ -892,7 +892,7 @@ TEST_F(scoreboard_test, gfx125_RaR_over_different_pipes) EXPECT_EQ(instruction(block0, 2)->sched, tgl_swsb_regdist(1)); } -TEST_F(scoreboard_test, DISABLED_gitlab_issue_from_mr_29723) +TEST_F(scoreboard_test, gitlab_issue_from_mr_29723) { brw_init_isa_info(&compiler->isa, devinfo); @@ -916,7 +916,7 @@ TEST_F(scoreboard_test, DISABLED_gitlab_issue_from_mr_29723) EXPECT_EQ(instruction(block0, 1)->sched, tgl_swsb_regdist(1)); } -TEST_F(scoreboard_test, DISABLED_gitlab_issue_11069) +TEST_F(scoreboard_test, gitlab_issue_11069) { brw_init_isa_info(&compiler->isa, devinfo);