Bug 34929 - [r300g] slowdown with r300g threading
Summary: [r300g] slowdown with r300g threading
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/r300 (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: 2011-03-02 08:02 UTC by Fabio Pedretti
Modified: 2011-08-30 06:35 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Fabio Pedretti 2011-03-02 08:02:49 UTC
I noticed that since r300g threading was enabled many applications slowed down. On setting RADEON_THREAD=0 openarena go from 94.9 to 100.0, glxgears (FWIW) from 1275 to 1632.

Applications running under gdb shows hundreds of:

[New Thread 0xb6af3b70 (LWP 4622)]
[Thread 0xb6af3b70 (LWP 4622) exited]
[New Thread 0xb6af3b70 (LWP 4623)]
[Thread 0xb6af3b70 (LWP 4623) exited]

and slowdown even more (glxgears drop to ~100 FPS, supertuxkart drop by 50%).

I am running current mesa git + kernel 2.6.37.2 with a RV530 on an Intel Core Duo.
Comment 1 Marek Olšák 2011-03-02 08:57:46 UTC
You have a single-core processor, right? Does commit 	f6dbcb92bf4a3597c7b3da890ffafc84951f25df fix this?
Comment 2 Fabio Pedretti 2011-03-02 09:08:50 UTC
(In reply to comment #1)
> You have a single-core processor, right?
No, I already specified I have a Core Duo (T2600, dual core) since I suspected I was asked for that...

> Does commit    
> f6dbcb92bf4a3597c7b3da890ffafc84951f25df fix this?

It doesn't change nothing, indeed.
Comment 3 Marek Olšák 2011-03-02 09:53:12 UTC
I can't see a significant performance difference with the games you mentioned. openarena fps went from 93 to 91 with threading. glxgears frames went from 15k to 17k. Torcs fps went from 23 to 27. There is no visible difference in supertuxkart. I don't say it always improves performance, but it should mostly be a win.
Comment 4 Fabio Pedretti 2011-03-03 02:06:34 UTC
(In reply to comment #3)
> I can't see a significant performance difference with the games you mentioned.
> openarena fps went from 93 to 91 with threading. glxgears frames went from 15k
> to 17k. Torcs fps went from 23 to 27. There is no visible difference in
> supertuxkart. I don't say it always improves performance, but it should mostly
> be a win.

Without gdb torcs is about the same but I definitively get a slowdown with glxgears:

$ vblank_mode=0 RADEON_THREAD=0 glxgears 2>&1 | grep FPS
8445 frames in 5.0 seconds = 1688.847 FPS
8196 frames in 5.0 seconds = 1639.119 FPS
8197 frames in 5.0 seconds = 1639.396 FPS

$ vblank_mode=0 glxgears 2>&1 | grep FPS
6789 frames in 5.0 seconds = 1357.671 FPS
6878 frames in 5.0 seconds = 1375.596 FPS
6879 frames in 5.0 seconds = 1375.797 FPS

Did you try running some apps under gdb? The problem is hugely amplified with it. Example:

$ vblank_mode=0 RADEON_THREAD=0 gdb glxgears 2>&1 | grep FPS
8171 frames in 5.0 seconds = 1634.191 FPS
8258 frames in 5.0 seconds = 1651.503 FPS
8544 frames in 5.0 seconds = 1708.673 FPS

$ vblank_mode=0 gdb glxgears 2>&1 | grep FPS
1216 frames in 5.0 seconds = 242.979 FPS
1131 frames in 5.0 seconds = 226.024 FPS
862 frames in 5.0 seconds = 172.242 FPS

It looks like opening/exiting threads has a noticeable overhead.
Comment 5 Thierry Vignaud 2011-03-03 07:49:34 UTC
Come on, you cannot decently compare performance when running under GDB...
GDB has its own thread overhead
Comment 6 Fabio Pedretti 2011-03-04 02:34:24 UTC
(In reply to comment #5)
> Come on, you cannot decently compare performance when running under GDB...
> GDB has its own thread overhead

The point is that on my system, for whatever reason, r300g threading make every application I tried slower (or at least not faster), with or without gdb. Running it under gdb amplifies the problem and may be a useful test case to further debug the problem to who, instead, got the speedups, possibly because on his system the thread management overhead is less than the benefit from using two CPU cores. Maybe it's possible to leave the thread always open without opening/exiting it many times.
Comment 7 Marek Olšák 2011-03-07 23:29:27 UTC
Does commit 5650a719f0c69c00954e47bd7a7b3e9433cb551d improve anything? It speeds up glxgears here.
Comment 8 Fabio Pedretti 2011-03-08 02:22:57 UTC
(In reply to comment #7)
> Does commit 5650a719f0c69c00954e47bd7a7b3e9433cb551d improve anything? It
> speeds up glxgears here.

Definitively. Now on enabling threading:
- torcs goes from ~23 to ~28 fps (before was ~20 with or without threading);
- glxgears with or without gdb doesn't slowdown any more, however I also don't get any speedup, fps are all within 1.5% (interestingly gdb no longer prints the 'New Thread...', 'Thread ... exited' info, it looks like the same path is always taken);
- openarena without gdb is still a bit slower (~100 vs ~103 fps);
- openarena under gdb is still a lot slower (~76 vs ~103).

(Note that when running under gdb to get correct numbers I add '2>&1 > /dev/null' or else the thread info printing on console slowdown apps even more.)
Comment 9 Fabio Pedretti 2011-03-08 06:07:15 UTC
> - torcs goes from ~23 to ~28 fps (before was ~20 with or without threading);

Note: for some reason torcs here still gives about ~20 fps when vblank_mode=0 is not set, threading enabled or not. So the ~20 I was getting before was because of that. Testing again the pre 5650a7 with vblank_mode=0 (as done with glxgears and openarena) still gives ~23 (thread off) and ~28 fps (thread on).

> - openarena without gdb is still a bit slower (~100 vs ~103 fps);
With pre 5650a7 I am getting a max of ~96 fps.

> - openarena under gdb is still a lot slower (~76 vs ~103).
With pre 5650a7 I am getting a max of ~38 fps.
Comment 10 Marek Olšák 2011-06-08 17:20:48 UTC
(In reply to comment #8)
> - openarena without gdb is still a bit slower (~100 vs ~103 fps);

Because that was the only remaining slowdown and now I can't see any difference between threading enabled and disabled in openarena (if I enable hyperz, there is a slowdown 153->152 fps with threading off->on, respectively, which I don't consider significant, given the improvement in other apps), I am closing this bug.
Comment 11 Fabio Pedretti 2011-08-30 06:35:26 UTC
This commit fixes the performance regression when running under gdb:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=210ddf0819b5acf87a614214b6d4b02193aafa4a


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.