Re: Promising results with Intel Linux x86 compiler

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kyle <kaf(at)nwlink(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Promising results with Intel Linux x86 compiler
Date: 2002-03-12 02:11:01
Message-ID: 16256.1015899061@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kyle <kaf(at)nwlink(dot)com> writes:
> * Linking doesn't appear to work with icc's "-ipo" optimization. The
> goal of ipo to perform inlining of functions between source files.
> This is a bummer, since -ipo can produce very good code.

You should be quite wary of that one.

The reason is that accesses to shared memory are typically protected by
LWLockAcquire/LWLockRelease call pairs. It's absolutely critical that
no operations get relocated into or out of the code segments between
such call pairs. With interprocedural optimizations turned on, I think
it's quite likely for a compiler to blow this --- which would lead to
extremely nasty, low-probability, hard-to-debug failures during
concurrent operation.

Having recently tracked down some similar nastiness *within*
LWLockAcquire (AIX's compiler feels no compunction about rearranging
volatile-object operations w.r.t. non-volatile ones) the prospect of
any compiler deciding to interleave LWLockAcquire/LWLockRelease code
with calling code scares me to death.

AFAIK the only way we could prevent such problems is for *all* pointers
to shared memory to be marked volatile --- which would doubtless blow a
good proportion of the speedup one might otherwise hope to get. Within
an LWLockAcquire'd segment, shared memory is *not* volatile and we don't
want to completely defeat optimization of routines such as the lock and
buffer managers.

Possibly you could avoid the issue by arranging for lwlock.c to be
compiled at a lower optimization level that doesn't expose its routines
for merging with callers.

> Side note: it seems difficult to get consistent results out of
> pgbench.

Yeah, I've noticed that too. You really have to do a complete vacuum
between runs to get any semblance of stable results.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2002-03-12 03:25:27 Re: Domain Support -- another round
Previous Message Justin Clift 2002-03-12 02:10:42 Re: Promising results with Intel Linux x86 compiler