Mesa (staging/20.0): intel/fs: Don't delete coalesced MOVs if they have a cmod
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Apr 29 23:14:23 UTC 2020
Module: Mesa
Branch: staging/20.0
Commit: 90934659dcf9276873ccf3fa8ee5665976c7a4cb
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=90934659dcf9276873ccf3fa8ee5665976c7a4cb
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Mon Apr 27 15:31:12 2020 -0500
intel/fs: Don't delete coalesced MOVs if they have a cmod
Shader-db results on ICL:
total instructions in shared programs: 17133088 -> 17133287 (<.01%)
instructions in affected programs: 61300 -> 61499 (0.32%)
helped: 0
HURT: 199
This means it's likely fixing 199 bugs. :-) All the changed shaders are
in Mad Max. It's surprisingly difficult to get the back-end compiler to
generate a pattern that hits this we don't tend to emit a lot coalescable
MOVs. The pattern in Mad Max that's able to hit is fsign(fsat(x)) under
the right conditions.
Closes: #2820
Cc: mesa-stable at lists.freedesktop.org
Tested-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4773>
(cherry picked from commit e581ddeeeecf9475d0634794ee126096d0f23135)
---
.pick_status.json | 2 +-
src/intel/compiler/brw_fs_register_coalesce.cpp | 17 +++++++++++++++--
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index fa281cc4cb9..41c46c98844 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -148,7 +148,7 @@
"description": "intel/fs: Don't delete coalesced MOVs if they have a cmod",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": null
},
diff --git a/src/intel/compiler/brw_fs_register_coalesce.cpp b/src/intel/compiler/brw_fs_register_coalesce.cpp
index 8127b29369c..3d84b987bb0 100644
--- a/src/intel/compiler/brw_fs_register_coalesce.cpp
+++ b/src/intel/compiler/brw_fs_register_coalesce.cpp
@@ -242,13 +242,26 @@ fs_visitor::register_coalesce()
progress = true;
for (int i = 0; i < src_size; i++) {
- if (mov[i]) {
+ if (!mov[i])
+ continue;
+
+ if (mov[i]->conditional_mod == BRW_CONDITIONAL_NONE) {
mov[i]->opcode = BRW_OPCODE_NOP;
- mov[i]->conditional_mod = BRW_CONDITIONAL_NONE;
mov[i]->dst = reg_undef;
for (int j = 0; j < mov[i]->sources; j++) {
mov[i]->src[j] = reg_undef;
}
+ } else {
+ /* If we have a conditional modifier, rewrite the MOV to be a
+ * MOV.cmod from the coalesced register. Hopefully, cmod
+ * propagation will clean this up and move it to the instruction
+ * that writes the register. If not, this keeps things correct
+ * while still letting us coalesce.
+ */
+ assert(mov[i]->opcode == BRW_OPCODE_MOV);
+ assert(mov[i]->sources == 1);
+ mov[i]->src[0] = mov[i]->dst;
+ mov[i]->dst = retype(brw_null_reg(), mov[i]->dst.type);
}
}
More information about the mesa-commit
mailing list