All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tobias Klausmann <tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
To: Ilia Mirkin <imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
Cc: "nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH v2] nv50/ir: Handle OP_CVT when folding constant expressions
Date: Sun, 11 Jan 2015 21:17:46 +0100	[thread overview]
Message-ID: <54B2DA6A.7080505@mni.thm.de> (raw)
In-Reply-To: <CAKb7Uvi7Ke_fzbpQ_JvLvv-1u2H=F-udRdb0A+dCM0=tsqBKBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>



On 11.01.2015 20:57, Ilia Mirkin wrote:
> On Sun, Jan 11, 2015 at 2:56 PM, Tobias Klausmann
> <tobias.johannes.klausmann@mni.thm.de> wrote:
>>
>> On 11.01.2015 20:19, Ilia Mirkin wrote:
>>> On Sun, Jan 11, 2015 at 12:27 PM, Tobias Klausmann
>>> <tobias.johannes.klausmann@mni.thm.de> wrote:
>>>>
>>>> On 11.01.2015 01:58, Ilia Mirkin wrote:
>>>>> On Fri, Jan 9, 2015 at 8:24 PM, Tobias Klausmann
>>>>> <tobias.johannes.klausmann@mni.thm.de> wrote:
>>>>>> Folding for conversions: F32->(U{16/32}, S{16/32}) and (U{16/32},
>>>>>> {S16/32})->F32
>>>>>>
>>>>>> Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
>>>>>> ---
>>>>>> V2: beat me, whip me, split out F64
>>>>>>
>>>>>>     .../drivers/nouveau/codegen/nv50_ir_peephole.cpp   | 81
>>>>>> ++++++++++++++++++++++
>>>>>>     1 file changed, 81 insertions(+)
>>>>>>
>>>>>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>>>>> b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>>>>> index 9a0bb60..741c74f 100644
>>>>>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>>>>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>>>>> @@ -997,6 +997,87 @@ ConstantFolding::opnd(Instruction *i,
>>>>>> ImmediateValue
>>>>>> &imm0, int s)
>>>>>>           i->op = OP_MOV;
>>>>>>           break;
>>>>>>        }
>>>>>> +   case OP_CVT: {
>>>>>> +      Storage res;
>>>>>> +      bld.setPosition(i, true); /* make sure bld is init'ed */
>>>>>> +      switch(i->dType) {
>>>>>> +      case TYPE_U16:
>>>>>> +         switch (i->sType) {
>>>>>> +         case TYPE_F32:
>>>>>> +            if (i->saturate)
>>>>>> +               res.data.u16 = util_iround(CLAMP(imm0.reg.data.f32, 0,
>>>>>> +                                                UINT16_MAX));
>>>>> Where did this saturate stuff come from? It doesn't make sense to
>>>>> saturate to a non-float dtype. I'd go ahead and just
>>>>> assert(!i->saturate) in the int dtype cases.
>>>>>
>>>>> One does wonder what the hw does if the float doesn't fit in the
>>>>> destination... whether it saturates or not. I don't hugely care
>>>>> though.
>>>> Actually i can't remember why that was added in the first place, i'll go
>>>> ahead and follow your advice here.
>>> Oh wait... this was to support saturating an array access into a u16...
>>>
>>>            const int sat = (i->op == OP_TXF) ? 1 : 0;
>>>            DataType sTy = (i->op == OP_TXF) ? TYPE_U32 : TYPE_F32;
>>>            bld.mkCvt(OP_CVT, TYPE_U16, layer, sTy, src)->saturate = sat;
>>>
>>> So... basically if the source is a U32 and the dest is a U16, we want
>>> to saturate there? IMO this is such a minor use-case that it doesn't
>>> really matter. However I guess you can keep the saturate bits around
>>> if you like.
>> We can do it with or without the saturate if we rely on the test,
>> assert(!i->saturate)'ing is the only thing that breaks the test you sure
>> meant:
>>
>> glsl-resource-not-bound 1DArray
>> glsl-resource-not-bound 2DArray
>> glsl-resource-not-bound 2DMSArray
> Hm, those are the only times that a texelFetch is done in piglit with
> a constant layer index, I guess.
Ok, i'll keep the saturates for (U/S)16 to for once satisfy the 
"dependency" you posted up there and to be future proof if somebody 
implements something similar(?) for the S16 one!
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

  parent reply	other threads:[~2015-01-11 20:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-09 23:47 [RESEND/PATCH] nv50/ir: Handle OP_CVT when folding constant expressions Tobias Klausmann
     [not found] ` <1420847276-8754-1-git-send-email-tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-01-10  1:41   ` Ilia Mirkin
     [not found]     ` <CAKb7UvhkHtoRFP1rk8=9w68ZcgesV21mGAMmdB5LsHvFVNzo3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-10  1:08       ` Tobias Klausmann
2015-01-10  1:24       ` [PATCH v2] " Tobias Klausmann
     [not found]         ` <1420853067-13115-1-git-send-email-tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-01-11  0:58           ` Ilia Mirkin
     [not found]             ` <CAKb7UvinNbgsgz7PGzzy0fAmfzAykm9Fph_FRDxoZKV5cS+ybg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-11 17:27               ` Tobias Klausmann
     [not found]                 ` <54B2B283.9020400-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-01-11 19:19                   ` Ilia Mirkin
     [not found]                     ` <CAKb7Uvg_dR3U_swgod0oLb5cLm8OX8OtTQPU514VG92G1vYg2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-11 19:56                       ` Tobias Klausmann
     [not found]                         ` <54B2D552.6030700-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-01-11 19:57                           ` Ilia Mirkin
     [not found]                             ` <CAKb7Uvi7Ke_fzbpQ_JvLvv-1u2H=F-udRdb0A+dCM0=tsqBKBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-11 20:17                               ` Tobias Klausmann [this message]
     [not found]                                 ` <54B2DA6A.7080505-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-01-11 21:40                                   ` [PATCH] " Tobias Klausmann
     [not found]                                     ` <1421012422-30607-1-git-send-email-tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-01-11 21:54                                       ` Ilia Mirkin
     [not found]                                         ` <CAKb7Uvgnd25Ubm4m_-auNHw8p_Z9g=7sSxDrRb+CmbE5MZtohA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-11 22:08                                           ` Tobias Klausmann
     [not found]                                             ` <54B2F467.3050007-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-01-11 22:12                                               ` Ilia Mirkin
     [not found]                                                 ` <CAKb7UvgiWyNAumaKaiw_B2f49Q+xXszdwBE1abJwoC8SEpH8Lg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-11 22:48                                                   ` Tobias Klausmann
     [not found]                                                     ` <54B2FDB9.60906-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-01-11 22:53                                                       ` Ilia Mirkin
     [not found]                                                         ` <CAKb7UvidgoVLmvvG3r2M2Eio-EexLh1RsXh9GK8Pf-UMSVOPgw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-24 18:18                                                           ` [PATCH v4] " Tobias Klausmann
2015-01-24 18:19                                                           ` [PATCH] " Tobias Klausmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54B2DA6A.7080505@mni.thm.de \
    --to=tobias.johannes.klausmann-aqjdnwhu20eelga04laivw@public.gmane.org \
    --cc=imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.