summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2022-02-08 17:53:02 -0800
committerDylan Baker <dylan.c.baker@intel.com>2022-02-24 14:56:50 -0800
commitd653651b49df3b9bf7ab4165cb221a66b7b9bd5c (patch)
tree623ee3ccfc9a6a50a67c683bd6a8c7fc4264b8b9
parent7ba68c86f788aff078851cb70d25fa6dc327b7eb (diff)
gallivm/nir: Call nir_lower_bool_to_int32 after nir_opt_algebraic_late
All of the opcodes in nir_opt_algebraic_late are the unsized (1-bit) versions. If the lowering to int32 happens first, many of the optimizations and lowerings won't happen. Of particular importance is the lowering of fisfinite. If a shader happens to contain fisfinite of an fp16 value, it will assert later during compliation. Reviewed-by: Dave Airlie <airlied@redhat.com> Fixes: 78b4e417d44 ("gallivm: handle fisfinite/fisnormal") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14942> (cherry picked from commit e3cbc328e0dbb5865cc036ecbf977127850b4670)
-rw-r--r--.pick_status.json2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_nir.c9
2 files changed, 7 insertions, 4 deletions
diff --git a/.pick_status.json b/.pick_status.json
index c58ec23ae74..8f17ac3f280 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -373,7 +373,7 @@
"description": "gallivm/nir: Call nir_lower_bool_to_int32 after nir_opt_algebraic_late",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "78b4e417d44016cdb5df7dbfc3b1ea28219e6fd4"
},
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir.c b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
index 6dbb840cd73..2538bf32e49 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
@@ -733,8 +733,7 @@ static LLVMValueRef do_alu_action(struct lp_build_nir_context *bld_base,
break;
}
case nir_op_fisfinite32:
- result = lp_build_isfinite(get_flt_bld(bld_base, src_bit_size[0]), src[0]);
- break;
+ unreachable("Should have been lowered in nir_opt_algebraic_late.");
case nir_op_flog2:
result = lp_build_log2_safe(get_flt_bld(bld_base, src_bit_size[0]), src[0]);
break;
@@ -2479,7 +2478,6 @@ void lp_build_opt_nir(struct nir_shader *nir)
NIR_PASS_V(nir, nir_lower_subgroups, &subgroups_options);
} while (progress);
- nir_lower_bool_to_int32(nir);
do {
progress = false;
@@ -2490,4 +2488,9 @@ void lp_build_opt_nir(struct nir_shader *nir)
NIR_PASS_V(nir, nir_opt_cse);
}
} while (progress);
+
+ if (nir_lower_bool_to_int32(nir)) {
+ NIR_PASS_V(nir, nir_copy_prop);
+ NIR_PASS_V(nir, nir_opt_dce);
+ }
}