broadcom: add on-disk cache debug option
Add support for`V3D_DEBUG=cache`, which prints on-disk cache events. v2: - Use same debug format for v3d and v3dv (Alejandro) Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15380>
This commit is contained in:
parent
4468db20f7
commit
102ae4bdc8
|
@ -90,6 +90,10 @@ static const struct debug_named_value debug_control[] = {
|
|||
"Disable loop unrolling" },
|
||||
{ "db", V3D_DEBUG_DOUBLE_BUFFER,
|
||||
"Enable double buffer for Tile Buffer when MSAA is disabled" },
|
||||
#ifdef ENABLE_SHADER_CACHE
|
||||
{ "cache", V3D_DEBUG_CACHE,
|
||||
"Print during on-disk cache events" },
|
||||
#endif
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ extern uint32_t V3D_DEBUG;
|
|||
#define V3D_DEBUG_NO_LOOP_UNROLL (1 << 20)
|
||||
#define V3D_DEBUG_CL_NO_BIN (1 << 21)
|
||||
#define V3D_DEBUG_DOUBLE_BUFFER (1 << 22)
|
||||
#define V3D_DEBUG_CACHE (1 << 23)
|
||||
|
||||
#define V3D_DEBUG_SHADERS (V3D_DEBUG_TGSI | V3D_DEBUG_NIR | \
|
||||
V3D_DEBUG_VIR | V3D_DEBUG_QPU | \
|
||||
|
|
|
@ -178,7 +178,7 @@ v3dv_pipeline_cache_search_for_nir(struct v3dv_pipeline *pipeline,
|
|||
} else {
|
||||
cache->nir_stats.hit++;
|
||||
if (debug_cache) {
|
||||
fprintf(stderr, "\tnir cache hit: %p\n", nir);
|
||||
fprintf(stderr, "[v3dv nir cache] hit: %p\n", nir);
|
||||
if (dump_stats)
|
||||
cache_dump_stats(cache);
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ v3dv_pipeline_cache_search_for_nir(struct v3dv_pipeline *pipeline,
|
|||
|
||||
cache->nir_stats.miss++;
|
||||
if (debug_cache) {
|
||||
fprintf(stderr, "\tnir cache miss\n");
|
||||
fprintf(stderr, "[v3dv nir cache] miss\n");
|
||||
if (dump_stats)
|
||||
cache_dump_stats(cache);
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
|
|||
cache->stats.hit++;
|
||||
*cache_hit = true;
|
||||
if (debug_cache) {
|
||||
fprintf(stderr, "\tcache hit: %p\n", cache_entry);
|
||||
fprintf(stderr, "[v3dv cache] hit: %p\n", cache_entry);
|
||||
if (dump_stats)
|
||||
cache_dump_stats(cache);
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
|
|||
|
||||
cache->stats.miss++;
|
||||
if (debug_cache) {
|
||||
fprintf(stderr, "\tcache miss\n");
|
||||
fprintf(stderr, "[v3dv cache] miss\n");
|
||||
if (dump_stats)
|
||||
cache_dump_stats(cache);
|
||||
}
|
||||
|
@ -309,13 +309,18 @@ v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
|
|||
|
||||
size_t buffer_size;
|
||||
uint8_t *buffer = disk_cache_get(disk_cache, cache_key, &buffer_size);
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_CACHE)) {
|
||||
char sha1buf[41];
|
||||
_mesa_sha1_format(sha1buf, cache_key);
|
||||
fprintf(stderr, "[v3dv on-disk cache] %s %s\n",
|
||||
buffer ? "hit" : "miss",
|
||||
sha1buf);
|
||||
}
|
||||
|
||||
if (buffer) {
|
||||
struct blob_reader blob;
|
||||
struct v3dv_pipeline_shared_data *shared_data;
|
||||
|
||||
if (debug_cache)
|
||||
fprintf(stderr, "\ton-disk-cache hit\n");
|
||||
|
||||
blob_reader_init(&blob, buffer, buffer_size);
|
||||
shared_data = v3dv_pipeline_shared_data_create_from_blob(cache, &blob);
|
||||
free(buffer);
|
||||
|
@ -325,9 +330,6 @@ v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
|
|||
pipeline_cache_upload_shared_data(cache, shared_data, true);
|
||||
return shared_data;
|
||||
}
|
||||
} else {
|
||||
if (debug_cache)
|
||||
fprintf(stderr, "\ton-disk-cache miss\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -464,14 +466,12 @@ pipeline_cache_upload_shared_data(struct v3dv_pipeline_cache *cache,
|
|||
cache_key cache_key;
|
||||
disk_cache_compute_key(disk_cache, shared_data->sha1_key, 20, cache_key);
|
||||
|
||||
disk_cache_put(disk_cache, cache_key, binary.data, binary.size, NULL);
|
||||
if (debug_cache) {
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_CACHE)) {
|
||||
char sha1buf[41];
|
||||
_mesa_sha1_format(sha1buf, shared_data->sha1_key);
|
||||
|
||||
fprintf(stderr, "on-disk-cache, new cache entry with sha1 key %s:%p\n\n",
|
||||
sha1buf, shared_data);
|
||||
fprintf(stderr, "[v3dv on-disk cache] storing %s\n", sha1buf);
|
||||
}
|
||||
disk_cache_put(disk_cache, cache_key, binary.data, binary.size, NULL);
|
||||
}
|
||||
|
||||
blob_finish(&binary);
|
||||
|
|
|
@ -122,6 +122,14 @@ v3d_disk_cache_retrieve(struct v3d_context *v3d,
|
|||
size_t buffer_size;
|
||||
void *buffer = disk_cache_get(cache, cache_key, &buffer_size);
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_CACHE)) {
|
||||
char sha1[41];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[v3d on-disk cache] %s %s\n",
|
||||
buffer ? "hit" : "miss",
|
||||
sha1);
|
||||
}
|
||||
|
||||
if (!buffer)
|
||||
return NULL;
|
||||
|
||||
|
@ -195,6 +203,12 @@ v3d_disk_cache_store(struct v3d_context *v3d,
|
|||
cache_key cache_key;
|
||||
v3d_disk_cache_compute_key(cache, key, cache_key);
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_CACHE)) {
|
||||
char sha1[41];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[v3d on-disk cache] storing %s\n", sha1);
|
||||
}
|
||||
|
||||
struct blob blob;
|
||||
blob_init(&blob);
|
||||
|
||||
|
|
Loading…
Reference in New Issue