Re: [Mesa-dev] [PATCH] r600/sb: use safe math optimizatiosn when TGSI contains precise operations

2018-09-14 Thread Roland Scheidegger
I suppose ideally it would only affect instruction chains which have a
precise modifier somewhere. But it's better than just ignoring it
completely.

Reviewed-by: Roland Scheidegger 


Am 14.09.2018 um 16:56 schrieb Gert Wollny:
> Fixes:
>   dEQP-GLES3.functional.shaders.invariance.highp.common_subexpression_3
>   dEQP-GLES3.functional.shaders.invariance.mediump.common_subexpression_3
>   dEQP-GLES3.functional.shaders.invariance.lowp.common_subexpression_3
> 
> Signed-off-by: Gert Wollny 
> ---
>  src/gallium/drivers/r600/r600_asm.h  | 1 +
>  src/gallium/drivers/r600/r600_shader.c   | 3 +++
>  src/gallium/drivers/r600/sb/sb_bc_parser.cpp | 2 +-
>  3 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/r600/r600_asm.h 
> b/src/gallium/drivers/r600/r600_asm.h
> index 5841044bf8..ca9280a7a8 100644
> --- a/src/gallium/drivers/r600/r600_asm.h
> +++ b/src/gallium/drivers/r600/r600_asm.h
> @@ -277,6 +277,7 @@ struct r600_bytecode {
>   struct r600_bytecode_output pending_outputs[5];
>   int n_pending_outputs;
>   boolean need_wait_ack; /* emit a pending WAIT_ACK prior 
> to control flow */
> + boolean precise;
>  };
>  
>  /* eg_asm.c */
> diff --git a/src/gallium/drivers/r600/r600_shader.c 
> b/src/gallium/drivers/r600/r600_shader.c
> index 2229dc8fab..408939d110 100644
> --- a/src/gallium/drivers/r600/r600_shader.c
> +++ b/src/gallium/drivers/r600/r600_shader.c
> @@ -3879,6 +3879,9 @@ static int r600_shader_from_tgsi(struct r600_context 
> *rctx,
>   ctx.inst_info = 
> _shader_tgsi_instruction[opcode];
>   else
>   ctx.inst_info = 
> _shader_tgsi_instruction[opcode];
> +
> + ctx.bc->precise |= 
> ctx.parse.FullToken.FullInstruction.Instruction.Precise;
> +
>   r = ctx.inst_info->process();
>   if (r)
>   goto out_err;
> diff --git a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp 
> b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
> index a7b828268b..eafc1cb8ec 100644
> --- a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
> +++ b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
> @@ -75,7 +75,7 @@ int bc_parser::decode() {
>   }
>  
>   sh = new shader(ctx, t, bc->debug_id);
> - sh->safe_math = sb_context::safe_math || (t == TARGET_COMPUTE);
> + sh->safe_math = sb_context::safe_math || (t == TARGET_COMPUTE || 
> bc->precise);
>  
>   int r = decode_shader();
>  
> 

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


Re: [Mesa-dev] [PATCH] r600/sb: use safe math optimizatiosn when TGSI contains precise operations

2018-09-14 Thread Gert Wollny
The typo in subject is fixed locally. 

Am Freitag, den 14.09.2018, 16:56 +0200 schrieb Gert Wollny:
> Fixes:
>   dEQP-
> GLES3.functional.shaders.invariance.highp.common_subexpression_3
>   dEQP-
> GLES3.functional.shaders.invariance.mediump.common_subexpression_3
>   dEQP-
> GLES3.functional.shaders.invariance.lowp.common_subexpression_3
> 
> Signed-off-by: Gert Wollny 
> ---
>  src/gallium/drivers/r600/r600_asm.h  | 1 +
>  src/gallium/drivers/r600/r600_shader.c   | 3 +++
>  src/gallium/drivers/r600/sb/sb_bc_parser.cpp | 2 +-
>  3 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/r600/r600_asm.h
> b/src/gallium/drivers/r600/r600_asm.h
> index 5841044bf8..ca9280a7a8 100644
> --- a/src/gallium/drivers/r600/r600_asm.h
> +++ b/src/gallium/drivers/r600/r600_asm.h
> @@ -277,6 +277,7 @@ struct r600_bytecode {
>   struct r600_bytecode_output pending_outputs[5];
>   int n_pending_outputs;
>   boolean need_wait_ack; /* emit a
> pending WAIT_ACK prior to control flow */
> + boolean precise;
>  };
>  
>  /* eg_asm.c */
> diff --git a/src/gallium/drivers/r600/r600_shader.c
> b/src/gallium/drivers/r600/r600_shader.c
> index 2229dc8fab..408939d110 100644
> --- a/src/gallium/drivers/r600/r600_shader.c
> +++ b/src/gallium/drivers/r600/r600_shader.c
> @@ -3879,6 +3879,9 @@ static int r600_shader_from_tgsi(struct
> r600_context *rctx,
>   ctx.inst_info =
> _shader_tgsi_instruction[opcode];
>   else
>   ctx.inst_info =
> _shader_tgsi_instruction[opcode];
> +
> + ctx.bc->precise |=
> ctx.parse.FullToken.FullInstruction.Instruction.Precise;
> +
>   r = ctx.inst_info->process();
>   if (r)
>   goto out_err;
> diff --git a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
> b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
> index a7b828268b..eafc1cb8ec 100644
> --- a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
> +++ b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
> @@ -75,7 +75,7 @@ int bc_parser::decode() {
>   }
>  
>   sh = new shader(ctx, t, bc->debug_id);
> - sh->safe_math = sb_context::safe_math || (t ==
> TARGET_COMPUTE);
> + sh->safe_math = sb_context::safe_math || (t ==
> TARGET_COMPUTE || bc->precise);
>  
>   int r = decode_shader();
>  
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] r600/sb: use safe math optimizatiosn when TGSI contains precise operations

2018-09-14 Thread Gert Wollny
Fixes:
  dEQP-GLES3.functional.shaders.invariance.highp.common_subexpression_3
  dEQP-GLES3.functional.shaders.invariance.mediump.common_subexpression_3
  dEQP-GLES3.functional.shaders.invariance.lowp.common_subexpression_3

Signed-off-by: Gert Wollny 
---
 src/gallium/drivers/r600/r600_asm.h  | 1 +
 src/gallium/drivers/r600/r600_shader.c   | 3 +++
 src/gallium/drivers/r600/sb/sb_bc_parser.cpp | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/r600_asm.h 
b/src/gallium/drivers/r600/r600_asm.h
index 5841044bf8..ca9280a7a8 100644
--- a/src/gallium/drivers/r600/r600_asm.h
+++ b/src/gallium/drivers/r600/r600_asm.h
@@ -277,6 +277,7 @@ struct r600_bytecode {
struct r600_bytecode_output pending_outputs[5];
int n_pending_outputs;
boolean need_wait_ack; /* emit a pending WAIT_ACK prior 
to control flow */
+   boolean precise;
 };
 
 /* eg_asm.c */
diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 2229dc8fab..408939d110 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -3879,6 +3879,9 @@ static int r600_shader_from_tgsi(struct r600_context 
*rctx,
ctx.inst_info = 
_shader_tgsi_instruction[opcode];
else
ctx.inst_info = 
_shader_tgsi_instruction[opcode];
+
+   ctx.bc->precise |= 
ctx.parse.FullToken.FullInstruction.Instruction.Precise;
+
r = ctx.inst_info->process();
if (r)
goto out_err;
diff --git a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp 
b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
index a7b828268b..eafc1cb8ec 100644
--- a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
+++ b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
@@ -75,7 +75,7 @@ int bc_parser::decode() {
}
 
sh = new shader(ctx, t, bc->debug_id);
-   sh->safe_math = sb_context::safe_math || (t == TARGET_COMPUTE);
+   sh->safe_math = sb_context::safe_math || (t == TARGET_COMPUTE || 
bc->precise);
 
int r = decode_shader();
 
-- 
2.16.4

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