i965/fs: Print spills:fills and number of promoted constants.
authorMatt Turner <mattst88@gmail.com>
Mon, 16 Mar 2015 19:18:31 +0000 (12:18 -0700)
committerMatt Turner <mattst88@gmail.com>
Thu, 19 Mar 2015 18:15:57 +0000 (11:15 -0700)
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
src/mesa/drivers/dri/i965/brw_fs_generator.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_vec4.cpp

index f9b17376451d650f1584ed87decb203d474c8607..32919b13a62d22889e2e3b76b8c65335c0a6663a 100644 (file)
@@ -31,7 +31,7 @@ brw_blorp_eu_emitter::brw_blorp_eu_emitter(struct brw_context *brw,
    : mem_ctx(ralloc_context(NULL)),
      generator(brw, mem_ctx, (void *) rzalloc(mem_ctx, struct brw_wm_prog_key),
                (struct brw_stage_prog_data *) rzalloc(mem_ctx, struct brw_wm_prog_data),
-               NULL, false, "BLORP")
+               NULL, 0, false, "BLORP")
 {
    if (debug_flag)
       generator.enable_debug("blorp");
index 3d4d31ac19e26e3b17643fdd72dcb7a530f9cb44..10084675c836bbb9caf99ada82abe9563426a560 100644 (file)
@@ -4068,7 +4068,7 @@ brw_wm_fs_emit(struct brw_context *brw,
    }
 
    fs_generator g(brw, mem_ctx, (void *) key, &prog_data->base,
-                  &fp->Base, v.runtime_check_aads_emit, "FS");
+                  &fp->Base, v.promoted_constants, v.runtime_check_aads_emit, "FS");
 
    if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
       char *name;
index 23e7135399252e1a762527cc7e4f0c9a95c29d81..2f362dbd8e8110c4c5822e1e0c6e0d6476480f92 100644 (file)
@@ -514,6 +514,8 @@ public:
    bool spilled_any_registers;
 
    const unsigned dispatch_width; /**< 8 or 16 */
+
+   unsigned promoted_constants;
 };
 
 /**
@@ -529,6 +531,7 @@ public:
                 const void *key,
                 struct brw_stage_prog_data *prog_data,
                 struct gl_program *fp,
+                unsigned promoted_constants,
                 bool runtime_check_aads_emit,
                 const char *stage_abbrev);
    ~fs_generator();
@@ -640,6 +643,7 @@ private:
    unsigned dispatch_width; /**< 8 or 16 */
 
    exec_list discard_halt_patches;
+   unsigned promoted_constants;
    bool runtime_check_aads_emit;
    bool debug_flag;
    const char *shader_name;
index 7ddb2537a33171351874be9f569e2a85374a64c9..ebde8df2ff1696782c84a057ccd7d938b662d373 100644 (file)
@@ -286,6 +286,7 @@ fs_visitor::opt_combine_constants()
          reg.subreg_offset = 0;
       }
    }
