Re: Optimizing PostgreSQL with LLVM's PGO+LTO

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: João Paulo Labegalini de Carvalho <jaopaulolc(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Optimizing PostgreSQL with LLVM's PGO+LTO
Date: 2023-01-27 23:28:16
Message-ID: 3586117.1674862096@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> On 2023-01-27 15:06:37 -0500, Tom Lane wrote:
>> There are a lot of places where we're implicitly relying on
>> cross-compilation-unit optimizations NOT happening, because the code isn't
>> adequately decorated with memory barriers and the like.

> We have a fallback compiler barrier implementation doing that, but it
> shouldn't be used on any halfway reasonable compiler. Cross-compilation-unit
> calls don't provide a memory barrier - I assume you're thinking about a
> compiler barrier?

Sorry, yeah, I was being sloppy there.

> I'm sure we have a few places that aren't that careful, but I would hope it's
> not a large number. Are you thinking of specific "patterns" we've repeated all
> over, or just a few cases you recall?

I recall that we used to have dependencies on, for example, the LWLock
functions being out-of-line. Probably that specific pain point has
been cleaned up, but it surprises me not at all to hear that there
are more.

I agree that there are probably not a huge number of places that would
need to be fixed, but I'm not sure how we'd go about finding them.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-01-27 23:28:21 Re: recovery modules
Previous Message David Rowley 2023-01-27 23:28:14 Re: heapgettup() with NoMovementScanDirection unused in core?