iris: Add finalize_nir

Improves performance of SynMark OglDrvShComp by +241.879%±1.01366% (n=5)
on a random KBL desktop that I have.  That seems to put it at about the
same performance as i965, but I did not test that in a statistically
sound way.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12858>
This commit is contained in:
Ian Romanick 2021-09-07 13:52:05 -07:00
parent b042c71ac1
commit 897bb9a222
1 changed files with 20 additions and 11 deletions

View File

@ -2429,8 +2429,6 @@ iris_create_uncompiled_shader(struct iris_screen *screen,
nir_shader *nir,
const struct pipe_stream_output_info *so_info)
{
const struct intel_device_info *devinfo = &screen->devinfo;
struct iris_uncompiled_shader *ish =
calloc(1, sizeof(struct iris_uncompiled_shader));
if (!ish)
@ -2440,15 +2438,6 @@ iris_create_uncompiled_shader(struct iris_screen *screen,
list_inithead(&ish->variants);
simple_mtx_init(&ish->lock, mtx_plain);
NIR_PASS_V(nir, iris_fix_edge_flags);
brw_preprocess_nir(screen->compiler, nir, NULL);
NIR_PASS_V(nir, brw_nir_lower_storage_image, devinfo);
NIR_PASS_V(nir, iris_lower_storage_image_derefs);
nir_sweep(nir);
ish->uses_atomic_load_store = iris_uses_image_atomic(nir);
ish->program_id = get_new_program_id(screen);
@ -2907,6 +2896,25 @@ iris_bind_cs_state(struct pipe_context *ctx, void *state)
bind_shader_state((void *) ctx, state, MESA_SHADER_COMPUTE);
}
static char *
iris_finalize_nir(struct pipe_screen *_screen, void *nirptr)
{
struct iris_screen *screen = (struct iris_screen *)_screen;
struct nir_shader *nir = (struct nir_shader *) nirptr;
const struct intel_device_info *devinfo = &screen->devinfo;
NIR_PASS_V(nir, iris_fix_edge_flags);
brw_preprocess_nir(screen->compiler, nir, NULL);
NIR_PASS_V(nir, brw_nir_lower_storage_image, devinfo);
NIR_PASS_V(nir, iris_lower_storage_image_derefs);
nir_sweep(nir);
return NULL;
}
static void
iris_set_max_shader_compiler_threads(struct pipe_screen *pscreen,
unsigned max_threads)
@ -2946,6 +2954,7 @@ iris_init_screen_program_functions(struct pipe_screen *pscreen)
iris_is_parallel_shader_compilation_finished;
pscreen->set_max_shader_compiler_threads =
iris_set_max_shader_compiler_threads;
pscreen->finalize_nir = iris_finalize_nir;
}
void