[Mesa-dev] [PATCH] glsl: Do not vectorize vector array dereferences.
Ian Romanick
idr at freedesktop.org
Mon Feb 10 16:32:45 PST 2014
On 02/10/2014 01:09 PM, Matt Turner wrote:
> Array dereferences must have scalar indices, so we cannot vectorize
> them.
>
> Reported-by: Andrew Guertin <lists at dolphinling.net>
Seems like the easy fix.
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Candidate for 10.1?
> ---
> src/glsl/opt_vectorize.cpp | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/src/glsl/opt_vectorize.cpp b/src/glsl/opt_vectorize.cpp
> index 8ee81f1..dba303d 100644
> --- a/src/glsl/opt_vectorize.cpp
> +++ b/src/glsl/opt_vectorize.cpp
> @@ -82,6 +82,7 @@ public:
>
> virtual ir_visitor_status visit_enter(ir_assignment *);
> virtual ir_visitor_status visit_enter(ir_swizzle *);
> + virtual ir_visitor_status visit_enter(ir_dereference_array *);
> virtual ir_visitor_status visit_enter(ir_if *);
> virtual ir_visitor_status visit_enter(ir_loop *);
>
> @@ -289,6 +290,19 @@ ir_vectorize_visitor::visit_enter(ir_swizzle *ir)
> return visit_continue;
> }
>
> +/* Upon entering an ir_array_dereference, remove the current assignment from
> + * further consideration. Since the index of an array dereference must scalar,
> + * we are not able to vectorize it.
> + *
> + * FINISHME: If all of scalar indices are identical we could vectorize.
> + */
> +ir_visitor_status
> +ir_vectorize_visitor::visit_enter(ir_dereference_array *ir)
> +{
> + this->current_assignment = NULL;
> + return visit_continue_with_parent;
> +}
> +
> /* Since there is no statement to visit between the "then" and "else"
> * instructions try to vectorize before, in between, and after them to avoid
> * combining statements from different basic blocks.
>
More information about the mesa-dev
mailing list