Defaulting to AVX for 64-bit architectures?

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.

What instruction set should be the minimum for Pale Moon going forward?

Poll ended at 2024-03-09, 15:33

Keep it as-is (SSE2 or later)
18
33%
AVX (Bulldozer/AMD FX/Intel Sandy Bridge)
19
35%
AVX2 (Excavator/Zen/Haswell/Core i3/5/7)
15
27%
Just show me the results
3
5%
 
Total votes: 55

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35650
Joined: 2011-08-28, 17:27
Location: Motala, SE

Defaulting to AVX for 64-bit architectures?

Unread post by Moonchild » 2024-03-02, 15:33

AVX has been around for a long time now, ever since Jaguar/Puma/Bulldozer(AMD) and Intel Sandy Bridge, both in 2011. That covers the vast majority of Pale Moon's lifespan, and it's high time that we move to using it if we want to keep saying that it is "optimized for modern processors" which was previously an indicator we were ahead of the curve in terms of SIMD instructions. All supported operating systems also provide OS support for the AVX instruction set (which is the other half of the equation).
AVX2 was introduced just a few years later, with Haswell (2013) and Excavator (Q2 2015), the latest of which is now also almost 10 years old.

Users of the independent AVX builds have also indicated they notice considerable performance enhancement when in use, so there is no real reason to further delay this in 2024, and I'd like to move forward with this, but I'm on the fence whether I should use AVX or AVX2, as I don't have a good handle on what percentage of our users are on unsupported hardware (I can imagine especially the AMD camp might still be rocking FX CPUs or what not, which are AVX but not AVX2 capable).
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
Pentium4User
Board Warrior
Board Warrior
Posts: 1138
Joined: 2019-04-24, 09:38

Re: Defaulting to AVX for 64-bit architectures?

Unread post by Pentium4User » 2024-03-02, 16:03

My Celeron J4125 doesn't have AVX - it is from 2019.

Enforcing SSE3 seems reasonable for me, but AVX would exclude too much.

EDIT: Why not making AVX default and provide non-AVX builds alongside, at least for Linux?
The profile picture shows my Maico EC30 E ceiling fan.

mrnhmath
Fanatic
Fanatic
Posts: 122
Joined: 2017-06-21, 02:37

Re: Defaulting to AVX for 64-bit architectures?

Unread post by mrnhmath » 2024-03-02, 16:57

Nehalem and Stars based CPUs are pretty capable still, I wouldn't lock them out of 64-bit builds.

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1537
Joined: 2018-10-28, 19:56
Location: Georgia

Re: Defaulting to AVX for 64-bit architectures?

Unread post by athenian200 » 2024-03-02, 17:55

I still have an Ivy Bridge machine that I run Pale Moon and Epyrus on as I type this. Same machine I was using as a development PC three years ago, actually. It was exactly one generation short of Haswell, the requirement for AVX2, and cannot be upgraded to it without moving to an entirely new motherboard.

While I did replace my main development PC with something newer, and that could run Pale Moon without issues, adopting AVX2 for release builds would mean that I can no longer run the mainstream releases of Pale Moon on that machine. My Mom's laptop also has a similar CPU. I already had some weird issues with this when... you-know-who sent me prerelease builds of Interlink on IRC. He asked me if my CPU supported AVX, I said yes, then it didn't work, and I had to explain to him that my system supports AVX but not AVX2, and yes there is a difference, and he just rolled his eyes and said no one should be running anything older than Haswell anyway, so the difference "shouldn't matter."

So basically, I still have a ton of computers laying around that support AVX, but not AVX2. I got rid of everything that would be limited to SSE3 years ago.

However, on the other hand it is worth noting that unfortunately Intel has defined these ham-fisted "architecture levels," and most vendors aren't willing to pick and choose instructions to be compatible with Sandy/Ivy Bridge even though those chips were very popular. There's only x86-64-v2, which is the level of support I think we currently have or x86-64-v3, which would bump everything all the way to AVX2 and make all the Sandy and Ivy Bridge chips useless. RHEL 10 and Ubuntu are adopting that soon, making a Haswell CPU the minimum requirement.

So that is to say, it would inconvenience me personally if you made AVX2 the baseline, but that would be in line with what other vendors that are adopt x86-64-v3 are doing. Plus, I actually have the luxury of self-building versions of Pale Moon that will run on my PC myself, if it comes down to it, seeing as I know how our toolchain works.

EDIT: It is also worth noting that a lot of later Atom CPUs were limited to SSE4.2, so none of those would work with Pale Moon if it were AVX-only anyway. SSE4.2 was introduced with Nehalem and is what most late-model Atoms support.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

