mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-22 04:28:10 +02:00
If loop iterator is incremented with something other than regular addition, it would be more error prone to calculate the number of iterations theoretically. What we can do instead, is try to emulate the loop, and determine the number of iterations empirically. These operations are covered: - imul - fmul - ishl - ishr - ushr Also add unit tests for loop unrollment. Improves performance of Aztec Ruins (sixonix gfxbench5.aztec_ruins_vk_high) by -1.28042% +/- 0.498555% (N=5) on Intel Arc A770. v2 (idr): Rebase on 3 years. :( Use nir_phi_instr_add_src in the test cases. v3 (idr): Use try_eval_const_alu in to evaluate loop termination condition in get_iteration_empirical. Also restructure the loop slightly. This fixed off by one iteration errors in "inverted" loop tests (e.g., nir_loop_analyze_test.ushr_ieq_known_count_invert_31). v4 (idr): Use try_eval_const_alu in to evaluate induction variable update in get_iteration_empirical. This fixes non-commutative update operations (e.g., shifts) when the induction varible is not the first source. This fixes the unit test nir_loop_analyze_test.ishl_rev_ieq_infinite_loop_unknown_count. v5 (idr): Fix _type parameter for fadd and fadd_rev loop unroll tests. Hopefully that fixes the failure on s390x. Temporarily disable fmul. This works-around the revealed problem in glsl-fs-loop-unroll-mul-fp64, and there were no shader-db or fossil-db changes. v6 (idr): Plumb max_unroll_iterations into get_iteration_empirical. I was going to do this, but I forgot. Suggested by Tim. v7 (idr): Disable fadd tests on s390x. They fail because S390 is weird. Almost all of the shaders affected (OpenGL or Vulkan) are from gfxbench or geekbench. A couple shaders in Deus Ex (OpenGL), Dirt Rally (OpenGL), Octopath Traveler (Vulkan), and Rise of the Tomb Raider (Vulkan) are helped. The lost / gained shaders in OpenGL are an Aztec Ruins shader that goes from SIMD16 to SIMD8. The spills / fills affected are in a single Aztec Ruins (Vulkan) compute shader. shader-db results: Skylake, Ice Lake, and Tiger Lake had similar results. (Tiger Lake shown) total loops in shared programs: 5514 -> 5470 (-0.80%) loops in affected programs: 62 -> 18 (-70.97%) helped: 37 / HURT: 0 LOST: 2 GAINED: 2 Haswell and Broadwell had similar results. (Broadwell shown) total loops in shared programs: 5346 -> 5298 (-0.90%) loops in affected programs: 66 -> 18 (-72.73%) helped: 39 / HURT: 0 fossil-db results: Skylake, Ice Lake, and Tiger Lake had similar results. (Tiger Lake shown) Instructions in all programs: 157374679 -> 157397421 (+0.0%) Instructions hurt: 28 SENDs in all programs: 7463800 -> 7467639 (+0.1%) SENDs hurt: 28 Loops in all programs: 38980 -> 38950 (-0.1%) Loops helped: 28 Cycles in all programs: 7559486451 -> 7557455384 (-0.0%) Cycles helped: 28 Spills in all programs: 11405 -> 11403 (-0.0%) Spills helped: 1 Fills in all programs: 19578 -> 19588 (+0.1%) Fills hurt: 1 Lost: 1 Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3445> |
||
|---|---|---|
| .. | ||
| amd | ||
| android_stub | ||
| asahi | ||
| broadcom | ||
| c11 | ||
| compiler | ||
| drm-shim | ||
| egl | ||
| etnaviv | ||
| freedreno | ||
| gallium | ||
| gbm | ||
| getopt | ||
| glx | ||
| gtest | ||
| imagination | ||
| imgui | ||
| intel | ||
| loader | ||
| mapi | ||
| mesa | ||
| microsoft | ||
| nouveau | ||
| panfrost | ||
| tool | ||
| util | ||
| virtio | ||
| vulkan | ||
| meson.build | ||