mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
ac/llvm: implement udot_4x8/sdot_4x8/udot_2x16/sdot_2x16 opcodes
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12617>
This commit is contained in:
parent
d6619d0a01
commit
859790ba54
1 changed files with 28 additions and 0 deletions
|
|
@ -1247,6 +1247,34 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
|
|||
break;
|
||||
}
|
||||
|
||||
case nir_op_sdot_4x8_iadd:
|
||||
case nir_op_udot_4x8_uadd:
|
||||
case nir_op_sdot_4x8_iadd_sat:
|
||||
case nir_op_udot_4x8_uadd_sat: {
|
||||
const char *name = instr->op == nir_op_sdot_4x8_iadd ||
|
||||
instr->op == nir_op_sdot_4x8_iadd_sat
|
||||
? "llvm.amdgcn.sdot4" : "llvm.amdgcn.udot4";
|
||||
src[3] = LLVMConstInt(ctx->ac.i1, instr->op == nir_op_sdot_4x8_iadd_sat ||
|
||||
instr->op == nir_op_udot_4x8_uadd_sat, false);
|
||||
result = ac_build_intrinsic(&ctx->ac, name, def_type, src, 4, AC_FUNC_ATTR_READNONE);
|
||||
break;
|
||||
}
|
||||
|
||||
case nir_op_sdot_2x16_iadd:
|
||||
case nir_op_udot_2x16_uadd:
|
||||
case nir_op_sdot_2x16_iadd_sat:
|
||||
case nir_op_udot_2x16_uadd_sat: {
|
||||
const char *name = instr->op == nir_op_sdot_2x16_iadd ||
|
||||
instr->op == nir_op_sdot_2x16_iadd_sat
|
||||
? "llvm.amdgcn.sdot2" : "llvm.amdgcn.udot2";
|
||||
src[0] = LLVMBuildBitCast(ctx->ac.builder, src[0], ctx->ac.v2i16, "");
|
||||
src[1] = LLVMBuildBitCast(ctx->ac.builder, src[1], ctx->ac.v2i16, "");
|
||||
src[3] = LLVMConstInt(ctx->ac.i1, instr->op == nir_op_sdot_2x16_iadd_sat ||
|
||||
instr->op == nir_op_udot_2x16_uadd_sat, false);
|
||||
result = ac_build_intrinsic(&ctx->ac, name, def_type, src, 4, AC_FUNC_ATTR_READNONE);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Unknown NIR alu instr: ");
|
||||
nir_print_instr(&instr->instr, stderr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue