[Mesa-dev] [PATCH] gallium: Force blend color to 16-byte alignment

Chuck Atkins chuck.atkins at kitware.com
Wed Jun 29 01:56:35 UTC 2016


Really it's a workaround to fix bad vectorization in the Intel compiler,
but it doesn't it doesn't hurt for other compilers, even if the performance
difference is marginal if at all, and could only help.  If it was
problematic otherwise I'd guard it with an #ifdef _INTEL_COMPILER.  I can
update the patch with a comment explaining why it's there in case other
developers stumble on it and think "wtf".
On Jun 28, 2016 6:38 PM, "Roland Scheidegger" <sroland at vmware.com> wrote:

Am 28.06.2016 um 22:45 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.
>
> Reported-by: Tim Rowley <timothy.o.rowley at intel.com>
> Signed-off-by: Chuck Atkins <chuck.atkins at kitware.com>
> ---
>  src/gallium/include/pipe/p_state.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gallium/include/pipe/p_state.h
b/src/gallium/include/pipe/p_state.h
> index 1543e90..95f140f 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -326,7 +326,7 @@ struct pipe_blend_state
>
>  struct pipe_blend_color
>  {
> -   float color[4];
> +  PIPE_ALIGN_VAR(16) float color[4];
>  };
>

I'm wondering if that's really needed. I have a difficult time to
imagine setting blend color is performance critical. And driver internal
you can obviously still align pipe_blend_color structs yourself.
But OTOH, why not...

Acked-by: Roland Scheidegger <sroland at vmware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160628/33162fc1/attachment.html>


More information about the mesa-dev mailing list