[PATCH] libgccjit: Add support for machine-dependent builtins
Uros Bizjak
ubizjak@gmail.com
Thu Jun 27 16:35:12 GMT 2024
On Thu, Jun 27, 2024 at 12:49 AM David Malcolm <dmalcolm@redhat.com> wrote:
>
> On Thu, 2023-11-23 at 17:17 -0500, Antoni Boucher wrote:
> > Hi.
> > I did split the patch and sent one for the bfloat16 support and
> > another
> > one for the vector support.
> >
> > Here's the updated patch for the machine-dependent builtins.
> >
>
> Thanks for the patch; sorry about the long delay in reviewing it.
>
> CCing Jan and Uros re the i386 part of that patch; for reference the
> patch being discussed is here:
> https://gcc.gnu.org/pipermail/gcc-patches/2023-November/638027.html
>
> > From e025f95f4790ae861e709caf23cbc0723c1a3804 Mon Sep 17 00:00:00 2001
> > From: Antoni Boucher <bouanto@zoho.com>
> > Date: Mon, 23 Jan 2023 17:21:15 -0500
> > Subject: [PATCH] libgccjit: Add support for machine-dependent builtins
>
> [...snip...]
>
> > diff --git a/gcc/config/i386/i386-builtins.cc b/gcc/config/i386/i386-builtins.cc
> > index 42fc3751676..5cc1d6f4d2e 100644
> > --- a/gcc/config/i386/i386-builtins.cc
> > +++ b/gcc/config/i386/i386-builtins.cc
> > @@ -225,6 +225,22 @@ static GTY(()) tree ix86_builtins[(int) IX86_BUILTIN_MAX];
> >
> > struct builtin_isa ix86_builtins_isa[(int) IX86_BUILTIN_MAX];
> >
> > +static void
> > +clear_builtin_types (void)
> > +{
> > + for (int i = 0 ; i < IX86_BT_LAST_CPTR + 1 ; i++)
> > + ix86_builtin_type_tab[i] = NULL;
> > +
> > + for (int i = 0 ; i < IX86_BUILTIN_MAX ; i++)
> > + {
> > + ix86_builtins[i] = NULL;
> > + ix86_builtins_isa[i].set_and_not_built_p = true;
> > + }
> > +
> > + for (int i = 0 ; i < IX86_BT_LAST_ALIAS + 1 ; i++)
> > + ix86_builtin_func_type_tab[i] = NULL;
> > +}
> > +
> > tree get_ix86_builtin (enum ix86_builtins c)
> > {
> > return ix86_builtins[c];
> > @@ -1483,6 +1499,8 @@ ix86_init_builtins (void)
> > {
> > tree ftype, decl;
> >
> > + clear_builtin_types ();
> > +
> > ix86_init_builtin_types ();
> >
> > /* Builtins to get CPU type and features. */
>
> Please can one of the i386 maintainers check this?
> (CCing Jan and Uros: this is for the case where the compiler code runs
> multiple times in-process due to being linked into libgccjit.so. We
> want to restore state within i386-builtins.cc to an initial state, and
> ensure that no GC-managed objects persist from previous in-memory
> compiles).
Can we rather introduce TARGET_CLEANUP_BUILTINS hook and call it from
the JIT compiler at some appropriate time? IMO, this burdens
unnecessarily non-JIT compilation.
Uros.
More information about the Jit
mailing list