spirv: workaround LLVM-SPIRV Undef variable initializers
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 24 Sep 2021 12:19:50 +0000 (15:19 +0300)
committerMarge Bot <eric+marge@anholt.net>
Mon, 27 Sep 2021 19:04:42 +0000 (19:04 +0000)
commita17d24d9017c8e1e6ac57dab68aa9ece793dece6
treeb85cd2d7d3492e955a8eb80b057f7294349c41da
parenta17928639dfdd285bbe258f9985a6d8568b51e8a
spirv: workaround LLVM-SPIRV Undef variable initializers

The LLVM-SPIRV translator creates variables with initializers, but
most of those are actually undef initializers. We can just skip
composites that are entirely made of undefs, but for partially undefs,
we will still zero initialize.

v2: Rename wa_llvm_spirv_undef_initializer to wa_llvm_spirv_ignore_workgroup_initializer (Caio)
    Limit workaround to OpenCL (Caio)
    Make workaround clearer (Caio)

v3: Only apply workaround on workgroup storage (Caio)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13030>
src/compiler/spirv/spirv_to_nir.c
src/compiler/spirv/vtn_private.h
src/compiler/spirv/vtn_variables.c