i965/fs: Print spills:fills and number of promoted constants.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
This commit is contained in:
Matt Turner 2015-03-16 12:18:31 -07:00
parent b616164c95
commit b0d422cd2a
7 changed files with 25 additions and 13 deletions

View 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");

View 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;

View 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;

View 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++) {

View 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;
}

View 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();

View 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",