Previous Thread
Next Thread
Print Thread
#124137 01/19/25 07:47 AM
Joined: Mar 2004
Posts: 702
Likes: 2
Senior Member
Senior Member
Joined: Mar 2004
Posts: 702
Likes: 2
Hello,

the official builds have recently switched to using x86_64-v2 as the compilation target. Additionally, there is some effort in Fedora to allow shipping optimised binaries [1]. Both of these make me wonder: are there any benchmarks showing improved performance when enabling the additional CPU instructions? Fedora packaging guidelines discourage deviating from the default flags unless one has receipts it helps [2], and as such, mame is currently build with -O2. A while back, the flags did not seem to have huge effect [3]. Has this changed?

[1] https://fedoraproject.org/wiki/Changes/Optimized_Binaries_for_the_AMD64_Architecture_v2
[2] https://docs.fedoraproject.org/en-US/packaging-guidelines/#_compiler_flags
[3] https://www.reddit.com/r/MAME/comments/mi9l4c/some_mame_0230_benchmarks_with_different_cflags/

Joined: Mar 2001
Posts: 17,249
Likes: 265
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,249
Likes: 265
We have receipts for x86-64-v2, O2 vs O3 varies by compiler.

Joined: Feb 2004
Posts: 2,622
Likes: 326
Very Senior Member
Very Senior Member
Joined: Feb 2004
Posts: 2,622
Likes: 326
That reddit thread is looking at things through a very narrow lens. He’s just saying “Do I get higher frame rates in these specific games?”

SSE4.2 is the point where you start to see improvements from vectorising string handling and general data loops, and even the compiler’s automatic vectorisation starts being effective. Allowing SSE4.2 gives small but useful improvements for software list parsing, the system and software selection menus, the -listxml verb, and various other things. As MAME continues to grow, it adds up. That’s putting aside the gains you get for stuff that uses it directly and the measurable improvement in emulation performance for 3D graphics.

But I really don’t care what you do for Fedora, because you’ll still have stuff like GNU libc _FORTIFY_SOURCE enabled and other things that more than outweigh any gains you’ll get for this. (I’ll take this opportunity to remind people that _FORTIFY_SOURCE can cause weird changes in behaviour, like causing strlcpy to read more than the number of bytes specified by the length argument or change the IR in a way that causes the optimiser to assume code is unreachable, and there have been CVEs for serious bugs in the supposedly “fortified” versions of C library functions.)

Joined: Mar 2004
Posts: 702
Likes: 2
Senior Member
Senior Member
Joined: Mar 2004
Posts: 702
Likes: 2
Originally Posted by Vas Crabb
But I really don’t care what you do for Fedora, because you’ll still have stuff like GNU libc _FORTIFY_SOURCE enabled and other things that more than outweigh any gains you’ll get for this. (I’ll take this opportunity to remind people that _FORTIFY_SOURCE can cause weird changes in behaviour, like causing strlcpy to read more than the number of bytes specified by the length argument or change the IR in a way that causes the optimiser to assume code is unreachable, and there have been CVEs for serious bugs in the supposedly “fortified” versions of C library functions.)
That's a bit harsh. Would you prefer Fedora not to carry mame packages? Decision how much sense certain flags make in a distribution-wide context is way above my pay grade, and the packaging guidelines mandate that all packages use distro-wide CFLAGS. If this is any consolation, I got a permission to filter out -D_GLIBCXX_ASSERTIONS. Ultimately, if we want to be able Fedora users to install mame from the package repositories, I have to play by the packaging rules. I know how to build mame from source and so do the users who want to squeeze out every last bit of performance, but do we really want to tell every Fedora user that they need to build from source? We are all volunteers, and if my time is better spent elsewhere, this can be arranged.
That aside, if there are gains to be made from using advanced instructions, I will follow more closely if the optimised binaries feature gets anywhere. If anything, this will maybe offset the performance losses caused by the compiler flags to some extent.

Joined: Aug 2009
Posts: 1,277
Likes: 209
Very Senior Member
Very Senior Member
Joined: Aug 2009
Posts: 1,277
Likes: 209
I did some quick tests and got a ~+15% on Amiga by just mimicking the flags used (i.e. 610% -> 627%, with a500 rodland over 60 seconds). This by just using the same compiler options as the ones that Vas hooked up in his build release commit. This on F41 / Intel 11th gen CPU.

1 member likes this: belegdol
Joined: Feb 2004
Posts: 2,622
Likes: 326
Very Senior Member
Very Senior Member
Joined: Feb 2004
Posts: 2,622
Likes: 326
I have mixed feelings about the MAME packages provided by Linux distributions. I understand that they’re a convenience for users, but they all change things and end up providing an experience we can’t really endorse. FWIW Fedora is one of the better distros in this regard – MAME packaged for Fedora is pretty close to stock MAME.

I had a particularly bad experience with the person making the package for Void Linux. Every time they asked for advice, they insisted on doing the opposite of what I recommended. I believe the Arch Linux package is based on the Void Linux package. I would recommend against using either.

Trying to work with the person who wanted to make Debian packages was incredibly frustrating, too. They seemed to have no aptitude for actually handling porting issues, and would immediately start demanding assistance any time they encountered anything that required any thought. They’d need hand-holding for everything. It was like they wanted credit for packaging MAME while pushing the actual work back onto me.

As for how much value the Linux packages provide, I’m not sure. Mac users are often mocked for being non-technical and needing a one-button mouse interface to do anything, but Mac users have had no trouble compiling MAME for themselves since the days when SDLMAME was still a patch set. I would expect Linux users could work it out.

2 members like this: robcfg, belegdol

Link Copied to Clipboard
Who's Online Now
3 members (robcfg, 2 invisible), 95 guests, and 0 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,345
Posts122,343
Members5,082
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Powered by UBB.threads™ PHP Forum Software 8.0.0