Summary: | [Regression, NIR, bisected] Black squares in Unigine Heaven via DXVK | ||
---|---|---|---|
Product: | Mesa | Reporter: | Danylo <danylo.piliaiev> |
Component: | Mesa core | Assignee: | mesa-dev |
Status: | RESOLVED FIXED | QA Contact: | mesa-dev |
Severity: | normal | ||
Priority: | medium | CC: | danylo.piliaiev |
Version: | git | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
unigine_heaven_artifacts
good_vs_bad_shaders_nir |
Description
Danylo
2019-08-06 15:53:44 UTC
Checking out 96fcb3f95bd and commenting out that optimization doesn't affect any of the Unigine Heaven shaders that I have in shader-db (which are all from the native Linux OpenGL version). Do you think you could send me dumps with and without that optimization with the environment variable NIR_PRINT=true? If I can see what changes in the NIR, that should shed some light on things. Another thing to try... does changing 'flt' to '~flt' make any difference? Created attachment 144968 [details] good_vs_bad_shaders_nir > does changing 'flt' to '~flt' make any difference? No > Do you think you could send me dumps with and without that optimization with the environment variable NIR_PRINT=true? I've attached the relevant parts of optimizations and the final NIR, the whole dump is 300 mb so I didn't attach it. Vulkan renderdoc of frame with issue: https://mega.nz/#!sR8DGKwD!IHSQv6dWjk-YfyOnWZy36v-STBctmJbqGod19RPVDfg . Captured on Mesa master and HD 620. It is a capture of dx11 capture because the app is 32 bit so I was unable to directly capture Vulkan trace of it. Don't mind green artifacts in trace - they appear only in Vulkan trace. The corruption starts from the call EID 2821, select "NaN/INF" overlay and look at the only output of this draw. NaNs would be highlighted as red. I think I have an idea what could be happening. There are a lot of occurrences of a pattern like y = exp2(-(x*x)) * small_constant + y; At the end, y is compared 0 < y, and that comparison is eliminated. If x*x is sufficiently large, exp2(-(x*x)) will flush to zero. Does changing case nir_op_fexp2: r = (struct ssa_result_range){gt_zero, analyze_expression(alu, 0, ht).is_integral}; break; to case nir_op_fexp2: r = (struct ssa_result_range){ge_zero, analyze_expression(alu, 0, ht).is_integral}; break; help? I don't have the renderdoc set up on this system. I can try that later today of you don't beat me to it. If that fixes the problem, then fmul and ffma (and possibly others) will need fixes to account for flush-to-zero behavior. Interesting observation. I would be able to try tomorrow. Yes, changing fexp2 be >= 0 instead of > 0 solves the issue. https://gitlab.freedesktop.org/mesa/piglit/merge_requests/110 contains several test cases that reproduce this problem and some related problems. I should have an MR for the fixes later today. Fixed by commit commit 33ad2bab4bcb52c0f6be56e2f9cce5f52601a4ea Author: Ian Romanick <ian.d.romanick@intel.com> Date: Wed Aug 7 08:56:22 2019 -0700 nir/range-analysis: Adjust result range of exp2 to account for flush-to-zero Fixes piglit tests (new in piglit!110): - fs-underflow-exp2-compare-zero.shader_test Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111308 Fixes: 405de7ccb6c ("nir/range-analysis: Rudimentary value range analysis pass") Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> Most of the shaders affected are, unsurprisingly, in Unigine Heaven. All Gen6+ platforms had similar results. (Ice Lake shown) total instructions in shared programs: 16278207 -> 16278465 (<.01%) instructions in affected programs: 11374 -> 11632 (2.27%) helped: 0 HURT: 58 HURT stats (abs) min: 2 max: 13 x̄: 4.45 x̃: 4 HURT stats (rel) min: 0.54% max: 4.11% x̄: 2.42% x̃: 2.82% 95% mean confidence interval for instructions value: 3.77 5.13 95% mean confidence interval for instructions %-change: 2.19% 2.64% Instructions are HURT. total cycles in shared programs: 367134284 -> 367135159 (<.01%) cycles in affected programs: 81207 -> 82082 (1.08%) helped: 17 HURT: 36 helped stats (abs) min: 6 max: 356 x̄: 90.35 x̃: 6 helped stats (rel) min: 0.69% max: 21.45% x̄: 5.71% x̃: 0.78% HURT stats (abs) min: 4 max: 235 x̄: 66.97 x̃: 16 HURT stats (rel) min: 0.35% max: 27.58% x̄: 5.34% x̃: 1.09% 95% mean confidence interval for cycles value: -20.36 53.38 95% mean confidence interval for cycles %-change: -1.08% 4.67% Inconclusive result (value mean confidence interval includes 0). No changes on any earlier platforms. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.