ac/nir: split 16-bit load/store to global memory on GFX6

Due to possible alignment issues, make sure to split loads/stores
of 16-bit vectors.

Doom Eternal requires storageBuffer16BitAccess.

Cc: 20.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4339>
(cherry picked from commit 55fdcc03de)
This commit is contained in:
Samuel Pitoiset 2020-03-26 14:14:27 +01:00 committed by Dylan Baker
parent 820c636a06
commit fbef99b5a6
2 changed files with 3 additions and 5 deletions

View file

@ -2353,7 +2353,7 @@
"description": "ac/nir: split 16-bit load/store to global memory on GFX6",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},

View file

@ -2324,8 +2324,7 @@ static LLVMValueRef visit_load_var(struct ac_nir_context *ctx,
unsigned natural_stride = type_scalar_size_bytes(deref->type);
unsigned stride = explicit_stride ? explicit_stride : natural_stride;
int elem_size_bytes = ac_get_elem_bits(&ctx->ac, result_type) / 8;
bool split_loads = ctx->ac.chip_class == GFX6 &&
elem_size_bytes == 1;
bool split_loads = ctx->ac.chip_class == GFX6 && elem_size_bytes < 4;
if (stride != natural_stride || split_loads) {
if (LLVMGetTypeKind(result_type) == LLVMVectorTypeKind)
@ -2481,8 +2480,7 @@ visit_store_var(struct ac_nir_context *ctx,
unsigned natural_stride = type_scalar_size_bytes(deref->type);
unsigned stride = explicit_stride ? explicit_stride : natural_stride;
int elem_size_bytes = ac_get_elem_bits(&ctx->ac, LLVMTypeOf(val)) / 8;
bool split_stores = ctx->ac.chip_class == GFX6 &&
elem_size_bytes == 1;
bool split_stores = ctx->ac.chip_class == GFX6 && elem_size_bytes < 4;
LLVMTypeRef ptr_type = LLVMPointerType(LLVMTypeOf(val),
LLVMGetPointerAddressSpace(LLVMTypeOf(address)));