Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lYw4F-0007gc-EX for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Apr 2021 19:29:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lYw4E-0004QF-Aa for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Apr 2021 19:29:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lYw4C-0004Pa-Py for pgsql-bugs@lists.postgresql.org; Tue, 20 Apr 2021 19:29:50 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lYw47-0000sx-Nt for pgsql-bugs@lists.postgresql.org; Tue, 20 Apr 2021 19:29:47 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 5D6A64907; Tue, 20 Apr 2021 15:29:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 20 Apr 2021 15:29:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=00zY2jIeZZrVUaBJlXsYuGLmrEj np982XechaKkYDUE=; b=AGE49bf0D1I22m+OVlcrtWP9St2iLYQOSWAwoVIEa3m uBWO/cVdHCOz8u+lZ8hSbYUFkXbeRXO6KIh8reiyftLo+6O7N901xJeNhjIr6vTG O7YSW5/4QUz4YkEG1EYLsI7EuvdFk7fnRo6bM7NlvJFhA/jW804PsPYUr9nIa334 9eiRubJSO9Ns1cEDd+1655j3O3mH3OcwY+Nl6G6kdnIP0PaSzakU2sjGe1q4IMe+ nVtWeY+n8a8pMDiYb9GtXJRk7yyPFvfy9Bm7CNaTfOsqlGD+ij8OQnXz8ILJzS8I boylnARORPLNXbJvFWzzU4qmGHHmBqbl8nIKfxRg1Gw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=00zY2j IeZZrVUaBJlXsYuGLmrEjnp982XechaKkYDUE=; b=E3+ZDFsC7hOhu/tR0OKi9h Dok1rYmDS7L74XpVekL0+YzvYTxoeMCxPK2FBeo7ArkKVgcTTGGuHcvx7TCZUYFI wqjUM7lFcHyCyrUcFb1QWNQ3SXO4aUrsbmZ7NcBv1cf/Lll05iyhnz39D+a+wdL8 CFQmwrtWq/M1nu9Lwe5cKFZSSd0hbAEY9vMNdB5b7/jsVnoI26rNDzNFe6aswdJC sn/mL4kNh86iAyhC1qedTDtKJ9pRSvSDDibA0gjXRR2f3X+pZwfx5hR/cvb91g5/ Bm9BhYkjLrXqAxaOIlgdfuN0f04gn8lqA8CDJLbgJ1g+kUWRA04/lsC/EvZ9MB3g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddtiedgudegudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfhfgggtuggjsehttd ertddttddvnecuhfhrohhmpeetnhgurhgvshcuhfhrvghunhguuceorghnughrvghssegr nhgrrhgriigvlhdruggvqeenucggtffrrghtthgvrhhnpeekueeifedvueeljefgueefve ejffegkefhhfffueetgfeuleektefgudeivdfhfeenucffohhmrghinhepuggvsghirghn rdhorhhgpdhfvgguohhrrghprhhojhgvtghtrdhorhhgnecukfhppedutdejrddugedvrd effedruddtfeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpegrnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Received: from intern.anarazel.de (107-142-33-103.lightspeed.sntcca.sbcglobal.net [107.142.33.103]) by mail.messagingengine.com (Postfix) with ESMTPA id DE3B824005E; Tue, 20 Apr 2021 15:29:38 -0400 (EDT) Date: Tue, 20 Apr 2021 12:29:37 -0700 From: Andres Freund To: tstellar@redhat.com, pgsql-bugs@lists.postgresql.org, Tom Lane Subject: Re: BUG #16971: Incompatible datalayout errors with llvmjit Message-ID: <20210420192937.3zu4wpdemxwfvo4u@alap3.anarazel.de> References: <16971-5d004d34742a3d35@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16971-5d004d34742a3d35@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Thanks to tgl for pointing me this thread... On 2021-04-19 18:29:52 +0000, PG Bug reporting form wrote: > In our Fedora builds, we are getting errors[1] in the postgresql tests due > to incompatible datalayouts between the JIT engine and the LLVM modules > being compiled. The problem is that the JIT engine is being created with > host specific CPU and features, while the datalayout for the compiled module > is being taken from llvmjit_types.bc which is compiled without any specified > CPU type or features. It's very odd that features would change the data layout - analogizing with plain C code that'd mean that you cannot link a binary compiled with something like -mavx2 against a library compiled without. To me this smells like a bug somewhere lower level. Reformatting the error yields: ERROR: failed to JIT module: Added modules have incompatible data layouts: E-m:e-i1:8:16-i8:8:16-i64:64-f128:64- a:8:16-n32:64 (module) vs E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64 (jit) The -v128:64 is about how to align vectors. Skimming the relevant LLVM code I don't see why it'd be included in JIted code but not native code. Just to be sure, I take checking for llvm-config... /usr/bin/llvm-config checking for clang... /usr/bin/clang are for llvm & clang compiled from the same code? I temporarily had access to s390x to debug an unrelated issue in the past, and there I did hit this problem, but IIRC only because of clang vs llvm version mismatches. Unfortunately it is a bit hard to debug without access to a s390x box... Can you provide that? If not I might ask the Debian folks for access to one of their porter machines. FWIW, the Debian s390x build seems to succeed at the moment: https://buildd.debian.org/status/fetch.php?pkg=postgresql-13&arch=s390x&ver=13.2-1&stamp=1613044202&raw=0 > One way to fix this would be to add -march=native to the %.bc rules in > src/Makefile.global.in. However, this will only work when the build system > and the run system are the same. > I think to fix this correctly, the llvmjit_types.bc file will need to be > compiled when the JIT engine is initialized at runtime, so that it can use > the same datalayout as the JIT engine. That'd require headers to be present, which I don't think we should require... And more importantly, it'd not go very far, because we also have lot of other .bc files that will have the layout embedded (for inlining functions/operators into JITed code). Which'd then require all the source code to be present and to be compiled into bitcode. Not an, uh, satisfying option. > [1] https://kojipkgs.fedoraproject.org//work/tasks/2182/66082182/build.log Random thing I noticed while scrolling through the log: > configure: WARNING: unrecognized options: --disable-dependency-tracking PG requires dependency tracking to be explicitly enabled, and it's a different flag name (--enable-depend). Greetings, Andres Freund