[Mesa-dev] [PATCH 1/2] nir: Add a fquantize2f16 opcode

Erik Faye-Lund kusmabite at gmail.com
Tue Jan 12 16:38:08 PST 2016


On Wed, Jan 13, 2016 at 1:10 AM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> On Tue, Jan 12, 2016 at 3:52 PM, Matt Turner <mattst88 at gmail.com> wrote:
>>
>> On Tue, Jan 12, 2016 at 3:35 PM, Jason Ekstrand <jason at jlekstrand.net>
>> wrote:
>> > This opcode simply takes a 32-bit floating-point value and reduces its
>> > effective precision to 16 bits.
>> > ---
>>
>> What's it supposed to do for values not representable in half-precision?
>
>
> If they're in-range, round.  If they're out-of-range, the appropriate
> infinity.
>
>>
>>
>> I think we need some more information about this opcode's purpose to
>> be able to review.
>
>
> The purpose is very specifically to implement the OpQuantizeF16 opcode in
> spirv:
> https://www.khronos.org/registry/spir-v/specs/1.0/SPIRV.html#OpQuantizeToF16

Ah, that seems to be slightly different from what the commit message
say (but seemingly identical to what the code does): it doesn't reduce
a 32-bit float to 16-bit precision, it reduces it to the precision
(and range) of FP16. FP16 numbers has 10 bit precision, not 16.


More information about the mesa-dev mailing list