[Mesa-dev] [PATCH 01/14] i965/fs: Define a new fs_builder constructor taking an instruction as argument.

Jason Ekstrand jason at jlekstrand.net
Tue Jul 28 14:14:43 PDT 2015


All patches in this series except for 8 and 14 are

Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>

8 looks fishy and I think the code we have there today is probably not
what we want as well.  Shouldn't take too much time to fix.

Once 8 gets sorted, I'm fine with 14 but we obviously can't push it
until we have 8.

--Jason

On Tue, Jul 28, 2015 at 1:23 AM, Francisco Jerez <currojerez at riseup.net> wrote:
> We have a number of optimization passes that repeat the same pattern
> before inserting new instructions into the program based on some
> previous instruction: They point the default builder at the original
> instruction, then call exec_all() and group() to select the same
> execution controls the original instruction had, and then maybe call
> annotate() to clone the debug annotation from the original
> instruction.
>
> In fact an optimization pass missing any of these steps is likely to
> be broken if the intention was to emit new code based on a preexisting
> instruction, so let's make it easy for passes to do the right thing by
> having an fs_builder constructor that automates the task of setting up
> a builder to emit a given instruction provided as argument.
>
> The following patches fix all cases I've found in which we weren't
> explicitly initializing the execution controls of the emitted
> instructions, and clean-up optimization passes which were already
> doing the right thing to use the new constructor.
> ---
>  src/mesa/drivers/dri/i965/brw_fs_builder.h | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_builder.h b/src/mesa/drivers/dri/i965/brw_fs_builder.h
> index e7d5f8a..12653d0 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_builder.h
> +++ b/src/mesa/drivers/dri/i965/brw_fs_builder.h
> @@ -64,6 +64,22 @@ namespace brw {
>        }
>
>        /**
> +       * Construct an fs_builder that inserts instructions into \p shader
> +       * before instruction \p inst in basic block \p block.  The default
> +       * execution controls and debug annotation are initialized from the
> +       * instruction passed as argument.
> +       */
> +      fs_builder(backend_shader *shader, bblock_t *block, fs_inst *inst) :
> +         shader(shader), block(block), cursor(inst),
> +         _dispatch_width(inst->exec_size),
> +         _group(inst->force_sechalf ? 8 : 0),
> +         force_writemask_all(inst->force_writemask_all)
> +      {
> +         annotation.str = inst->annotation;
> +         annotation.ir = inst->ir;
> +      }
> +
> +      /**
>         * Construct an fs_builder that inserts instructions before \p cursor in
>         * basic block \p block, inheriting other code generation parameters
>         * from this.
> --
> 2.4.6
>


More information about the mesa-dev mailing list