From 63ab36fe28b3a4f50de635c79d8e42aa014cc348 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Sun, 25 Feb 2024 09:30:54 -0800 Subject: [PATCH] intel/compiler: Fix SIMD lowering when instruction needs a larger SIMD When lower_simd_width() encounters an instruction that needs a larger SIMD, for example SHADER_OPCODE_TXS_LOGICAL in Gfx4 needs at least SIMD16. In this case the builder needs to be at least as large as max_width, otherwise the group() setup will assert. Turns out this did not assert before "by accident", since it was relying on the default fs_visitor builder that had a dispatch width of 64, a bogus placeholder value, expected not to be used. However, when we changed the code to remove that builder (and the bogus value), we created a new builder in the pass shader dispatch_width -- which work fine except in the case where we want to "lower" the SIMD above the shader dispatch width. The fix is to also consider the already calculated max_width when creating the builder. Fixes: 5b8ec015f27 ("intel/compiler: Don't use fs_visitor::bld in remaining places") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10338 Reviewed-by: Ian Romanick Part-of: (cherry picked from commit 337641cfcc952c01d0555791a7a5465abc867e0a) --- .pick_status.json | 2 +- src/intel/compiler/brw_fs.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 3f97b349938..aabede9cd75 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1764,7 +1764,7 @@ "description": "intel/compiler: Fix SIMD lowering when instruction needs a larger SIMD", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "5b8ec015f27e879438216f20198e907419ee2f13", "notes": null diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index cdf4db7a67f..b4b8f94992d 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -5473,7 +5473,8 @@ fs_visitor::lower_simd_width() */ const unsigned max_width = MAX2(inst->exec_size, lower_width); - const fs_builder bld = fs_builder(this).at_end(); + const fs_builder bld = + fs_builder(this, MAX2(max_width, this->dispatch_width)).at_end(); const fs_builder ibld = bld.at(block, inst) .exec_all(inst->force_writemask_all) .group(max_width, inst->group / max_width);