Re: [Mesa-dev] [PATCH] r600g: Fix flush issue with llvm on r700

2012-11-21 Thread Vadim Girlin
On Tue, 2012-11-20 at 23:26 +0100, Vincent Lejeune wrote:
 ---
  src/gallium/drivers/r600/r600_llvm.c | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)
 
 diff --git a/src/gallium/drivers/r600/r600_llvm.c 
 b/src/gallium/drivers/r600/r600_llvm.c
 index b3d4e6b..170dac7 100644
 --- a/src/gallium/drivers/r600/r600_llvm.c
 +++ b/src/gallium/drivers/r600/r600_llvm.c
 @@ -11,6 +11,7 @@
  #include r600_asm.h
  #include r600_opcodes.h
  #include r600_shader.h
 +#include r600_pipe.h
  #include radeon_llvm.h
  #include radeon_llvm_emit.h
  
 @@ -324,8 +325,10 @@ static void llvm_emit_tex(
  
   sampler_src = emit_data-inst-Instruction.NumSrcRegs-1;
  
 + // XXX: Resource ID offset is R600_MAX_CONST_BUFFERS but LLVM already 
 adds 2
 + // to the generated machine resource id
   args[c++] = lp_build_const_int32(gallivm,
 - 
 emit_data-inst-Src[sampler_src].Register.Index);
 + 
 emit_data-inst-Src[sampler_src].Register.Index + R600_MAX_CONST_BUFFERS - 
 2);
   args[c++] = lp_build_const_int32(gallivm,
   emit_data-inst-Texture.Texture);
  

As Marek said, it's not a flushing issue. The problem is with the
difference in sampler_id/resource_id mapping between the compiler and
the driver introduced by recent driver changes. There is a temporary fix
in the Tom's llvm tree:

http://cgit.freedesktop.org/~tstellar/llvm/commit/?id=dca75e6619ed9262936a233deb03de9da897aa93

Actually I think that the compiler shouldn't be aware of these internal
driver details at all, driver should precompute and pass both id's to
the compiler, and then these id's should go through the llvm backend
unchanged (at least while we are not using indexing for
resource_id/sampler_id and not trying to optimize it somehow).

Vadim

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] r600g: Fix flush issue with llvm on r700

2012-11-20 Thread Vincent Lejeune
---
 src/gallium/drivers/r600/r600_llvm.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/r600_llvm.c 
b/src/gallium/drivers/r600/r600_llvm.c
index b3d4e6b..170dac7 100644
--- a/src/gallium/drivers/r600/r600_llvm.c
+++ b/src/gallium/drivers/r600/r600_llvm.c
@@ -11,6 +11,7 @@
 #include r600_asm.h
 #include r600_opcodes.h
 #include r600_shader.h
+#include r600_pipe.h
 #include radeon_llvm.h
 #include radeon_llvm_emit.h
 
@@ -324,8 +325,10 @@ static void llvm_emit_tex(
 
sampler_src = emit_data-inst-Instruction.NumSrcRegs-1;
 
+   // XXX: Resource ID offset is R600_MAX_CONST_BUFFERS but LLVM already 
adds 2
+   // to the generated machine resource id
args[c++] = lp_build_const_int32(gallivm,
-   
emit_data-inst-Src[sampler_src].Register.Index);
+   
emit_data-inst-Src[sampler_src].Register.Index + R600_MAX_CONST_BUFFERS - 2);
args[c++] = lp_build_const_int32(gallivm,
emit_data-inst-Texture.Texture);
 
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] r600g: Fix flush issue with llvm on r700

2012-11-20 Thread Marek Olšák
It's not really a flush fix, you're just fixing wrong RESOURCE_ID in shaders.

The best solution would be not to add 2 in LLVM and not to subtract 2
here. Other than that, it looks good.

Marek

On Tue, Nov 20, 2012 at 11:26 PM, Vincent Lejeune v...@ovi.com wrote:
 ---
  src/gallium/drivers/r600/r600_llvm.c | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

 diff --git a/src/gallium/drivers/r600/r600_llvm.c 
 b/src/gallium/drivers/r600/r600_llvm.c
 index b3d4e6b..170dac7 100644
 --- a/src/gallium/drivers/r600/r600_llvm.c
 +++ b/src/gallium/drivers/r600/r600_llvm.c
 @@ -11,6 +11,7 @@
  #include r600_asm.h
  #include r600_opcodes.h
  #include r600_shader.h
 +#include r600_pipe.h
  #include radeon_llvm.h
  #include radeon_llvm_emit.h

 @@ -324,8 +325,10 @@ static void llvm_emit_tex(

 sampler_src = emit_data-inst-Instruction.NumSrcRegs-1;

 +   // XXX: Resource ID offset is R600_MAX_CONST_BUFFERS but LLVM already 
 adds 2
 +   // to the generated machine resource id
 args[c++] = lp_build_const_int32(gallivm,
 -   
 emit_data-inst-Src[sampler_src].Register.Index);
 +   
 emit_data-inst-Src[sampler_src].Register.Index + R600_MAX_CONST_BUFFERS - 
 2);
 args[c++] = lp_build_const_int32(gallivm,
 emit_data-inst-Texture.Texture);

 --
 1.7.11.7

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev