https://bugs.winehq.org/show_bug.cgi?id=55899
Bug ID: 55899 Summary: Daily Chthonicle - performance regression Product: Wine Version: 8.20 Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: dark.shadow4@web.de Distribution: ---
Created attachment 75437 --> https://bugs.winehq.org/attachment.cgi?id=75437 Hack to work around the issue
Since wine-8.9 the already very slow game (bug 53947) is even slower. It takes approximately 3 times longer to render each image
Bisected to commit 62173699c38453777c7d5638ed2e779790506b75 Author: Alexandre Julliard julliard@winehq.org Date: Tue May 30 12:11:51 2023 +0200
include: Don't align the stack for PE builds.
Attaching a small hack to partially revert that commit, that works around the issue.
https://bugs.winehq.org/show_bug.cgi?id=55899
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch, performance, | |regression Regression SHA1| |62173699c38453777c7d5638ed2 | |e779790506b75
https://bugs.winehq.org/show_bug.cgi?id=55899
Gabriel Ivăncescu gabrielopcode@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gabrielopcode@gmail.com
--- Comment #1 from Gabriel Ivăncescu gabrielopcode@gmail.com --- Are you using any special CFLAGS?
What happens if you use "-mpreferred-stack-boundary=2" as additional CFLAGS? Or "-mincoming-stack-boundary=2 -mpreferred-stack-boundary=4"? Does either of them change anything?
https://bugs.winehq.org/show_bug.cgi?id=55899
--- Comment #2 from Fabian Maurer dark.shadow4@web.de --- My flags (taken from Makefile) are
CFLAGS = -g -O0 -fcommon -O2 i386_CFLAGS = -g -O0 -fcommon -O2 i386_EXTRACFLAGS = -D__WINE_PE_BUILD -Wall -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers -Winit-self -Wno-packed-not-aligned -Wshift-overflow=2 -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith -Wlogical-op -Wabsolute-value -fno-omit-frame-pointer -gdwarf-4 EXTRACFLAGS = -Wall -pipe -fcf-protection=none -fvisibility=hidden -fno-stack-protector -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers -Winit-self -Wno-packed-not-aligned -Wshift-overflow=2 -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith -Wlogical-op -gdwarf-4
Note that I didn't set those EXTRACFLAGS
The first gives
cc1: error: '-mpreferred-stack-boundary=2' is not between 3 and 12
The second gives
cc1: error: '-mincoming-stack-boundary=2' is not between 3 and 12
https://bugs.winehq.org/show_bug.cgi?id=55899
--- Comment #3 from Gabriel Ivăncescu gabrielopcode@gmail.com --- Ah yeah, probably because it gets added to x86_64 as well, which obviously doesn't support 4-byte stack alignment. You'll have to add it only to the i386_CFLAGS (not sure if that's possible with env vars, but you can just edit the Makefile manually after it's generated and add them).
https://bugs.winehq.org/show_bug.cgi?id=55899
--- Comment #4 from Gabriel Ivăncescu gabrielopcode@gmail.com --- Sorry, forgot to mention, you should be adding it to i386_CROSSCFLAGS, for PE modules, not unixlib.
https://bugs.winehq.org/show_bug.cgi?id=55899
--- Comment #5 from Fabian Maurer dark.shadow4@web.de --- An thanks, it works now.
-mpreferred-stack-boundary=2
helps, more or less completely resolves the issue
-mincoming-stack-boundary=2 -mpreferred-stack-boundary=4
doesn't change anything
I have no idea what to make of that though.
https://bugs.winehq.org/show_bug.cgi?id=55899
--- Comment #6 from Gabriel Ivăncescu gabrielopcode@gmail.com --- mpreferred-stack-boundary is how GCC prefers to keep the stack aligned. -mincoming-stack-boundary is what GCC assumes the incoming stack from external callers (i.e. code it cannot "see" or analyze itself). Both are powers-of-2, so value of 2 means 4 bytes, value of 4 means 16 bytes alignment.
-mpreferred-stack-boundary implies -mincoming-stack-boundary, if it's not set (it will be set to same value).
On 32-bit Windows, incoming stack is aligned to 4 bytes only (it's not guaranteed to be more), but on Linux it's 16 bytes. There's a bug with MinGW where it doesn't default to mpreferred-stack-boundary=2 (see MR !4030).
I don't know why it affects performance, though, but might be due to the bug. What I mean is it's totally normal for -mpreferred-stack-boundary=2 to be better, but I don't understand why it's "fast" when it always aligns the stack (reverting the commit).
Anyway I think this is another argument why we'd want to have that MR in… instead of waiting for upstream to fix it (if ever).
https://bugs.winehq.org/show_bug.cgi?id=55899
Alex Henrie alexhenrie24@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.winehq.org/sho | |w_bug.cgi?id=55007 CC| |alexhenrie24@gmail.com
--- Comment #7 from Alex Henrie alexhenrie24@gmail.com --- My guess is that because MinGW wrongly assumes that the stack is always aligned to multiples of 16 bytes, it emits instructions that are fast for aligned memory but slow for unaligned memory.
https://bugs.winehq.org/show_bug.cgi?id=55899
Julian Rüger jr98@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jr98@gmx.net
https://bugs.winehq.org/show_bug.cgi?id=55899
Alex Henrie alexhenrie24@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |4b458775bb8c9492ac859cfd167 | |c5f54f245dec1 Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #8 from Alex Henrie alexhenrie24@gmail.com --- Fixed by https://gitlab.winehq.org/wine/wine/-/commit/4b458775bb8c9492ac859cfd167c5f5...
https://bugs.winehq.org/show_bug.cgi?id=55899
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 9.0-rc1.
https://bugs.winehq.org/show_bug.cgi?id=55899
Alex Henrie alexhenrie24@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.winehq.org/sho | |w_bug.cgi?id=45289
https://bugs.winehq.org/show_bug.cgi?id=55899
Gabriel Ravier gabravier@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gabravier@gmail.com