pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Chiranmoy.Bhattacharya@fujitsu.com <Chiranmoy.Bhattacharya@fujitsu.com>
Cc: Devanga.Susmitha@fujitsu.com <Devanga.Susmitha@fujitsu.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: Ragesh.Hajela@fujitsu.com <Ragesh.Hajela@fujitsu.com>
Subject: Re: [PATCH] Hex-coding optimizations using SVE on ARM.
Date: Fri, 10 Jan 2025 14:46:45 -0600
Message-ID: <Z4GHNfhRKuA0r_Wn@nathan> (raw)
In-Reply-To: <Z4E-5oQGux-2R4iL@nathan>
References: <OSZPR01MB8499D4884C4541159FA00ECC8B132@OSZPR01MB8499.jpnprd01.prod.outlook.com>
	<Z4AUr-Y-TPaqtg0y@nathan>
	<OSBPR01MB26648F7B60A543069C75EC43971C2@OSBPR01MB2664.jpnprd01.prod.outlook.com>
	<Z4E-5oQGux-2R4iL@nathan>

On Fri, Jan 10, 2025 at 09:38:14AM -0600, Nathan Bossart wrote:
> On Fri, Jan 10, 2025 at 11:10:03AM +0000, Chiranmoy.Bhattacharya@fujitsu.com wrote:
>> We tried auto-vectorization and observed no performance improvement.
> 
> Do you mean that the auto-vectorization worked and you observed no
> performance improvement, or the auto-vectorization had no effect on the
> code generated?

I was able to get auto-vectorization to take effect on Apple clang 16 with
the following addition to src/backend/utils/adt/Makefile:

	encode.o: CFLAGS += ${CFLAGS_VECTORIZE} -mllvm -force-vector-width=8

This gave the following results with your hex_encode_test() function:

    buf  | HEAD  | patch | % diff
  -------+-------+-------+--------
      16 |    21 |    16 |   24
      64 |    54 |    41 |   24
     256 |   138 |   100 |   28
    1024 |   441 |   300 |   32
    4096 |  1671 |  1106 |   34
   16384 |  6890 |  4570 |   34
   65536 | 27393 | 18054 |   34

This doesn't compare with the gains you are claiming to see with
intrinsics, but it's not bad for a one line change.  I bet there are ways
to adjust the code so that the auto-vectorization is more effective, too.

-- 
nathan





view thread (48+ messages)  latest in thread

Message-ID: <Z4GHNfhRKuA0r_Wn@nathan>
Permalink:  ../Z4GHNfhRKuA0r_Wn@nathan/
Also on:    postgresql.org/message-id/Z4GHNfhRKuA0r_Wn@nathan

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, Chiranmoy.Bhattacharya@fujitsu.com, Devanga.Susmitha@fujitsu.com, Ragesh.Hajela@fujitsu.com
  Subject: Re: [PATCH] Hex-coding optimizations using SVE on ARM.
  In-Reply-To: <Z4GHNfhRKuA0r_Wn@nathan>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox