nir: get ffma support from NIR options for nir_lower_flrp
This also fixes the inverted last parameter of nir_lower_flrp in most drivers. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6599>
This commit is contained in:
@@ -173,7 +173,7 @@ traces:
|
||||
- path: godot/Material Testers.x86_64_2020.04.08_13.38_frame799.rdc
|
||||
expectations:
|
||||
- device: gl-radeonsi-stoney
|
||||
checksum: 2ddcda6b1c136ce1448714a3ff8432eb
|
||||
checksum: 5164e238381e7d77a64e3de771cc005f
|
||||
- path: gputest/gimark.trace
|
||||
expectations:
|
||||
- device: gl-radeonsi-stoney
|
||||
|
@@ -261,8 +261,7 @@ radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively,
|
||||
shader,
|
||||
nir_lower_flrp,
|
||||
lower_flrp,
|
||||
false /* always_precise */,
|
||||
shader->options->lower_ffma);
|
||||
false /* always_precise */);
|
||||
if (lower_flrp_progress) {
|
||||
NIR_PASS(progress, shader,
|
||||
nir_opt_constant_folding);
|
||||
|
@@ -1451,8 +1451,7 @@ v3d_optimize_nir(struct nir_shader *s)
|
||||
|
||||
NIR_PASS(lower_flrp_progress, s, nir_lower_flrp,
|
||||
lower_flrp,
|
||||
false /* always_precise */,
|
||||
s->options->lower_ffma);
|
||||
false /* always_precise */);
|
||||
if (lower_flrp_progress) {
|
||||
NIR_PASS(progress, s, nir_opt_constant_folding);
|
||||
progress = true;
|
||||
|
@@ -4314,7 +4314,7 @@ void nir_lower_alpha_test(nir_shader *shader, enum compare_func func,
|
||||
bool nir_lower_alu(nir_shader *shader);
|
||||
|
||||
bool nir_lower_flrp(nir_shader *shader, unsigned lowering_mask,
|
||||
bool always_precise, bool have_ffma);
|
||||
bool always_precise);
|
||||
|
||||
bool nir_lower_alu_to_scalar(nir_shader *shader, nir_instr_filter_cb cb, const void *data);
|
||||
bool nir_lower_bool_to_bitsize(nir_shader *shader);
|
||||
|
@@ -364,9 +364,10 @@ static void
|
||||
convert_flrp_instruction(nir_builder *bld,
|
||||
struct u_vector *dead_flrp,
|
||||
nir_alu_instr *alu,
|
||||
bool always_precise,
|
||||
bool have_ffma)
|
||||
bool always_precise)
|
||||
{
|
||||
bool have_ffma = !bld->shader->options->lower_ffma;
|
||||
|
||||
bld->cursor = nir_before_instr(&alu->instr);
|
||||
|
||||
/* There are two methods to implement flrp(x, y, t). The strictly correct
|
||||
@@ -586,8 +587,7 @@ static void
|
||||
lower_flrp_impl(nir_function_impl *impl,
|
||||
struct u_vector *dead_flrp,
|
||||
unsigned lowering_mask,
|
||||
bool always_precise,
|
||||
bool have_ffma)
|
||||
bool always_precise)
|
||||
{
|
||||
nir_builder b;
|
||||
nir_builder_init(&b, impl);
|
||||
@@ -599,8 +599,7 @@ lower_flrp_impl(nir_function_impl *impl,
|
||||
|
||||
if (alu->op == nir_op_flrp &&
|
||||
(alu->dest.dest.ssa.bit_size & lowering_mask)) {
|
||||
convert_flrp_instruction(&b, dead_flrp, alu, always_precise,
|
||||
have_ffma);
|
||||
convert_flrp_instruction(&b, dead_flrp, alu, always_precise);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -622,8 +621,7 @@ lower_flrp_impl(nir_function_impl *impl,
|
||||
bool
|
||||
nir_lower_flrp(nir_shader *shader,
|
||||
unsigned lowering_mask,
|
||||
bool always_precise,
|
||||
bool have_ffma)
|
||||
bool always_precise)
|
||||
{
|
||||
struct u_vector dead_flrp;
|
||||
|
||||
@@ -633,7 +631,7 @@ nir_lower_flrp(nir_shader *shader,
|
||||
nir_foreach_function(function, shader) {
|
||||
if (function->impl) {
|
||||
lower_flrp_impl(function->impl, &dead_flrp, lowering_mask,
|
||||
always_precise, have_ffma);
|
||||
always_precise);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -185,8 +185,7 @@ ir3_optimize_loop(nir_shader *s)
|
||||
if (lower_flrp != 0) {
|
||||
if (OPT(s, nir_lower_flrp,
|
||||
lower_flrp,
|
||||
false /* always_precise */,
|
||||
s->options->lower_ffma)) {
|
||||
false /* always_precise */)) {
|
||||
OPT(s, nir_opt_constant_folding);
|
||||
progress = true;
|
||||
}
|
||||
|
@@ -203,7 +203,7 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
|
||||
NIR_PASS_V(sel->nir, nir_lower_int64);
|
||||
NIR_PASS_V(sel->nir, nir_opt_vectorize, NULL, NULL);
|
||||
}
|
||||
NIR_PASS_V(sel->nir, nir_lower_flrp, ~0, false, false);
|
||||
NIR_PASS_V(sel->nir, nir_lower_flrp, ~0, false);
|
||||
}
|
||||
nir_tgsi_scan_shader(sel->nir, &sel->info, true);
|
||||
|
||||
|
@@ -644,8 +644,7 @@ static void si_nir_opts(struct nir_shader *nir, bool first)
|
||||
assert(lower_flrp);
|
||||
bool lower_flrp_progress = false;
|
||||
|
||||
NIR_PASS(lower_flrp_progress, nir, nir_lower_flrp, lower_flrp, false /* always_precise */,
|
||||
nir->options->lower_ffma);
|
||||
NIR_PASS(lower_flrp_progress, nir, nir_lower_flrp, lower_flrp, false /* always_precise */);
|
||||
if (lower_flrp_progress) {
|
||||
NIR_PASS(progress, nir, nir_opt_constant_folding);
|
||||
progress = true;
|
||||
|
@@ -1546,8 +1546,7 @@ vc4_optimize_nir(struct nir_shader *s)
|
||||
|
||||
NIR_PASS(lower_flrp_progress, s, nir_lower_flrp,
|
||||
lower_flrp,
|
||||
false /* always_precise */,
|
||||
s->options->lower_ffma);
|
||||
false /* always_precise */);
|
||||
if (lower_flrp_progress) {
|
||||
NIR_PASS(progress, s, nir_opt_constant_folding);
|
||||
progress = true;
|
||||
|
@@ -590,7 +590,7 @@ val_shader_compile_to_ir(struct val_pipeline *pipeline,
|
||||
do {
|
||||
progress = false;
|
||||
|
||||
progress |= OPT(nir_lower_flrp, 32|64, true, false);
|
||||
progress |= OPT(nir_lower_flrp, 32|64, true);
|
||||
progress |= OPT(nir_split_array_vars, nir_var_function_temp);
|
||||
progress |= OPT(nir_shrink_vec_array_vars, nir_var_function_temp);
|
||||
progress |= OPT(nir_opt_deref);
|
||||
|
@@ -597,8 +597,7 @@ brw_nir_optimize(nir_shader *nir, const struct brw_compiler *compiler,
|
||||
if (lower_flrp != 0) {
|
||||
if (OPT(nir_lower_flrp,
|
||||
lower_flrp,
|
||||
false /* always_precise */,
|
||||
compiler->devinfo->gen >= 6)) {
|
||||
false /* always_precise */)) {
|
||||
OPT(nir_opt_constant_folding);
|
||||
}
|
||||
|
||||
|
@@ -305,8 +305,7 @@ st_nir_opts(nir_shader *nir)
|
||||
|
||||
NIR_PASS(lower_flrp_progress, nir, nir_lower_flrp,
|
||||
lower_flrp,
|
||||
false /* always_precise */,
|
||||
nir->options->lower_ffma);
|
||||
false /* always_precise */);
|
||||
if (lower_flrp_progress) {
|
||||
NIR_PASS(progress, nir,
|
||||
nir_opt_constant_folding);
|
||||
|
@@ -1272,8 +1272,7 @@ bi_optimize_nir(nir_shader *nir)
|
||||
nir,
|
||||
nir_lower_flrp,
|
||||
lower_flrp,
|
||||
false /* always_precise */,
|
||||
nir->options->lower_ffma);
|
||||
false /* always_precise */);
|
||||
if (lower_flrp_progress) {
|
||||
NIR_PASS(progress, nir,
|
||||
nir_opt_constant_folding);
|
||||
|
@@ -536,8 +536,7 @@ optimise_nir(nir_shader *nir, unsigned quirks, bool is_blend)
|
||||
nir,
|
||||
nir_lower_flrp,
|
||||
lower_flrp,
|
||||
false /* always_precise */,
|
||||
nir->options->lower_ffma);
|
||||
false /* always_precise */);
|
||||
if (lower_flrp_progress) {
|
||||
NIR_PASS(progress, nir,
|
||||
nir_opt_constant_folding);
|
||||
|
Reference in New Issue
Block a user