Re: SIMD optimization for list_sort

2025-03-03 Thread John Naylor
On Sat, Mar 1, 2025 at 1:23 PM Shankaran, Akash wrote: > Given the same x86-simdsort library is intended to optimize 1) list_sort 2) > tuple sort, it didn't make sense to duplicate the work to integrate it in > pg_vector for list_sort, and then again in postgres for tuple-sort. Thank you for t

RE: SIMD optimization for list_sort

2025-03-01 Thread Shankaran, Akash
>> > I don't think "another extension might use it someday" makes a very strong >> > case, >> > particularly for something that requires a new dependency. >> >> The x86-simdsort library is an optional dependency in Postgres. Also the new >> list sort implementation which uses the x86-simdsort lib

Re: SIMD optimization for list_sort

2025-02-28 Thread John Naylor
On Fri, Feb 28, 2025 at 12:43 PM R, Rakshit wrote: > > I don't think "another extension might use it someday" makes a very strong > > case, > > particularly for something that requires a new dependency. > > The x86-simdsort library is an optional dependency in Postgres. Also the new > list sort

RE: SIMD optimization for list_sort

2025-02-27 Thread R, Rakshit
Hi All, Thank you so much for the feedback. > I don't think "another extension might use it someday" makes a very strong > case, > particularly for something that requires a new dependency. The x86-simdsort library is an optional dependency in Postgres. Also the new list sort implementation

RE: SIMD optimization for list_sort

2025-02-20 Thread Devulapalli, Raghuveer
> Note that our current implemention is highly optimized for low-cardinality > inputs. > This is needed for aggregate queries. I found this write-up of a couple > scalar and > vectorized sorts, and they show this library doing very poorly on very-low > cardinality inputs. I would look into that b

Re: SIMD optimization for list_sort

2025-02-18 Thread John Naylor
On Tue, Feb 18, 2025 at 1:49 PM R, Rakshit wrote: > > Hi All, > > Thank you very much for your feedback! We investigated the recommendations as > we developed the current patch. Please refer to the comments below. > > > I'd suggest targeting pg_qsort() directly, instead of list_sort(). > > list_

RE: SIMD optimization for list_sort

2025-02-17 Thread R, Rakshit
gards, -Original Message- From: Andrei Lepikhov Sent: Saturday, November 23, 2024 8:50 AM To: Giacchino, Luca ; pgsql-hackers@lists.postgresql.org Cc: R, Rakshit ; Shankaran, Akash ; Devulapalli, Raghuveer Subject: Re: SIMD optimization for list_sort On 22/11/2024 06:27, Giacchino, Luca wrot

Re: SIMD optimization for list_sort

2024-11-22 Thread Andrei Lepikhov
On 22/11/2024 06:27, Giacchino, Luca wrote: We’d appreciate feedback on this approach. In the meantime, we will complete the patch to share. We also plan to extend SIMD-based sort to tuple sort in the future. Nice! I continually see performance reports when sorting and group order impact perfor

Re: SIMD optimization for list_sort

2024-11-22 Thread John Naylor
On Fri, Nov 22, 2024 at 6:27 AM Giacchino, Luca wrote: > We’d appreciate feedback on this approach. In the meantime, we will complete > the patch to share. We also plan to extend SIMD-based sort to tuple sort in > the future. Coincidentally, I'll be prototyping a tuple sort that will take bette

Re: SIMD optimization for list_sort

2024-11-22 Thread Nathan Bossart
On Fri, Nov 22, 2024 at 06:01:22PM +0200, Heikki Linnakangas wrote: > On 22/11/2024 01:27, Giacchino, Luca wrote: >> We´d appreciate feedback on this approach. In the meantime, we will >> complete the patch to share. We also plan to extend SIMD-based sort to >> tuple sort in the future. > > If you

Re: SIMD optimization for list_sort

2024-11-22 Thread Heikki Linnakangas
On 22/11/2024 01:27, Giacchino, Luca wrote: The existing list_sort takes a comparator function to compare pairs of ListCell. On the other hand, x86-simd-sort requires an array of numeric values to sort, and it returns an array of sorted indices. To enable x86-simd-sort, we add new list_sort_sim

SIMD optimization for list_sort

2024-11-21 Thread Giacchino, Luca
Hi All, We propose enabling SIMD-based sort for list_sort using the x86-simd-sort library (https://github.com/intel/x86-simd-sort). The existing list_sort takes a comparator function to compare pairs of ListCell. On the other hand, x86-simd-sort requires an array of numeric values to sort, and