mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
Merge branch 'pan/algebraic-mediump-fma-opt' into 'main'
Draft: nir/opt_algebraic: Optimize mediump ops done in highp See merge request mesa/mesa!41419
This commit is contained in:
commit
4455b68438
1 changed files with 8 additions and 5 deletions
|
|
@ -1963,11 +1963,6 @@ optimizations.extend([
|
|||
(('f2u32', ('f2fmp', 'a@32')), ('f2u32', a), 'true', TestStatus.UNSUPPORTED),
|
||||
(('i2f32', ('i2imp', 'a@32')), ('i2f32', a), 'true', TestStatus.UNSUPPORTED),
|
||||
|
||||
# f16 -> f2f32 -> fmul32 -> f2fmp when the second operand is a constant
|
||||
# The optimization only works when the constant can be safely represented with 16 bits
|
||||
(('f2fmp', ('fmul(is_used_once,contract)', ('f2f32', 'a@16'), '#b(is_representable_as_f16)')), ('fmul', a, ('f2fmp', b)), 'true', TestStatus.UNSUPPORTED),
|
||||
(('f2fmp', ('fadd(is_used_once,contract)', ('f2f32', 'a@16'), '#b(is_representable_as_f16)')), ('fadd', a, ('f2fmp', b)), 'true', TestStatus.UNSUPPORTED),
|
||||
|
||||
(('ffloor', 'a(is_integral)'), a),
|
||||
(('fceil', 'a(is_integral)'), a),
|
||||
(('ftrunc', 'a(is_integral)'), a),
|
||||
|
|
@ -2011,6 +2006,14 @@ optimizations.extend([
|
|||
(('ult', a, 0), False),
|
||||
])
|
||||
|
||||
# f2fmp(op(f2f16(a), f2f16(b))) -> op(a, b)
|
||||
# The result is bit-per-bit identical except for NaN representations.
|
||||
for op in ['fadd', 'fmul', 'fdiv', 'frem']:
|
||||
optimizations += [
|
||||
(('f2fmp', (f'{op}(is_used_once)', ('f2f32', 'a@16'), '#b(is_representable_as_f16)')), (op, a, ('f2fmp', b)), 'true', TestStatus.UNSUPPORTED),
|
||||
(('f2fmp', (f'{op}(is_used_once)', ('f2f32', 'a@16'), ('f2f32', 'b@16'))), (op, a, b), 'true', TestStatus.UNSUPPORTED),
|
||||
]
|
||||
|
||||
for bits in [16, 32, 64]:
|
||||
cond = '!(options->lower_doubles_options & nir_lower_fp64_full_software)' if bits == 64 else 'true'
|
||||
bcsel = 'bcsel@{}'.format(bits)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue