zink: lower 8/16 bit alu ops vk spirv doesn't allow

Cc: mesa-stable
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30504>
(cherry picked from commit b2225b9437)
This commit is contained in:
Karol Herbst 2024-08-04 13:38:49 +02:00 committed by Eric Engestrom
parent 6eecba324a
commit a0291c4041
2 changed files with 23 additions and 1 deletions

View File

@ -4874,7 +4874,7 @@
"description": "zink: lower 8/16 bit alu ops vk spirv doesn't allow",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View File

@ -5796,6 +5796,27 @@ lower_vec816_alu(const nir_instr *instr, const void *cb_data)
return 4;
}
static unsigned
zink_lower_bit_size_cb(const nir_instr *instr, void *data)
{
switch (instr->type) {
case nir_instr_type_alu: {
nir_alu_instr *alu = nir_instr_as_alu(instr);
switch (alu->op) {
case nir_op_bit_count:
case nir_op_find_lsb:
case nir_op_ifind_msb:
case nir_op_ufind_msb:
return alu->src[0].src.ssa->bit_size == 32 ? 0 : 32;
default:
return 0;
}
}
default:
return 0;
}
}
static bool
fix_vertex_input_locations_instr(nir_builder *b, nir_intrinsic_instr *intr, void *data)
{
@ -6140,6 +6161,7 @@ zink_shader_create(struct zink_screen *screen, struct nir_shader *nir)
.cb_data = screen,
};
NIR_PASS_V(nir, nir_lower_mem_access_bit_sizes, &lower_mem_access_options);
NIR_PASS_V(nir, nir_lower_bit_size, zink_lower_bit_size_cb, NULL);
NIR_PASS_V(nir, alias_scratch_memory);
NIR_PASS_V(nir, nir_lower_alu_width, lower_vec816_alu, NULL);
NIR_PASS_V(nir, nir_lower_alu_vec8_16_srcs);