2015-11-14 20:26:47 -05:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2015 Connor Abbott
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
|
* Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
|
* IN THE SOFTWARE.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "nir.h"
|
|
|
|
|
#include "nir_vla.h"
|
|
|
|
|
#include "nir_builder.h"
|
|
|
|
|
#include "util/u_dynarray.h"
|
|
|
|
|
|
2020-02-27 15:04:25 +02:00
|
|
|
#define HASH(hash, data) XXH32(&data, sizeof(data), hash)
|
2015-11-14 20:26:47 -05:00
|
|
|
|
|
|
|
|
static uint32_t
|
|
|
|
|
hash_src(uint32_t hash, const nir_src *src)
|
|
|
|
|
{
|
|
|
|
|
assert(src->is_ssa);
|
2019-06-20 23:05:13 -04:00
|
|
|
void *hash_data = nir_src_is_const(*src) ? NULL : src->ssa;
|
2015-11-14 20:26:47 -05:00
|
|
|
|
2019-06-20 23:05:13 -04:00
|
|
|
return HASH(hash, hash_data);
|
2015-11-14 20:26:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint32_t
|
|
|
|
|
hash_alu_src(uint32_t hash, const nir_alu_src *src)
|
|
|
|
|
{
|
|
|
|
|
assert(!src->abs && !src->negate);
|
|
|
|
|
|
|
|
|
|
/* intentionally don't hash swizzle */
|
|
|
|
|
|
|
|
|
|
return hash_src(hash, &src->src);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint32_t
|
|
|
|
|
hash_alu(uint32_t hash, const nir_alu_instr *instr)
|
|
|
|
|
{
|
|
|
|
|
hash = HASH(hash, instr->op);
|
|
|
|
|
|
|
|
|
|
hash = HASH(hash, instr->dest.dest.ssa.bit_size);
|
|
|
|
|
|
|
|
|
|
for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++)
|
|
|
|
|
hash = hash_alu_src(hash, &instr->src[i]);
|
|
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint32_t
|
2020-09-23 15:08:13 +01:00
|
|
|
hash_instr(const void *data)
|
2015-11-14 20:26:47 -05:00
|
|
|
{
|
2020-09-23 15:08:13 +01:00
|
|
|
const nir_instr *instr = (nir_instr *) data;
|
2020-02-27 15:04:25 +02:00
|
|
|
uint32_t hash = 0;
|
2015-11-14 20:26:47 -05:00
|
|
|
|
|
|
|
|
switch (instr->type) {
|
|
|
|
|
case nir_instr_type_alu:
|
|
|
|
|
return hash_alu(hash, nir_instr_as_alu(instr));
|
|
|
|
|
default:
|
|
|
|
|
unreachable("bad instruction type");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
srcs_equal(const nir_src *src1, const nir_src *src2)
|
|
|
|
|
{
|
|
|
|
|
assert(src1->is_ssa);
|
|
|
|
|
assert(src2->is_ssa);
|
|
|
|
|
|
2019-06-20 23:05:13 -04:00
|
|
|
return src1->ssa == src2->ssa ||
|
|
|
|
|
nir_src_is_const(*src1) == nir_src_is_const(*src2);
|
2015-11-14 20:26:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
alu_srcs_equal(const nir_alu_src *src1, const nir_alu_src *src2)
|
|
|
|
|
{
|
|
|
|
|
assert(!src1->abs);
|
|
|
|
|
assert(!src1->negate);
|
|
|
|
|
assert(!src2->abs);
|
|
|
|
|
assert(!src2->negate);
|
|
|
|
|
|
|
|
|
|
return srcs_equal(&src1->src, &src2->src);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
2020-09-23 15:08:13 +01:00
|
|
|
instrs_equal(const void *data1, const void *data2)
|
2015-11-14 20:26:47 -05:00
|
|
|
{
|
2020-09-23 15:08:13 +01:00
|
|
|
const nir_instr *instr1 = (nir_instr *) data1;
|
|
|
|
|
const nir_instr *instr2 = (nir_instr *) data2;
|
2015-11-14 20:26:47 -05:00
|
|
|
switch (instr1->type) {
|
|
|
|
|
case nir_instr_type_alu: {
|
|
|
|
|
nir_alu_instr *alu1 = nir_instr_as_alu(instr1);
|
|
|
|
|
nir_alu_instr *alu2 = nir_instr_as_alu(instr2);
|
|
|
|
|
|
|
|
|
|
if (alu1->op != alu2->op)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (alu1->dest.dest.ssa.bit_size != alu2->dest.dest.ssa.bit_size)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
for (unsigned i = 0; i < nir_op_infos[alu1->op].num_inputs; i++) {
|
|
|
|
|
if (!alu_srcs_equal(&alu1->src[i], &alu2->src[i]))
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
unreachable("bad instruction type");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
instr_can_rewrite(nir_instr *instr)
|
|
|
|
|
{
|
|
|
|
|
switch (instr->type) {
|
|
|
|
|
case nir_instr_type_alu: {
|
|
|
|
|
nir_alu_instr *alu = nir_instr_as_alu(instr);
|
|
|
|
|
|
|
|
|
|
/* Don't try and vectorize mov's. Either they'll be handled by copy
|
|
|
|
|
* prop, or they're actually necessary and trying to vectorize them
|
|
|
|
|
* would result in fighting with copy prop.
|
|
|
|
|
*/
|
|
|
|
|
if (alu->op == nir_op_mov)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (nir_op_infos[alu->op].output_size != 0)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
for (unsigned i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
|
|
|
|
|
if (nir_op_infos[alu->op].input_sizes[i] != 0)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* TODO support phi nodes */
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Tries to combine two instructions whose sources are different components of
|
|
|
|
|
* the same instructions into one vectorized instruction. Note that instr1
|
|
|
|
|
* should dominate instr2.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static nir_instr *
|
2020-08-27 12:49:13 -07:00
|
|
|
instr_try_combine(struct nir_shader *nir, nir_instr *instr1, nir_instr *instr2,
|
|
|
|
|
nir_opt_vectorize_cb filter, void *data)
|
2015-11-14 20:26:47 -05:00
|
|
|
{
|
|
|
|
|
assert(instr1->type == nir_instr_type_alu);
|
|
|
|
|
assert(instr2->type == nir_instr_type_alu);
|
|
|
|
|
nir_alu_instr *alu1 = nir_instr_as_alu(instr1);
|
|
|
|
|
nir_alu_instr *alu2 = nir_instr_as_alu(instr2);
|
|
|
|
|
|
|
|
|
|
assert(alu1->dest.dest.ssa.bit_size == alu2->dest.dest.ssa.bit_size);
|
|
|
|
|
unsigned alu1_components = alu1->dest.dest.ssa.num_components;
|
|
|
|
|
unsigned alu2_components = alu2->dest.dest.ssa.num_components;
|
|
|
|
|
unsigned total_components = alu1_components + alu2_components;
|
|
|
|
|
|
|
|
|
|
if (total_components > 4)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2020-05-03 20:10:57 -04:00
|
|
|
if (nir->options->vectorize_vec2_16bit &&
|
|
|
|
|
(total_components > 2 || alu1->dest.dest.ssa.bit_size != 16))
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2020-08-27 12:49:13 -07:00
|
|
|
if (filter && !filter(&alu1->instr, &alu2->instr, data))
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2015-11-14 20:26:47 -05:00
|
|
|
nir_builder b;
|
|
|
|
|
nir_builder_init(&b, nir_cf_node_get_function(&instr1->block->cf_node));
|
|
|
|
|
b.cursor = nir_after_instr(instr1);
|
|
|
|
|
|
|
|
|
|
nir_alu_instr *new_alu = nir_alu_instr_create(b.shader, alu1->op);
|
|
|
|
|
nir_ssa_dest_init(&new_alu->instr, &new_alu->dest.dest,
|
|
|
|
|
total_components, alu1->dest.dest.ssa.bit_size, NULL);
|
|
|
|
|
new_alu->dest.write_mask = (1 << total_components) - 1;
|
|
|
|
|
|
2020-09-11 14:55:28 -04:00
|
|
|
/* If either channel is exact, we have to preserve it even if it's
|
|
|
|
|
* not optimal for other channels.
|
|
|
|
|
*/
|
|
|
|
|
new_alu->exact = alu1->exact || alu2->exact;
|
|
|
|
|
|
|
|
|
|
/* If all channels don't wrap, we can say that the whole vector doesn't
|
|
|
|
|
* wrap.
|
|
|
|
|
*/
|
|
|
|
|
new_alu->no_signed_wrap = alu1->no_signed_wrap && alu2->no_signed_wrap;
|
|
|
|
|
new_alu->no_unsigned_wrap = alu1->no_unsigned_wrap && alu2->no_unsigned_wrap;
|
|
|
|
|
|
2015-11-14 20:26:47 -05:00
|
|
|
for (unsigned i = 0; i < nir_op_infos[alu1->op].num_inputs; i++) {
|
2019-06-20 23:05:13 -04:00
|
|
|
/* handle constant merging case */
|
|
|
|
|
if (alu1->src[i].src.ssa != alu2->src[i].src.ssa) {
|
|
|
|
|
nir_const_value *c1 = nir_src_as_const_value(alu1->src[i].src);
|
|
|
|
|
nir_const_value *c2 = nir_src_as_const_value(alu2->src[i].src);
|
|
|
|
|
assert(c1 && c2);
|
2020-09-08 18:36:47 -05:00
|
|
|
nir_const_value value[NIR_MAX_VEC_COMPONENTS];
|
2019-06-20 23:05:13 -04:00
|
|
|
unsigned bit_size = alu1->src[i].src.ssa->bit_size;
|
|
|
|
|
|
|
|
|
|
for (unsigned j = 0; j < total_components; j++) {
|
|
|
|
|
value[j].u64 = j < alu1_components ?
|
|
|
|
|
c1[alu1->src[i].swizzle[j]].u64 :
|
|
|
|
|
c2[alu2->src[i].swizzle[j - alu1_components]].u64;
|
|
|
|
|
}
|
|
|
|
|
nir_ssa_def *def = nir_build_imm(&b, total_components, bit_size, value);
|
|
|
|
|
|
|
|
|
|
new_alu->src[i].src = nir_src_for_ssa(def);
|
|
|
|
|
for (unsigned j = 0; j < total_components; j++)
|
|
|
|
|
new_alu->src[i].swizzle[j] = j;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-14 20:26:47 -05:00
|
|
|
new_alu->src[i].src = alu1->src[i].src;
|
|
|
|
|
|
|
|
|
|
for (unsigned j = 0; j < alu1_components; j++)
|
|
|
|
|
new_alu->src[i].swizzle[j] = alu1->src[i].swizzle[j];
|
|
|
|
|
|
|
|
|
|
for (unsigned j = 0; j < alu2_components; j++) {
|
|
|
|
|
new_alu->src[i].swizzle[j + alu1_components] =
|
|
|
|
|
alu2->src[i].swizzle[j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nir_builder_instr_insert(&b, &new_alu->instr);
|
|
|
|
|
|
2020-09-08 18:36:47 -05:00
|
|
|
unsigned swiz[NIR_MAX_VEC_COMPONENTS];
|
|
|
|
|
for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++)
|
|
|
|
|
swiz[i] = i;
|
2015-11-14 20:26:47 -05:00
|
|
|
nir_ssa_def *new_alu1 = nir_swizzle(&b, &new_alu->dest.dest.ssa, swiz,
|
|
|
|
|
alu1_components);
|
|
|
|
|
|
|
|
|
|
for (unsigned i = 0; i < alu2_components; i++)
|
|
|
|
|
swiz[i] += alu1_components;
|
|
|
|
|
nir_ssa_def *new_alu2 = nir_swizzle(&b, &new_alu->dest.dest.ssa, swiz,
|
|
|
|
|
alu2_components);
|
|
|
|
|
|
|
|
|
|
nir_foreach_use_safe(src, &alu1->dest.dest.ssa) {
|
|
|
|
|
if (src->parent_instr->type == nir_instr_type_alu) {
|
|
|
|
|
/* For ALU instructions, rewrite the source directly to avoid a
|
|
|
|
|
* round-trip through copy propagation.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
nir_instr_rewrite_src(src->parent_instr, src,
|
|
|
|
|
nir_src_for_ssa(&new_alu->dest.dest.ssa));
|
|
|
|
|
} else {
|
|
|
|
|
nir_instr_rewrite_src(src->parent_instr, src,
|
|
|
|
|
nir_src_for_ssa(new_alu1));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nir_foreach_if_use_safe(src, &alu1->dest.dest.ssa) {
|
|
|
|
|
nir_if_rewrite_condition(src->parent_if, nir_src_for_ssa(new_alu1));
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-28 21:27:52 +11:00
|
|
|
assert(list_is_empty(&alu1->dest.dest.ssa.uses));
|
|
|
|
|
assert(list_is_empty(&alu1->dest.dest.ssa.if_uses));
|
2015-11-14 20:26:47 -05:00
|
|
|
|
|
|
|
|
nir_foreach_use_safe(src, &alu2->dest.dest.ssa) {
|
|
|
|
|
if (src->parent_instr->type == nir_instr_type_alu) {
|
|
|
|
|
/* For ALU instructions, rewrite the source directly to avoid a
|
|
|
|
|
* round-trip through copy propagation.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
nir_alu_instr *use = nir_instr_as_alu(src->parent_instr);
|
|
|
|
|
|
|
|
|
|
unsigned src_index = 5;
|
|
|
|
|
for (unsigned i = 0; i < nir_op_infos[use->op].num_inputs; i++) {
|
|
|
|
|
if (&use->src[i].src == src) {
|
|
|
|
|
src_index = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
assert(src_index != 5);
|
|
|
|
|
|
|
|
|
|
nir_instr_rewrite_src(src->parent_instr, src,
|
|
|
|
|
nir_src_for_ssa(&new_alu->dest.dest.ssa));
|
|
|
|
|
|
|
|
|
|
for (unsigned i = 0;
|
|
|
|
|
i < nir_ssa_alu_instr_src_components(use, src_index); i++) {
|
|
|
|
|
use->src[src_index].swizzle[i] += alu1_components;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
nir_instr_rewrite_src(src->parent_instr, src,
|
|
|
|
|
nir_src_for_ssa(new_alu2));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nir_foreach_if_use_safe(src, &alu2->dest.dest.ssa) {
|
|
|
|
|
nir_if_rewrite_condition(src->parent_if, nir_src_for_ssa(new_alu2));
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-28 21:27:52 +11:00
|
|
|
assert(list_is_empty(&alu2->dest.dest.ssa.uses));
|
|
|
|
|
assert(list_is_empty(&alu2->dest.dest.ssa.if_uses));
|
2015-11-14 20:26:47 -05:00
|
|
|
|
|
|
|
|
nir_instr_remove(instr1);
|
|
|
|
|
nir_instr_remove(instr2);
|
|
|
|
|
|
|
|
|
|
return &new_alu->instr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct set *
|
|
|
|
|
vec_instr_set_create(void)
|
|
|
|
|
{
|
2020-09-23 15:08:13 +01:00
|
|
|
return _mesa_set_create(NULL, hash_instr, instrs_equal);
|
2015-11-14 20:26:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
vec_instr_set_destroy(struct set *instr_set)
|
|
|
|
|
{
|
|
|
|
|
_mesa_set_destroy(instr_set, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
2020-05-03 20:10:57 -04:00
|
|
|
vec_instr_set_add_or_rewrite(struct nir_shader *nir, struct set *instr_set,
|
2020-08-27 12:49:13 -07:00
|
|
|
nir_instr *instr,
|
|
|
|
|
nir_opt_vectorize_cb filter, void *data)
|
2015-11-14 20:26:47 -05:00
|
|
|
{
|
|
|
|
|
if (!instr_can_rewrite(instr))
|
|
|
|
|
return false;
|
|
|
|
|
|
2020-09-23 15:08:13 +01:00
|
|
|
struct set_entry *entry = _mesa_set_search(instr_set, instr);
|
2015-11-14 20:26:47 -05:00
|
|
|
if (entry) {
|
2020-09-23 15:08:13 +01:00
|
|
|
nir_instr *old_instr = (nir_instr *) entry->key;
|
|
|
|
|
_mesa_set_remove(instr_set, entry);
|
|
|
|
|
nir_instr *new_instr = instr_try_combine(nir, old_instr, instr,
|
|
|
|
|
filter, data);
|
|
|
|
|
if (new_instr) {
|
|
|
|
|
_mesa_set_add(instr_set, new_instr);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2015-11-14 20:26:47 -05:00
|
|
|
}
|
|
|
|
|
|
2020-09-23 15:08:13 +01:00
|
|
|
_mesa_set_add(instr_set, instr);
|
2015-11-14 20:26:47 -05:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
2020-05-03 20:10:57 -04:00
|
|
|
vectorize_block(struct nir_shader *nir, nir_block *block,
|
2020-08-27 12:49:13 -07:00
|
|
|
struct set *instr_set,
|
|
|
|
|
nir_opt_vectorize_cb filter, void *data)
|
2015-11-14 20:26:47 -05:00
|
|
|
{
|
|
|
|
|
bool progress = false;
|
|
|
|
|
|
|
|
|
|
nir_foreach_instr_safe(instr, block) {
|
2020-08-27 12:49:13 -07:00
|
|
|
if (vec_instr_set_add_or_rewrite(nir, instr_set, instr, filter, data))
|
2015-11-14 20:26:47 -05:00
|
|
|
progress = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (unsigned i = 0; i < block->num_dom_children; i++) {
|
|
|
|
|
nir_block *child = block->dom_children[i];
|
2020-08-27 12:49:13 -07:00
|
|
|
progress |= vectorize_block(nir, child, instr_set, filter, data);
|
2015-11-14 20:26:47 -05:00
|
|
|
}
|
|
|
|
|
|
2020-09-23 15:08:13 +01:00
|
|
|
nir_foreach_instr_reverse(instr, block) {
|
|
|
|
|
if (instr->type != nir_instr_type_alu)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
struct set_entry *entry = _mesa_set_search(instr_set, instr);
|
|
|
|
|
if (entry)
|
|
|
|
|
_mesa_set_remove(instr_set, entry);
|
|
|
|
|
}
|
2015-11-14 20:26:47 -05:00
|
|
|
|
|
|
|
|
return progress;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
2020-08-27 12:49:13 -07:00
|
|
|
nir_opt_vectorize_impl(struct nir_shader *nir, nir_function_impl *impl,
|
|
|
|
|
nir_opt_vectorize_cb filter, void *data)
|
2015-11-14 20:26:47 -05:00
|
|
|
{
|
|
|
|
|
struct set *instr_set = vec_instr_set_create();
|
|
|
|
|
|
|
|
|
|
nir_metadata_require(impl, nir_metadata_dominance);
|
|
|
|
|
|
2020-08-27 12:49:13 -07:00
|
|
|
bool progress = vectorize_block(nir, nir_start_block(impl), instr_set,
|
|
|
|
|
filter, data);
|
2015-11-14 20:26:47 -05:00
|
|
|
|
|
|
|
|
if (progress)
|
|
|
|
|
nir_metadata_preserve(impl, nir_metadata_block_index |
|
|
|
|
|
nir_metadata_dominance);
|
|
|
|
|
|
|
|
|
|
vec_instr_set_destroy(instr_set);
|
|
|
|
|
return progress;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
2020-08-27 12:49:13 -07:00
|
|
|
nir_opt_vectorize(nir_shader *shader, nir_opt_vectorize_cb filter,
|
|
|
|
|
void *data)
|
2015-11-14 20:26:47 -05:00
|
|
|
{
|
|
|
|
|
bool progress = false;
|
|
|
|
|
|
|
|
|
|
nir_foreach_function(function, shader) {
|
|
|
|
|
if (function->impl)
|
2020-08-27 12:49:13 -07:00
|
|
|
progress |= nir_opt_vectorize_impl(shader, function->impl, filter, data);
|
2015-11-14 20:26:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return progress;
|
|
|
|
|
}
|