* [PATCH mesa v2 1/3] nouveau: codegen: LOAD: Always use component 0 when getting the address
@ 2016-04-21 12:39 Hans de Goede
2016-04-21 12:39 ` [PATCH mesa v2 2/3] nouveau: codegen: LOAD: Do not call fetchSrc(1) if the address is immediate Hans de Goede
[not found] ` <1461242362-1281-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 2 replies; 8+ messages in thread
From: Hans de Goede @ 2016-04-21 12:39 UTC (permalink / raw)
To: Ilia Mirkin, Samuel Pitoiset
Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
LOAD loads upto 4 components from the specified resource starting at
the passed in x value of the 2nd source operand, the y, z and w
components of the address should not be used.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-New patch in v2 of this patch-set
---
src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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..d3c2d61 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -2277,7 +2277,7 @@ Converter::handleLOAD(Value *dst0[4])
if (!dst0[c])
continue;
- Value *off = fetchSrc(1, c);
+ Value *off = fetchSrc(1, 0);
Symbol *sym;
if (tgsi.getSrc(1).getFile() == TGSI_FILE_IMMEDIATE) {
off = NULL;
--
2.7.3
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH mesa v2 2/3] nouveau: codegen: LOAD: Do not call fetchSrc(1) if the address is immediate
2016-04-21 12:39 [PATCH mesa v2 1/3] nouveau: codegen: LOAD: Always use component 0 when getting the address Hans de Goede
@ 2016-04-21 12:39 ` Hans de Goede
[not found] ` <1461242362-1281-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
1 sibling, 0 replies; 8+ messages in thread
From: Hans de Goede @ 2016-04-21 12:39 UTC (permalink / raw)
To: Ilia Mirkin, Samuel Pitoiset; +Cc: mesa-dev, nouveau
"off" later gets set to NULL when the address is immediate, so move the
fetchSrc(1) call to the non-immediate branch of the if-else. This brings
handleLOAD's offset handling inline with how it is done in handleSTORE.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-New patch in v2 of this patch-set
---
src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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 d3c2d61..e2db731 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -2277,13 +2277,14 @@ Converter::handleLOAD(Value *dst0[4])
if (!dst0[c])
continue;
- Value *off = fetchSrc(1, 0);
+ Value *off;
Symbol *sym;
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);
} else {
+ off = fetchSrc(1, 0);
sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c, 4 * c);
}
--
2.7.3
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH mesa v2 3/3] nouveau: codegen: LOAD: Take src swizzle into account
[not found] ` <1461242362-1281-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2016-04-21 12:39 ` Hans de Goede
2016-04-21 17:04 ` Ilia Mirkin
0 siblings, 1 reply; 8+ messages in thread
From: Hans de Goede @ 2016-04-21 12:39 UTC (permalink / raw)
To: Ilia Mirkin, Samuel Pitoiset
Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
The llvm TGSI backend uses pointers in registers and does things
like:
LOAD TEMP[0].y, MEMORY[0], TEMP[0]
Expecting the data at address TEMP[0].x to get loaded to
TEMP[0].y. But this will cause the data at TEMP[0].x + 4 to be
loaded instead.
This commit adds support for a swizzle suffix for the 1st source
operand, which allows using:
LOAD TEMP[0].y, MEMORY[0].xxxx, TEMP[0]
And actually getting the desired behavior
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Tweaked commit msg a bit
-Add documentation for this to src/gallium/docs/source/tgsi.rst
---
src/gallium/docs/source/tgsi.rst | 3 +++
src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 8 ++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index 85c302f..4315707 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -2288,6 +2288,9 @@ Resource Access Opcodes
texture arrays and 2D textures. address.w is always
ignored.
+ A swizzle suffix may be added to the resource argument
+ this will cause the resource data to be swizzled accordingly.
+
.. opcode:: STORE - Write data to a shader resource
Syntax: ``STORE resource, address, src``
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 e2db731..01df4f3 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -2279,13 +2279,17 @@ Converter::handleLOAD(Value *dst0[4])
Value *off;
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 {
off = fetchSrc(1, 0);
- 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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH mesa v2 3/3] nouveau: codegen: LOAD: Take src swizzle into account
2016-04-21 12:39 ` [PATCH mesa v2 3/3] nouveau: codegen: LOAD: Take src swizzle into account Hans de Goede
@ 2016-04-21 17:04 ` Ilia Mirkin
2016-04-22 7:08 ` Marek Olšák
0 siblings, 1 reply; 8+ messages in thread
From: Ilia Mirkin @ 2016-04-21 17:04 UTC (permalink / raw)
To: Hans de Goede, Marek Olšák, Nicolai Hähnle-Montoro,
Bas Nieuwenhuizen
Cc: mesa-dev@lists.freedesktop.org, nouveau@lists.freedesktop.org
[+radeon folk]
Marek, Nicolai, Bas - please have a look at the doc change and let us
know if you think this will cause a problem for radeon.
Hans is solving the issue that he wants to swizzle the data loaded
from the image/buffer/whatever before sticking it into the dst
register.
-ilia
On Thu, Apr 21, 2016 at 8:39 AM, Hans de Goede <hdegoede@redhat.com> wrote:
> The llvm TGSI backend uses pointers in registers and does things
> like:
>
> LOAD TEMP[0].y, MEMORY[0], TEMP[0]
>
> Expecting the data at address TEMP[0].x to get loaded to
> TEMP[0].y. But this will cause the data at TEMP[0].x + 4 to be
> loaded instead.
>
> This commit adds support for a swizzle suffix for the 1st source
> operand, which allows using:
>
> LOAD TEMP[0].y, MEMORY[0].xxxx, TEMP[0]
>
> And actually getting the desired behavior
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Tweaked commit msg a bit
> -Add documentation for this to src/gallium/docs/source/tgsi.rst
> ---
> src/gallium/docs/source/tgsi.rst | 3 +++
> src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 8 ++++++--
> 2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
> index 85c302f..4315707 100644
> --- a/src/gallium/docs/source/tgsi.rst
> +++ b/src/gallium/docs/source/tgsi.rst
> @@ -2288,6 +2288,9 @@ Resource Access Opcodes
> texture arrays and 2D textures. address.w is always
> ignored.
>
> + A swizzle suffix may be added to the resource argument
> + this will cause the resource data to be swizzled accordingly.
> +
> .. opcode:: STORE - Write data to a shader resource
>
> Syntax: ``STORE resource, address, src``
> 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 e2db731..01df4f3 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
> @@ -2279,13 +2279,17 @@ Converter::handleLOAD(Value *dst0[4])
>
> Value *off;
> 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 {
> off = fetchSrc(1, 0);
> - 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
>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH mesa v2 3/3] nouveau: codegen: LOAD: Take src swizzle into account
2016-04-21 17:04 ` Ilia Mirkin
@ 2016-04-22 7:08 ` Marek Olšák
2016-04-22 7:23 ` Hans de Goede
0 siblings, 1 reply; 8+ messages in thread
From: Marek Olšák @ 2016-04-22 7:08 UTC (permalink / raw)
To: Ilia Mirkin; +Cc: nouveau@lists.freedesktop.org, mesa-dev@lists.freedesktop.org
On Thu, Apr 21, 2016 at 7:04 PM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
> [+radeon folk]
>
> Marek, Nicolai, Bas - please have a look at the doc change and let us
> know if you think this will cause a problem for radeon.
>
> Hans is solving the issue that he wants to swizzle the data loaded
> from the image/buffer/whatever before sticking it into the dst
> register.
Is this something st/mesa needs or just nouveau? If just nouveau needs
it, I don't see a point in updating the TGSI spec, since nouveau can
just add the swizzle when translating from TGSI.
Marek
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH mesa v2 3/3] nouveau: codegen: LOAD: Take src swizzle into account
2016-04-22 7:08 ` Marek Olšák
@ 2016-04-22 7:23 ` Hans de Goede
[not found] ` <5719D17F.3050503-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Hans de Goede @ 2016-04-22 7:23 UTC (permalink / raw)
To: Marek Olšák, Ilia Mirkin
Cc: nouveau@lists.freedesktop.org, mesa-dev@lists.freedesktop.org
Hi,
On 22-04-16 09:08, Marek Olšák wrote:
> On Thu, Apr 21, 2016 at 7:04 PM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
>> [+radeon folk]
>>
>> Marek, Nicolai, Bas - please have a look at the doc change and let us
>> know if you think this will cause a problem for radeon.
>>
>> Hans is solving the issue that he wants to swizzle the data loaded
>> from the image/buffer/whatever before sticking it into the dst
>> register.
>
> Is this something st/mesa needs or just nouveau? If just nouveau needs
> it, I don't see a point in updating the TGSI spec, since nouveau can
> just add the swizzle when translating from TGSI.
This is something which the llvm tgsi backend needs, which we plan to
use to add opencl support to nouveau.
From the commit msg:
"The llvm TGSI backend uses pointers in registers and does things like:
LOAD TEMP[0].y, MEMORY[0], TEMP[0]
Expecting the data at address TEMP[0].x to get loaded to
TEMP[0].y. But this will cause the data at TEMP[0].x + 4 to be
loaded instead.
This commit adds support for a swizzle suffix for the 1st source
operand, which allows using:
LOAD TEMP[0].y, MEMORY[0].xxxx, TEMP[0]
And actually getting the desired behavior"
Regards,
Hans
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH mesa v2 3/3] nouveau: codegen: LOAD: Take src swizzle into account
[not found] ` <5719D17F.3050503-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2016-04-22 8:37 ` Marek Olšák
[not found] ` <CAAxE2A5xGaAagKfFJ4rALa2rHVJ_UV3eNjXLJKwzKEp7A36ATw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Marek Olšák @ 2016-04-22 8:37 UTC (permalink / raw)
To: Hans de Goede
Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Nicolai Hähnle-Montoro, Bas Nieuwenhuizen,
mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
On Fri, Apr 22, 2016 at 9:23 AM, Hans de Goede <hdegoede@redhat.com> wrote:
> Hi,
>
> On 22-04-16 09:08, Marek Olšák wrote:
>>
>> On Thu, Apr 21, 2016 at 7:04 PM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
>>>
>>> [+radeon folk]
>>>
>>> Marek, Nicolai, Bas - please have a look at the doc change and let us
>>> know if you think this will cause a problem for radeon.
>>>
>>> Hans is solving the issue that he wants to swizzle the data loaded
>>> from the image/buffer/whatever before sticking it into the dst
>>> register.
>>
>>
>> Is this something st/mesa needs or just nouveau? If just nouveau needs
>> it, I don't see a point in updating the TGSI spec, since nouveau can
>> just add the swizzle when translating from TGSI.
>
>
> This is something which the llvm tgsi backend needs, which we plan to
> use to add opencl support to nouveau.
>
> From the commit msg:
>
> "The llvm TGSI backend uses pointers in registers and does things like:
>
> LOAD TEMP[0].y, MEMORY[0], TEMP[0]
>
> Expecting the data at address TEMP[0].x to get loaded to
> TEMP[0].y. But this will cause the data at TEMP[0].x + 4 to be
> loaded instead.
>
> This commit adds support for a swizzle suffix for the 1st source
> operand, which allows using:
>
> LOAD TEMP[0].y, MEMORY[0].xxxx, TEMP[0]
>
> And actually getting the desired behavior"
If radeonsi needs no changes and st/mesa doesn't change behavior, it's OK.
Marek
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH mesa v2 3/3] nouveau: codegen: LOAD: Take src swizzle into account
[not found] ` <CAAxE2A5xGaAagKfFJ4rALa2rHVJ_UV3eNjXLJKwzKEp7A36ATw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-04-22 8:44 ` Hans de Goede
0 siblings, 0 replies; 8+ messages in thread
From: Hans de Goede @ 2016-04-22 8:44 UTC (permalink / raw)
To: Marek Olšák
Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Nicolai Hähnle-Montoro, Bas Nieuwenhuizen,
mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Hi,
On 22-04-16 10:37, Marek Olšák wrote:
> On Fri, Apr 22, 2016 at 9:23 AM, Hans de Goede <hdegoede@redhat.com> wrote:
>> Hi,
>>
>> On 22-04-16 09:08, Marek Olšák wrote:
>>>
>>> On Thu, Apr 21, 2016 at 7:04 PM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
>>>>
>>>> [+radeon folk]
>>>>
>>>> Marek, Nicolai, Bas - please have a look at the doc change and let us
>>>> know if you think this will cause a problem for radeon.
>>>>
>>>> Hans is solving the issue that he wants to swizzle the data loaded
>>>> from the image/buffer/whatever before sticking it into the dst
>>>> register.
>>>
>>>
>>> Is this something st/mesa needs or just nouveau? If just nouveau needs
>>> it, I don't see a point in updating the TGSI spec, since nouveau can
>>> just add the swizzle when translating from TGSI.
>>
>>
>> This is something which the llvm tgsi backend needs, which we plan to
>> use to add opencl support to nouveau.
>>
>> From the commit msg:
>>
>> "The llvm TGSI backend uses pointers in registers and does things like:
>>
>> LOAD TEMP[0].y, MEMORY[0], TEMP[0]
>>
>> Expecting the data at address TEMP[0].x to get loaded to
>> TEMP[0].y. But this will cause the data at TEMP[0].x + 4 to be
>> loaded instead.
>>
>> This commit adds support for a swizzle suffix for the 1st source
>> operand, which allows using:
>>
>> LOAD TEMP[0].y, MEMORY[0].xxxx, TEMP[0]
>>
>> And actually getting the desired behavior"
>
> If radeonsi needs no changes and st/mesa doesn't change behavior, it's OK.
Since radeonsi does not use llvm generated tgsi, it should not need any
changes, and these patches do not touch st/mesa.
Regards,
Hans
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-04-22 8:44 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-21 12:39 [PATCH mesa v2 1/3] nouveau: codegen: LOAD: Always use component 0 when getting the address Hans de Goede
2016-04-21 12:39 ` [PATCH mesa v2 2/3] nouveau: codegen: LOAD: Do not call fetchSrc(1) if the address is immediate Hans de Goede
[not found] ` <1461242362-1281-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-21 12:39 ` [PATCH mesa v2 3/3] nouveau: codegen: LOAD: Take src swizzle into account Hans de Goede
2016-04-21 17:04 ` Ilia Mirkin
2016-04-22 7:08 ` Marek Olšák
2016-04-22 7:23 ` Hans de Goede
[not found] ` <5719D17F.3050503-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-22 8:37 ` Marek Olšák
[not found] ` <CAAxE2A5xGaAagKfFJ4rALa2rHVJ_UV3eNjXLJKwzKEp7A36ATw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-22 8:44 ` Hans de Goede
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.