<p dir="ltr">Ah, I may have read over your commit too hastily. Will have another look.</p>
<div class="gmail_quote">On Apr 8, 2016 5:27 AM, "Hans de Goede" <<a href="mailto:hdegoede@redhat.com">hdegoede@redhat.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
On 07-04-16 15:58, Ilia Mirkin wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That's wrong.<br>
</blockquote>
<br>
It used to work with the old RES[] code and if one cannot specify<br>
a source swizzle, then how can I do something like<br>
<br>
LOAD TEMP[0].y, MEMORY[0], address<br>
<br>
And get the data at absolute global memory address "address" into TEMP[0].y ?<br>
<br>
This is a must-have for llvm to be able to generate working TGSI code,<br>
I do not see any way around this.<br>
<br>
AFAIK this is exactly what src-swizzling is for. Also note that<br>
this commit does not change anything if no src-swizzling is specified,<br>
in that case things work exactly as before.<br>
<br>
> The spec for the instruction needs to be clarified...<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The current nouveau impl is correct - only the .x of the address<br>
should be loaded, with up to 16 bytes read into the destination.<br>
</blockquote>
<br>
Ah note this is not about swizzling on the address, that indeed<br>
makes no sense given how the addressing works for BUFFERS / MEMORY,<br>
no this is about adding a swizlling postfix to the buffer / memory<br>
resource specification, for example:<br>
<br>
LOAD TEMP[0].y, MEMORY[0].xxxx, TEMP[0]<br>
<br>
See the swizzling is done on the resource, not on the address, so<br>
the swizzling specifies swizzling of the up to 16 bytes read from<br>
address, it does not influence the address handling at all.<br>
<br>
I now see I made an error in my commit msg, it gives the following<br>
example:<br>
<br>
LOAD TEMP[0].y, MEMORY[0].xxxx, TEMP[0].x<br>
<br>
This clearly is wrong, the last TEMP[0].x is not even valid TGSI,<br>
the correct example would be:<br>
<br>
LOAD TEMP[0].y, MEMORY[0].xxxx, TEMP[0]<br>
<br>
Regards,<br>
<br>
Hans<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, Apr 7, 2016 at 9:27 AM, Hans de Goede <<a href="mailto:hdegoede@redhat.com" target="_blank">hdegoede@redhat.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The llvm TGSI backend does things like:<br>
<br>
<br>
<br>
Expecting the data at address TEMP[0].x to get loaded to<br>
TEMP[0].y. Before this commit the data at TEMP[0].x + 4 would be<br>
loaded instead. This commit fixes this.<br>
<br>
Signed-off-by: Hans de Goede <<a href="mailto:hdegoede@redhat.com" target="_blank">hdegoede@redhat.com</a>><br>
---<br>
src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 8 ++++++--<br>
1 file changed, 6 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp<br>
index 557608e..cc51f5a 100644<br>
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp<br>
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp<br>
@@ -2279,12 +2279,16 @@ Converter::handleLOAD(Value *dst0[4])<br>
<br>
Value *off = fetchSrc(1, c);<br>
Symbol *sym;<br>
+ uint32_t src0_component_offset = tgsi.getSrc(0).getSwizzle(c) * 4;<br>
+<br>
if (tgsi.getSrc(1).getFile() == TGSI_FILE_IMMEDIATE) {<br>
off = NULL;<br>
sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c,<br>
- tgsi.getSrc(1).getValueU32(0, info) + 4 * c);<br>
+ tgsi.getSrc(1).getValueU32(0, info) +<br>
+ src0_component_offset);<br>
} else {<br>
- sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c, 4 * c);<br>
+ sym = makeSym(tgsi.getSrc(0).getFile(), r, -1, c,<br>
+ src0_component_offset);<br>
}<br>
<br>
Instruction *ld = mkLoad(TYPE_U32, dst0[c], sym, off);<br>
--<br>
2.7.3<br>
<br>
</blockquote></blockquote>
</blockquote></div>