From 92bfcb208fa13ea201c7aa421a26c7e662a7e974 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 27 Mar 2026 20:59:38 -0700 Subject: [PATCH] brw: brw_reg::nr for an accumulator is not part of the offset Without this, reg_offset will return 1024 for acc0. This causes has_invalid_dst_region to decide that the destination region is invalid (because 1024 != 0), and the lowering code tries to treat the floating point accumulators as integers. It's a mess. v2: Add and use set_gfx_platform. Suggested by Caio. Fixes: 937373eb25c ("i965/fs: Handle fixed HW GRF subnr in reg_offset().") Reviewed-by: Caio Oliveira (cherry picked from commit cfdb3ddb93c02eb1e98e9f634263313fc87693c0) Part-of: --- .pick_status.json | 2 +- src/intel/compiler/brw/brw_reg.h | 3 ++- src/intel/compiler/brw/test_helpers.h | 12 ++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 8a8dc078b07..b39cb0a02f7 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3344,7 +3344,7 @@ "description": "brw: brw_reg::nr for an accumulator is not part of the offset", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "937373eb25c53b0803e526b7b273afc2b3330752", "notes": null diff --git a/src/intel/compiler/brw/brw_reg.h b/src/intel/compiler/brw/brw_reg.h index ab9ad970455..786c4bdee04 100644 --- a/src/intel/compiler/brw/brw_reg.h +++ b/src/intel/compiler/brw/brw_reg.h @@ -1447,7 +1447,8 @@ reg_space(const brw_reg &r) static inline unsigned reg_offset(const brw_reg &r) { - return (r.file == ADDRESS || r.file == VGRF || r.file == IMM || r.file == ATTR ? 0 : r.nr) * + return (r.file == ADDRESS || r.file == VGRF || r.file == IMM || + r.file == ATTR || brw_reg_is_arf(r, BRW_ARF_ACCUMULATOR) ? 0 : r.nr) * (r.file == UNIFORM ? 4 : REG_SIZE) + r.offset + (r.file == ADDRESS || r.file == ARF || r.file == FIXED_GRF ? r.subnr : 0); } diff --git a/src/intel/compiler/brw/test_helpers.h b/src/intel/compiler/brw/test_helpers.h index 25e4155371d..b1ec3cd7143 100644 --- a/src/intel/compiler/brw/test_helpers.h +++ b/src/intel/compiler/brw/test_helpers.h @@ -128,6 +128,18 @@ protected: brw_init_isa_info(&compiler->isa, devinfo); } + void + set_gfx_platform(const char *name) + { + int pci_id = intel_device_name_to_pci_device_id(name); + assert(pci_id > 0); + + intel_get_device_info_from_pci_id(pci_id, devinfo); + assert(devinfo->ver > 0); + + brw_init_isa_info(&compiler->isa, devinfo); + } + brw_builder make_shader(mesa_shader_stage stage = MESA_SHADER_FRAGMENT, unsigned dispatch_width = 0)