From fbef99b5a6b247393f81c287cd125dd7e63b87a6 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 26 Mar 2020 14:14:27 +0100 Subject: [PATCH] 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 Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: (cherry picked from commit 55fdcc03de8dd7cf62d5b6e3d2369c55e222a822) --- .pick_status.json | 2 +- src/amd/llvm/ac_nir_to_llvm.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 9725e55a55e..11e9648798e 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 }, diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 6acef5e7fb7..51a64e56934 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -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)));