[Mesa-dev] [PATCH 1/2] spirv: Fix reaching unreachable for compare exchange on images

Jason Ekstrand jason at jlekstrand.net
Fri Jun 23 18:29:39 UTC 2017


OpAtomicCompareExchangeWeak is only available in OpenCL, not Vulkan.  As
such, we probably don't want to handle it yet as no one uses spirv_to_nir
for OpenCL.  The assert on AtomicCompareExchange is, however, a bug we
should fix now.

--Jason

On Wed, Jun 21, 2017 at 8:59 AM, James Legg <jlegg at feralinteractive.com>
wrote:

> We were hitting the
>         unreachable("Invalid image opcode")
> near the end of vtn_handle_image when parsing SpvOpAtomicCompareExchange
> and SpvOpAtomicCompareExchangeWeak opcodes.
> ---
>  src/compiler/spirv/spirv_to_nir.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/compiler/spirv/spirv_to_nir.c
> b/src/compiler/spirv/spirv_to_nir.c
> index 0a5eb0e..8f21aec 100644
> --- a/src/compiler/spirv/spirv_to_nir.c
> +++ b/src/compiler/spirv/spirv_to_nir.c
> @@ -1805,6 +1805,7 @@ fill_common_atomic_sources(struct vtn_builder *b,
> SpvOp opcode,
>        break;
>
>     case SpvOpAtomicCompareExchange:
> +   case SpvOpAtomicCompareExchangeWeak:
>        src[0] = nir_src_for_ssa(vtn_ssa_value(b, w[8])->def);
>        src[1] = nir_src_for_ssa(vtn_ssa_value(b, w[7])->def);
>        break;
> @@ -1977,6 +1978,8 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
>        intrin->src[2] = nir_src_for_ssa(vtn_ssa_value(b, w[3])->def);
>        break;
>
> +   case SpvOpAtomicCompareExchange:
> +   case SpvOpAtomicCompareExchangeWeak:
>     case SpvOpAtomicIIncrement:
>     case SpvOpAtomicIDecrement:
>     case SpvOpAtomicExchange:
> --
> 2.9.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170623/d57b8c15/attachment.html>


More information about the mesa-dev mailing list