Am 29.06.2016 um 04:32 schrieb Chuck Atkins:
> This aligns the 4-element color float array to 16 byte boundaries.  This
> should allow compiler vectorizers to generate better optimizations.
> Also fixes broken vectorization generated by Intel compiler.
> 
> v2: Fixed indentation and added a lengthy comment explaining the
>     reason for the alignment.
> 
> Reported-by: Tim Rowley <[email protected]>
> Tested-by: Tim Rowley <[email protected]>
> Signed-off-by: Chuck Atkins <[email protected]>
> Acked-by: Roland Scheidegger <[email protected]>
> ---
>  src/gallium/include/pipe/p_state.h | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/include/pipe/p_state.h 
> b/src/gallium/include/pipe/p_state.h
> index 1543e90..5526c39 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -326,7 +326,17 @@ struct pipe_blend_state
>  
>  struct pipe_blend_color
>  {
> -   float color[4];
> +   /**
> +    * Making the color array explicitly 16-byte aligned provides a hint to
> +    * compilers to make more efficient auto-vectorization optimizations.
> +    * The actual performance gains from vectorizing the blend color array are
> +    * fairly minimal, if any, but the alignment is necessary to work around
> +    * buggy vectorization in some compilers which fail to generate the 
> correct
> +    * unaligned accessors resulting in a segfault.  Specifically several
> +    * versions of the Intel compiler are known to be affected but it's likely
> +    * others are as well.
> +    */
> +   PIPE_ALIGN_VAR(16) float color[4];
>  };
>  
>  

I'm all for comments but that looks a bit too much for such a simple
thing. I think the first sentence would do...

Roland


_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to