From: Nala Ginrut <nalaginrut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Guile User <guile-user-mXXj517/zsQ@public.gmane.org>
Cc: Maxime Devos
<maximedevos-CNXmb7IdZIWZIoH1IeqzKA@public.gmane.org>,
team-rHw2apc0TIwgsBAKwltoeQ@public.gmane.org,
jit-/MQLu3FmUzdAfugRpC6u6w@public.gmane.org,
"dmalcolm-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org"
<dmalcolm-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
basile-VdE74OAlGqnvXjIo7pOF+l6hYfS7NtTn@public.gmane.org
Subject: Re: AOT compiler (was: Running Compiled Guile Objects)
Date: Sun, 15 Dec 2024 11:08:25 +0900 [thread overview]
Message-ID: <CAPjoZof2pmNCQH1EQvJjFmUf+Fwt+qMd8y4daxkZMbCY9Bez+Q@mail.gmail.com> (raw)
In-Reply-To: <CAPjoZodoBRcw28E5Zjnxb-f_aWG49LjOEDjKQptEH5RnxXsdvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 6719 bytes --]
> FWIW libgccjit builds position independent code, and can be used to
build dynamic libraries (which is what I believe gccemacs is doing).
To my limited experience, libgccjit can generate executable ELF and
relocatable .so, folks may pass gcc parameters for common considerations in
final codegen.
That's why I think libgccjit is good choice for Guile AOT. The whole
process and codegen can be consistent with common gcc cases and GNU
conventions.
Best regards.
On Sun, Dec 15, 2024, 10:59 Nala Ginrut <nalaginrut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi folks! Please reply AOT topic in this thread.
>
>
> > Indeed, it turns out that everyone using libgccjit is using it for
> ahead-of-time compilation, rather than jit-compilation. Sorry about
> picking a bad name :)
>
> Thanks for the work!
>
> At least in Guile community, now that we already have JIT with GNU
> Lightening, we won't redundantly talk libgccjit for JIT. But I think it's
> still interesting to try libgccjit for JIT in my other project. :-p
>
> > Probably of most interest to guile developers might be the gccemacs
> project here:
> https://akrl.sdf.org/gccemacs.html
>
>
> It looks super interesting!
>
> They created a high level IR just like GIMPLE, which named LIMPLE. It's
> the way I preferred in streaming-fist. The basic idea is to provide such an
> IR, then try to replace 'bytecode' in Guile compiler tower codegen. And
> they choose SBCL for it, I think it can inspire people who are interested
> in Guile AOT. Or maybe they could consider to change to Guile to save a lot
> of time for both Guile and Emacs.
>
> The compiler tower is so flexible that it's possible to try it as a
> plugin.
>
> I agreed with @mikael about losing weight of Guile. The AOT feature can be
> a plugin to install as guild tools. Of course, plugin unnecessarily mean it
> will be small......
>
>
> Best regards.
>
> On Sun, Dec 15, 2024, 02:45 Nala Ginrut <nalaginrut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>> Thanks for the inspiring sharing! 👏
>>
>> On Sun, Dec 15, 2024, 02:39 Basile Starynkevitch <
>> basile-VdE74OAlGqnvXjIo7pOF+l6hYfS7NtTn@public.gmane.org> wrote:
>>
>>> On Sun, 2024-12-15 at 02:21 +0900, Nala Ginrut wrote:
>>>
>>> @basile I'm glad you raise this topic, I've played lobgccjit with a toy
>>> project.
>>> https://gitlab.com/hardenedlinux/screaming-fist
>>>
>>> I would say libgccjit is a wrong name since it's more like a tool for
>>> AOT.
>>> Of course, one may still use it for JIT, however you have to do your own
>>> work for JIT and finally use libgccjit for codegen. 😁
>>>
>>> Best regards.
>>>
>>>
>>> You basically are right. If you want to use get a fast just-in-time
>>> compilation, libgccjit might not be the right tool.
>>>
>>> But in practice, current computers are so fast that I think that in
>>> practice libgccjit is quite usable, and it can be tuned to various GCC
>>> optimization strategy.
>>>
>>> A few years ago I did experiment (see https://arxiv.org/abs/1109.0779 ...)
>>> generation of C++ code which (on Linux desktop) was GCC compiled to a
>>> plugin and dlopen-ed. This works quite well with an elapsed time suitable
>>> for human users.
>>>
>>> A related experiment is my manydl.c thing on
>>> https://github.com/bstarynk/misc-basile - it is/was a toy program that
>>> I wrote which generates a lot of random C code (in many thousands of C
>>> files), compile it to a plugin, and use dlopen and dlsym. It shows that on
>>> Linux a process can successfully dlopen do many hundred thousands of
>>> plugins (and never bother dlclose-ing them)
>>>
>>> BTW in France the Lisp syntax and Scheme semantics of GNU guile is sadly
>>> becoming impopular. I know few persons using it.
>>>
>>> Just in case I am attaching a few PDF files on RefPerSys.
>>>
>>> Some ideas of RefPerSys originated from books and papers by by Jacques
>>> Pitrat
>>> https://en.wikipedia.org/wiki/Jacques_Pitrat
>>>
>>> Please mention RefPerSys to your colleagues and forward them this email.
>>>
>>> Thanks
>>>
>>>
>>>
>>> ---------- Forwarded message ---------
>>> From: Basile Starynkevitch <basile-VdE74OAlGqnvXjIo7pOF+l6hYfS7NtTn@public.gmane.org>
>>> Date: Sun, Dec 15, 2024, 02:11
>>> Subject: Re: Running Compiled Guile Objects
>>> To: Nala Ginrut <nalaginrut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>, Hakan Candar <
>>> hakancandar-g/b1ySJe57IN+BqQ9rBEUg@public.gmane.org>
>>> Cc: guile-user-mXXj517/zsQ@public.gmane.org <guile-user-mXXj517/zsQ@public.gmane.org>, <jit-/MQLu3FmUzdAfugRpC6u6w@public.gmane.org>
>>>
>>>
>>> On Sat, 2024-12-14 at 09:15 +0900, Nala Ginrut wrote:
>>> > Hi Hakan!
>>> > The current Guile is not AOT yet. Although the object file is ELF,
>>> > it's
>>> > just bytecode wrapped ELF header. So you can't run it as a regular
>>> > executable file.
>>> >
>>>
>>> Those willing to contribute a proper ahead-of-time compiler to GNU
>>> guile could use the GNU CC libgccjit library which is part of the GCC
>>> compiler.
>>> https://gcc.gnu.org/onlinedocs/jit/
>>>
>>> This libgccjit layer of the GCC compiler is stable and maintained C API
>>> and has some obsolete C++ API (which seems unmaintained in december
>>> 2024). Most of the libgccjit code is internally coded (under GPL
>>> license) in C++, but the stable API is for C.
>>>
>>> I am using the C API of libgccjit in the RefPerSys open source
>>> inference engine project (GPLv3+ licensed) on
>>> https://github.com/RefPerSys/RefPerSys/
>>>
>>> Both libgccjit and GNU lightning (see
>>> https://www.gnu.org/software/lightning/ ...) could be a basis for
>>> adding a genuine compilation layer to GNU guile. And RefPerSys uses
>>> both.
>>>
>>> I guess a significant issue would be to use libgccjit (or GNU
>>> lightning) with GUILE's garbage collector (which seems to be Boehm
>>> conservative GC).
>>>
>>> The RefPerSys project has a precise garbage collector and some
>>> persistence (to textual files). Since it is GPLv3+ licensed, its code
>>> could be reused in a future GUILE major version. RefPerSys is mostly
>>> coded in C++.
>>>
>>> I did contribute to GCC long time ago and hope that RefPerSys could
>>> become a GNU project (but don't know how to make that happen)
>>>
>>>
>>> --
>>>
>>> Basile STARYNKEVITCH <basile-VdE74OAlGqnvXjIo7pOF+l6hYfS7NtTn@public.gmane.org>8 rue de la Faïencerie
>>> 92340 Bourg-la-Reine, France <https://www.google.com/maps/search/8+rue+de+la+Fa%C3%AFencerie%0D%0A92340+Bourg-la-Reine,++++++++++France?entry=gmail&source=g>http://starynkevitch.net/Basile & https://github.com/bstarynk
>>>
>>>
[-- Attachment #2: Type: text/html, Size: 10983 bytes --]
next prev parent reply other threads:[~2024-12-15 2:08 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-13 20:34 Running Compiled Guile Objects Hakan Candar via General Guile related discussions
2024-12-14 0:15 ` Nala Ginrut
2024-12-14 1:14 ` Keith Wright
2024-12-14 2:33 ` Nala Ginrut
2024-12-14 2:43 ` Nala Ginrut
2024-12-14 13:01 ` Maxime Devos via General Guile related discussions
2024-12-14 14:37 ` Nala Ginrut
2024-12-14 14:53 ` Maxime Devos via General Guile related discussions
2024-12-14 15:20 ` Nala Ginrut
2024-12-14 16:10 ` Maxime Devos via General Guile related discussions
2024-12-14 16:20 ` Nala Ginrut
2024-12-14 16:26 ` Nala Ginrut
2024-12-14 16:31 ` Nala Ginrut
2024-12-14 16:50 ` Maxime Devos via General Guile related discussions
2024-12-14 17:03 ` Nala Ginrut
2024-12-14 17:48 ` Maxime Devos via General Guile related discussions
2024-12-14 18:17 ` Nala Ginrut
[not found] ` <CAPjoZofH2QuH_ekSk2L=-sUtVTAfEBpsJS0HkXwA_J9y+Wmg0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2024-12-14 17:11 ` Basile Starynkevitch
2024-12-14 17:21 ` AOT compiler (was: Running Compiled Guile Objects) Nala Ginrut
[not found] ` <49d9827f4455076cc066add3e51f0e882b59e9b7.camel@starynkevitch.net>
[not found] ` <CAPjoZoeu++mC+Syd35LjvLJVu6FEcZ=tb5jWdYgS0fZP-OHQiQ@mail.gmail.com>
[not found] ` <CAPjoZoeu++mC+Syd35LjvLJVu6FEcZ=tb5jWdYgS0fZP-OHQiQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2024-12-15 1:59 ` Nala Ginrut
[not found] ` <CAPjoZodoBRcw28E5Zjnxb-f_aWG49LjOEDjKQptEH5RnxXsdvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2024-12-15 2:08 ` Nala Ginrut [this message]
[not found] ` <CAPjoZof2pmNCQH1EQvJjFmUf+Fwt+qMd8y4daxkZMbCY9Bez+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2024-12-15 7:39 ` Eli Zaretskii
[not found] ` <86msgxs8d0.fsf-mXXj517/zsQ@public.gmane.org>
2024-12-15 8:07 ` Nala Ginrut
[not found] ` <CAPjoZoeBSvJrCDkDXgJX27Hr3Y3yAC4-mmMzKsuPnQvGwEjatQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2024-12-15 10:41 ` Eli Zaretskii
[not found] ` <86ed29rzy1.fsf-mXXj517/zsQ@public.gmane.org>
2024-12-15 10:49 ` Nala Ginrut
[not found] ` <CAPjoZoc-8THB4BAPUFR2OayrvnSKhFtyOLWR64-jOfYxaJme2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2024-12-15 10:58 ` tomas-2s+jgvIlYZ2ELgA04lAiVw
2024-12-15 11:01 ` Eli Zaretskii
[not found] ` <86bjxdryzg.fsf-mXXj517/zsQ@public.gmane.org>
2024-12-15 11:09 ` Nala Ginrut
[not found] ` <CAPjoZodWGB+QMYABLr5cM_jN2Lpk3Ex-47snPnLBa3-TMZxQYw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2024-12-15 11:32 ` Eli Zaretskii
[not found] ` <769073d434c2ed5fb7937c85da240aa5df4d854a.camel-VdE74OAlGqnvXjIo7pOF+l6hYfS7NtTn@public.gmane.org>
2024-12-14 23:02 ` Running Compiled Guile Objects David Malcolm
[not found] ` <fd04850b1d1b2b5e0c909b5b05d1d6a29a5cbd10.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2024-12-14 23:43 ` Maxime Devos
[not found] ` <20241215004310.onj82D0091dDhme01nj9u5-Pw8LEBfqDLYI1J5xXzd7/dsHW6RRjAQv@public.gmane.org>
2024-12-15 1:43 ` David Malcolm
2024-12-14 19:21 ` Dr. Arne Babenhauserheide
2024-12-14 20:12 ` Matt Wette
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPjoZof2pmNCQH1EQvJjFmUf+Fwt+qMd8y4daxkZMbCY9Bez+Q@mail.gmail.com \
--to=nalaginrut-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=basile-VdE74OAlGqnvXjIo7pOF+l6hYfS7NtTn@public.gmane.org \
--cc=dmalcolm-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=guile-user-mXXj517/zsQ@public.gmane.org \
--cc=jit-/MQLu3FmUzdAfugRpC6u6w@public.gmane.org \
--cc=maximedevos-CNXmb7IdZIWZIoH1IeqzKA@public.gmane.org \
--cc=team-rHw2apc0TIwgsBAKwltoeQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).