Re: Substituting Checksum Algorithm (was: Enabling Checksums)

From: Ants Aasma <ants(at)cybertec(dot)at>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Ants Aasma <ants(at)cybertec(dot)at>, Jeff Davis <pgsql(at)j-davis(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)2ndquadrant(dot)com>, Florian Pflug <fgp(at)phlo(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Greg Smith <greg(at)2ndquadrant(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Subject: Re: Substituting Checksum Algorithm (was: Enabling Checksums)
Date: 2013-04-30 11:23:35
Message-ID: CA+CSw_sAkLXALLR72=8bkcH-vpMrWsAG1tekwjDsfuiWHa_2Vg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 30, 2013 at 1:55 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
> On 30 April 2013 06:57, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>
>> I'm about to light up the build farm with a trial commit of the
>> compiler instructions stuff.
>
> Amazingly that seemed to work.

Thanks for committing. Sorry about missing the .h file from the patch.
The two commits look good to me.

I can confirm that compiling with CFLAGS="-O2 -march=native" will
vectorize the committed code on GCC 4.7.

I also checked the situation on clang. clang-3.2 isn't able to
vectorize the loop even with vectorization options. I will check what
is stopping it. If any volunteer has a working build setup with ICC or
MSVC and is willing to run a couple of test compiles, I think we can
achieve vectorization there too.

> ISTM that we also need this patch to put memory barriers in place
> otherwise the code might be rearranged.

The compiler and CPU both have to preserve correctness when
rearranging code, so I don't think we care about it here. It might
matter if these routine could be called concurrently by multiple
backends for a single buffer, but in that case memory barriers won't
be enough, we'd need full exclusion.

Regards,
Ants Aasma
--
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt
Web: http://www.postgresql-support.de

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2013-04-30 11:29:26 Re: Remaining beta blockers
Previous Message Andres Freund 2013-04-30 11:09:43 Re: Substituting Checksum Algorithm (was: Enabling Checksums)