diff options
author | Eric Anholt <[email protected]> | 2019-03-13 14:19:02 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2019-04-12 15:59:24 -0700 |
commit | b02dbaa8cecd585c47c2c53362e3c9d9d0db0e34 (patch) | |
tree | b029edde5d6ee7c5358f3811468d5ac382f2f8ea | |
parent | 276ec879fdd6295105163bee83764d3e83855008 (diff) |
v3d: Include the number of max temps used in the shader-db output.
This gives us finer-grained feedback on how we're doing on register
pressure than "did we trigger a new shader to spill or drop thread count?"
-rw-r--r-- | src/broadcom/compiler/vir.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c index 551542f33bb..8632936b67b 100644 --- a/src/broadcom/compiler/vir.c +++ b/src/broadcom/compiler/vir.c @@ -814,6 +814,33 @@ v3d_nir_lower_fs_late(struct v3d_compile *c) NIR_PASS_V(c->s, nir_lower_io_to_scalar, nir_var_shader_in); } +static uint32_t +vir_get_max_temps(struct v3d_compile *c) +{ + int max_ip = 0; + vir_for_each_inst_inorder(inst, c) + max_ip++; + + uint32_t *pressure = rzalloc_array(NULL, uint32_t, max_ip); + + for (int t = 0; t < c->num_temps; t++) { + for (int i = c->temp_start[t]; (i < c->temp_end[t] && + i < max_ip); i++) { + if (i > max_ip) + break; + pressure[i]++; + } + } + + uint32_t max_temps = 0; + for (int i = 0; i < max_ip; i++) + max_temps = MAX2(max_temps, pressure[i]); + + ralloc_free(pressure); + + return max_temps; +} + uint64_t *v3d_compile(const struct v3d_compiler *compiler, struct v3d_key *key, struct v3d_prog_data **out_prog_data, @@ -876,12 +903,13 @@ uint64_t *v3d_compile(const struct v3d_compiler *compiler, char *shaderdb; int ret = asprintf(&shaderdb, "%s shader: %d inst, %d threads, %d loops, " - "%d uniforms, %d:%d spills:fills", + "%d uniforms, %d max-temps, %d:%d spills:fills", vir_get_stage_name(c), c->qpu_inst_count, c->threads, c->loops, c->num_uniforms, + vir_get_max_temps(c), c->spills, c->fills); if (ret >= 0) { |