pan/midgard: Count shader-db stats by bundled instructions
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 30 Aug 2019 20:08:16 +0000 (13:08 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 30 Aug 2019 22:50:22 +0000 (15:50 -0700)
This does not affect shaders in any way. Rather, it makes the shader-db
instruction count recorded in the compiler accurate with the in-order
scheduler, matching up with what we calculate from pandecode.

Though shaders are the same, instruction counts cannot be compared
across this commit for this reason.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/midgard_compile.c

index 74796b661df6fa4edf292ad8809909722081b379..69966854b111aa5c26089db7bec6b63264b4ea8f 100644 (file)
@@ -2800,15 +2800,14 @@ midgard_compile_shader_nir(struct midgard_screen *screen, nir_shader *nir, midga
 
                 /* Count instructions and bundles */
 
-                mir_foreach_instr_global(ctx, ins) {
-                        nr_ins++;
-                }
-
                 mir_foreach_block(ctx, block) {
                         nr_bundles += util_dynarray_num_elements(
                                               &block->bundles, midgard_bundle);
 
                         nr_quadwords += block->quadword_count;
+
+                        mir_foreach_bundle_in_block(block, bun)
+                                nr_ins += bun->instruction_count;
                 }
 
                 /* Calculate thread count. There are certain cutoffs by