+   promoted_constants = table.len;
 
    /* Rewrite the immediate sources to refer to the new GRFs. */
    for (int i = 0; i < table.len; i++) {
index e0862665f8b5ea1aca1f94241cfbaaa7e0f395b5..05a2db4e5ac07e993936ebeed74cd7cd92356807 100644 (file)
@@ -126,13 +126,15 @@ fs_generator::fs_generator(struct brw_context *brw,
                            const void *key,
                            struct brw_stage_prog_data *prog_data,
                            struct gl_program *prog,
+                           unsigned promoted_constants,
                            bool runtime_check_aads_emit,
                            const char *stage_abbrev)
 
    : brw(brw), key(key),
      prog_data(prog_data),
-     prog(prog), runtime_check_aads_emit(runtime_check_aads_emit),
-     debug_flag(false), stage_abbrev(stage_abbrev), mem_ctx(mem_ctx)
+     prog(prog), promoted_constants(promoted_constants),
+     runtime_check_aads_emit(runtime_check_aads_emit), debug_flag(false),
+     stage_abbrev(stage_abbrev), mem_ctx(mem_ctx)
 {
    ctx = &brw->ctx;
 
@@ -1563,6 +1565,7 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
       brw_set_default_compression_control(p, BRW_COMPRESSION_COMPRESSED);
 
    int start_offset = p->next_insn_offset;
+   int spill_count = 0, fill_count = 0;
    int loop_count = 0;
 
    struct annotation_info annotation;
@@ -1959,14 +1962,17 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
 
       case SHADER_OPCODE_GEN4_SCRATCH_WRITE:
         generate_scratch_write(inst, src[0]);
+         spill_count++;
         break;
 
       case SHADER_OPCODE_GEN4_SCRATCH_READ:
         generate_scratch_read(inst, dst);
+         fill_count++;
         break;
 
       case SHADER_OPCODE_GEN7_SCRATCH_READ:
         generate_scratch_read_gen7(inst, dst);
+         fill_count++;
         break;
 
       case SHADER_OPCODE_URB_WRITE_SIMD8:
@@ -2111,10 +2117,10 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
 
    if (unlikely(debug_flag)) {
       fprintf(stderr, "Native code for %s\n"
-              "SIMD%d shader: %d instructions. %d loops. Compacted %d to %d"
+              "SIMD%d shader: %d instructions. %d loops. %d:%d spills:fills. Promoted %u constants. Compacted %d to %d"
               " bytes (%.0f%%)\n",
-              shader_name,
-              dispatch_width, before_size / 16, loop_count, before_size, after_size,
+              shader_name, dispatch_width, before_size / 16, loop_count,
+              spill_count, fill_count, promoted_constants, before_size, after_size,
               100.0f * (before_size - after_size) / before_size);
 
       dump_assembly(p->store, annotation.ann_count, annotation.ann, brw, prog);
@@ -2126,10 +2132,10 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
                   MESA_DEBUG_SOURCE_SHADER_COMPILER,
                   MESA_DEBUG_TYPE_OTHER,
                   MESA_DEBUG_SEVERITY_NOTIFICATION,
-                  "%s SIMD%d shader: %d inst, %d loops, "
-                  "compacted %d to %d bytes.\n",
+                  "%s SIMD%d shader: %d inst, %d loops, %d:%d spills:fills, "
+                  "Promoted %u constants, compacted %d to %d bytes.\n",
                   stage_abbrev, dispatch_width, before_size / 16, loop_count,
-                  before_size, after_size);
+                  spill_count, fill_count, promoted_constants, before_size, after_size);
 
    return start_offset;
 }
index 0d5252ab08e509a4a3e7925d3dbc37ea03392a15..60a7a97f0e07c8e9e49f52917fa3a5c159c02529 100644 (file)
@@ -4082,7 +4082,7 @@ fs_visitor::fs_visitor(struct brw_context *brw,
      reg_null_d(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_D)),
      reg_null_ud(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_UD)),
      key(key), prog_data(&prog_data->base),
-     dispatch_width(dispatch_width)
+     dispatch_width(dispatch_width), promoted_constants(0)
 {
    this->mem_ctx = mem_ctx;
    init();
@@ -4101,7 +4101,7 @@ fs_visitor::fs_visitor(struct brw_context *brw,
      reg_null_d(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_D)),
      reg_null_ud(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_UD)),
      key(key), prog_data(&prog_data->base.base),
-     dispatch_width(dispatch_width)
+     dispatch_width(dispatch_width), promoted_constants(0)
 {
    this->mem_ctx = mem_ctx;
    init();
index 8edb4d0b160c34fcde92e3c1d62dc139378b592c..b13dd58771b483f3efd2b02a680dad5573a083a2 100644 (file)
@@ -1969,7 +1969,8 @@ brw_vs_emit(struct brw_context *brw,
       }
 
       fs_generator g(brw, mem_ctx, (void *) &c->key, &prog_data->base.base,
-                     &c->vp->program.Base, v.runtime_check_aads_emit, "VS");
+                     &c->vp->program.Base, v.promoted_constants,
+                     v.runtime_check_aads_emit, "VS");
       if (INTEL_DEBUG & DEBUG_VS) {
          char *name = ralloc_asprintf(mem_ctx, "%s vertex shader %d",
                                       prog->Label ? prog->Label : "unnamed",