[Mesa-dev] [PATCH 1/2] nir: optimize min(min(a, b), c) to min3(a, b, c) under an option
Ian Romanick
idr at freedesktop.org
Fri Jun 1 18:13:46 UTC 2018
On 06/01/2018 10:17 AM, Eric Anholt wrote:
> Samuel Pitoiset <samuel.pitoiset at gmail.com> writes:
>
>> On 06/01/2018 02:17 AM, Ian Romanick wrote:
>>> On 05/30/2018 10:06 AM, Samuel Pitoiset wrote:
>>>> Similar for max().
>>>>
>>>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>>>> ---
>>>> src/compiler/nir/nir.h | 3 +++
>>>> src/compiler/nir/nir_opt_algebraic.py | 8 ++++++++
>>>> 2 files changed, 11 insertions(+)
>>>>
>>>> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
>>>> index f6086bd6c0..04991b7d04 100644
>>>> --- a/src/compiler/nir/nir.h
>>>> +++ b/src/compiler/nir/nir.h
>>>> @@ -1897,6 +1897,9 @@ typedef struct nir_shader_compiler_options {
>>>> /* lower b2f to iand */
>>>> bool lower_b2f;
>>>>
>>>> + /* lower min(min(a, b), c) to min3(a, b, c) (same for max()). */
>>>> + bool lower_minmax3;
>>>
>>> The way this variable is named and the way it is used is confusing.
>>> Every other lower_foo means "convert foo to something else." This one
>>> means "make some foo."
>>
>> Yes, the name is not that good. Any suggestions?
>
> We use !options->lower_fsat to decide if we should turn min(max())
> patterns into fsat, so we could go with that model again. You'd just
> need to be sure to update other NIR drivers to flag lower_minmax3 so
> they don't start seeing unexpected minmax3s.
Sounds good to me.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180601/e7ecd391/attachment.sig>
More information about the mesa-dev
mailing list