Bug 108611

Summary: [radv] [regression,bisected]: LLVM 8.0 breaks lighting in Mass Effect Andromeda
Product: Mesa Reporter: Philip Rebohle <philip.rebohle>
Component: Drivers/Vulkan/radeonAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium CC: fdsfgs, nhaehnle, nickfaces
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Screenshot with broken rendering
Screenshot with correct rendering

Description Philip Rebohle 2018-10-31 11:53:26 UTC
Hello,

as stated in the title, when building mesa (both latest -git and 18.2.3) against LLVM 8, Lighting in Mass Effect Andromeda is broken; there are blocky artifacts. Applying https://reviews.llvm.org/D53359 does not solve the issue.

This renderdoc capture shows the problem, recorded with Renderdoc 1.1 (stable) on Polaris:
https://mega.nz/#!4Hwm0KTQ!lT7cqh_h04ZEIRQ_VoTXw8J3PXzUc0RnxRxtwUe68sU

With LLVM 7, everything renders correctly.
Comment 1 Philip Rebohle 2018-10-31 11:59:41 UTC
Created attachment 142301 [details]
Screenshot with broken rendering
Comment 2 Philip Rebohle 2018-10-31 12:00:11 UTC
Created attachment 142302 [details]
Screenshot with correct rendering
Comment 3 Samuel Pitoiset 2018-10-31 13:55:59 UTC
Introduced by the following LLVM commit:

cc436fd26637b0629b95fd8e60fde61cec4b421f is the first bad commit
commit cc436fd26637b0629b95fd8e60fde61cec4b421f
Author: Nicolai Haehnle <nhaehnle@gmail.com>
Date:   Wed Oct 17 15:37:30 2018 +0000

    AMDGPU: Divergence-driven selection of scalar buffer load intrinsics
    
    Summary:
    Moving SMRD to VMEM in SIFixSGPRCopies is rather bad for performance if
    the load is really uniform. So select the scalar load intrinsics directly
    to either VMEM or SMRD buffer loads based on divergence analysis.
    
    If an offset happens to end up in a VGPR -- either because a floating
    point calculation was involved, or due to other remaining deficiencies
    in SIFixSGPRCopies -- we use v_readfirstlane.
    
    There is some unrelated churn in tests since we now select MUBUF offsets
    in a unified way with non-scalar buffer loads.
    
    Change-Id: I170e6816323beb1348677b358c9d380865cd1a19
    
    Reviewers: arsenm, alex-t, rampitec, tpr
    
    Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, t-tye, llvm-commits
    
    Differential Revision: https://reviews.llvm.org/D53283
    
    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344696 91177308-0d34-0410-b5e6-96231b3b80d8
Comment 4 Vladimir 2018-11-04 19:16:33 UTC
Same problem in another Frostbite-source title - NFS Payback.
Comment 5 Nicolai Hähnle 2018-11-04 21:37:28 UTC
I can reproduce this based on the RenderDoc trace and will investigate.
Comment 6 Nicolai Hähnle 2018-11-07 21:59:11 UTC
I'm reverting the commit to LLVM for now. The change exposed a bug in how divergence analysis info is passed through code generation, and it looks like I will have to touch common code to fix that bug.

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.