mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-04 13:08:15 +02:00
ac/llvm: never create ffmaz for broken llvm
The workaround wasn't proper fused ffma. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41649>
This commit is contained in:
parent
015b1d9e6d
commit
3ea594f42b
2 changed files with 14 additions and 12 deletions
|
|
@ -10,6 +10,10 @@
|
|||
#include "nir_builder.h"
|
||||
#include "nir_intrinsics.h"
|
||||
|
||||
#if AMD_LLVM_AVAILABLE
|
||||
#include <llvm/Config/llvm-config.h>
|
||||
#endif
|
||||
|
||||
/* Set NIR options shared by ACO, LLVM, RADV, and radeonsi. */
|
||||
void ac_nir_set_options(const struct ac_compiler_info *info, bool use_llvm,
|
||||
nir_shader_compiler_options *options)
|
||||
|
|
@ -144,6 +148,14 @@ void ac_nir_set_options(const struct ac_compiler_info *info, bool use_llvm,
|
|||
options->max_workgroup_count[1] = UINT16_MAX;
|
||||
options->max_workgroup_count[2] = UINT16_MAX;
|
||||
options->max_samples = 8;
|
||||
|
||||
/* Workaround for LLVM bug that crashes when using legacy fma on GFX12. */
|
||||
#if AMD_LLVM_AVAILABLE
|
||||
if (info->gfx_level == GFX12 && use_llvm && LLVM_VERSION_MAJOR <= 21)
|
||||
options->has_ffmaz_no_denorms = false;
|
||||
#else
|
||||
assert(!use_llvm);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Sleep for the given number of clock cycles. */
|
||||
|
|
|
|||
|
|
@ -767,18 +767,8 @@ 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]);
|
||||
#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);
|
||||
}
|
||||
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