[Mesa-dev] [PATCH v2 1/3] i965: Sweep NIR after linking phase to free held memory

Mark Janes mark.a.janes at intel.com
Tue Jul 24 17:31:03 UTC 2018


This patch segfaults when both of the following environment variables
are set:

NIR_TEST_CLONE=true
NIR_TEST_SERIALIZE=true

Dylan -- please do not apply this to any stable branch until this bug
has been resolved:

https://bugs.freedesktop.org/show_bug.cgi?id=107366

-Mark

Danylo Piliaiev <danylo.piliaiev at gmail.com> writes:

> After optimization passes and many trasfromations most of memory
> NIR holds is a garbage which was being freed only after shader deletion.
> Freeing it at the end of linking will save memory which would be useful
> in case there are a lot of complex shaders being compiled.
> The common case for this issue is 32bit game running under Wine.
>
> The cost of the optimization is around ~3-5% of compilation speed
> with complex shaders.
>
> V2: by Jason Ekstrand
>     - Move nir_sweep up, right after the last change of NIR
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103274
>
> Signed-off-by: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
> ---
>  src/mesa/drivers/dri/i965/brw_link.cpp | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
> index 1071056f14..378426101b 100644
> --- a/src/mesa/drivers/dri/i965/brw_link.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_link.cpp
> @@ -317,6 +317,8 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
>        NIR_PASS_V(prog->nir, nir_lower_atomics_to_ssbo,
>                   prog->nir->info.num_abos);
>  
> +      nir_sweep(prog->nir);
> +
>        infos[stage] = &prog->nir->info;
>  
>        update_xfb_info(prog->sh.LinkedTransformFeedback, infos[stage]);
> -- 
> 2.17.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list