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

Matt Turner mattst88 at gmail.com
Thu Jan 12 23:14:41 UTC 2017


On Thu, Jan 5, 2017 at 5:07 AM, Samuel Iglesias Gonsálvez
<siglesias at igalia.com> wrote:
> 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 duplicate the execution size and regioning parameters.
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp  | 19 ++++++++++++++-----
>  src/mesa/drivers/dri/i965/brw_ir_fs.h |  1 +
>  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 c8a0693..eb3b4aa 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -340,6 +340,19 @@ fs_inst::has_source_and_destination_hazard() const
>     }
>  }
>
> +unsigned
> +fs_inst::exec_data_size() const
> +{
> +  unsigned exec_data_size = 0;
> +
> +  for (int i = 0; i < this->sources; i++) {
> +    if (this->src[i].type != BAD_FILE)
> +      exec_data_size = MAX2(exec_data_size, type_sz(this->src[i].type));

Indentation is wrong (looks like 2 space, but should be 3 space). Also
please use braces in nested control flow.

> +  }
> +
> +  return exec_data_size;
> +}
> +
>  bool
>  fs_inst::is_copy_payload(const brw::simple_allocator &grf_alloc) const
>  {
> @@ -4577,11 +4590,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));
> -      }
> +      unsigned exec_type_size = inst->exec_data_size();
>        assert(exec_type_size);
>
>        /* The hardware shifts exactly 8 channels per compressed half of the
> diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
> index cad3712..9875f2d 100644
> --- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
> +++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
> @@ -349,6 +349,7 @@ public:
>     bool can_change_types() const;
>     bool has_side_effects() const;
>     bool has_source_and_destination_hazard() const;
> +   unsigned exec_data_size() const;

In the reworked patch in your new branch, this still exists even
though the function is no longer a member.


More information about the mesa-dev mailing list