Re: Improving spin-lock implementation on ARM. - Mailing list pgsql-hackers

From Krunal Bauskar
Subject Re: Improving spin-lock implementation on ARM.
Date
Msg-id CAB10pya7k0zo5O9me5K7VD-A1y=bGe=hz10w-UBrG0BZfb-GxQ@mail.gmail.com
Whole thread Raw
In response to Re: Improving spin-lock implementation on ARM.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Improving spin-lock implementation on ARM.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers


On Mon, 30 Nov 2020 at 10:14, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Krunal Bauskar <krunalbauskar@gmail.com> writes:
> So given all the permutations and combinations, I think we could approach
> the problem as follows:

> * Enable use of CAS as it is known to have optimal performance (vs TAS)

The results I posted at [1] seem to contradict this for Apple's new
machines.

In general, I'm pretty skeptical of *all* the results posted so far on
this thread, because everybody seems to be testing exactly one machine.
If there's one thing that it's safe to assume about ARM, it's that
there are a lot of different implementations; and this area seems very
very likely to differ across implementations.

For the results you saw on Mac-Mini was LSE enabled by default.
Maybe clang does it on mac by default to harvest performance.
If that is the case then your results are still inline with what Alexander posted.

On other hand, Peter saw some % improvement on M1 MacBook.

------

* Can you please check/confirm the LSE enable status on MAC (default).
* Also, if possible run some quick micro-benchmark to help understand how TAS and CAS perform
on MAC. It would be a big surprise to learn that M1 can execute TAS better than CAS (without lse).
* I would also suggest if possible try with higher scalability (more than 4 to check if with increase scalability CAS out-perform).

Results I have seen to date (in different contexts too), CAS has outperformed on Kunpeng, Graviton2, (Other ARM arch), ... (matches with theory too unless LSE is enabled).
If M1 goes the other way around that would be a big surprise for the arm community too.

 

I don't have a big problem with catering for a few different spinlock
implementations on ARM ... but it's sure unclear how we could decide
which one to use.

                        regards, tom lane

[1] https://www.postgresql.org/message-id/741389.1606530957@sss.pgh.pa.us


--
Regards,
Krunal Bauskar

pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: Printing backtrace of postgres processes
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] fix compilation with gnu89