[Mesa-dev] [PATCH 28/41] i965/fs: Make fs_reg::effective_width take fs_inst* instead of fs_visitor*

Jason Ekstrand jason at jlekstrand.net
Sat Sep 20 10:23:17 PDT 2014


Now that we have execution sizes, we can use that instead of the dispatch
width.  This way it also works for 8-wide instructions in SIMD16.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp                  | 10 +++++-----
 src/mesa/drivers/dri/i965/brw_fs.h                    |  4 ++--
 src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index bd11691..1261cf6 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -354,7 +354,7 @@ fs_visitor::LOAD_PAYLOAD(const fs_reg &dst, fs_reg *src, int sources)
        * dealing with whole registers.  If this ever changes, we can deal
        * with it later.
        */
-      int size = src[i].effective_width(this) * type_sz(src[i].type);
+      int size = src[i].effective_width(inst) * type_sz(src[i].type);
       assert(size % 32 == 0);
       inst->regs_written += (size + 31) / 32;
    }
@@ -583,7 +583,7 @@ fs_reg::equals(const fs_reg &r) const
 }
 
 uint8_t
-fs_reg::effective_width(const fs_visitor *v) const
+fs_reg::effective_width(const fs_inst *inst) const
 {
    switch (this->file) {
    case BAD_FILE:
@@ -591,10 +591,10 @@ fs_reg::effective_width(const fs_visitor *v) const
    case UNIFORM:
    case IMM:
       assert(this->width == 1);
-      return v->dispatch_width;
+      return inst->exec_size;
    case GRF:
    case HW_REG:
-      assert(this->width > 1 && this->width <= v->dispatch_width);
+      assert(this->width > 1 && this->width <= inst->exec_size);
       assert(this->width % 8 == 0);
       return this->width;
    case MRF:
@@ -2960,7 +2960,7 @@ fs_visitor::lower_load_payload()
          fs_reg dst = inst->dst;
 
          for (int i = 0; i < inst->sources; i++) {
-            dst.width = inst->src[i].effective_width(this);
+            dst.width = inst->src[i].effective_width(inst);
             dst.type = inst->src[i].type;
 
             if (inst->src[i].file == BAD_FILE) {
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 7574133..491fc4d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -62,7 +62,7 @@ namespace brw {
    class fs_live_variables;
 }
 
-class fs_visitor;
+class fs_inst;
 
 class fs_reg : public backend_reg {
 public:
@@ -110,7 +110,7 @@ public:
     * effectively take on the width of the instruction in which they are
     * used.
     */
-   uint8_t effective_width(const fs_visitor *v) const;
+   uint8_t effective_width(const fs_inst *inst) const;
 
    /** Register region horizontal stride */
    uint8_t stride;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index 42b023a..1f8c50f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -589,13 +589,13 @@ fs_visitor::opt_copy_propagate_local(void *copy_prop_ctx, bblock_t *block,
                  inst->dst.file == GRF) {
          int offset = 0;
          for (int i = 0; i < inst->sources; i++) {
-            int regs_written = ((inst->src[i].effective_width(this) *
+            int regs_written = ((inst->src[i].effective_width(inst) *
                                  type_sz(inst->src[i].type)) + 31) / 32;
             if (inst->src[i].file == GRF) {
                acp_entry *entry = ralloc(copy_prop_ctx, acp_entry);
                entry->dst = inst->dst;
                entry->dst.reg_offset = offset;
-               entry->dst.width = inst->src[i].effective_width(this);
+               entry->dst.width = inst->src[i].effective_width(inst);
                entry->src = inst->src[i];
                entry->regs_written = regs_written;
                entry->opcode = inst->opcode;
-- 
2.1.0



More information about the mesa-dev mailing list