[Mesa-dev] [PATCH 03/11] panfrost/midgard: Flush undefineds to zero
Ilia Mirkin
imirkin at alum.mit.edu
Wed Jul 10 13:56:51 UTC 2019
On Wed, Jul 10, 2019 at 9:25 AM Alyssa Rosenzweig
<alyssa.rosenzweig at collabora.com> wrote:
>
> Fixes a buggy dEQP test.
>
> Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
> ---
> .../drivers/panfrost/ci/expected-failures.txt | 6 --
> src/gallium/drivers/panfrost/meson.build | 1 +
> .../drivers/panfrost/midgard/compiler.h | 6 ++
> .../panfrost/midgard/midgard_compile.c | 4 +
> .../panfrost/midgard/nir_undef_to_zero.c | 89 +++++++++++++++++++
> 5 files changed, 100 insertions(+), 6 deletions(-)
> create mode 100644 src/gallium/drivers/panfrost/midgard/nir_undef_to_zero.c
>
> diff --git a/src/gallium/drivers/panfrost/ci/expected-failures.txt b/src/gallium/drivers/panfrost/ci/expected-failures.txt
> index 33059118b49..6f52773cc73 100644
> --- a/src/gallium/drivers/panfrost/ci/expected-failures.txt
> +++ b/src/gallium/drivers/panfrost/ci/expected-failures.txt
> @@ -256,12 +256,6 @@ dEQP-GLES2.functional.rasterization.limits.points
> dEQP-GLES2.functional.shaders.builtin_variable.fragcoord_w
> dEQP-GLES2.functional.shaders.preprocessor.predefined_macros.line_2_fragment
> dEQP-GLES2.functional.shaders.preprocessor.predefined_macros.line_2_vertex
> -dEQP-GLES2.functional.shaders.random.all_features.fragment.0
> -dEQP-GLES2.functional.shaders.random.all_features.fragment.16
> -dEQP-GLES2.functional.shaders.random.all_features.fragment.5
> -dEQP-GLES2.functional.shaders.random.all_features.fragment.6
> -dEQP-GLES2.functional.shaders.random.all_features.vertex.0
> -dEQP-GLES2.functional.shaders.random.all_features.vertex.17
> dEQP-GLES2.functional.shaders.scoping.valid.local_variable_hides_function_parameter_fragment
> dEQP-GLES2.functional.shaders.scoping.valid.local_variable_hides_function_parameter_vertex
> dEQP-GLES2.functional.shaders.struct.local.dynamic_loop_assignment_fragment
> diff --git a/src/gallium/drivers/panfrost/midgard/nir_undef_to_zero.c b/src/gallium/drivers/panfrost/midgard/nir_undef_to_zero.c
> new file mode 100644
> index 00000000000..aacecc17e9d
> --- /dev/null
> +++ b/src/gallium/drivers/panfrost/midgard/nir_undef_to_zero.c
> + * Flushes undefined SSA values to a zero vector fo the appropriate component
> + * count, to avoid undefined behaviour in the resulting shader. Not required
> + * for conformance as use of uninitialized variables is explicitly left
> + * undefined by the spec. Works around buggy apps, however.
> + *
> + * Call immediately after nir_opt_undef. If called before, larger optimization
> + * opportunities from the former pass will be missed. If called outside of an
> + * optimization loop, constant propagation and algebraic optimizations won't be
> + * able to kick in to reduce stuff consuming the zero.
I don't think other drivers have had to do this. I've definitely
resisted stuff like that in nouveau in the past. Are you sure this is
necessary? Would be good to check if these tests pass or fail on
nouveau, for example. (Although by coincidence, they could be ending
up with zero values, of course...)
-ilia
More information about the mesa-dev
mailing list