Re: LLVM 16 (opaque pointers)

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Ronan Dunklau <ronan(dot)dunklau(at)aiven(dot)io>, Devrim Gündüz <devrim(at)gunduz(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Tom Stellard <tstellar(at)redhat(dot)com>, Mark Wong <markwkm(at)gmail(dot)com>
Subject: Re: LLVM 16 (opaque pointers)
Date: 2023-10-21 23:16:54
Message-ID: CA+hUKGLuLyntaBEJNt2yu==T+vy8oU0S6J-dR4dTykgBhdF1zw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 21, 2023 at 7:08 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> I've attached a patch revision that I spent the last couple hours working
> on. It's very very roughly based on a patch Tom Stellard had written (which I
> think a few rpm packages use). But instead of encoding details about specific
> layout details, I made the code check if the data layout works and fall back
> to the cpu / features used for llvmjit_types.bc. This way it's not s390x
> specific, future odd architecture behaviour would "automatically" be handled
> the same

The explanation makes sense and this seems like a solid plan to deal
with it. I didn't try on a s390x, but I tested locally on our master
branch with LLVM 7, 10, 17, 18, and then I hacked your patch to take
the fallback path as if a layout mismatch had been detected, and it
worked fine:

2023-10-22 11:49:55.663 NZDT [12000] DEBUG: detected CPU "skylake",
with features "...", resulting in layout
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
2023-10-22 11:49:55.664 NZDT [12000] DEBUG: detected CPU / features
yield incompatible data layout, using values from module instead
2023-10-22 11:49:55.664 NZDT [12000] DETAIL: module CPU "x86-64",
features "...", resulting in layout
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

+ To deal with that, check if data layouts match during JIT
initialization. If
+ the runtime detected cpu / features result in a different layout,
try if the
+ cpu/features recorded in in llvmjit_types.bc work.

s|try |check |
s| in in | in |

+ errmsg_internal("could not
determine working CPU / feature comination for JIT compilation"),

s|comination|combination|
s| / |/|g

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2023-10-22 01:44:31 Re: LLVM 16 (opaque pointers)
Previous Message Alexander Korotkov 2023-10-21 22:01:49 Re: Removing unneeded self joins