[Mesa-dev] [PATCH v2 02/20] i965/fs: add helper to retrieve instruction data size

Francisco Jerez currojerez at riseup.net
Tue Jan 17 20:34:52 UTC 2017


Samuel Iglesias Gonsálvez <siglesias at igalia.com> writes:

> From: "Juan A. Suarez Romero" <jasuarez at igalia.com>
>
> The execution data size is the biggest type size of any instruction
> operand.
>
> We will use it to know if the instruction deals with DF, because in Ivy
> we need to double the execution size and regioning parameters.
>
> v2:
> - Fix typo in commit log (Matt)
> - Use static inline function instead of fs_inst's method (Curro).
> - Define the result as a constant (Curro).
> - Fix indentation (Matt).
> - Add braces to nested control flow (Matt).
>
> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

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

> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp |  6 +-----
>  src/mesa/drivers/dri/i965/brw_fs.h   | 14 ++++++++++++++
>  2 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 13949c9d9f7..95714c16f15 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -4564,11 +4564,7 @@ get_fpu_lowered_simd_width(const struct gen_device_info *devinfo,
>         !inst->force_writemask_all) {
>        const unsigned channels_per_grf = inst->exec_size /
>           DIV_ROUND_UP(inst->size_written, REG_SIZE);
> -      unsigned exec_type_size = 0;
> -      for (int i = 0; i < inst->sources; i++) {
> -         if (inst->src[i].file != BAD_FILE)
> -            exec_type_size = MAX2(exec_type_size, type_sz(inst->src[i].type));
> -      }
> +      const unsigned exec_type_size = get_exec_type_size(inst);
>        assert(exec_type_size);
>  
>        /* The hardware shifts exactly 8 channels per compressed half of the
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
> index d0e272bb9ee..95b2b8eaa81 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.h
> +++ b/src/mesa/drivers/dri/i965/brw_fs.h
> @@ -501,3 +501,17 @@ fs_reg setup_imm_df(const brw::fs_builder &bld,
>  
>  enum brw_barycentric_mode brw_barycentric_mode(enum glsl_interp_mode mode,
>                                                 nir_intrinsic_op op);
> +
> +static inline unsigned
> +get_exec_type_size(const fs_inst *inst)
> +{
> +   unsigned exec_type_size = 0;
> +
> +   for (int i = 0; i < inst->sources; i++) {
> +      if (inst->src[i].type != BAD_FILE) {
> +         exec_type_size = MAX2(exec_type_size, type_sz(inst->src[i].type));
> +      }
> +   }
> +
> +   return exec_type_size;
> +}
> -- 
> 2.11.0
>
> _______________________________________________
> 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/20170117/d096b9b2/attachment.sig>


More information about the mesa-dev mailing list