All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Ilia Mirkin <imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
Cc: "mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	"nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH] nouveau: codegen: Take src swizzle into account on loads
Date: Fri, 8 Apr 2016 11:27:23 +0200	[thread overview]
Message-ID: <5707797B.4040708@redhat.com> (raw)
In-Reply-To: <CAKb7Uvhf=6TngukZe976+fX2zibE6U4D05zYOUEj_F5mCVKOBA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi,

On 07-04-16 15:58, Ilia Mirkin wrote:
> That's wrong.

It used to work with the old RES[] code and if one cannot specify
a source swizzle, then how can I do something like

LOAD TEMP[0].y, MEMORY[0], address

And get the data at absolute global memory address "address" into TEMP[0].y ?

This is a must-have for llvm to be able to generate working TGSI code,
I do not see any way around this.

AFAIK this is exactly what src-swizzling is for. Also note that
this commit does not change anything if no src-swizzling is specified,
in that case things work exactly as before.

 > The spec for the instruction needs to be clarified...
> The current nouveau impl is correct - only the .x of the address
> should be loaded, with up to 16 bytes read into the destination.

Ah note this is not about swizzling on the address, that indeed
makes no sense given how the addressing works for BUFFERS / MEMORY,
no this is about adding a swizlling postfix to the buffer / memory
resource specification, for example:

LOAD TEMP[0].y, MEMORY[0].xxxx, TEMP[0]

See the swizzling is done on the resource, not on the address, so
the swizzling specifies swizzling of the up to 16 bytes read from
address, it does not influence the address handling at all.

I now see I made an error in my commit msg, it gives the following
example:

LOAD TEMP[0].y, MEMORY[0].xxxx, TEMP[0].x

This clearly is wrong, the last TEMP[0].x is not even valid TGSI,
the correct example would be:

LOAD TEMP[0].y, MEMORY[0].xxxx, TEMP[0]

Regards,

Hans


> On Thu, Apr 7, 2016 at 9:27 AM, Hans de Goede <hdegoede@redhat.com> wrote:
>> The llvm TGSI backend does things like:
>>
>>
>>
>> Expecting the data at address TEMP[0].x to get loaded to
>> TEMP[0].y. Before this commit the data at TEMP[0].x + 4 would be
>> loaded instead. This commit fixes this.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 8 ++++++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
>> index 557608e..cc51f5a 100644
>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
>> @@ -2279,12 +2279,16 @@ Converter::handleLOAD(Value *dst0[4])
>>
>>            Value *off = fetchSrc(1, c);
>>            Symbol *sym;
>> +         uint32_t src0_component_offset = tgsi.getSrc(0).getSwizzle(c) * 4;
>> +
>>            if (tgsi.getSrc(1).getFile() == TGSI_FILE_IMMEDIATE) {
>>               off = NULL;
>>               sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c,
>> -                          tgsi.getSrc(1).getValueU32(0, info) + 4 * c);
>> +                          tgsi.getSrc(1).getValueU32(0, info) +
>> +                          src0_component_offset);
>>            } else {
>> -            sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c, 4 * c);
>> +            sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c,
>> +                          src0_component_offset);
>>            }
>>
>>            Instruction *ld = mkLoad(TYPE_U32, dst0[c], sym, off);
>> --
>> 2.7.3
>>
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

  parent reply	other threads:[~2016-04-08  9:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 13:27 [PATCH] nouveau: codegen: Take src swizzle into account on loads Hans de Goede
     [not found] ` <1460035648-3804-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-07 13:58   ` Ilia Mirkin
     [not found]     ` <CAKb7Uvhf=6TngukZe976+fX2zibE6U4D05zYOUEj_F5mCVKOBA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-08  9:27       ` Hans de Goede [this message]
     [not found]         ` <5707797B.4040708-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-08 13:56           ` Ilia Mirkin
2016-04-08 15:02           ` Ilia Mirkin
     [not found]             ` <CAKb7UvjhSJGCH2bLJWc+A8hOUepR8=AnjKjLWTW9ipr44N2NnQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-08 15:28               ` Hans de Goede
     [not found]                 ` <5707CE34.6050904-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-08 15:45                   ` Ilia Mirkin
     [not found]                     ` <CAKb7Uvg5c1NorKA3uvnXfToZb+QUwRzZ0T9cUaA5jEuiBma+gA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-08 16:06                       ` Hans de Goede
2016-04-08 16:26                         ` [Nouveau] " Hans de Goede
2016-04-08 16:34                           ` Ilia Mirkin

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=5707797B.4040708@redhat.com \
    --to=hdegoede-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org \
    --cc=mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@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.