| From: | Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com> | 
|---|---|
| To: | Diego Fronza <diego(dot)fronza(at)percona(dot)com> | 
| Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de> | 
| Subject: | Re: meson vs. llvm bitcode files | 
| Date: | 2025-03-12 10:26:46 | 
| Message-ID: | CAN55FZ2qGH8WsRaX3UxC4E-ZEwv0ZHr9p1XQfLqLs1fGKLAaoA@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Hi,
On Tue, 11 Mar 2025 at 01:04, Diego Fronza <diego(dot)fronza(at)percona(dot)com> wrote:
> I did a full review on the provided patches plus some tests, I was able to validate that the loading of bitcode modules is working also JIT works for both backend and contrib modules.
Thank you!
> To test JIT on contrib modules I just lowered the costs for all jit settings and used the intarray extension, using the data/test__int.data:
> CREATE EXTENSION intarray;
> CREATE TABLE test__int( a int[] );1
> \copy test__int from 'data/test__int.data'
>
> For queries any from line 98+ on contrib/intarray/sql/_int.sql will work.
>
> Then I added extra debug messages to llvmjit_inline.cpp on add_module_to_inline_search_path() function, also on llvm_build_inline_plan(), I was able to see many functions in this module being successfully inlined.
>
> I'm attaching a new patch based on your original work which add further support for generating bitcode from:
Thanks for doing that!
>  - Generated backend sources: processed by flex, bison, etc.
>  - Generated contrib module sources,
I think we do not need to separate these two.
   foreach srcfile : bitcode_module['srcfiles']
-    if meson.version().version_compare('>=0.59')
+    srcfilename = '@0@'.format(srcfile)
+    if srcfilename.startswith('<CustomTarget')
+      srcfilename = srcfile.full_path().split(meson.build_root() + '/')[1]
+    elif meson.version().version_compare('>=0.59')
Also, checking if the string starts with '<CustomTarget' is a bit
hacky, and 'srcfilename = '@0@'.format(srcfile)' causes a deprecation
warning. So, instead of this we can process all generated sources like
how generated backend sources are processed. I updated the patch with
that.
> On this patch I just included fmgrtab.c and src/backend/parser for the backend generated code.
> For contrib generated sources I added contrib/cube as an example.
I applied your contrib/cube example and did the same thing for the contrib/seg.
> All relevant details about the changes are included in the patch itself.
>
> As you may know already I also created a PR focused on llvm bitcode emission on meson, it generates bitcode for all backend and contribution modules, currently under review by some colleagues at Percona: https://github.com/percona/postgres/pull/103
> I'm curious if we should get all or some of the generated backend sources compiled to bitcode, similar to contrib modules.
I think we can do this. I added other backend sources like you did in
the PR but attached it as another patch (0007) because I wanted to
hear other people's opinions on that first.
v3 is attached.
--
Regards,
Nazir Bilal Yavuz
Microsoft
| Attachment | Content-Type | Size | 
|---|---|---|
| v3-0001-meson-Add-generated-header-stamps.patch | text/x-patch | 5.0 KB | 
| v3-0002-meson-Add-postgresql-extension.pc-for-building-ex.patch | text/x-patch | 4.5 KB | 
| v3-0003-meson-Test-building-extensions-by-using-postgresq.patch | text/x-patch | 10.7 KB | 
| v3-0004-meson-WIP-Add-docs-for-postgresql-extension.pc.patch | text/x-patch | 12.3 KB | 
| v3-0005-meson-Add-architecture-for-LLVM-bitcode-emission.patch | text/x-patch | 9.1 KB | 
| v3-0006-meson-Add-LLVM-bitcode-emissions-for-contrib-libr.patch | text/x-patch | 22.6 KB | 
| v3-0007-meson-Add-LLVM-bitcode-emission-for-backend-sourc.patch | text/x-patch | 5.2 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Kapila | 2025-03-12 10:34:06 | Re: Add an option to skip loading missing publication to avoid logical replication failure | 
| Previous Message | Ashutosh Bapat | 2025-03-12 10:26:08 | Re: Test mail for pgsql-hackers |