| Lists: | pgsql-hackers |
|---|
| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers(at)postgresql(dot)org |
| Cc: | johncnaylorls(at)gmail(dot)com |
| Subject: | a couple of small patches for simd.h |
| Date: | 2025-09-22 21:44:20 |
| Message-ID: | aNHDNDSHleq0ogC_@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
0001 essentially reverts commit c6a43c2, and instead fixes the problem
(MSVC dislikes casts to the same type) by omitting the cast in the
problematic line in pg_lfind32(). While working on optimizing hex_encode()
and hex_decode() [0], I noticed that implicit conversions sufficed.
0002 optimizes vector8_has_le() on AArch64 by using vminvq_u8(). I needed
vector8_has_ge() for the hex_encode()/hex_decode() work and noticed this
opportunity.
[0] https://commitfest.postgresql.org/patch/5538/
--
nathan
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Remove-vector32_is_highbit_set.patch | text/plain | 2.1 KB |
| v1-0002-Optimize-vector8_has_le-on-AArch64.patch | text/plain | 627 bytes |
| From: | John Naylor <johncnaylorls(at)gmail(dot)com> |
|---|---|
| To: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: a couple of small patches for simd.h |
| Date: | 2025-09-24 01:04:59 |
| Message-ID: | CANWCAZaLyxDHoDFjvtaz0aM6Agx=P5i=0T8HnkgLNdwXwJn9Ug@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On Tue, Sep 23, 2025 at 4:44 AM Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
>
> 0001 essentially reverts commit c6a43c2, and instead fixes the problem
> (MSVC dislikes casts to the same type) by omitting the cast in the
> problematic line in pg_lfind32(). While working on optimizing hex_encode()
> and hex_decode() [0], I noticed that implicit conversions sufficed.
I don't remember why that cast was there, but I suggest testing on gcc
/ aarch64 if you haven't already.
As for 0002, +1 for more succinct expressions when the hardware supports it.
--
John Naylor
Amazon Web Services
| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | John Naylor <johncnaylorls(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: a couple of small patches for simd.h |
| Date: | 2025-09-24 17:41:11 |
| Message-ID: | aNQtN89VW8z-yo3B@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On Wed, Sep 24, 2025 at 08:04:59AM +0700, John Naylor wrote:
> On Tue, Sep 23, 2025 at 4:44 AM Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
>> 0001 essentially reverts commit c6a43c2, and instead fixes the problem
>> (MSVC dislikes casts to the same type) by omitting the cast in the
>> problematic line in pg_lfind32(). While working on optimizing hex_encode()
>> and hex_decode() [0], I noticed that implicit conversions sufficed.
>
> I don't remember why that cast was there, but I suggest testing on gcc
> / aarch64 if you haven't already.
Ah, I thought CI was testing that, but apparently it is not. After some
basic testing in godbolt.org, I see that leaving out the cast makes
gcc/arm64 unhappy, and adding the cast makes msvc/x64 unhappy. gcc has a
-flax-vector-conversions option that fixes it, but the documentation for
that option [0] cautions against using it. So, 0001 is bogus, and I need
to figure out how to get the hex_{encode,decode} patches working for
gcc/arm64...
[0] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#index-flax-vector-conversions
--
nathan
| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | John Naylor <johncnaylorls(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: a couple of small patches for simd.h |
| Date: | 2025-09-25 19:10:19 |
| Message-ID: | aNWTmzIHyqeTo7Kw@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
Here's a new version of 0002 with a modified SSE2 implementation, as
discussed elsewhere [0]. This allows us to remove vector8_ssub().
[0] https://postgr.es/m/aNWO7L43UevRErw_%40nathan
--
nathan
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Optimize-vector8_has_le-on-AArch64.patch | text/plain | 2.2 KB |
| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | John Naylor <johncnaylorls(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: a couple of small patches for simd.h |
| Date: | 2025-09-25 21:27:35 |
| Message-ID: | aNWzxxWxV3ScHNeE@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On Thu, Sep 25, 2025 at 02:10:19PM -0500, Nathan Bossart wrote:
> Here's a new version of 0002 with a modified SSE2 implementation, as
> discussed elsewhere [0]. This allows us to remove vector8_ssub().
Sorry for the noise. v3 fixes the mixed-declarations-and-code problems.
--
nathan
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-Optimize-vector8_has_le-on-AArch64.patch | text/plain | 2.5 KB |
| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | John Naylor <johncnaylorls(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: a couple of small patches for simd.h |
| Date: | 2025-10-02 17:36:12 |
| Message-ID: | aN64DMgVzSTyuvN7@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On Thu, Sep 25, 2025 at 04:27:35PM -0500, Nathan Bossart wrote:
> On Thu, Sep 25, 2025 at 02:10:19PM -0500, Nathan Bossart wrote:
>> Here's a new version of 0002 with a modified SSE2 implementation, as
>> discussed elsewhere [0]. This allows us to remove vector8_ssub().
>
> Sorry for the noise. v3 fixes the mixed-declarations-and-code problems.
Barring objections, I plan to commit this soon. Probably tomorrow.
--
nathan
| From: | John Naylor <johncnaylorls(at)gmail(dot)com> |
|---|---|
| To: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: a couple of small patches for simd.h |
| Date: | 2025-10-03 07:40:22 |
| Message-ID: | CANWCAZYzD0OZ0HcPAoJtZ+h48Acm6LeG1c3rhfK8w4y+o68AsQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On Fri, Oct 3, 2025 at 12:36 AM Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
> Barring objections, I plan to commit this soon. Probably tomorrow.
LGTM.
--
John Naylor
Amazon Web Services
| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | John Naylor <johncnaylorls(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: a couple of small patches for simd.h |
| Date: | 2025-10-03 19:04:10 |
| Message-ID: | aOAeKrWw1kD6SzJE@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On Fri, Oct 03, 2025 at 02:40:22PM +0700, John Naylor wrote:
> LGTM.
Committed, thanks for reviewing.
--
nathan