intel/compiler: Don't cmod propagate into a saturated operation
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 4 Oct 2017 20:49:29 +0000 (13:49 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 5 Oct 2017 18:54:49 +0000 (11:54 -0700)
Shader-db results on Sky Lake:

    total instructions in shared programs: 12954445 -> 12955125 (0.01%)
    instructions in affected programs: 141862 -> 142542 (0.48%)
    helped: 0
    HURT: 626

Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
src/intel/compiler/brw_fs_cmod_propagation.cpp
src/intel/compiler/brw_vec4_cmod_propagation.cpp

index 2d50c92e9e303b0bd96feec3e5129b190650b7b5..db63e942b75f940cc3a493fedc2a8ba83cbc23e8 100644 (file)
@@ -142,6 +142,14 @@ opt_cmod_propagation_local(const gen_device_info *devinfo, bblock_t *block)
                 scan_inst->opcode == BRW_OPCODE_CMPN)
                break;
 
+            /* From the Sky Lake PRM Vol. 7 "Assigning Conditional Mods":
+             *
+             *    * Note that the [post condition signal] bits generated at
+             *      the output of a compute are before the .sat.
+             */
+            if (scan_inst->saturate)
+               break;
+
             /* Otherwise, try propagating the conditional. */
             enum brw_conditional_mod cond =
                inst->src[0].negate ? brw_swap_cmod(inst->conditional_mod)
index 4454cdbfc94a25e153e2a18357141a10148b99d4..05e651681935f25de6f7527edec38b9b3bddecbc 100644 (file)
@@ -129,6 +129,14 @@ opt_cmod_propagation_local(bblock_t *block)
                 scan_inst->opcode == BRW_OPCODE_CMPN)
                break;
 
+            /* From the Sky Lake PRM Vol. 7 "Assigning Conditional Mods":
+             *
+             *    * Note that the [post condition signal] bits generated at
+             *      the output of a compute are before the .sat.
+             */
+            if (scan_inst->saturate)
+               break;
+
             /* Otherwise, try propagating the conditional. */
             enum brw_conditional_mod cond =
                inst->src[0].negate ? brw_swap_cmod(inst->conditional_mod)