mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-24 10:38:11 +02:00
ac: handle new float multadd opcodes
This advertizes both ffma and fmad on a couple of chipsets to support VK_KHR_shader_fma and to improve OpenCL fma performance, where fma is not optional and the emulation is more expensive than slow fma. Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41165>
This commit is contained in:
parent
0082745b0a
commit
570bfe1ee0
1 changed files with 14 additions and 1 deletions
|
|
@ -14,6 +14,8 @@
|
|||
void ac_nir_set_options(const struct ac_compiler_info *info, bool use_llvm,
|
||||
nir_shader_compiler_options *options)
|
||||
{
|
||||
memset(options, 0, sizeof(*options));
|
||||
|
||||
/* |---------------------------------- Performance & Availability --------------------------------|
|
||||
* |MAD/MAC/MADAK/MADMK|MAD_LEGACY|MAC_LEGACY| FMA |FMAC/FMAAK/FMAMK|FMA_LEGACY|PK_FMA_F16,|Best choice
|
||||
* Arch | F32,F16,F64 | F32,F16 | F32,F16 |F32,F16,F64 | F32,F16 | F32 |PK_FMAC_F16|F16,F32,F64
|
||||
|
|
@ -34,7 +36,17 @@ void ac_nir_set_options(const struct ac_compiler_info *info, bool use_llvm,
|
|||
* gfx10 and older prefer MAD for F32 because of the legacy instruction.
|
||||
*/
|
||||
|
||||
memset(options, 0, sizeof(*options));
|
||||
options->float_mul_add32 = nir_float_muladd_support_has_ffma;
|
||||
if (info->has_mad32)
|
||||
options->float_mul_add32 |= nir_float_muladd_support_prefers_split;
|
||||
|
||||
if (info->gfx_level >= GFX8) {
|
||||
options->float_mul_add16 = nir_float_muladd_support_has_ffma;
|
||||
if (info->gfx_level == GFX8)
|
||||
options->float_mul_add16 |= nir_float_muladd_support_prefers_split;
|
||||
}
|
||||
|
||||
options->float_mul_add64 = nir_float_muladd_support_has_ffma;
|
||||
options->vertex_id_zero_based = true;
|
||||
options->lower_scmp = true;
|
||||
options->lower_flrp16 = true;
|
||||
|
|
@ -972,6 +984,7 @@ ac_nir_op_supports_packed_math_16bit(const nir_alu_instr* alu)
|
|||
case nir_op_fadd:
|
||||
case nir_op_fsub:
|
||||
case nir_op_fmul:
|
||||
case nir_op_ffma:
|
||||
case nir_op_ffma_old:
|
||||
case nir_op_fdiv:
|
||||
case nir_op_flrp:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue