summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadym Shovkoplias <vadym.shovkoplias@globallogic.com>2021-10-21 23:06:29 +0300
committerEric Engestrom <eric@engestrom.ch>2021-11-03 20:15:49 +0000
commitbca13e8fc8c16c6a4110c3ecb005022170736121 (patch)
treef129cb44a360c8c8b2bd387072ee324df782b457
parent3e826c339cf93c06f9ce319ed363c52d2cf438c4 (diff)
downloadmesa-bca13e8fc8c16c6a4110c3ecb005022170736121.tar.gz
intel/fs: Fix a cmod prop bug when cmod is set to inst that doesn't support it
Fixes dEQP-VK.reconvergence.*nesting* tests. There are cases when cmod is set to an instruction that cannot have conditional modifier. E.g. following: find_live_channel(32) vgrf166:UD, NoMask cmp.z.f0.0(32) null:D, vgrf166+0.0<0>:D, 0d is optimized to: find_live_channel.z.f0.0(32) vgrf166:UD, NoMask v2: - Add unit test to check cmod is not set to 'find_live_channel' (Matt Turner) - Update flag_subreg when conditonal_mod is updated (Ian Romanick) Signed-off-by: Vadym Shovkoplias <vadym.shovkoplias@globallogic.com> Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5431 Fixes: 32b7ba66b01 ("intel/compiler: fix cmod propagation optimisations") Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13268> (cherry picked from commit 2dbb66997e2e2ab0a07a84a40df70d8d75fe2524)
-rw-r--r--.pick_status.json2
-rw-r--r--src/intel/compiler/brw_fs_cmod_propagation.cpp5
-rw-r--r--src/intel/compiler/test_fs_cmod_propagation.cpp32
3 files changed, 37 insertions, 2 deletions
diff --git a/.pick_status.json b/.pick_status.json
index d3fdb8d69e5..8aaafa8ff4e 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -427,7 +427,7 @@
"description": "intel/fs: Fix a cmod prop bug when cmod is set to inst that doesn't support it",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "32b7ba66b0156d9fd40b059f20da79a74451f7fd"
},
diff --git a/src/intel/compiler/brw_fs_cmod_propagation.cpp b/src/intel/compiler/brw_fs_cmod_propagation.cpp
index afbc34eef23..ed0c5aa0c70 100644
--- a/src/intel/compiler/brw_fs_cmod_propagation.cpp
+++ b/src/intel/compiler/brw_fs_cmod_propagation.cpp
@@ -135,6 +135,7 @@ cmod_propagate_cmp_to_add(const intel_device_info *devinfo, bblock_t *block,
((!read_flag && scan_inst->conditional_mod == BRW_CONDITIONAL_NONE) ||
scan_inst->conditional_mod == cond)) {
scan_inst->conditional_mod = cond;
+ scan_inst->flag_subreg = inst->flag_subreg;
inst->remove(block, true);
return true;
}
@@ -203,6 +204,7 @@ cmod_propagate_not(const intel_device_info *devinfo, bblock_t *block,
((!read_flag && scan_inst->conditional_mod == BRW_CONDITIONAL_NONE) ||
scan_inst->conditional_mod == cond)) {
scan_inst->conditional_mod = cond;
+ scan_inst->flag_subreg = inst->flag_subreg;
inst->remove(block, true);
return true;
}
@@ -458,8 +460,9 @@ opt_cmod_propagation_local(const intel_device_info *devinfo, bblock_t *block)
}
break;
- } else if (!read_flag) {
+ } else if (!read_flag && scan_inst->can_do_cmod()) {
scan_inst->conditional_mod = inst->conditional_mod;
+ scan_inst->flag_subreg = inst->flag_subreg;
inst->remove(block, true);
progress = true;
break;
diff --git a/src/intel/compiler/test_fs_cmod_propagation.cpp b/src/intel/compiler/test_fs_cmod_propagation.cpp
index 6d5851d6448..15ca26a3986 100644
--- a/src/intel/compiler/test_fs_cmod_propagation.cpp
+++ b/src/intel/compiler/test_fs_cmod_propagation.cpp
@@ -251,6 +251,38 @@ TEST_F(cmod_propagation_test, non_cmod_instruction)
EXPECT_EQ(BRW_CONDITIONAL_GE, instruction(block0, 1)->conditional_mod);
}
+TEST_F(cmod_propagation_test, non_cmod_livechannel)
+{
+ const fs_builder &bld = v->bld;
+ fs_reg dest = v->vgrf(glsl_type::uint_type);
+ fs_reg zero(brw_imm_d(0));
+ bld.emit(SHADER_OPCODE_FIND_LIVE_CHANNEL, dest)->exec_size = 32;
+ bld.CMP(bld.null_reg_d(), dest, zero, BRW_CONDITIONAL_Z)->exec_size = 32;
+
+ /* = Before =
+ *
+ * 0: find_live_channel(32) dest
+ * 1: cmp.z.f0.0(32) null dest 0d
+ *
+ *
+ * = After =
+ * (no changes)
+ */
+
+ v->calculate_cfg();
+ bblock_t *block0 = v->cfg->blocks[0];
+
+ EXPECT_EQ(0, block0->start_ip);
+ EXPECT_EQ(1, block0->end_ip);
+
+ EXPECT_FALSE(cmod_propagation(v));
+ EXPECT_EQ(0, block0->start_ip);
+ EXPECT_EQ(1, block0->end_ip);
+ EXPECT_EQ(SHADER_OPCODE_FIND_LIVE_CHANNEL, instruction(block0, 0)->opcode);
+ EXPECT_EQ(BRW_OPCODE_CMP, instruction(block0, 1)->opcode);
+ EXPECT_EQ(BRW_CONDITIONAL_Z, instruction(block0, 1)->conditional_mod);
+}
+
TEST_F(cmod_propagation_test, intervening_flag_write)
{
const fs_builder &bld = v->bld;