public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: "Paulo César Pereira de Andrade"
	<paulo.cesar.pereira.de.andrade@gmail.com>,
	"Basile Starynkevitch" <basile@starynkevitch.net>
Cc: lightning <lightning@gnu.org>,
	"team@refpersys.org" <team@refpersys.org>,
	jit@gcc.gnu.org
Subject: Re: [PATCH] Add debug stream parameter to init_jit()
Date: Mon, 16 Oct 2023 10:49:11 +0200	[thread overview]
Message-ID: <331A75C1-652B-4730-A590-40E62AC4D31F@crapouillou.net> (raw)
In-Reply-To: <CAHAq8pGdAFUw9CAzDLHvdQp=XPpxu4CP+3Hdn4QsyL-cjmyNZw@mail.gmail.com>

Hi,

Le 16 octobre 2023 01:55:41 GMT+02:00, "Paulo César Pereira de Andrade" <paulo.cesar.pereira.de.andrade@gmail.com> a écrit :
>Em sáb., 14 de out. de 2023 às 04:04, Basile Starynkevitch
><basile@starynkevitch.net> escreveu:
>>
>>
>> On 10/13/23 20:15, Paulo César Pereira de Andrade wrote:
>>
>> Hi Paul. Please sendo the v2 and I will apply the patch during the weekend.
>>
>> Em qua, 11 de out de 2023 12:57, Paul Cercueil <paul@crapouillou.net> escreveu:
>>>
>>> Ooops, I missed to update the source files in check/.
>>>
>>> I'll send a V2.
>>>
>>> -Paul
>>>
>>> Le mercredi 11 octobre 2023 à 17:47 +0200, Paul Cercueil a écrit :
>>> > Allow specifying where Lightning's messages and disassembly will be
>>> > printed, instead of inconditionally using the error output.
>>> > diff --git a/include/lightning.h.in b/include/lightning.h.in
>>> > index 6d51235..25f685b 100644
>>> > --- a/include/lightning.h.in
>>> > +++ b/include/lightning.h.in
>>> > @@ -23,6 +23,7 @@
>>> >  #include <unistd.h>
>>> >  #include <stdlib.h>
>>> >  @MAYBE_INCLUDE_STDINT_H@
>>> > +#include <stdio.h>
>>> >  #include <string.h>
>>> >  #include <pthread.h>
>>> >
>>> > @@ -1220,7 +1221,7 @@ typedef void
>>> > (*jit_free_func_ptr)        (void*);
>>> >  /*
>>> >   * Prototypes
>>> >   */
>>> > -extern void init_jit(const char*);
>>> > +extern void init_jit(const char*,FILE*);
>>> >  extern void finish_jit(void);
>>> >
>>
>>
>> This patch is interesting and provides an interesting feature. However, it is changing the public API of GNU lightning in an incompatible way.
>
>  I did not like it much when first looking at it due to the clear abi break.
>  But the feature is very useful. It just sets the FILE* where binutils is
>told to print the disassembly, as well as where debug printed by Lightning
>is also output.

I can make init_jit() a macro that would call a init_jit_dbg() function (the current init_jit() renamed) with stderr as parameter.

Cheers,
-Paul

>> For projects (like the RefPerSys open source inference engine on https://github.com/RefPerSys/RefPerSys/ ....) which are using GNU lightning it would be very convenient to have a preprocessor convention (inspired by libgccjit on https://gcc.gnu.org/onlinedocs/jit/ ...) which enables users of GNU lightning to test it.
>>
>>
>> What about adding in include/lightning.h.in some preprocessor symbols like
>>
>> #define LIB_LIGHTNING_API 1
>>
>> and increment that number every time the external API of GNU lightning is changing?
>>
>> This would make using GNU lightning easier.
>
>  I believe this is good, but should be avoided and only done when
>really required. For now the proper approach should be to make a
>new function call, to set the disasm_stream pointer in jit_disasm.c.
>
>> Thanks
>>
>> --
>> Basile Starynkevitch
>>  <basile@starynkevitch.net>
>> (only mine opinions / les opinions sont miennes uniquement)
>> 92340 Bourg-la-Reine, France
>> web page: starynkevitch.net/Basile/
>
>Thanks,
>Paulo

      reply	other threads:[~2023-10-16  8:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20231011154753.50583-1-paul@crapouillou.net>
     [not found] ` <c6658d2735e955bd7758653fdd46a948c36fa925.camel@crapouillou.net>
     [not found]   ` <CAHAq8pFco=evvo+V3VFVONkNjtigt6hYk0=jm-J6-Wt_EX--Ug@mail.gmail.com>
2023-10-14  7:04     ` Basile Starynkevitch
2023-10-15 23:55       ` Paulo César Pereira de Andrade
2023-10-16  8:49         ` Paul Cercueil [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=331A75C1-652B-4730-A590-40E62AC4D31F@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=basile@starynkevitch.net \
    --cc=jit@gcc.gnu.org \
    --cc=lightning@gnu.org \
    --cc=paulo.cesar.pereira.de.andrade@gmail.com \
    --cc=team@refpersys.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).