mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
ac/llvm: workaround legacy fma intrinsic crash on gfx12
This is a llvm bug: https://github.com/llvm/llvm-project/issues/170437 Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14359 Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38884>
This commit is contained in:
parent
cb9d9b8a6e
commit
3f37740762
1 changed files with 12 additions and 2 deletions
|
|
@ -857,8 +857,18 @@ static bool visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
|
|||
src[0] = ac_to_float(&ctx->ac, src[0]);
|
||||
src[1] = ac_to_float(&ctx->ac, src[1]);
|
||||
src[2] = ac_to_float(&ctx->ac, src[2]);
|
||||
result = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.fma.legacy", ctx->ac.f32,
|
||||
src, 3, 0);
|
||||
#if LLVM_VERSION_MAJOR <= 21
|
||||
/* Workaround for LLVM bug that crashes when using legacy fma on GFX12. */
|
||||
if (ctx->ac.gfx_level == GFX12) {
|
||||
LLVMValueRef mulz = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.fmul.legacy",
|
||||
ctx->ac.f32, src, 2, 0);
|
||||
result = LLVMBuildFAdd(ctx->ac.builder, mulz, src[2], "");
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
result = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.fma.legacy", ctx->ac.f32,
|
||||
src, 3, 0);
|
||||
}
|
||||
break;
|
||||
case nir_op_ldexp:
|
||||
src[0] = ac_to_float(&ctx->ac, src[0]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue