[Mesa-dev] [PATCH 2/2] i965: Delete linked GLSL IR when using NIR.
Tapani Pälli
tapani.palli at intel.com
Thu Jun 25 04:29:13 PDT 2015
Huh I see this went in already, I've noticed a problem and thought to
share it.
Currently program resource list (used by gl api shader queries) is
generated in linker, before backend LinkShader call. What this means is
that it relies on frontend optimization passes to get rid of dead inputs
and outputs. But .. this does not seem to always happen, sometimes these
get removed only during backend optimization passes. I have a bug on
this as #90925.
There's 2 possibilities to move with this, either move resource list
creation to happen after LinkShader (which would mean we should not free
IR during LinkShader) or try to fix frontend dead code removal to
recognize the case in the bug. I will keep digging why the variable in
question is not recognized by the frontend passes, just wanted to let
you know!
On 06/11/2015 07:40 PM, Jason Ekstrand wrote:
> On Thu, Jun 11, 2015 at 12:41 AM, Tapani Pälli <tapani.palli at intel.com> wrote:
>> This is based on Kenneth's patch to delete 'most of the IR'. Due to
>> linker changes to clone variables, we can now free all of IR.
>>
>> Saves 58MB of memory when replaying a Dota 2 trace on Broadwell.
>
> I think we've saved ~50 MB 3 times now on that one dota trace. Good work guys!
>
>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>> ---
>> src/mesa/drivers/dri/i965/brw_shader.cpp | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
>> index 76285f2..99de1cd 100644
>> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
>> @@ -297,8 +297,11 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
>>
>> brw_add_texrect_params(prog);
>>
>> - if (options->NirOptions)
>> + if (options->NirOptions) {
>> prog->nir = brw_create_nir(brw, shProg, prog, (gl_shader_stage) stage);
>> + ralloc_free(shader->ir);
>> + shader->ir = NULL;
>> + }
>>
>> _mesa_reference_program(ctx, &prog, NULL);
>> }
>> --
>> 2.1.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list