Bug 64877

Summary: R600: OpenCL Regression since llvm commit b6379de427c009
Product: Mesa Reporter: Aaron Watry <awatry>
Component: Drivers/Gallium/r600Assignee: mesa-dev
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Test case that passed before the bisected commit and fails on git head
Possible fix

Description Aaron Watry 2013-05-22 18:10:04 UTC
Created attachment 79681 [details]
Test case that passed before the bisected commit and fails on git head

Using the piglit generated_tests/cl/builtin/int/builtin-int-min-1.1.generated.cl scalar test cases (attached min.cl), results went from all passing to about half of the test cases failing with the following commit:

Hardware:
Radeon HD 5400 series
Radeon HD 6850

e917ed96ae38fc382bac50a6536d761b829ac8cd is the first bad commit
commit e917ed96ae38fc382bac50a6536d761b829ac8cd
Author: Tom Stellard <thomas.stellard@amd.com>
Date:   Fri May 3 11:15:55 2013 -0700

    r600g/llvm: Don't emit CALL_FS for vertex shaders
    
    The LLVM backend takes care of this now.


Each stage of the bisect was run using the matching LLVM revision specified in mesa/src/gallium/drivers/radeon/LLVM_REVISION.txt
Comment 1 vincent 2013-05-22 18:32:21 UTC
What is your llvm HEAD ?
Comment 2 Aaron Watry 2013-05-22 18:57:48 UTC
Currently, I can reproduce the bug with the following components (all current within the last hour):
llvm: e67c9c341f18a4 (svn: 182405)
clang: 097e0a2cb08 (svn: 182406)
drm: 8a88e349975a
mesa: ff68f61bedc2
kernel: 3.9.0
video: Radeon 5400 (cedar)
Comment 3 Aaron Watry 2013-05-22 19:59:24 UTC
Note that this is the first mesa commit that shows the issue.  

The LLVM_REVISION.txt was bumped from LLVM revision 180753 to revision 181223... which means that it could've been an LLVM R600 change anywhere in that revision range that caused the problem (or maybe it's this mesa change that's causing it)... I haven't yet gone back to the previous mesa commit and tried to bisect through individual LLVM revisions.
Comment 4 Aaron Watry 2013-05-22 22:50:51 UTC
I've gone one step further and verified that the issue exists in:
llvm: e5c8c24ed5 (svn: 181222)
clang: c2fc4ab28c1 (svn: 181272)
drm: 8a88e349975a
mesa: 1d09a8c3cdf02ed2c1
kernel: 3.9.0
video: Radeon 5400 (cedar)

This is the mesa and LLVM commits immediately proceeding e917ed96ae38fc, which says that we can rule out any Mesa changes.

The culprit lies between LLVM revisions 180753 and 181222, and maybe clang revisions 181272 and 182406.

I'll keep going and post an update when I find the commit that introduced the regression.
Comment 5 Aaron Watry 2013-05-23 01:57:33 UTC
Think I found the commit in LLVM that broke things for me:
clang version used: aa3cef411387d1c (svn: 180748)
mesa: 1d09a8c3cdf02ed2c1


b6379de427c009284d47c5fc764f11bbd2bf2484 is the first bad commit
commit b6379de427c009284d47c5fc764f11bbd2bf2484
Author: Vincent Lejeune <vljn@ovi.com>
Date:   Tue Apr 30 00:13:53 2013 +0000

    R600: Turn TEX/VTX into native instructions
    
    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180756 91177308-0d34-0410-b5e6-96231b3b80d8
Comment 6 Tom Stellard 2013-05-23 16:52:40 UTC
Created attachment 79716 [details] [review]
Possible fix

This patch should fix the bug.
Comment 7 Aaron Watry 2013-05-23 17:40:18 UTC
This patch does in fact fix that test for me.  

I've done a CL piglit run as well, and many of the other related failures (abs_diff, add_sat, clamp, mad24, max, min, mul24, rotate) that I was having have also been resolved.

Thank you very much Tom/Vincent for looking into the fix for this.

--Aaron

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.