[Mesa-dev] [PATCH v4 03/28] i965/fs: add helper to retrieve instruction data size

Samuel Iglesias Gonsálvez siglesias at igalia.com
Mon Mar 20 09:17:00 UTC 2017


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/intel/compiler/brw_fs.cpp |  6 +-----
 src/intel/compiler/brw_fs.h   | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index c410efc29d6..b009ce41bc1 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -4585,11 +4585,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/intel/compiler/brw_fs.h b/src/intel/compiler/brw_fs.h
index 00861ce5dad..f3d36848e54 100644
--- a/src/intel/compiler/brw_fs.h
+++ b/src/intel/compiler/brw_fs.h
@@ -498,3 +498,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



More information about the mesa-dev mailing list