public inbox for overseers@sourceware.org
 help / color / mirror / Atom feed
From: Janne Blomqvist <blomqvist.janne@gmail.com>
To: FX Coudert <fxcoudert@gmail.com>
Cc: Thomas Koenig <tkoenig@netcologne.de>,
	Mark Wielaard <mark@klomp.org>,
	overseers@sourceware.org,  gcc@gcc.gnu.org,
	binutils@sourceware.org, gdb@sourceware.org,
	 libc-alpha@sourceware.org,
	"fortran@gcc.gnu.org" <fortran@gcc.gnu.org>
Subject: Re: Updated Sourceware infrastructure plans
Date: Thu, 18 Apr 2024 14:38:15 +0300	[thread overview]
Message-ID: <CAO9iq9HffQYSr7Bd-6kJ+OhmEdu=0zFC=jpMxLB8S-eKH-RF=A@mail.gmail.com> (raw)
In-Reply-To: <4353C519-D023-45B0-A254-C7274B7CFC6F@gmail.com>

On Thu, Apr 18, 2024 at 11:15 AM FX Coudert <fxcoudert@gmail.com> wrote:
>
> > I regenerate auto* files from time to time for libgfortran. Regenerating
> > them has always been very fragile (using --enable-maintainer-mode),
> > and difficult to get right.
>
> I have never found them difficult to regenerate, but if you have only a non maintainer build, it is a pain to have to make a new maintainer build for a minor change.
>
> Moreover, our m4 code is particularly painful to use and unreadable. I have been wondering for some time: should we switch to simpler Python scripts? It would also mean that we would have fewer files in the generated/ folder: right now, every time we add new combinations of types, we have a combinatorial explosion of files.
>
> $ ls generated/sum_*
> generated/sum_c10.c generated/sum_c17.c generated/sum_c8.c  generated/sum_i16.c generated/sum_i4.c  generated/sum_r10.c generated/sum_r17.c generated/sum_r8.c
> generated/sum_c16.c generated/sum_c4.c  generated/sum_i1.c  generated/sum_i2.c  generated/sum_i8.c  generated/sum_r16.c generated/sum_r4.c
>
> We could imagine having a single file for all sum intrinsics.
>
> How do Fortran maintainers feel about that?

For the time being I'm not an active maintainer, so my opinion doesn't
per se have weight, but back when I was active I did think about this
issue. IMHO the best of my ideas was to convert these into C++
templates. What we're essentially doing with the M4 stuff and the
proposed in-house Python reimplementation is to make up for lack of
monomorphization in plain old C. Rather than doing some DIY templates,
switch the implementation language to something which has that feature
built-in, in this case C++.  No need to convert the entire libgfortran
to C++ if you don't want to, just those objects that are generated
from the M4 templates. Something like

template<typename T>
void matmul(T* a, T* b, T* c, ...)
{
   // actual matmul code here
}

extern "C" {
  // Instantiate template for every type and export the symbol
  void matmul_r4(gfc_array_r4* a, gfc_array_r4* b, gfc_array_r4* c, ...)
  {
    matmul(a, b, c, ...);
  }
  // And so on for other types
}


-- 
Janne Blomqvist

  parent reply	other threads:[~2024-04-18 11:38 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17 23:27 Mark Wielaard
2024-04-18  6:04 ` Thomas Koenig
2024-04-18  8:14   ` FX Coudert
2024-04-18  9:01     ` Christophe Lyon
2024-04-18 11:38     ` Janne Blomqvist [this message]
2024-04-18 12:01       ` Generated files in libgfortran for Fortran intrinsic procedures (was: Updated Sourceware infrastructure plans) Tobias Burnus
2024-04-18 12:32         ` Martin Uecker
2024-04-19  9:35   ` Updated Sourceware infrastructure plans Jonathan Wakely
2024-04-18 15:56 ` Joseph Myers
2024-04-18 17:37   ` Frank Ch. Eigler
2024-04-18 17:54     ` Joseph Myers
2024-04-18 18:29     ` Matt Rice
2024-04-22 15:39     ` Tom Tromey
2024-04-23  2:55       ` Jason Merrill
2024-04-23  3:12         ` Simon Marchi
2024-04-23  3:24         ` Tom Tromey
2024-04-23  3:51           ` Jason Merrill
2024-04-23  8:56             ` Mark Wielaard
2024-04-23  9:39               ` Richard Earnshaw (lists)
2024-04-23 15:08             ` Tom Tromey
2024-04-23 15:25               ` Simon Marchi
2024-04-24  8:49                 ` Aktemur, Tankut Baris
2024-04-23  4:06           ` Ian Lance Taylor
2024-04-23  9:30           ` Richard Earnshaw (lists)
2024-04-23 13:51             ` Ian Lance Taylor
2024-05-01 19:15           ` Jeff Law
2024-05-01 19:38             ` Jonathan Wakely
2024-05-01 20:20               ` Mark Wielaard
2024-05-01 20:53                 ` Tom Tromey
2024-05-01 21:04                   ` Simon Marchi
2024-05-02 15:35                     ` Pedro Alves
2024-05-02 23:05                       ` Fangrui Song
     [not found]                       ` <DS7PR12MB57651DA3A5C22B2847C13580CB182@DS7PR12MB5765.namprd12.prod.outlook.com>
2024-05-07 16:17                         ` Joseph Myers
2024-05-10 10:43                           ` Ben Boeckel
2024-05-01 20:04             ` Jason Merrill
2024-05-01 21:26               ` Mark Wielaard
2024-05-01 22:01                 ` Sergio Durigan Junior
2024-05-02 12:54                 ` Claudio Bantaloukas
2024-05-02 15:33                 ` Pedro Alves
2024-05-03  2:59                   ` Ian Lance Taylor
2024-05-04 19:56                 ` Ben Boeckel
2024-05-05  5:22                   ` Benson Muite
2024-05-06 13:58                     ` Ben Boeckel
2024-05-07 16:26                   ` Joseph Myers
2024-05-01 21:38               ` Jeff Law
2024-05-02  6:47                 ` Richard Biener
2024-05-02 11:29                   ` Ian Lance Taylor
2024-05-02 14:26                   ` Simon Marchi
2024-05-02 11:45                 ` Mark Wielaard
2024-05-01 22:56               ` Tom Tromey
2024-04-23 10:34         ` Florian Weimer
2024-04-22 10:01   ` Mark Wielaard
2024-04-22 13:23     ` Joseph Myers
2024-04-19  9:33 ` Jonathan Wakely
2024-04-22 10:24   ` Mark Wielaard
2024-04-22 11:40     ` Jonathan Wakely
2024-04-23  0:48   ` Frank Ch. Eigler
2024-05-16 15:58 ` Cristian Rodríguez

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='CAO9iq9HffQYSr7Bd-6kJ+OhmEdu=0zFC=jpMxLB8S-eKH-RF=A@mail.gmail.com' \
    --to=blomqvist.janne@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=fortran@gcc.gnu.org \
    --cc=fxcoudert@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=gdb@sourceware.org \
    --cc=libc-alpha@sourceware.org \
    --cc=mark@klomp.org \
    --cc=overseers@sourceware.org \
    --cc=tkoenig@netcologne.de \
    /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).