User avatar
trava90
Contributing developer
Contributing developer
Posts: 1742
Joined: 2013-05-20, 18:19
Location: Somewhere in Sector 001

Re: Defaulting to AVX for 64-bit architectures?

Unread post by trava90 » 2024-03-02, 18:04

As someone who is in the AMD camp I am in favor of using AVX but not AVX2 by default just yet. While my primary system is modern enough to support AVX2 without issue, I do still have an FX-6300 system that sees daily use and on which Pale Moon is used very heavily. I'm sure I'm not the only person out there who uses Pale Moon daily on an FX system and while I could obviously just build Pale Moon myself for that system, that's not really a solution for the majority of users.
Off-topic:
I even still have an old Phenom II 980 system (lacking even AVX) that sees nearly daily use, though I am not factoring Phenom's into my opinion.
Pentium4User wrote:
2024-03-02, 16:03
EDIT: Why not making AVX default and provide non-AVX builds alongside, at least for Linux?
Regardless of the final decision to use AVX or AVX2, the mainline Linux builds we provide will use the same default as the Windows builds. There will be nothing stopping anyone from building, using, or even contributing a non-AVX(2) build, but it will not be done by me.

User avatar
Southern_Computer_Geek
Hobby Astronomer
Hobby Astronomer
Posts: 21
Joined: 2022-04-16, 19:53
Location: Mississippi, USA

Re: Defaulting to AVX for 64-bit architectures?

Unread post by Southern_Computer_Geek » 2024-03-02, 18:07

Defaulting to AVX2 or at least AVX seems like a good idea to me. I suppose if there is enough demand for a plain SSE2 64-bit version someone could step up to provide alternative builds if the main team cannot. Most of my machines do not support AVX but I roll my own builds for those.
Image

User avatar
RealityRipple
Astronaut
Astronaut
Posts: 666
Joined: 2018-05-17, 02:34
Location: Los Berros Canyon, California

Re: Defaulting to AVX for 64-bit architectures?

Unread post by RealityRipple » 2024-03-02, 18:29

I think the answer lies in the question, "are Pale Moon's gains from AVX2 over first-gen AVX that much greater?" - if not, then there's no point to drop support for 10-15 year old CPUs in favor of <10 year old ones.

User avatar
Piotr Kostrzewski
Lunatic
Lunatic
Posts: 280
Joined: 2018-08-14, 15:08

Re: Defaulting to AVX for 64-bit architectures?

Unread post by Piotr Kostrzewski » 2024-03-02, 18:45

RealityRipple wrote:
2024-03-02, 18:29
I think the answer lies in the question, "are Pale Moon's gains from AVX2 over first-gen AVX that much greater?" - if not, then there's no point to drop support for 10-15 year old CPUs in favor of <10 year old ones.
Does the transition to AVX-2 mean abandoning SSE-2 and later? I understand that maintaining both technologies is time-consuming.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35650
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: Defaulting to AVX for 64-bit architectures?

Unread post by Moonchild » 2024-03-02, 18:53

Pentium4User wrote:
2024-03-02, 16:03
Enforcing SSE3 seems reasonable for me, but AVX would exclude too much.
SSE3 and 4.x wouldn't really bring much to the table for a web browser, which is why this wasn't brought up before. AVX, however, has a big impact on the typical use in the browser internals. Many parts of the code can be vectorized (we're using a compiler software equivalent of that now) and doing that in hardware really makes a difference.
Pentium4User wrote:
2024-03-02, 16:03
Celeron J4125 doesn't have AVX - it is from 2019.
That's really bad from Intel then. Still making Celerons, really?
I'm not sure if I should let ultra low power mobile machines be a limiting factor though. :think:
mrnhmath wrote:
2024-03-02, 16:57
Nehalem and Stars based CPUs
Aren't those really old Xeons? Are there really that many end-users using server hardware from < 2010 these days?

The overall response I read here is that AVX should be the choice, not AVX2, i.e. slightly more broadly compatible. While there is a big difference between SSE and AVX, i'm not sure we're intensively using the few extra CPU instructions introduced with AVX2, which is why I'm probing here.

Please do keep voting and giving your insights/opinions :) The more information I have, the better I can choose.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
opus_27
Apollo supporter
Apollo supporter
Posts: 36
Joined: 2020-06-16, 13:29

Re: Defaulting to AVX for 64-bit architectures?

Unread post by opus_27 » 2024-03-02, 19:01

My main (Windows 7, x64) driver supports AVX but not AVX2. I'm not sure it's up to making a specially configured build, so I'd need help if/when AVX2 becomes the default.

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1537
Joined: 2018-10-28, 19:56
Location: Georgia

