[Mesa-dev] [PATCH 2/2] i965: Create new program cache bo when clearing the program cache

Kenneth Graunke kenneth at whitecape.org
Sat Feb 3 06:44:24 UTC 2018

On Friday, February 2, 2018 5:07:01 PM PST Jordan Justen wrote:
> When the disk shader cache CI testing was enabled, we started noticing
> occasional failures on deqp test runs. (Mainly SNB, rarely HSW)
> Before this change, when we cleared the (in memory) program cache we
> reused the same bo. Since the disk shader cache quickly restores
> programs, it appears that this would lead to overwrites of the older
> program binaries in the in memory program cache that apparently were
> still executing in some cases. If these programs were still executing,
> this could cause a GPU hang.
> This issue probably is not disk shader cache specific, but rather may
> have been hidden since the compiler would take some time to recompile
> programs after the cache was cleared.
> Cc: Kenneth Graunke <kenneth at whitecape.org>
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_program_cache.c | 2 ++
>  1 file changed, 2 insertions(+)
> diff --git a/src/mesa/drivers/dri/i965/brw_program_cache.c b/src/mesa/drivers/dri/i965/brw_program_cache.c
> index f084f94f929..a6638c3d302 100644
> --- a/src/mesa/drivers/dri/i965/brw_program_cache.c
> +++ b/src/mesa/drivers/dri/i965/brw_program_cache.c
> @@ -448,6 +448,8 @@ brw_clear_cache(struct brw_context *brw, struct brw_cache *cache)
>     brw->cs.base.prog_data = NULL;
>     intel_batchbuffer_flush(brw);
> +   if (cache->bo)
> +      brw_cache_new_bo(cache, cache->bo->size, false);
>  }
>  void

I'd kind of expected this to be called from brw_program_cache_check_size
instead...was worried we'd be making a new BO on brw_destroy_cache...but
in that case, we've destroyed cache->bo and made it NULL, so this NULL
check will guarantee that we do the right thing.

Either way's fine with me.

With the extra boolean parameter dropped, this is
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180202/c9120be1/attachment.sig>

More information about the mesa-dev mailing list