[Mesa-dev] [PATCH 01/14] nir: Add explicitly sized types

Samuel Iglesias Gonsálvez siglesias at igalia.com
Mon Mar 14 06:05:19 UTC 2016


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256



On 12/03/16 17:26, Connor Abbott wrote:
> On Fri, Mar 11, 2016 at 2:33 AM, Samuel Iglesias Gonsálvez 
> <siglesias at igalia.com> wrote:
> 
> 
> On 11/03/16 01:08, Jason Ekstrand wrote:
>>>> On Thu, Mar 10, 2016 at 4:00 PM, Connor Abbott 
>>>> <cwabbott0 at gmail.com> wrote:
>>>> 
>>>>> On Mon, Mar 7, 2016 at 3:45 AM, Samuel Iglesias Gonsálvez 
>>>>> <siglesias at igalia.com> wrote:
>>>>>> From: Jason Ekstrand <jason.ekstrand at intel.com>
>>>>>> 
>>>>>> v2: Fix size/type mask to properly handle 8-bit types.
>>>>>> 
>>>>>> Signed-off-by: Juan A. Suarez Romero
>>>>>> <jasuarez at igalia.com> --- src/compiler/nir/nir.h | 17
>>>>>> ++++++++++++++++- 1 file changed, 16 insertions(+), 1
>>>>>> deletion(-)
>>>>>> 
>>>>>> diff --git a/src/compiler/nir/nir.h
>>>>>> b/src/compiler/nir/nir.h index cccb3a4..659e98c 100644
>>>>>> --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h
>>>>>> @@ -605,9 +605,24 @@ typedef enum { nir_type_float,
>>>>>> nir_type_int, nir_type_uint, -   nir_type_bool +
>>>>>> nir_type_bool, +   nir_type_bool32 =    32 | 
>>>>>> nir_type_bool, +   nir_type_int8 =      8  |
>>>>>> nir_type_int, + nir_type_int16 =     16 | nir_type_int, +
>>>>>> nir_type_int32 = 32 | nir_type_int, +   nir_type_int64 =
>>>>>> 64 | nir_type_int, +   nir_type_uint8 =     8  |
>>>>>> nir_type_uint, + nir_type_uint16 =    16 | nir_type_uint,
>>>>>> +   nir_type_uint32 = 32 | nir_type_uint, +
>>>>>> nir_type_uint64 =    64 | nir_type_uint, +
>>>>>> nir_type_float16 =   16 | nir_type_float, + 
>>>>>> nir_type_float32 =   32 | nir_type_float, +
>>>>>> nir_type_float64 =   64 | nir_type_float, }
>>>>>> nir_alu_type;
>>>>>> 
>>>>>> +#define NIR_ALU_TYPE_SIZE_MASK 0xfffffff8 +#define 
>>>>>> NIR_ALU_TYPE_BASE_TYPE_MASK 0x00000007
>>>>> 
>>>>> So I'm not really the one to be reviewing this series
>>>>> (after all, I wrote most of it :) ) but one thing that I
>>>>> never quite liked, and didn't get around to fixing, is how
>>>>> we use these raw constants all over the place. Perhaps we
>>>>> could make things more readable by adding
>>>>> nir_get_sized_type(), nir_get_unsized_type(), and
>>>>> nir_type_size() helpers and then use those instead of 
>>>>> or-ing/and-ing things together everywhere.
>>>>> 
>>>> 
>>>> Agreed.
>>>> 
>>>> 
> 
> Agreed. We saw it too but, as this is used in a lot in the fp64
> patches, we were thinking on apply one patch at the end of the fp64
> series adding those helper functions (maybe just macros like
> NIR_GET_UNSIZED_TYPE and NIR_GET_TYPE_SIZE) and adapting the users
> of the mask.
> 
>> I should probably mention, in general we tend to prefer inline 
>> functions over macros where possible since it's clearer what
>> their argument types and return type are and they tend to
>> integrate better with gdb.
> 

Thanks for the advice! We will use inline functions then.

Sam

> 
> However, we can add them here and modify the rest of fp64 patches
> if you prefer it.
> 
> Sam
> 
>>>>> 
>>>>>> + typedef enum { NIR_OP_IS_COMMUTATIVE = (1 << 0), 
>>>>>> NIR_OP_IS_ASSOCIATIVE = (1 << 1), -- 2.7.0
>>>>>> 
>>>>>> _______________________________________________ mesa-dev 
>>>>>> mailing list mesa-dev at lists.freedesktop.org 
>>>>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>>>> _______________________________________________ mesa-dev
>>>>> mailing list mesa-dev at lists.freedesktop.org 
>>>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>>>> 
>>>> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJW5lSfAAoJEH/0ujLxfcNDeVMP/jv3UO2VNeW2R/3BX1d7KTni
GJ/0lH4BxEEDlJNUoxCOoxRGVmUVI8D/NNRKWg9lWjP1aPSKcpNLXCSzw5C3YHql
YzklKjnNi6nSZdzjjDWOtC7wJvOrLUhbst2ng6N9vu9SkjGTT2TOjp6AMSc0O5G6
ptnH+mdqKqBb31rh22w5LhlJnjIA2qmAsVpR2XZ8RCTaRZw/whKnQ+RN3MBSW7qs
ENMoeBeaG8pKdJc7w8YzfO1jM4Tgic8cFlPq2rWF3eeG0s9pACLmCOFroyBjJvD9
ysQkUQoNyG25ElVMA8jdhuI19CemHN7EK1BxmA+U0RQyUQfMmax4g4TUFLloALnw
FapL4FI0j4nuER9liW/EED/NVgn78cLpMMOYyVjxOEt3GjAZ9WwIHHtDr9ZTXmdu
u9pyciB724XQJNkcaMQiAF1vJgsnR3WdBuHKgOul8B3EV8urRtUYLOv+4eqVbaIT
p5E3n1On5zxyifeWX/Nq2JDFA029K74G+6bVN3VnyZNUv5dMw4Ry+fNY6CrAdYqY
cvTs9WMxWhsPwK3CRKVYImquKngoVdkXazA7sePRF44AGBMobFPN4tF2DOtRVfOq
EtvbP7nJ3UJSA527KKdnUG4scf/1XDVkvPVK48/nkVVpURIZPj4fkXZvdAdUsutk
VZR5zXfg5JuF1xNiV6gH
=DTjV
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list