nir/algebraic: prevent ffract optimization on lowered ffloor
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

ffloor(a) is lowered as a - ffract(a). dEQP expects that for example
ffloor(a) == 1.0 for every a in between 1.0 a 2.0. This worked fine,
but the new ffract(a + b(is_integral)) -> ffract(a) rule broke this.
Specifically, dEQP-GLES2.functional.shaders.struct.uniform.equal_fragment
checks that ffloor(a + 1.0) == 1.0 for every a between 0.0 and 1.0.
However this is not exactly true once the ffract(a + 1.0) is lowered
to ffract(a).

Prevent this by marking ffract from ffloor lowering as exact so that
the recently introduced ffract(a + b(is_integral)) -> ffract(a) rule
does not trigger.

Fixes: c6aaafa3 ("nir: add lowering for ffloor")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15562
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41882>
This commit is contained in:
Pavel Ondračka 2026-05-29 09:18:56 +02:00 committed by Marge Bot
parent 8ec56cc0cc
commit f6b06ea3de
11 changed files with 3 additions and 94 deletions

View file

@ -532,9 +532,9 @@ optimizations.extend([
(('ftrunc@64', a), ('bcsel', ('flt', a, 0.0), ('fneg', ('ffloor', ('fabs', a))), ('ffloor', ('fabs', a))),
'(options->lower_ftrunc || (options->lower_doubles_options & nir_lower_dtrunc)) && (!(options->lower_doubles_options & nir_lower_dfloor) || !(options->lower_doubles_options & nir_lower_dfract))'),
(('ffloor@16', a), ('fsub', a, ('ffract', a)), 'options->lower_ffloor'),
(('ffloor@32', a), ('fsub', a, ('ffract', a)), 'options->lower_ffloor'),
(('ffloor@64', a), ('fsub', a, ('ffract', a)), '(options->lower_ffloor || (options->lower_doubles_options & nir_lower_dfloor)) && !(options->lower_doubles_options & nir_lower_dfract)'),
(('ffloor@16', a), ('fsub', a, ('!ffract', a)), 'options->lower_ffloor'),
(('ffloor@32', a), ('fsub', a, ('!ffract', a)), 'options->lower_ffloor'),
(('ffloor@64', a), ('fsub', a, ('!ffract', a)), '(options->lower_ffloor || (options->lower_doubles_options & nir_lower_dfloor)) && !(options->lower_doubles_options & nir_lower_dfract)'),
(('fadd@16', a, ('fadd@16', b, ('fneg', ('ffract', a)))), ('fadd@16', b, ('ffloor', a)), '!options->lower_ffloor'),
(('fadd@32', a, ('fadd@32', b, ('fneg', ('ffract', a)))), ('fadd@32', b, ('ffloor', a)), '!options->lower_ffloor'),
(('fadd@64', a, ('fadd@64', b, ('fneg', ('ffract', a)))), ('fadd@64', b, ('ffloor', a)), '!options->lower_ffloor && !(options->lower_doubles_options & nir_lower_dfloor)'),

View file

@ -64,8 +64,6 @@ dEQP-GLES2.functional.shaders.functions.control_flow.mixed_return_break_continue
dEQP-GLES2.functional.shaders.loops.for_constant_iterations.101_iterations_fragment,Fail
dEQP-GLES2.functional.shaders.loops.for_constant_iterations.mixed_break_continue_fragment,Fail
dEQP-GLES2.functional.shaders.random.all_features.fragment.6,Fail
dEQP-GLES2.functional.shaders.struct.uniform.equal_fragment,Fail
dEQP-GLES2.functional.shaders.struct.uniform.not_equal_fragment,Fail
dEQP-GLES2.functional.texture.filtering.cube.linear_linear_clamp_l8_npot,Fail
dEQP-GLES2.functional.texture.filtering.cube.linear_linear_clamp_rgb888_npot,Fail
dEQP-GLES2.functional.texture.filtering.cube.linear_linear_clamp_rgba4444_npot,Fail

View file

@ -25,8 +25,6 @@ dEQP-GLES2.functional.shaders.random.all_features.fragment.6,Fail
dEQP-GLES2.functional.shaders.random.all_features.fragment.93,Fail
dEQP-GLES2.functional.shaders.random.all_features.fragment.97,Fail
dEQP-GLES2.functional.shaders.random.trigonometric.fragment.45,Fail
dEQP-GLES2.functional.shaders.struct.uniform.equal_fragment,Fail
dEQP-GLES2.functional.shaders.struct.uniform.not_equal_fragment,Fail
dEQP-GLES2.functional.texture.filtering.cube.linear_linear_clamp_l8_npot,Fail
dEQP-GLES2.functional.texture.filtering.cube.linear_linear_clamp_rgb888_npot,Fail
dEQP-GLES2.functional.texture.filtering.cube.linear_linear_clamp_rgba4444_npot,Fail

View file

@ -53,8 +53,6 @@ dEQP-GLES2.functional.shaders.loops.for_constant_iterations.101_iterations_verte
dEQP-GLES2.functional.shaders.loops.for_constant_iterations.mixed_break_continue_fragment,Fail
dEQP-GLES2.functional.shaders.loops.for_constant_iterations.mixed_break_continue_vertex,Fail
dEQP-GLES2.functional.shaders.random.all_features.fragment.6,Fail
dEQP-GLES2.functional.shaders.struct.uniform.equal_fragment,Fail
dEQP-GLES2.functional.shaders.struct.uniform.not_equal_fragment,Fail
dEQP-GLES2.functional.texture.filtering.cube.linear_linear_clamp_l8_npot,Fail
dEQP-GLES2.functional.texture.filtering.cube.linear_linear_clamp_rgb888_npot,Fail
dEQP-GLES2.functional.texture.filtering.cube.linear_linear_clamp_rgba4444_npot,Fail

View file

@ -5,8 +5,6 @@ dEQP-GLES2.functional.polygon_offset.default_factor_1_slope,Fail
dEQP-GLES2.functional.polygon_offset.fixed16_factor_1_slope,Fail
dEQP-GLES2.functional.shaders.loops.do_while_dynamic_iterations.mixed_break_continue_fragment,Fail
dEQP-GLES2.functional.shaders.struct.uniform.equal_fragment,Fail
dEQP-GLES2.functional.shaders.struct.uniform.not_equal_fragment,Fail
dEQP-GLES2.functional.texture.format.a8_cube_npot,Fail
dEQP-GLES2.functional.texture.format.l8_cube_npot,Fail

View file

@ -224,33 +224,3 @@ dEQP-GLES3.functional.transform_feedback.random.separate.triangles.1,Crash
dEQP-GLES3.functional.transform_feedback.random.separate.triangles.4,Crash
dEQP-GLES3.functional.transform_feedback.random.separate.triangles.6,Crash
dEQP-GLES3.functional.transform_feedback.random_full_array_capture.separate.triangles.1,Crash
# !41455
dEQP-GLES3.functional.shaders.struct.uniform.equal_fragment,Fail
dEQP-GLES3.functional.shaders.switch.default_label_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.default_not_last_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.do_while_loop_in_switch_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.do_while_loop_in_switch_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.no_default_label_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_switch_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_while_loop_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.struct.uniform.not_equal_fragment,Fail
dEQP-GLES3.functional.shaders.switch.basic_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.const_expr_in_label_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.for_loop_in_switch_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.if_in_switch_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.scope_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_for_loop_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.conditional_fall_through_2_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.conditional_fall_through_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.const_expr_in_label_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.default_label_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.default_not_last_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.fall_through_default_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.fall_through_default_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.fall_through_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.no_default_label_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_do_while_loop_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_for_loop_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_if_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.while_loop_in_switch_dynamic_vertex,Fail

View file

@ -14,7 +14,3 @@ dEQP-GLES31.functional.ssbo.layout.random.nested_structs_arrays_instance_arrays.
dEQP-GLES31.functional.ssbo.layout.random.nested_structs_arrays_instance_arrays.22
KHR-GL.*.texture_swizzle.smoke
# !41455
dEQP-GLES2.functional.shaders.struct.uniform.equal_fragment
dEQP-GLES2.functional.shaders.struct.uniform.not_equal_fragment

View file

@ -220,33 +220,3 @@ dEQP-GLES3.functional.transform_feedback.random.separate.triangles.1,Crash
dEQP-GLES3.functional.transform_feedback.random.separate.triangles.4,Crash
dEQP-GLES3.functional.transform_feedback.random.separate.triangles.6,Crash
dEQP-GLES3.functional.transform_feedback.random_full_array_capture.separate.triangles.1,Crash
# !41455
dEQP-GLES3.functional.shaders.struct.uniform.equal_fragment,Fail
dEQP-GLES3.functional.shaders.switch.default_label_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.default_not_last_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.do_while_loop_in_switch_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.do_while_loop_in_switch_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.no_default_label_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_switch_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_while_loop_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.struct.uniform.not_equal_fragment,Fail
dEQP-GLES3.functional.shaders.switch.basic_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.const_expr_in_label_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.for_loop_in_switch_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.if_in_switch_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.scope_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_for_loop_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.conditional_fall_through_2_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.conditional_fall_through_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.const_expr_in_label_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.default_label_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.default_not_last_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.fall_through_default_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.fall_through_default_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.fall_through_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.no_default_label_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_do_while_loop_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_for_loop_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_if_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.while_loop_in_switch_dynamic_vertex,Fail

View file

@ -10,7 +10,3 @@ dEQP-GLES31.functional.ssbo.layout.random.nested_structs_arrays_instance_arrays.
# Sometimes crashes, e.g. https://gitlab.freedesktop.org/kusma/mesa/-/jobs/4109419
dEQP-GLES31.functional.compute.basic.empty
# !41455
dEQP-GLES2.functional.shaders.struct.uniform.equal_fragment
dEQP-GLES2.functional.shaders.struct.uniform.not_equal_fragment

View file

@ -609,14 +609,3 @@ dEQP-GLES3.functional.transform_feedback.random_full_array_capture.interleaved.p
dEQP-GLES3.functional.transform_feedback.random_full_array_capture.interleaved.triangles.1,Crash
dEQP-GLES3.functional.transform_feedback.random_full_array_capture.separate.lines.6,Crash
dEQP-GLES3.functional.transform_feedback.random_full_array_capture.separate.triangles.4,Crash
# !41455
dEQP-GLES3.functional.shaders.struct.uniform.equal_fragment,Fail
dEQP-GLES3.functional.shaders.switch.default_label_dynamic_fragment,Fail
dEQP-GLES3.functional.shaders.switch.default_not_last_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.do_while_loop_in_switch_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.no_default_label_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_do_while_loop_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_for_loop_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.switch_in_switch_dynamic_vertex,Fail
dEQP-GLES3.functional.shaders.switch.while_loop_in_switch_dynamic_vertex,Fail

View file

@ -21,7 +21,3 @@ spec@ext_framebuffer_object@fbo-blending-formats
# uprev Piglit in Mesa
spec@egl_ext_protected_content@conformance
# !41455
dEQP-GLES2.functional.shaders.struct.uniform.equal_fragment
dEQP-GLES2.functional.shaders.struct.uniform.not_equal_fragment