[Mesa-dev] [PATCH 01/12] nir: Add an "exact" bit to nir_alu_instr

Francisco Jerez currojerez at riseup.net
Fri Mar 18 01:04:34 UTC 2016


Jason Ekstrand <jason at jlekstrand.net> writes:

> ---
>  src/compiler/nir/nir.h       | 11 +++++++++++
>  src/compiler/nir/nir_clone.c |  1 +
>  src/compiler/nir/nir_print.c |  2 ++
>  3 files changed, 14 insertions(+)
>
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index 34f31eb..94b981b 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -671,6 +671,17 @@ extern const nir_op_info nir_op_infos[nir_num_opcodes];
>  typedef struct nir_alu_instr {
>     nir_instr instr;
>     nir_op op;
> +
> +   /** Indicates that this ALU instruction generates an exact value
> +    *
> +    * This is kind-of a mixture of GLSL "precise" and "invariant" and not
> +    * really equivalent to either.  This indicates that the value generated by
> +    * this operation is high-precision and any code transformations that touch
> +    * it must ensure that the resulting value is bit-for-bit identical to the
> +    * original.
> +    */
> +   bool exact;
> +
>     nir_alu_dest dest;
>     nir_alu_src src[];
>  } nir_alu_instr;
> diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c
> index 198ca8b..90eefa7 100644
> --- a/src/compiler/nir/nir_clone.c
> +++ b/src/compiler/nir/nir_clone.c
> @@ -303,6 +303,7 @@ static nir_alu_instr *
>  clone_alu(clone_state *state, const nir_alu_instr *alu)
>  {
>     nir_alu_instr *nalu = nir_alu_instr_create(state->ns, alu->op);
> +   nalu->exact = alu->exact;
>  
>     __clone_dst(state, &nalu->instr, &nalu->dest.dest, &alu->dest.dest);
>     nalu->dest.saturate = alu->dest.saturate;
> diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
> index bdfbd26..26014c1 100644
> --- a/src/compiler/nir/nir_print.c
> +++ b/src/compiler/nir/nir_print.c
> @@ -207,6 +207,8 @@ print_alu_instr(nir_alu_instr *instr, print_state *state)
>     print_alu_dest(&instr->dest, state);
>  
>     fprintf(fp, " = %s", nir_op_infos[instr->op].name);
> +   if (instr->exact)
> +      fprintf(fp, "!");
>     if (instr->dest.saturate)
>        fprintf(fp, ".sat");
>     fprintf(fp, " ");

Patches 1-3 are:

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

> -- 
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160317/8baf3c38/attachment.sig>


More information about the mesa-dev mailing list