freedreno/ir3: More perfetto tracing
authorRob Clark <robdclark@chromium.org>
Thu, 16 Mar 2023 18:04:13 +0000 (11:04 -0700)
committerMarge Bot <emma+marge@anholt.net>
Mon, 24 Apr 2023 22:42:04 +0000 (22:42 +0000)
Some useful trace points that I had laying around.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22646>

src/freedreno/ir3/ir3_compiler.h
src/freedreno/ir3/ir3_compiler_nir.c
src/freedreno/ir3/ir3_context.c
src/freedreno/ir3/ir3_nir.c
src/freedreno/ir3/ir3_shader.c
src/gallium/drivers/freedreno/ir3/ir3_cache.c
src/gallium/drivers/freedreno/ir3/ir3_gallium.c

index 510d268..4abd574 100644 (file)
@@ -30,6 +30,7 @@
 #include "compiler/nir/nir.h"
 #include "util/disk_cache.h"
 #include "util/log.h"
+#include "util/perf/cpu_trace.h"
 
 #include "freedreno_dev_info.h"
 
index bdb2c92..b2d3ebe 100644 (file)
@@ -4230,6 +4230,8 @@ uses_store_output(struct ir3_shader_variant *so)
 static void
 emit_instructions(struct ir3_context *ctx)
 {
+   MESA_TRACE_FUNC();
+
    nir_function_impl *fxn = nir_shader_get_entrypoint(ctx->s);
 
    /* some varying setup which can't be done in setup_input(): */
@@ -4576,6 +4578,8 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler,
    int ret = 0, max_bary;
    bool progress;
 
+   MESA_TRACE_FUNC();
+
    assert(!so->ir);
 
    ctx = ir3_context_init(compiler, shader, so);
index 46e771c..fcf82a4 100644 (file)
@@ -34,6 +34,8 @@ struct ir3_context *
 ir3_context_init(struct ir3_compiler *compiler, struct ir3_shader *shader,
                  struct ir3_shader_variant *so)
 {
+   MESA_TRACE_FUNC();
+
    struct ir3_context *ctx = rzalloc(NULL, struct ir3_context);
 
    if (compiler->gen == 4) {
index c92dc4d..00d9733 100644 (file)
@@ -87,6 +87,8 @@ ir3_nir_should_vectorize_mem(unsigned align_mul, unsigned align_offset,
 void
 ir3_optimize_loop(struct ir3_compiler *compiler, nir_shader *s)
 {
+   MESA_TRACE_FUNC();
+
    bool progress;
    unsigned lower_flrp = (s->options->lower_flrp16 ? 16 : 0) |
                          (s->options->lower_flrp32 ? 32 : 0) |
@@ -325,6 +327,8 @@ ir3_nir_lower_array_sampler(nir_shader *shader)
 void
 ir3_finalize_nir(struct ir3_compiler *compiler, nir_shader *s)
 {
+   MESA_TRACE_FUNC();
+
    struct nir_lower_tex_options tex_options = {
       .lower_rect = 0,
       .lower_tg4_offsets = true,
@@ -462,6 +466,8 @@ ir3_nir_post_finalize(struct ir3_shader *shader)
    struct nir_shader *s = shader->nir;
    struct ir3_compiler *compiler = shader->compiler;
 
+   MESA_TRACE_FUNC();
+
    NIR_PASS_V(s, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
               ir3_glsl_type_size, nir_lower_io_lower_64bit_to_32);
 
@@ -632,6 +638,8 @@ lower_ucp_vs(struct ir3_shader_variant *so)
 void
 ir3_nir_lower_variant(struct ir3_shader_variant *so, nir_shader *s)
 {
+   MESA_TRACE_FUNC();
+
    if (ir3_shader_debug & IR3_DBG_DISASM) {
       mesa_logi("----------------------");
       nir_log_shaderi(s);
index 2549924..5995146 100644 (file)
@@ -394,6 +394,8 @@ ir3_shader_get_variant(struct ir3_shader *shader,
                        const struct ir3_shader_key *key, bool binning_pass,
                        bool write_disasm, bool *created)
 {
+   MESA_TRACE_FUNC();
+
    mtx_lock(&shader->variants_lock);
    struct ir3_shader_variant *v = shader_variant(shader, key);
 
index 0501248..ff39540 100644 (file)
@@ -97,6 +97,8 @@ ir3_cache_lookup(struct ir3_cache *cache, const struct ir3_cache_key *key,
       return entry->data;
    }
 
+   MESA_TRACE_FUNC();
+
    if (key->hs)
       assert(key->ds);
 
index ff622d6..2ff8827 100644 (file)
@@ -124,6 +124,8 @@ ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key,
    struct ir3_shader_variant *v;
    bool created = false;
 
+   MESA_TRACE_FUNC();
+
    /* Some shader key values may not be used by a given ir3_shader (for
     * example, fragment shader saturates in the vertex shader), so clean out
     * those flags to avoid recompiling.
@@ -248,6 +250,8 @@ create_initial_variants_async(void *job, void *gdata, int thread_index)
    struct ir3_shader_state *hwcso = job;
    struct util_debug_callback debug = {};
 
+   MESA_TRACE_FUNC();
+
    create_initial_variants(hwcso, &debug);
 }
 
@@ -259,6 +263,8 @@ create_initial_compute_variants_async(void *job, void *gdata, int thread_index)
    struct util_debug_callback debug = {};
    static struct ir3_shader_key key; /* static is implicitly zeroed */
 
+   MESA_TRACE_FUNC();
+
    ir3_shader_variant(shader, key, false, &debug);
    shader->initial_variants_done = true;
 }
@@ -450,6 +456,8 @@ ir3_get_shader(struct ir3_shader_state *hwcso)
    if (!hwcso)
       return NULL;
 
+   MESA_TRACE_FUNC();
+
    struct ir3_shader *shader = hwcso->shader;
    perf_time (1000, "waited for %s:%s:%s variants",
               _mesa_shader_stage_to_abbrev(shader->type),
@@ -502,6 +510,8 @@ ir3_screen_finalize_nir(struct pipe_screen *pscreen, void *nir)
 {
    struct fd_screen *screen = fd_screen(pscreen);
 
+   MESA_TRACE_FUNC();
+
    ir3_nir_lower_io_to_temporaries(nir);
    ir3_finalize_nir(screen->compiler, nir);