intel/ir: Pass block cycle count information explicitly to disassembler.
authorFrancisco Jerez <currojerez@riseup.net>
Fri, 3 Apr 2020 00:42:57 +0000 (17:42 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Wed, 29 Apr 2020 06:01:27 +0000 (23:01 -0700)
So we can eventually remove the cycle count estimates from the CFG
data structure and consolidate performance information in the
brw::performance object.

It would be cleaner to pass the brw::performance object directly to
the disassembler but that isn't straightforward since the disassembler
is built as a plain C file unlike the rest of the compiler back-end.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/compiler/brw_disasm_info.c
src/intel/compiler/brw_disasm_info.h
src/intel/compiler/brw_fs_generator.cpp
src/intel/compiler/brw_vec4_generator.cpp
src/intel/compiler/test_eu_validate.cpp

index bec83e8a65d3bde5b85952bdab63894ccf188a5a..14cea9a77bd27890536b00d70e5cda8e1f3fa272 100644 (file)
@@ -31,7 +31,8 @@ __attribute__((weak)) void nir_print_instr(UNUSED const nir_instr *instr,
                                            UNUSED FILE *fp) {}
 
 void
-dump_assembly(void *assembly, struct disasm_info *disasm)
+dump_assembly(void *assembly, struct disasm_info *disasm,
+              const unsigned *block_latency)
 {
    const struct gen_device_info *devinfo = disasm->devinfo;
    const char *last_annotation_string = NULL;
@@ -55,7 +56,10 @@ dump_assembly(void *assembly, struct disasm_info *disasm)
             struct bblock_t *predecessor_block = predecessor_link->block;
             fprintf(stderr, " <-B%d", predecessor_block->num);
          }
-         fprintf(stderr, " (%u cycles)\n", group->block_start->cycle_count);
+         if (block_latency)
+            fprintf(stderr, " (%u cycles)",
+                    block_latency[group->block_start->num]);
+         fprintf(stderr, "\n");
       }
 
       if (last_annotation_ir != group->ir) {
index b8826e681750b93565cce3da2f4b16c17fd37207..932c06b6c3014b287dfad8781635925273ca25e6 100644 (file)
@@ -65,7 +65,8 @@ struct disasm_info {
 };
 
 void
-dump_assembly(void *assembly, struct disasm_info *disasm);
+dump_assembly(void *assembly, struct disasm_info *disasm,
+              const unsigned *block_latency);
 
 struct disasm_info *
 disasm_initialize(const struct gen_device_info *devinfo,
index dc524a61e1d5b07df2f2dafc294049c0f56edcbe..fa2abd48553d5f0065d5e135294e140b37b0ecc1 100644 (file)
@@ -2472,7 +2472,7 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width,
 
       /* overriding the shader makes disasm_info invalid */
       if (!brw_try_override_assembly(p, start_offset, sha1buf)) {
-         dump_assembly(p->store, disasm_info);
+         dump_assembly(p->store, disasm_info, perf.block_latency);
       } else {
          fprintf(stderr, "Successfully overrode shader with sha1 %s\n\n", sha1buf);
       }
index e95a70d86053f3be1efea1062e29941ea2c7afbe..7c038c97196b744156c0a31ded44a811a79e0e4e 100644 (file)
@@ -2227,7 +2227,7 @@ generate_code(struct brw_codegen *p,
 
       /* overriding the shader makes disasm_info invalid */
       if (!brw_try_override_assembly(p, 0, sha1buf)) {
-         dump_assembly(p->store, disasm_info);
+         dump_assembly(p->store, disasm_info, perf.block_latency);
       } else {
          fprintf(stderr, "Successfully overrode shader with sha1 %s\n\n", sha1buf);
       }
index 16d1fc4faae17d242a26d07e9869fca36d4e2f53..03da003c0d6203a1eb7ae9e9adf4a60cc26e26bc 100644 (file)
@@ -110,7 +110,7 @@ validate(struct brw_codegen *p)
                                         p->next_insn_offset, disasm);
 
    if (print) {
-      dump_assembly(p->store, disasm);
+      dump_assembly(p->store, disasm, NULL);
    }
    ralloc_free(disasm);