diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-08-14 09:11:55 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-08-14 10:31:09 -0700 |
commit | 5f0f9e1333385bd59a92b3a4dc72c4f9593eca68 (patch) | |
tree | ce7ce0a37f67407c3f52842087cacb02e1651ac3 /src/panfrost/midgard/disassemble.c | |
parent | 863bdd1f8dcb4b36b85f1ab80a3d44eea93a1663 (diff) |
pan/midgard: Implement blobber-db
We wire through some shader-db-style stats on the current shader in the
disassemble so we can get a quick estimate of shader complexity from a
trace.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Suggested-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/panfrost/midgard/disassemble.c')
-rw-r--r-- | src/panfrost/midgard/disassemble.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/panfrost/midgard/disassemble.c b/src/panfrost/midgard/disassemble.c index 8f2020c4c4c..382b4af7cbf 100644 --- a/src/panfrost/midgard/disassemble.c +++ b/src/panfrost/midgard/disassemble.c @@ -42,6 +42,10 @@ static bool is_instruction_int = false; +/* Stats */ + +static unsigned nr_ins = 0; + /* Prints a short form of the tag for branching, the minimum needed to be * legible and unambiguous */ @@ -541,6 +545,7 @@ print_vector_field(const char *name, uint16_t *words, uint16_t reg_word, reg_info->src2_reg, override, is_int); } + nr_ins++; printf("\n"); } @@ -621,6 +626,7 @@ print_scalar_field(const char *name, uint16_t *words, uint16_t reg_word, } else print_scalar_src(alu_field->src2, reg_info->src2_reg); + nr_ins++; printf("\n"); } @@ -728,6 +734,8 @@ print_compact_branch_writeout_field(uint16_t word) break; } } + + nr_ins++; } static void @@ -764,6 +772,8 @@ print_extended_branch_writeout_field(uint8_t *words) printf("%d -> ", br.offset); print_tag_short(br.dest_tag); printf("\n"); + + nr_ins++; } static unsigned @@ -1034,6 +1044,8 @@ print_load_store_instr(uint64_t data, printf(", "); print_load_store_arg(word->arg_2, 1); printf(" /* %X */\n", word->varying_parameters); + + nr_ins++; } static void @@ -1291,10 +1303,12 @@ print_texture_word(uint32_t *word, unsigned tabs) printf("// unknownA = 0x%x\n", texture->unknownA); printf("// unknown8 = 0x%x\n", texture->unknown8); } + + nr_ins++; } void -disassemble_midgard(uint8_t *code, size_t size) +disassemble_midgard(uint8_t *code, size_t size, bool stats, unsigned nr_registers) { uint32_t *words = (uint32_t *) code; unsigned num_words = size / 4; @@ -1306,6 +1320,11 @@ disassemble_midgard(uint8_t *code, size_t size) unsigned i = 0; + /* Stats for shader-db */ + unsigned nr_bundles = 0; + unsigned nr_quadwords = 0; + nr_ins = 0; + while (i < num_words) { unsigned tag = words[i] & 0xF; unsigned next_tag = (words[i] >> 4) & 0xF; @@ -1361,6 +1380,10 @@ disassemble_midgard(uint8_t *code, size_t size) i += 4 * num_quad_words; + /* We are parsing per bundle anyway */ + nr_bundles++; + nr_quadwords += num_quad_words; + /* Break based on instruction prefetch flag */ if (i < num_words && next == 1) { @@ -1371,5 +1394,18 @@ disassemble_midgard(uint8_t *code, size_t size) } } - return; + if (stats) { + unsigned nr_threads = + (nr_registers <= 4) ? 4 : + (nr_registers <= 8) ? 2 : + 1; + + printf("%s shader: " + "%u inst, %u bundles, %u quadwords, " + "%u registers, %u threads, 0 loops\n", + "FRAGMENT", /* TODO */ + nr_ins, nr_bundles, nr_quadwords, + nr_registers, nr_threads); + + } } |