Bug 64193 - LLVM RV670 regression since R600: Packetize instructions
Summary: LLVM RV670 regression since R600: Packetize instructions
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/r600 (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-03 18:28 UTC by Andy Furniss
Modified: 2013-05-21 09:10 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
R600_DEBUG=vs,ps,fs glxgears working before packetize commit (110.12 KB, text/plain)
2013-05-03 22:54 UTC, Andy Furniss
Details
R600_DEBUG=vs,ps,fs glxgears rendering dark on packetize commit (120.73 KB, text/plain)
2013-05-03 22:55 UTC, Andy Furniss
Details
R600_DEBUG=vs,ps,fs glxgears rendering OK on packetize with patch (120.70 KB, text/plain)
2013-05-04 18:35 UTC, Andy Furniss
Details
R600_DEBUG=vs,ps,fs glxgears rendering dark on heads (95.59 KB, text/plain)
2013-05-04 18:36 UTC, Andy Furniss
Details
Possible Fix - Patch 1 (3.15 KB, patch)
2013-05-14 15:05 UTC, Tom Stellard
Details | Splinter Review
Possible Fix - Patch 2 (1.08 KB, patch)
2013-05-14 15:05 UTC, Tom Stellard
Details | Splinter Review
R600_DEBUG output with swimming dolphin (194.57 KB, text/plain)
2013-05-15 11:33 UTC, Marc Dietrich
Details
R600_DEBUG output with only while water (162.12 KB, text/plain)
2013-05-15 11:33 UTC, Marc Dietrich
Details

Description Andy Furniss 2013-05-03 18:28:59 UTC
My AGP rv670 box has been in pieces for a while so no testing until today.

It seems that it suffers from the same regression as my 790 - 

https://bugs.freedesktop.org/show_bug.cgi?id=64096

but the fixes for that do not help.

With llvm set on -

commit 25f259cde28860ea76c2f5628010968945a28edb
Author: Vincent Lejeune <vljn@ovi.com>
Date:   Tue Apr 30 00:14:27 2013 +0000

    R600: Packetize instructions
    
    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180760 91177308-0d34-0410-b5e6-96231b3b80d8

the issue is there, the commit before and rendering is OK.
Comment 1 vincent 2013-05-03 20:15:50 UTC
Can you post the output of glxgears with R600_DEBUG=vs,ps,fs environment variable, before and after this commit ?
Comment 2 Andy Furniss 2013-05-03 22:54:59 UTC
Created attachment 78827 [details]
R600_DEBUG=vs,ps,fs glxgears working before packetize commit
Comment 3 Andy Furniss 2013-05-03 22:55:37 UTC
Created attachment 78828 [details]
R600_DEBUG=vs,ps,fs glxgears rendering dark on packetize commit
Comment 4 vincent 2013-05-04 15:51:22 UTC
Can you cherry pick this patch : https://bugs.freedesktop.org/attachment.cgi?id=78786 (from bugid 64096) on top of 25f259cde28860ea76c2f5628010968945a28edb and post the output of R600_DEBUG=vs,ps,fs again please ?
Comment 5 Andy Furniss 2013-05-04 18:33:34 UTC
(In reply to comment #4)
> Can you cherry pick this patch :
> https://bugs.freedesktop.org/attachment.cgi?id=78786 (from bugid 64096) on
> top of 25f259cde28860ea76c2f5628010968945a28edb and post the output of
> R600_DEBUG=vs,ps,fs again please ?

glxgears looks normal with the patch, though it doesn't fix other demos/games eg.
nexuiz just hung and gloss renders almost OK but the sides are matt with no reflection.

I'll attach the debug as requested and one from heads I did this morning as well where it is rendering dark.

FWIW when llvm is on packetize mesa doesn't build on head so for these it's been (random choice) set on 

e2b985dc0f93a195d984aa7c88669ab67160c6c4
Comment 6 Andy Furniss 2013-05-04 18:35:45 UTC
Created attachment 78854 [details]
R600_DEBUG=vs,ps,fs glxgears rendering OK on packetize with patch
Comment 7 Andy Furniss 2013-05-04 18:36:32 UTC
Created attachment 78855 [details]
R600_DEBUG=vs,ps,fs glxgears rendering dark on heads
Comment 8 Marc Dietrich 2013-05-14 14:07:37 UTC
The suggested patch also fixes gears and 0ad for me. But I still see the problem in chromium browser with webgl enabled, where the map is not displayed.
Comment 9 Alex Deucher 2013-05-14 14:30:55 UTC
As mentioned by Vadim on IRC:
it seems many instructions in bytecode generated for RS880 have (incorrect) OMOD = 2, that is, ALU WORD1 bit 7 is set where it shouldn't be set
Comment 10 Vadim Girlin 2013-05-14 14:37:26 UTC
I looked a bit more into it and AFAICS it's not just a single wrong bit, looks like r700 alu encoding is used for all r600  chips with llvm backend currently(In reply to comment #9)
> As mentioned by Vadim on IRC:
> it seems many instructions in bytecode generated for RS880 have (incorrect)
> OMOD = 2, that is, ALU WORD1 bit 7 is set where it shouldn't be set

I looked a bit more into it and AFAICS it's not just a single wrong bit, looks like r700 alu encoding is used for all r600 chips with llvm backend currently
Comment 11 Tom Stellard 2013-05-14 14:42:51 UTC
It looks like the special handling for R600 encoding is missing from the backend.  I think an earlier change to the code emitter made this code dead and then I deleted it in a more recent commit.
Comment 12 Marc Dietrich 2013-05-14 14:55:47 UTC
yes, there must be something else wrong because the patch seems to be applied in release_33 branch, but the problem somehow came back.
Comment 13 Tom Stellard 2013-05-14 15:05:09 UTC
Created attachment 79304 [details] [review]
Possible Fix - Patch 1
Comment 14 Tom Stellard 2013-05-14 15:05:57 UTC
Created attachment 79305 [details] [review]
Possible Fix - Patch 2

Do these two patches fix the problem?
Comment 15 Marc Dietrich 2013-05-14 15:33:29 UTC
hard to say, because mesa is broken again:

  CXX      gallivm/lp_bld_debug.lo
gallivm/lp_bld_debug.cpp: In member function 'virtual void raw_debug_ostream::write_impl(const char*, size_t)':
gallivm/lp_bld_debug.cpp:116:40: warning: cast from type 'const char*' to type 'char*' casts away qualifiers [-Wcast-qual]
gallivm/lp_bld_debug.cpp: In function 'size_t disassemble(const void*, llvm::raw_ostream&)':
gallivm/lp_bld_debug.cpp:216:64: error: no matching function for call to 'llvm::Target::createMCAsmInfo(std::string&) const'
gallivm/lp_bld_debug.cpp:216:64: note: candidate is:
In file included from gallivm/lp_bld_debug.cpp:38:0:
/usr/src/dri-project/llvm/Release-x86_64/include/llvm/Support/TargetRegistry.h:269:16: note: llvm::MCAsmInfo* llvm::Target::createMCAsmInfo(const llvm::MCRegisterInfo&, llvm::StringRef) const
/usr/src/dri-project/llvm/Release-x86_64/include/llvm/Support/TargetRegistry.h:269:16: note:   candidate expects 2 arguments, 1 provided
gmake[3]: *** [gallivm/lp_bld_debug.lo] Fehler 1
Comment 16 Tom Stellard 2013-05-14 16:07:00 UTC
(In reply to comment #15)
> hard to say, because mesa is broken again:
> 

Try again, this should be fixed now.
Comment 17 Marc Dietrich 2013-05-14 17:08:43 UTC
Thanks, this fixes gears and 0ad for me again.

Chrome still doesn't show background with WebGL on maps.google.com (this worked before the R600: Packetize instructions commit).

At least GPU hangs with Chrome are fixed now (will close the bug).
Comment 18 Marc Dietrich 2013-05-14 19:18:37 UTC
Tom, can you please also update llvm 3.3 branch if you haven't done yet?
Comment 19 Andy Furniss 2013-05-14 22:20:33 UTC
(In reply to comment #14)
> Created attachment 79305 [details] [review] [review]
> Possible Fix - Patch 2
> 
> Do these two patches fix the problem?

Fixed for me  - testing with nexuiz and etqw.
Comment 20 Marc Dietrich 2013-05-15 11:33:03 UTC
Created attachment 79339 [details]
R600_DEBUG output with swimming dolphin

Regarding WebGL problem. Steps to reproduce: go to http://www.ibiblio.org/e-notes/webgl/webgl.htm and click on the dophin. Before said commit, dolphin renders fine, after that, nothing is rendered at all.

Attached is the R600_DEBUG output with/without swimming dolphin.
Comment 21 Marc Dietrich 2013-05-15 11:33:56 UTC
Created attachment 79340 [details]
R600_DEBUG output with only while water
Comment 22 Marc Dietrich 2013-05-15 11:34:44 UTC
Note: this compares llvm/mesa state from ~29th Apr with llvm/release_33 and mesa from today.
Comment 23 vincent 2013-05-15 16:18:06 UTC
Marc, where is the dump without the dolphin ? Is this the "only while water" dump ?
Comment 24 Marc Dietrich 2013-05-15 18:51:32 UTC
sorry, this was a typo. I mean only *white* water (means only white background, nothing is shown)
Comment 25 Marc Dietrich 2013-05-21 09:10:03 UTC
As of today, http://www.ibiblio.org/e-notes/webgl/webgl.htm works again with firefox. (Chrome has webgl init error, but maybe a chrome bug). So I guess this was fixed otherwise.


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.