Mesa (master): lima: compute nir_sha1 for shader key even if disk cache is disabled
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Mar 25 22:06:39 UTC 2021
Module: Mesa
Branch: master
Commit: bff7fa3fe3748f124763b6dcad09d0ce39722fbb
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bff7fa3fe3748f124763b6dcad09d0ce39722fbb
Author: Vasily Khoruzhick <anarsoul at gmail.com>
Date: Thu Mar 25 11:16:23 2021 -0700
lima: compute nir_sha1 for shader key even if disk cache is disabled
We're using it for in-memory cache as well, so it needs to be computed
unconditionally.
Fixes: bf09ba538595 ("lima: implement shader disk cache")
Reviewed-by: Erico Nunes <nunes.erico at gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9838>
---
src/gallium/drivers/lima/lima_program.c | 46 ++++++++++++++-------------------
1 file changed, 20 insertions(+), 26 deletions(-)
diff --git a/src/gallium/drivers/lima/lima_program.c b/src/gallium/drivers/lima/lima_program.c
index 727a4485b41..19ad375c7ec 100644
--- a/src/gallium/drivers/lima/lima_program.c
+++ b/src/gallium/drivers/lima/lima_program.c
@@ -381,7 +381,6 @@ lima_create_fs_state(struct pipe_context *pctx,
{
struct lima_context *ctx = lima_context(pctx);
struct lima_fs_uncompiled_shader *so = rzalloc(NULL, struct lima_fs_uncompiled_shader);
- struct lima_screen *screen = lima_screen(pctx->screen);
if (!so)
return NULL;
@@ -400,18 +399,16 @@ lima_create_fs_state(struct pipe_context *pctx,
so->base.type = PIPE_SHADER_IR_NIR;
so->base.ir.nir = nir;
- if (screen->disk_cache) {
- /* Serialize the NIR to a binary blob that we can hash for the disk
- * cache. Drop unnecessary information (like variable names)
- * so the serialized NIR is smaller, and also to let us detect more
- * isomorphic shaders when hashing, increasing cache hits.
- */
- struct blob blob;
- blob_init(&blob);
- nir_serialize(&blob, nir, true);
- _mesa_sha1_compute(blob.data, blob.size, so->nir_sha1);
- blob_finish(&blob);
- }
+ /* Serialize the NIR to a binary blob that we can hash for the disk
+ * cache. Drop unnecessary information (like variable names)
+ * so the serialized NIR is smaller, and also to let us detect more
+ * isomorphic shaders when hashing, increasing cache hits.
+ */
+ struct blob blob;
+ blob_init(&blob);
+ nir_serialize(&blob, nir, true);
+ _mesa_sha1_compute(blob.data, blob.size, so->nir_sha1);
+ blob_finish(&blob);
if (lima_debug & LIMA_DEBUG_PRECOMPILE) {
/* Trigger initial compilation with default settings */
@@ -626,7 +623,6 @@ lima_create_vs_state(struct pipe_context *pctx,
const struct pipe_shader_state *cso)
{
struct lima_context *ctx = lima_context(pctx);
- struct lima_screen *screen = lima_screen(pctx->screen);
struct lima_vs_uncompiled_shader *so = rzalloc(NULL, struct lima_vs_uncompiled_shader);
if (!so)
@@ -646,18 +642,16 @@ lima_create_vs_state(struct pipe_context *pctx,
so->base.type = PIPE_SHADER_IR_NIR;
so->base.ir.nir = nir;
- if (screen->disk_cache) {
- /* Serialize the NIR to a binary blob that we can hash for the disk
- * cache. Drop unnecessary information (like variable names)
- * so the serialized NIR is smaller, and also to let us detect more
- * isomorphic shaders when hashing, increasing cache hits.
- */
- struct blob blob;
- blob_init(&blob);
- nir_serialize(&blob, nir, true);
- _mesa_sha1_compute(blob.data, blob.size, so->nir_sha1);
- blob_finish(&blob);
- }
+ /* Serialize the NIR to a binary blob that we can hash for the disk
+ * cache. Drop unnecessary information (like variable names)
+ * so the serialized NIR is smaller, and also to let us detect more
+ * isomorphic shaders when hashing, increasing cache hits.
+ */
+ struct blob blob;
+ blob_init(&blob);
+ nir_serialize(&blob, nir, true);
+ _mesa_sha1_compute(blob.data, blob.size, so->nir_sha1);
+ blob_finish(&blob);
if (lima_debug & LIMA_DEBUG_PRECOMPILE) {
/* Trigger initial compilation with default settings */
More information about the mesa-commit
mailing list