From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx-2023-1.gwdg.de (mx-2023-1.gwdg.de [134.76.10.21]) by sourceware.org (Postfix) with ESMTPS id D0C4A3858D33; Thu, 18 Apr 2024 12:32:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0C4A3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gwdg.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gwdg.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D0C4A3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=134.76.10.21 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713443546; cv=none; b=iScQ13OyWD7LHy+aMwL+c0VlGjZOonxR6SJ75v4a5iwntaRPqiDtWWZEIUvENp3x0BDGm7cTfSpdjKCag241e6RXtbB2+yXkKhwL2TsWbrzL5Fky+TTNUV9d8q5b2uHyQaxyVw52dGCvnbPJxWOcnd/duvgJ0kAicqwingXKb8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713443546; c=relaxed/simple; bh=uIhKYE3fOGb3tIFChy2ezUUmC7x9R6wvk55KWj3Dyfg=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=DkuAln0dPyHUpWNnYgDss8QdEO5cCbKEtJtGBDM6obHwMuSAzcd9k2S5M9kZEd6LUsqjXIRL0fsqh4kQjozFY+1+UJ105UJ1PlQOAF6tTKUshYxOKdfSgt5L/O7fqdiuql/CsoZ7+5r3TqIDTiF2R1IcvehZLYJqcBBK+jxJx1Q= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gwdg.de; s=2023-rsa; h=MIME-Version:Content-Transfer-Encoding:Content-Type:References: In-Reply-To:Date:CC:To:From:Subject:Message-ID:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=q7JD37jMULbmptVJ9U7zVFpz7q16yDRXT7mXbsqx0oc=; b=HjyjnKo29ueJ8aYznjXKyhw/IG NXRGzYRsUc0Qs00BJDUUq7NKNA/4wqgN1krJ9ZEjI1LGS8ryhP3p1ZAzurEWkWJEn6peTOdkZirVB a9a86VhdAqVXUf0Caic/VOQWrbjYwXNIyB6hpcgH4JHo3rTyrpiKbrIlcoHpm7sZcM7oNR3kpgzvc H/1kjyX7w4jEoMB1nEi8udItTPAbKNs6H3nu/s4Oz/HNlKDmHsEYTEeEWVQEEv4gsKTVP9ez5rYQe Z6bAPvwd0KVaZuzQBnHJyk7G8itK/n6JD08tqRqwCbNbCPhJnnnfcTXModPAJkSZlbN6gTkx0KDCB EA38Xdiw==; Received: from xmailer.gwdg.de ([134.76.10.29]:36738) by mailer.gwdg.de with esmtp (GWDG Mailer) (envelope-from ) id 1rxQwA-00ApDv-25; Thu, 18 Apr 2024 14:32:22 +0200 Received: from excmbx-29.um.gwdg.de ([134.76.9.204] helo=email.gwdg.de) by mailer.gwdg.de with esmtp (GWDG Mailer) (envelope-from ) id 1rxQwA-00012D-1p; Thu, 18 Apr 2024 14:32:22 +0200 Received: from fbmtpc21.tugraz.at (10.250.9.199) by EXCMBX-29.um.gwdg.de (134.76.9.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2507.37; Thu, 18 Apr 2024 14:32:22 +0200 Message-ID: <56b27622e866daa5871afa1239866d47f23609dc.camel@gwdg.de> Subject: Re: Generated files in libgfortran for Fortran intrinsic procedures (was: Updated Sourceware infrastructure plans) From: Martin Uecker To: Tobias Burnus , Janne Blomqvist , FX Coudert CC: Thomas Koenig , Mark Wielaard , , , , , , "fortran@gcc.gnu.org" Date: Thu, 18 Apr 2024 14:32:16 +0200 In-Reply-To: <686fac37-698f-4373-9469-ccabe96e702a@baylibre.com> References: <20240417232725.GC25080@gnu.wildebeest.org> <5bde614c-224f-4ec6-8450-7c0911938cf9@netcologne.de> <4353C519-D023-45B0-A254-C7274B7CFC6F@gmail.com> <686fac37-698f-4373-9469-ccabe96e702a@baylibre.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 MIME-Version: 1.0 X-Originating-IP: [10.250.9.199] X-ClientProxiedBy: excmbx-16.um.gwdg.de (134.76.9.227) To EXCMBX-29.um.gwdg.de (134.76.9.204) X-Virus-Scanned: (clean) by clamav X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Am Donnerstag, dem 18.04.2024 um 14:01 +0200 schrieb Tobias Burnus: > Hi Janne, >=20 > Janne Blomqvist wrote: > > back when I was active I did think about this > > issue. IMHO the best of my ideas was to convert these into C++ > > templates. I haven't looked at libgfortran but I didn't find it problematic at all to use C in similar numerical code and this helps with portability.=20 Either I use macros, which I keep short and then do not find inferior to templates (having used C++ for years previously) or=C2=A0 - if there is really a lot of code that needs to be specialized=C2=A0 for a type - simply by using includes: #define matmul_type double #include "matmul_impl.c" Martin >=20 > I think this will work =E2=80=93 but we have to be super careful: >=20 > With C++, there is the problem that we definitely do not want to add=20 > dependency on libstdc++ nor to use some features which require special= =20 > hardware support (like exceptions [always bad], symbol aliases, ...). =E2= =80=94=20 > On some systems, a full C++ support might be not available, like=20 > embedded systems (including some odd embedded OS) or offloading devices. >=20 > The libstdc++ dependency would be detected by linking as we currently=20 > do. For in-language features, we have to ensure the appropriate flags=20 > -fno-exceptions (and probably a few more). And it should be clear what= =20 > language features to use. >=20 > If we do, I think that would surely be an option. >=20 > > 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 > >=20 > > template > > void matmul(T* a, T* b, T* c, ...) > > { > > // actual matmul code here > > } > >=20 > > 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 > > } >=20 > Cheers, >=20 > Tobias