From 19a8626f8652b9ce5c1eaba249c64733141db39c Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Fri, 14 Apr 2023 15:58:31 +0800 Subject: [PATCH] ac/llvm,radeonsi: lower some pack/unpack ops not supported by aco MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit aco only support the split vertion of these instructions. Reviewed-by: Marek Olšák Signed-off-by: Qiang Yu Part-of: --- src/amd/llvm/ac_nir_to_llvm.c | 25 +------------------------ src/gallium/drivers/radeonsi/si_get.c | 5 +++++ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 06cc488..f1a7efc 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -569,24 +569,17 @@ static bool visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr) case nir_op_unpack_64_4x16: src_components = 1; break; - case nir_op_pack_half_2x16: case nir_op_pack_snorm_2x16: case nir_op_pack_unorm_2x16: case nir_op_pack_uint_2x16: case nir_op_pack_sint_2x16: - case nir_op_pack_32_2x16: - case nir_op_pack_64_2x32: src_components = 2; break; - case nir_op_unpack_half_2x16: - src_components = 1; - break; case nir_op_cube_face_coord_amd: case nir_op_cube_face_index_amd: src_components = 3; break; case nir_op_pack_32_4x8: - case nir_op_pack_64_4x16: src_components = 4; break; default: @@ -1104,9 +1097,6 @@ static bool visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr) case nir_op_imul_high: result = emit_imul_high(&ctx->ac, src[0], src[1]); break; - case nir_op_pack_half_2x16: - result = emit_pack_2x16(&ctx->ac, src[0], ac_build_cvt_pkrtz_f16); - break; case nir_op_pack_half_2x16_rtz_split: case nir_op_pack_half_2x16_split: src[0] = ac_to_float(&ctx->ac, src[0]); @@ -1157,9 +1147,6 @@ static bool visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr) result = ac_build_cvt_pk_i16(&ctx->ac, comp, 16, false); break; } - case nir_op_unpack_half_2x16: - result = emit_unpack_half_2x16(&ctx->ac, src[0]); - break; case nir_op_unpack_half_2x16_split_x: { assert(ac_get_llvm_num_components(src[0]) == 1); LLVMValueRef tmp = emit_unpack_half_2x16(&ctx->ac, src[0]); @@ -1185,10 +1172,6 @@ static bool visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr) result = LLVMBuildBitCast(ctx->ac.builder, src[0], ctx->ac.v4i16, ""); break; } - case nir_op_pack_64_4x16: { - result = LLVMBuildBitCast(ctx->ac.builder, src[0], ctx->ac.i64, ""); - break; - } case nir_op_unpack_64_2x32: { result = LLVMBuildBitCast(ctx->ac.builder, src[0], @@ -1208,19 +1191,13 @@ static bool visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr) break; } - case nir_op_pack_64_2x32: { - result = LLVMBuildBitCast(ctx->ac.builder, src[0], - ctx->ac.i64, ""); - break; - } case nir_op_pack_64_2x32_split: { LLVMValueRef tmp = ac_build_gather_values(&ctx->ac, src, 2); result = LLVMBuildBitCast(ctx->ac.builder, tmp, ctx->ac.i64, ""); break; } - case nir_op_pack_32_4x8: - case nir_op_pack_32_2x16: { + case nir_op_pack_32_4x8: { result = LLVMBuildBitCast(ctx->ac.builder, src[0], ctx->ac.i32, ""); break; diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c index 42688a9..e2b6fe5 100644 --- a/src/gallium/drivers/radeonsi/si_get.c +++ b/src/gallium/drivers/radeonsi/si_get.c @@ -1283,10 +1283,15 @@ void si_init_screen_get_functions(struct si_screen *sscreen) .lower_ineg = true, .lower_pack_snorm_4x8 = true, .lower_pack_unorm_4x8 = true, + .lower_pack_half_2x16 = true, + .lower_pack_64_2x32 = true, + .lower_pack_64_4x16 = true, + .lower_pack_32_2x16 = true, .lower_unpack_snorm_2x16 = true, .lower_unpack_snorm_4x8 = true, .lower_unpack_unorm_2x16 = true, .lower_unpack_unorm_4x8 = true, + .lower_unpack_half_2x16 = true, .lower_extract_byte = true, .lower_extract_word = true, .lower_insert_byte = true, -- 2.7.4