radeonsi: don't keep compute shader IR after compilation
authorMarek Olšák <marek.olsak@amd.com>
Sat, 2 Nov 2019 01:37:47 +0000 (21:37 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 6 Nov 2019 04:28:43 +0000 (23:28 -0500)
not needed. We also need to free TGSI in the destroy function for the case
when an app is terminated and si_create_compute_state_async is never
executed because of util_queue_drop_job.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/gallium/drivers/radeonsi/si_compute.c

index 56af2aedbb79f68c86218f47cb6cf33652b04002..4cadf3e808d21986fd6ee799389a1214217f8edd 100644 (file)
@@ -208,8 +208,10 @@ static void si_create_compute_state_async(void *job, int thread_index)
                simple_mtx_unlock(&sscreen->shader_cache_mutex);
        }
 
-       if (program->ir_type == PIPE_SHADER_IR_TGSI)
-               FREE(sel->tokens);
+       FREE(sel->tokens);
+       sel->tokens = NULL;
+       ralloc_free(sel->nir);
+       sel->nir = NULL;
 }
 
 static void *si_create_compute_state(
@@ -974,6 +976,7 @@ void si_destroy_compute(struct si_compute *program)
        FREE(program->global_buffers);
 
        si_shader_destroy(&program->shader);
+       FREE(program->sel.tokens);
        ralloc_free(program->sel.nir);
        FREE(program);
 }