diff options
author | Iago Toral Quiroga <[email protected]> | 2019-06-12 13:57:03 +0200 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2019-06-14 08:00:52 +0200 |
commit | 2a2501247b8b85423fa3861ef83b8fdecb7d8bdb (patch) | |
tree | fcde8a52cc1424b89aaacbb6ed9ff8fbd935485f /src/compiler/nir | |
parent | 287b58f827052d1d9cf101871e40ee24f6e7eef2 (diff) |
nir: detect more dynamically uniform expressions
Shader-db results for v3d:
total instructions in shared programs: 9132728 -> 9119238 (-0.15%)
instructions in affected programs: 596886 -> 583396 (-2.26%)
helped: 1118
HURT: 224
total threads in shared programs: 234298 -> 234308 (<.01%)
threads in affected programs: 10 -> 20 (100.00%)
helped: 5
HURT: 0
total uniforms in shared programs: 3022949 -> 3022622 (-0.01%)
uniforms in affected programs: 29163 -> 28836 (-1.12%)
helped: 108
HURT: 37
total max-temps in shared programs: 1328030 -> 1327762 (-0.02%)
max-temps in affected programs: 10097 -> 9829 (-2.65%)
helped: 263
HURT: 15
total spills in shared programs: 3793 -> 3777 (-0.42%)
spills in affected programs: 432 -> 416 (-3.70%)
helped: 16
HURT: 0
total fills in shared programs: 4380 -> 4266 (-2.60%)
fills in affected programs: 828 -> 714 (-13.77%)
helped: 16
HURT: 0
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r-- | src/compiler/nir/nir.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 5b75585498e..524b9445b11 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -1333,6 +1333,19 @@ nir_src_is_dynamically_uniform(nir_src src) return true; } + /* Operating together dynamically uniform expressions produces a + * dynamically uniform result + */ + if (src.ssa->parent_instr->type == nir_instr_type_alu) { + nir_alu_instr *alu = nir_instr_as_alu(src.ssa->parent_instr); + for (int i = 0; i < nir_op_infos[alu->op].num_inputs; i++) { + if (!nir_src_is_dynamically_uniform(alu->src[i].src)) + return false; + } + + return true; + } + /* XXX: this could have many more tests, such as when a sampler function is * called with dynamically uniform arguments. */ |