Re: Defaulting to AVX for 64-bit architectures?

Unread post by athenian200 » 2024-03-02, 19:57

Piotr Kostrzewski wrote:
2024-03-02, 18:45
Does the transition to AVX-2 mean abandoning SSE-2 and later? I understand that maintaining both technologies is time-consuming.
Not really... actually if you use AVX, it's assumed you support SSE4.2 by default. In fact, Visual Studio doesn't even have a build flag to enable SSE4.2 individually, you have to enable AVX to imply support for it (which makes me wonder how Visual Studio handles falling back from AVX on Atom CPUs, if at all). So you get all the benefits of SSE4.x as well, it's not an either-or situation. All processors that support AVX also support all versions of SSE. The SSE levels build on each other, with each new level assuming you have the level before it, and AVX going on top of SSE4.

There is at least one benefit of SSE4 that I think might help Pale Moon a bit, though...
Wikipedia wrote: SSE4.2 added STTNI (String and Text New Instructions),[10] several new instructions that perform character searches and comparison on two operands of 16 bytes at a time. These were designed (among other things) to speed up the parsing of XML documents.[11] It also added a CRC32 instruction to compute cyclic redundancy checks as used in certain data transfer protocols. These instructions were first implemented in the Nehalem-based Intel Core i7 product line and complete the SSE4 instruction set. Support is indicated via the CPUID.01H:ECX.SSE42[Bit 20] flag.
So, given that Pale Moon does indeed parse XML documents and use data transfer protocols, I would be surprised if it had no advantage... if I'm understanding correctly, it might also make regexp faster?
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

User avatar
Piotr Kostrzewski
Lunatic
Lunatic
Posts: 280
Joined: 2018-08-14, 15:08

Re: Defaulting to AVX for 64-bit architectures?

Unread post by Piotr Kostrzewski » 2024-03-02, 20:11

athenian200 wrote:
2024-03-02, 19:57

Not really... actually if you use AVX, it's assumed you support SSE4.2 by default. In fact, Visual Studio doesn't even have a build flag to enable SSE4.2 individually, you have to enable AVX to imply support for it (which makes me wonder how Visual Studio handles falling back from AVX on Atom CPUs, if at all). So you get all the benefits of SSE4.x as well, it's not an either-or situation. All processors that support AVX also support all versions of SSE. The SSE levels build on each other, with each new level assuming you have the level before it, and AVX going on top of SSE4.

There is at least one benefit of SSE4 that I think might help Pale Moon a bit, though...
Wikipedia wrote: SSE4.2 added STTNI (String and Text New Instructions),[10] several new instructions that perform character searches and comparison on two operands of 16 bytes at a time. These were designed (among other things) to speed up the parsing of XML documents.[11] It also added a CRC32 instruction to compute cyclic redundancy checks as used in certain data transfer protocols. These instructions were first implemented in the Nehalem-based Intel Core i7 product line and complete the SSE4 instruction set. Support is indicated via the CPUID.01H:ECX.SSE42[Bit 20] flag.
So, given that Pale Moon does indeed parse XML documents and use data transfer protocols, I would be surprised if it had no advantage...
Thank you very much for your explanation.
You've given me another question out of curiosity. Is there anything in the Pale Moon engine that the developers might want to improve in terms of performance or functionality?

User avatar
suzyne
Lunatic
Lunatic
Posts: 364
Joined: 2023-06-28, 22:43
Location: Australia

Re: Defaulting to AVX for 64-bit architectures?

Unread post by suzyne » 2024-03-02, 21:01

I agree that with Optimized for modern processors as a bullet point on the home page that Pale Moon needs a better version than the current one. For 64 bit it should be AVX2 (or AVX) and anyone without a suitable processor can still use Pale Moon 32 bit, which in my experience, is very capable on older computers.
Laptop 1: Windows 10 64-bit, i7 @ 2.80GHz, 16GB, NVIDIA GeForce MX450.
Laptop 2: Windows 10 32-bit, Atom Z3735F @ 1.33GHz, 2GB, Intel HD Graphics.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35650
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: Defaulting to AVX for 64-bit architectures?

Unread post by Moonchild » 2024-03-02, 21:18

athenian200 wrote:
2024-03-02, 19:57
given that Pale Moon does indeed parse XML documents and use data transfer protocols, I would be surprised if it had no advantage...
Considering our already highly-optimized and blazing-fast XML parser, i really don't think there would be a notable difference there. Also, the vast majority of time spent parsing web documents is not parsing XML, but rather parsing and processing other types of documents and media. And that would find a much greater advantage from AVX instructions that improve string handling in general (much more than SSE4.2 would, AFAIK).

