[Mesa-dev] [PATCH 1/2] i965: Create a has_side_effects for fs_inst

Kenneth Graunke kenneth at whitecape.org
Wed Apr 1 12:44:37 PDT 2015


On Wednesday, April 01, 2015 10:39:16 AM Ben Widawsky wrote:
> When an instruction has a side effect, it impacts the available options when
> reordering an instruction. As the EOT flag is an implied write to the render
> target in the FS, it can be considered a side effect.
> 
> This patch shouldn't actually have any impact on the current code since the EOT
> flag implies that the opcode is already one with side effects,
> FS_OPCODE_FB_WRITE. The next patch however will introduce an optimization
> whereby the EOT flag can occur with an opcode SHADER_OPCODE_TEX, and as that
> instruction will perform the same implied write to the render target, it cannot
> be reordered.
> 
> Cc: Matt Turner <mattst88 at gmail.com>
> Cc: Kenneth Graunke <kenneth at whitecape.org>
> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp  | 7 +++++++
>  src/mesa/drivers/dri/i965/brw_ir_fs.h | 1 +
>  2 files changed, 8 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 9c2ccce..e540dd1 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -531,6 +531,13 @@ fs_inst::can_do_source_mods(struct brw_context *brw)
>     return true;
>  }
>  
> +
> +bool
> +fs_inst::has_side_effects() const
> +{
> +   return this->eot || backend_instruction::has_side_effects();
> +}
> +
>  void
>  fs_reg::init()
>  {
> diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
> index 9ef1261..30c19f4 100644
> --- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
> +++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
> @@ -225,6 +225,7 @@ public:
>     bool is_partial_write() const;
>     int regs_read(int arg) const;
>     bool can_do_source_mods(struct brw_context *brw);
> +   bool has_side_effects() const;
>  
>     bool reads_flag() const;
>     bool writes_flag() const;
> 

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150401/b1feff6a/attachment.sig>


More information about the mesa-dev mailing list