nir/linker: disable varying from uniform lowering by default
This fixes performance regression for Specviewperf/Energy
on AMD GPU. Other GPUs passing varying by memory may choose
to re-enable it as need.
Fixes: 2604625043
("nir/linker: support uniform when optimizing varying")
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15341>
This commit is contained in:
@@ -3578,6 +3578,15 @@ typedef struct nir_shader_compiler_options {
|
||||
*/
|
||||
uint8_t support_indirect_inputs;
|
||||
uint8_t support_indirect_outputs;
|
||||
|
||||
/**
|
||||
* Remove varying loaded from uniform, let fragment shader load the
|
||||
* uniform directly. GPU passing varying by memory can benifit from it
|
||||
* for sure; but GPU passing varying by on chip resource may not.
|
||||
* Because it saves on chip resource but may increase memory pressure when
|
||||
* fragment task is far more than vertex one, so better left it disabled.
|
||||
*/
|
||||
bool lower_varying_from_uniform;
|
||||
} nir_shader_compiler_options;
|
||||
|
||||
typedef struct nir_shader {
|
||||
|
@@ -1377,7 +1377,8 @@ nir_link_opt_varyings(nir_shader *producer, nir_shader *consumer)
|
||||
nir_ssa_def *ssa = intr->src[1].ssa;
|
||||
if (ssa->parent_instr->type == nir_instr_type_load_const) {
|
||||
progress |= replace_varying_input_by_constant_load(consumer, intr);
|
||||
} else if (is_direct_uniform_load(ssa, &uni_scalar)) {
|
||||
} else if (consumer->options->lower_varying_from_uniform &&
|
||||
is_direct_uniform_load(ssa, &uni_scalar)) {
|
||||
progress |= replace_varying_input_by_uniform_load(consumer, intr,
|
||||
&uni_scalar);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user