Re: JIT compiling with LLVM v11

From: Andres Freund <andres(at)anarazel(dot)de>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Pierre Ducroquet <p(dot)psql(at)pinaraf(dot)info>
Subject: Re: JIT compiling with LLVM v11
Date: 2018-03-08 20:12:09
Message-ID: 20180308201209.miod2nwy5ivd4fxu@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018-03-08 11:58:41 -0800, Andres Freund wrote:
> I think we can easily fix this by behaving like clang, which uses
> llvm::sys::getHostCPUFeatures(HostFeatures) to built the feature list:
>
> // If -march=native, autodetect the feature list.
> if (const Arg *A = Args.getLastArg(clang::driver::options::OPT_march_EQ)) {
> if (StringRef(A->getValue()) == "native") {
> llvm::StringMap<bool> HostFeatures;
> if (llvm::sys::getHostCPUFeatures(HostFeatures))
> for (auto &F : HostFeatures)
> Features.push_back(
> Args.MakeArgString((F.second ? "+" : "-") + F.first()));
> }
> }
>
> which seems easy enough.

Or even in core LLVM, which has this nice comment:

// If user asked for the 'native' CPU, we need to autodetect features.
// This is necessary for x86 where the CPU might not support all the
// features the autodetected CPU name lists in the target. For example,
// not all Sandybridge processors support AVX.
if (MCPU == "native") {

which pretty much describes the issue you're apparently hitting.

I've pushed an attempted fix (needs a comment, but works here).

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-03-08 20:23:14 Re: [HACKERS] Restrict concurrent update/delete with UPDATE of partition key
Previous Message Andres Freund 2018-03-08 19:58:41 Re: JIT compiling with LLVM v11