public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: Basile Starynkevitch <basile@starynkevitch.net>
To: jit@gcc.gnu.org
Subject: Re: existing C frontend for libgccjit?
Date: Sat, 7 Oct 2023 17:26:15 +0200	[thread overview]
Message-ID: <238f808a-664f-4ad5-b310-72bc4b972e5b@starynkevitch.net> (raw)
In-Reply-To: <dd29f59b-c08a-4cfa-910b-182cdce56cc1@starynkevitch.net>

[-- Attachment #1: Type: text/plain, Size: 1864 bytes --]


On 10/7/23 16:47, Basile Starynkevitch wrote:
>
>
> On 10/7/23 16:43, Schrodinger ZHU Yifan wrote:
>> Hi,
>>
>> In my case, I wanted to include inline definitions in a header file 
>> into a context. Is there a way to this without writing all the functions?
>
>
> I don't know about it.
>
>
> An alternative (generating *less efficient* code) could be to consider 
> using GNU lightning. https://www.gnu.org/software/lightning/
>
> GNU lightning generates "unoptimized" code, but it generates it faster 
> than libgccjit.
>
> Another alternative could be to develop your GCC plugin generating 
> (using GIMPLE representation) some C code (which you could later pass 
> to GCC and compile, on Linux, as a shared object)
>
Of course, this won't easily work for C++ exceptions (so try or 
|GIMPLE_TRY)|, GCC builtins, OpenMP, asm statements. I was thinking of 
some kind of portable C code not using GCC features like OpenACC, 
builtins, vector code, etc etc.


BTW, you could be interested by the LTO (link-time optimization) 
framework of GCC (and GNU binutils). Basically, the GIMPLE code is then 
written inside (augmented) *.o object files.


In the RefPerSys open source inference engine project (see some code on 
https://github.com/RefPerSys/RefPerSys/ still buggy), we probably will 
either generate C++ files at runtime or use GNU lightning.


Observe that generating C or GNU lightning code is usually easy. On 
Linux an approach is to generate C code and compile it then dlopen it. 
This can be done many thousands of times (see the useless 
https://github.com/bstarynk/misc-basile/blob/master/manydl.c showing 
that a Linux process can do many thousands of dlopen at once....)
||

-- 
Basile Starynkevitch -http://starynkevitch.net/Basile/
email:<basile@starynkevitch.net>  (near Paris, France)
only mines opinions - les opinions sont seulement miennes

      reply	other threads:[~2023-10-07 15:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <xUyN-um9ScbmLylXsJiiBi5lDN-EqVJrG7l2Twf_EURFKAXh5KnTSwEbYNjnZEtTaeET3RoMqTTeDsMkz3TnQJMSFJt93gcmVQolubmOUnM=@zhuyi.fan>
2023-10-07 14:47 ` Basile Starynkevitch
2023-10-07 15:26   ` Basile Starynkevitch [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=238f808a-664f-4ad5-b310-72bc4b972e5b@starynkevitch.net \
    --to=basile@starynkevitch.net \
    --cc=jit@gcc.gnu.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).