From 4e3d69ad07d9c439fc99b7c1b1e999ce556d260f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 5 Mar 2020 18:03:35 -0800 Subject: nir/algebraic: Simplify a contradiction that can occur in __flt64_nonnan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pattern is added to opt_algebraic because, for example, comparisons with constant 0.0 will produce (a1 < 0). Even with a pass that optimized Boolean expressions, I think this would be very difficult to automatically recognize and optimize. Results on the 308 shaders extracted from the fp64 portion of the OpenGL CTS: Tiger Lake and Ice Lake had similar results. (Tiger Lake shown) total instructions in shared programs: 933054 -> 929619 (-0.37%) instructions in affected programs: 784041 -> 780606 (-0.44%) helped: 59 HURT: 0 helped stats (abs) min: 2 max: 213 x̄: 58.22 x̃: 44 helped stats (rel) min: 0.02% max: 2.51% x̄: 0.72% x̃: 0.46% 95% mean confidence interval for instructions value: -70.80 -45.64 95% mean confidence interval for instructions %-change: -0.92% -0.53% Instructions are helped. total cycles in shared programs: 7304712 -> 7280180 (-0.34%) cycles in affected programs: 7176260 -> 7151728 (-0.34%) helped: 92 HURT: 0 helped stats (abs) min: 8 max: 1414 x̄: 266.65 x̃: 166 helped stats (rel) min: 0.04% max: 2.34% x̄: 0.43% x̃: 0.22% 95% mean confidence interval for cycles value: -333.05 -200.26 95% mean confidence interval for cycles %-change: -0.54% -0.31% Cycles are helped. Regular shader-db changes: No changes on any Intel platform. Reviewed-by: Jason Ekstrand Reviewed-by: Matt Turner Part-of: --- src/compiler/nir/nir_opt_algebraic.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 5cbb9e7c3c2..7d9775950a4 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -942,6 +942,7 @@ optimizations.extend([ (('ilt', 'a(is_lt_zero)', 'b(is_not_negative)'), True), (('ult', 0, 'a(is_gt_zero)'), True), + (('ult', a, 0), False), # Packing and then unpacking does nothing (('unpack_64_2x32_split_x', ('pack_64_2x32_split', a, b)), a), -- cgit v1.2.3