Mesa (vulkan): nir/spirv: Remove the NoContraction hack

Jason Ekstrand jekstrand at kemper.freedesktop.org
Mon Mar 28 19:40:18 UTC 2016


Module: Mesa
Branch: vulkan
Commit: 47cac6c560b1d229c974daa1113ead47e9bff1f5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=47cac6c560b1d229c974daa1113ead47e9bff1f5

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Mon Mar 28 12:27:40 2016 -0700

nir/spirv: Remove the NoContraction hack

NIR now just handles this for us by not fusing if the multiply is marked as
exact.

---

 src/compiler/nir/spirv/vtn_alu.c | 23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/src/compiler/nir/spirv/vtn_alu.c b/src/compiler/nir/spirv/vtn_alu.c
index c9526f1..8b9a63c 100644
--- a/src/compiler/nir/spirv/vtn_alu.c
+++ b/src/compiler/nir/spirv/vtn_alu.c
@@ -329,30 +329,9 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
    /* Collect the various SSA sources */
    const unsigned num_inputs = count - 3;
    struct vtn_ssa_value *vtn_src[4] = { NULL, };
-   for (unsigned i = 0; i < num_inputs; i++) {
+   for (unsigned i = 0; i < num_inputs; i++)
       vtn_src[i] = vtn_ssa_value(b, w[i + 3]);
 
-      /* The way SPIR-V defines the NoContraction decoration is rediculous.
-       * It expressly says in the SPIR-V spec:
-       *
-       *    "For example, if applied to an OpFMul, that multiply can’t be
-       *    combined with an addition to yield a fused multiply-add
-       *    operation."
-       *
-       * Technically, this means we would have to either rewrite NIR with
-       * another silly "don't fuse me" flag or we would have to propagate
-       * the NoContraction decoration to all consumers of a value which
-       * would make it far more infectious than anyone intended.
-       *
-       * Instead, we take a short-cut by simply looking at the sources and
-       * see if any of them have it.  That should be good enough.
-       *
-       * See also issue #17 on the SPIR-V gitlab
-       */
-      vtn_foreach_decoration(b, vtn_untyped_value(b, w[i + 3]),
-                             handle_no_contraction, NULL);
-   }
-
    if (glsl_type_is_matrix(vtn_src[0]->type) ||
        (num_inputs >= 2 && glsl_type_is_matrix(vtn_src[1]->type))) {
       vtn_handle_matrix_alu(b, opcode, val, vtn_src[0], vtn_src[1]);




More information about the mesa-commit mailing list