Bug 108935

Summary: [LLVM Regression,bisected] Witcher 3 Corrupted Terrain
Product: Mesa Reporter: oschowa
Component: Drivers/Vulkan/radeonAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium CC: nhaehnle
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
i915 platform: i915 features:
Attachments: screenshot

Description oschowa 2018-12-03 21:34:39 UTC
Created attachment 142706 [details]

When running The Witcher 3 through DXVK there is terrain corruption in specific areas. This only occurs when radv is build against LLVM8-svn (r348050).
I tested the following configurations:

- Mesa 18.2.5 + LLVM 7 -> renders correctly
- Mesa-git b186731d5e413c + LLVM7 -> renders correctly
- Mesa-git b186731d5e413c + LLVM8 r348050 -> corrupted

My gpu is an RX580. I'll also attach a screenshot, savegame and renderdoc capture of the problematic area.

renderdoc capture: https://drive.google.com/open?id=1Rb2fsZoBLhp6h7RTiCLBJ5mcZwLl_2Ai

savegame: https://drive.google.com/open?id=1hKwP_fOX5rDZM4U24xwWWAnvHQHGHN9b
Comment 1 Samuel Pitoiset 2018-12-04 11:21:31 UTC
The problem can be reproduced on Polaris using the attached RenderDoc capture.

Bisected to:

41f457ff4f2e1571126d778f897efd274d1993ba is the first bad commit
commit 41f457ff4f2e1571126d778f897efd274d1993ba
Author: Nicolai Haehnle <nhaehnle@gmail.com>
Date:   Thu Nov 29 11:06:26 2018 +0000

    AMDGPU/InsertWaitcnts: Remove the dependence on MachineLoopInfo
    MachineLoopInfo cannot be relied on for correctness, because it cannot
    properly recognize loops in irreducible control flow which can be
    introduced by late machine basic block optimization passes. See the new
    test case for the reduced form of an example that occurred in practice.
    Use a simple fixpoint iteration instead.
    In order to facilitate this change, refactor WaitcntBrackets so that it
    only tracks pending events and registers, rather than also maintaining
    state that is relevant for the high-level algorithm. Various accessor
    methods can be removed or made private as a consequence.
    Affects (in radv):
    - dEQP-VK.glsl.loops.special.{for,while}_uniform_iterations.select_iteration_count_{fragment,vertex}
    Fixes: r345719 ("AMDGPU: Rewrite SILowerI1Copies to always stay on SALU")
    Reviewers: msearles, rampitec, scott.linder, kanarayan
    Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits, hakzsam
    Differential Revision: https://reviews.llvm.org/D54231
    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347853 91177308-0d34-0410-b5e6-96231b3b80d8
Comment 2 Philip Rebohle 2018-12-13 19:07:54 UTC
This regression also affects Hitman 2, https://reviews.llvm.org/D55602 fixes it.
Comment 3 Samuel Pitoiset 2018-12-19 12:02:56 UTC
The regression should be fixed with LLVM r349611.

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.