Of note we already do some hand-crafted assembly-optimization that selectively chooses SSE3/4 and AVX paths based on detected hardware for very hot paths, but that simply can't be extended to all code with conditional checking, which is where moving to AVX as a minimum architecture would come in.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
Al6bus
Lunatic
Lunatic
Posts: 288
Joined: 2015-08-24, 14:55
Location: Lemberg

Re: Defaulting to AVX for 64-bit architectures?

Unread post by Al6bus » 2024-03-02, 21:43

minimum sse3, for maximum compatibility. but 4.1 sounds reasonable

upd. completely forgot about 32-bit, mb sse3 for it and avx for 64
Last edited by Al6bus on 2024-03-02, 22:46, edited 5 times in total.
Windows 7 Pro x64 - Pale Moon x64
We hope for multiprocessing

User avatar
billmcct
Keeps coming back
Keeps coming back
Posts: 959
Joined: 2012-09-04, 15:19
Location: Costa Rica & Union City Georgia USA

Re: Defaulting to AVX for 64-bit architectures?

Unread post by billmcct » 2024-03-02, 21:51

I have 4 laptops here and all have a Intel Core i3 processor.
According to the instruction set they don't support AVX.
The highest is SSE4. However I'm still using 32-bit Pale Moon.
--------------------------------------------------------------------------------------------------------------
The difference between the Impossible and the Possible lies in a man's Determination.
Tommy Lasorda

Falna
Astronaut
Astronaut
Posts: 512
Joined: 2015-08-23, 17:56
Location: UK / France

Re: Defaulting to AVX for 64-bit architectures?

Unread post by Falna » 2024-03-02, 21:58

Both of my machines - one Intel, the other AMD - support AVX, but not AVX2.

Forked extensions :
● Add-ons Inspector ● Auto Text Link ● Copy As Plain Text ● Copy Hyperlink Text ● FireFTP button replacement ● gSearch Bar ● Navigation Bar Enhancer ● New Tab Links ● Number Tabs ● Print Preview Button and Keyboard Shortcut 2 ● Scrollbar Search Marker ● Simple Marker ● Tabs To Portfolio ● Update Alert ● Web Developer's Toolbox ● Zap Anything

Hint: If you expect a reply to your PM, allow replies...

User avatar
Eduardolucas1
Hobby Astronomer
Hobby Astronomer
Posts: 29
Joined: 2024-02-05, 03:15

Re: Defaulting to AVX for 64-bit architectures?

Unread post by Eduardolucas1 » 2024-03-02, 22:06

I`m one of the people who still actively run Pale Moon on SSE2 and 3 computers which are 64-bit. So i would see targeting an AVX-only requirement to be a little bit extreme when even the corporate browsers only require SSE3 (chromium) and SSE2 (Mozilla).

Lucio Chiappetti
Astronaut
Astronaut
Posts: 660
Joined: 2014-09-01, 15:11
Location: Milan Italy

Re: Defaulting to AVX for 64-bit architectures?

Unread post by Lucio Chiappetti » 2024-03-02, 22:28

The poll lacks an answer: "I haven't (almost) the faintest idea what is all about" :D :oops:
My home desktop has a sticker "Intel Core i7", the (newer) laptop possibly i5 ... the old work machine I do not know.
The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man. (G.B. Shaw)

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35650
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: Defaulting to AVX for 64-bit architectures?

Unread post by Moonchild » 2024-03-02, 22:37

billmcct wrote:
2024-03-02, 21:51
I have 4 laptops here and all have a Intel Core i3 processor.
According to the instruction set they don't support AVX.
All Intel Core i3/5/7 CPUs should support AVX, according to the information I have.
billmcct wrote:
2024-03-02, 21:51
The highest is SSE4. However I'm still using 32-bit Pale Moon.
32-bit wouldn't be impacted. This is only for 64-bit versions.
Eduardolucas1 wrote:
2024-03-02, 22:06
I`m one of the people who still actively run Pale Moon on SSE2 and 3 computers which are 64-bit. So i would see targeting an AVX-only requirement to be a little bit extreme when even the corporate browsers only require SSE3 (chromium) and SSE2 (Mozilla).
So how old are those SSE2 and 3 computers which are 64-bit? Wouldn't you think it'd be a little bit extreme if we keep targeting literally ancient hardware while leaving a lot of performance on the table for the other 95% (or maybe more) of the users?
Lucio Chiappetti wrote:
2024-03-02, 22:28
The poll lacks an answer: "I haven't (almost) the faintest idea what is all about" :D :oops:
"Just show me the results" :P
Seriously though if you want to know what your CPU supports, grab CPU-Z and have a look.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite