Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

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.
rpxrpx

Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by rpxrpx » 2019-09-09, 15:05

Compiling Palemoon on Linux on non x86/amd64 architectures there is a show stopper that breaks the build process. It is a hard wired SSE/SSE2 optimisation in the file: build/autoconf/compiler-opts.m4

I use the simple patch below every time I compile, but it would be great if Palemoon would compile out of the box. Can we make the optimisation in compiler-opts.m4 only appear if SSE optimisation is enabled in the .mozconfig file or something like that?
Or even better: Passing down any kind of optimisation from .mozconfig. May it be SSE or AltiVec or something else.

Code: Select all

git diff build/autoconf/compiler-opts.m4
diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4
index 82d0b43fc..c47d792f4 100644
--- a/build/autoconf/compiler-opts.m4
+++ b/build/autoconf/compiler-opts.m4
@@ -176,8 +176,8 @@ if test "$GNU_CC"; then
         CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
         CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
     fi
-    CFLAGS="$CFLAGS -fno-math-errno -msse2 -mfpmath=sse"
-    CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-math-errno -msse2 -mfpmath=sse"
+    CFLAGS="$CFLAGS -fno-math-errno"
+    CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-math-errno"
 
     if test -z "$CLANG_CC"; then
         case "$CC_VERSION" in
Thank you and keep up the great work on this project. :thumbup:

User avatar
adesh
Board Warrior
Board Warrior
Posts: 1277
Joined: 2017-06-06, 07:38

Re: Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by adesh » 2019-09-09, 18:35

I think the optimization is in line with the platform requirements for Pale Moon (UXP).

New Tobin Paradigm

Re: Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by New Tobin Paradigm » 2019-09-09, 19:49

Indeed it is. SSE2 is REQUIRED as a minimum for any UXP application regardless of target os. (My Win64 builds require AVX though).

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

Re: Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by Moonchild » 2019-09-09, 23:22

I think the issue here is that SSE2 is an Intel-architecture specific instruction set that MIPS/Sparc/PPC processors won't have. A compiler for those architectures may complain about an unsupported compiler parameter and abort.
"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

New Tobin Paradigm

Re: Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by New Tobin Paradigm » 2019-09-10, 03:16

Then we should fix that. Or just revert it and specify it in mozconfig or find a better place than there to have it added.

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

Re: Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by Moonchild » 2019-09-10, 08:45

"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

rpxrpx

Re: Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by rpxrpx » 2019-09-11, 15:06

@Moonchild: Thank you very much. This fixes the problem.

May I suggest to enhance this patch to:

Code: Select all

    if test "$CPU_ARCH" = "x86" -o "$CPU_ARCH" = "x86_64"; then
      CFLAGS="$CFLAGS -msse2 -mfpmath=sse"
      CXXFLAGS="$CXXFLAGS -msse2 -mfpmath=sse"
    elif test "$CPU_ARCH" = "ppc64"; then
      CFLAGS="$CFLAGS -maltivec"
      CXXFLAGS="$CXXFLAGS -maltivec"
    fi
All 64bit PowerPC CPUs (PowerPC 970, 970FX, 970MP, 970GX) provide an AltiVec compatible SIMD unit, even if IBM calls it VMX. So the test for "ppc64" covers all relevant CPUs.
Note: This could be further improved by adding a test for Apple G4 CPUs, that also provide AltiVec. But those CPUs are 32bit so I don't know if they are supported at all.

I just used the patch above in the current development branch (tag 18a2244f5b1e28c2d38dd95bf93d02cef0173178) and the compilation (on a PPC970MP cpu) went well and Palemoon seems to run well too.

Thank you. :thumbup:

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

Re: Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by Moonchild » 2019-09-11, 16:00

You can always add specific optimizations to your mozconfig if you want to use them:

Code: Select all

ac_add_options --enable-optimize="-O2 -maltivec"
...or similar.
"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
wicknix
Fanatic
Fanatic
Posts: 173
Joined: 2018-03-26, 04:47
Location: Wisconsin, USA
Contact:

Re: Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by wicknix » 2019-09-12, 02:40

rpxrpx wrote:
2019-09-11, 15:06
Note: This could be further improved by adding a test for Apple G4 CPUs, that also provide AltiVec. But those CPUs are 32bit so I don't know if they are supported at all.
Might not be an officially supported arch, but with a little extra elbow grease it builds and runs on 32-bit powerpc quite well. The only semi issue i found is colors in videos are reversed (red/blue).

Image

Cheers
Silence is golden, but duct tape is silver...

New Tobin Paradigm

Re: Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by New Tobin Paradigm » 2019-09-12, 04:57

So you will waste time on that but ignore requests for months not working towards an official mac build. Have to say you macintosh people are very disappointing.

Every damn one of you I have come across.

User avatar
wicknix
Fanatic
Fanatic
Posts: 173
Joined: 2018-03-26, 04:47
Location: Wisconsin, USA
Contact:

Re: Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by wicknix » 2019-09-12, 07:09

For the record: First, I am a Mac, Linux, and OpenBSD person. Second, I am not getting paid. I have a full time job, a wife, pets, friends, social life, etc. The time i put in to Mac stuff is of my own free will, when i have time, or the will to do so. I'm also a hobbyist who isn't an elite coder, that's learning as i go. So, with that said, chill out, or better yet, you own a Mac now, you do it.
Silence is golden, but duct tape is silver...

New Tobin Paradigm

Re: Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by New Tobin Paradigm » 2019-09-12, 07:48

I can RUN but I can't compile as you well know.. It is 10 years old, doesn't have enough ram, and it has heating issues. I told you this AT THE TIME.

If I could do it I would have done it by now.

So don't give me that shit. I put faith in you like SpockMan2, sugis, the rest and all I get is disappointment. So don't ask for shit if we ain't gonna get anything back.

The fuck is wrong with people.

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

Re: Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by Moonchild » 2019-09-12, 13:53

wicknix... I've been waiting for you to get stuff moving for an official Mac version. For months now. You said you were going to do this, so it doesn't matter if you are paid or not; if you say you are going to do something then do it, and not do something else first because it's more interesting for you at this time.

If you'd rather do something else, LET US KNOW and NOT keep us hanging on a promise, so we can find someone else to get Mac underway? I'm very unimpressed and I'm worried you won't maintain it either at this point... the nth Mac person doing so for Pale Moon.
By the way, Travis also has a job, a wife, family, etc. etc. and still has done Linux perfectly for years -- it's no excuse.
"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
wicknix
Fanatic
Fanatic
Posts: 173
Joined: 2018-03-26, 04:47
Location: Wisconsin, USA
Contact:

Re: Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by wicknix » 2019-09-13, 20:26

Hmmm.. belittling me and the other Mac users who helped get PM to a usable state on Mac is a great way to make sure it gets done. Delete my account. I'll donate my free time elsewhere.
Silence is golden, but duct tape is silver...

New Tobin Paradigm

Re: Linux: Hard coded SSE optimisation stops compilation on mips/sparc/ppc64

Unread post by New Tobin Paradigm » 2019-09-13, 21:31

I thank you for what you have done but as near as I can tell.. You haven't done anything for a long time. You are on freenode perpetually yet ignore me. We ask for you to test something with reasonable time window for you to see, do it, and respond and you come in AFTER someone else has already done it. I told you that we had some stuff to discuss and I needed you to come around when you could and you NEVER showed up.

You having free time or not isn't the issue here it is that you haven't been communicating and that is very frustrating. Lack of communication and follow through is the issue here which wasn't how it was when you were doing a fantastic job with whatever time you could spare. But then to see this unrelated "accomplishment" when getting macintosh to official build status has been the primary job you wanted to take on and it simply pissed me off. I was frustrated and disappointed and maybe you feel that is unfair to you and "all mac users" except every person who has came before you has done the same damn thing.

Now you want to ragedelete your account like something I said to you was so monstrous that you can no longer be associated with us. I find that shocking because you agreed with pretty much everything we have talked about in regards to mac development and the specific people who came before as well as this project. So either you are merely a coward trying to escape responsibility for your recent lack of communication and inaction OR you have been disingenuous from the very start and I was a fool to put faith in you, trust you, and vouch for you.

So before you ragequit.. Tell me which one it is. I'll accept the latter. Not like it hasn't happened before. Me being a fool. However, the former can be forgiven even now if you talk about it.

I await your answer.

Locked