From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 58CFF3858C78 for ; Thu, 18 Apr 2024 12:01:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 58CFF3858C78 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=baylibre.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 58CFF3858C78 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::336 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713441708; cv=none; b=jf2q8Iyp5qNpqBNK3+Tg9eJfFAWVXNlObVkKhVoSBdzWZf9+1Cz6vCeIkMQi+y/2DogTr96oQmgGmnsoHS+TRt4JvN19aJYnQfvK04zOPjQLKvH1SQRM6ZZVn2VCKy9BnM6W3FPbAPgfLUYx0UCVokTt8dk0morOnCqCZ6GbZHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713441708; c=relaxed/simple; bh=/ESiY0tLPUkvn+qz3zNyKXJYJoRnovBOmLoHOQ3+5dc=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=k4HYQeBUDt4D9piNVz8unqTwaXIcTQRaMyTM1EZcdcn1/WEDWU+eHUnL80kscw3Ux1j6+jjTfFnFScY2XQnbpPNRu5O2XvlLzC/j+ShfxGZvFNeGJiNCUBBqwlNXz0/pDXc4ra+Lv+p+aICdLFie563N7xKFrexu3ohe0gXBIpA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-418c0d83e61so8412265e9.3 for ; Thu, 18 Apr 2024 05:01:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1713441696; x=1714046496; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=JWWTq190BihVgPm03a2G0syOWpQfvtEAJrKkueZU0Yg=; b=Tg+7rqFA539fI7InOoFc3537BcKZblNJn5GMWKbDcRzqO3MLqDtrlNw32KLJ6BUqG3 OD1Q3zTWBxpgu1tj/0o1Bm4eo76f4wHpi3fVsjOEEWEqdEbgy3UqCweW2wDIF8J9ycWN mz5Cv3qrjorqsFhBp/RBcXk02cR1onltX3NzwwCmaPT7DclTMEo/GlDJI2gqvswDWKde lZ9L2E4fErOUn4xoS/LP+5zinu1xOU5oubTN1SOQ4BzUCaSA8zLz6MC4aFtX5+Nnbvc8 p539yZHIuDKlhfMMe/DfcGwapvK/ZpW93MRM8g7s9iawDBy/n9EeD0+vIULeq3bbZnVC FWdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713441696; x=1714046496; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JWWTq190BihVgPm03a2G0syOWpQfvtEAJrKkueZU0Yg=; b=aLXxPoSe+EgsvMj4QyX3Oez+0HVGSNxWFEVqrsAxzgTdOynUaJ35lnOHkT7xzOvTvl yuFokcimGptM5GxC13PMBBRNpC6sXXcSnCjC+E5LUcnXmnAHBT8CWYac4ynSPieYILpf G9mp1lLfLeoaOuVaMxBt7MqR5j9CoTj6jugKQGlZftCSmIa6gLzO0s/7NcL+RrLy6nFb kawdI/f+s4ko2sU81NvMPV7I/+IosHGWPRAITyORipt+1pZukiJhmcBOPbtzdgSkk5ch A6XWri2c8cLx4kwlr3tGiHwMFdIQ2YH2u2loe4dQ0tAszC5OXEfB88G9UMfkujf5yIP4 VF7A== X-Forwarded-Encrypted: i=1; AJvYcCUBZ11j0IrrcMGJThQQWXnZ8LBvmYFrGsYokIMJE//29vVqnQ+5pXwnpmTwxzm+nSHqN+Z6B0KaNdWaJdq5BHARJ3Y3 X-Gm-Message-State: AOJu0YwYv2Z7EpZ1SZNoVhBgyepVAugkPLJS+aXxn+PputEAomZJMgmp JxQUZTC+owctCCkGGt3SPmd+kdvX/NOtqXt8n1NVhl0rzqE6esjHlfEPOqyn370= X-Google-Smtp-Source: AGHT+IEFhhCPNosNamw2R24/i7QaSU1Rlj/Kv8Z3wE0JjW5UMKL7CVeGwOtWyMA2cbamEA3R/+6FpA== X-Received: by 2002:a05:600c:4fd3:b0:415:6728:a565 with SMTP id o19-20020a05600c4fd300b004156728a565mr2341167wmq.16.1713441695933; Thu, 18 Apr 2024 05:01:35 -0700 (PDT) Received: from ?IPV6:2001:16b8:3f2d:6500:cab2:a16e:9e9:ec5d? ([2001:16b8:3f2d:6500:cab2:a16e:9e9:ec5d]) by smtp.gmail.com with ESMTPSA id l9-20020a1c7909000000b004167b0819aasm7307741wme.0.2024.04.18.05.01.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Apr 2024 05:01:35 -0700 (PDT) Message-ID: <686fac37-698f-4373-9469-ccabe96e702a@baylibre.com> Date: Thu, 18 Apr 2024 14:01:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Generated files in libgfortran for Fortran intrinsic procedures (was: Updated Sourceware infrastructure plans) To: Janne Blomqvist , FX Coudert Cc: Thomas Koenig , Mark Wielaard , overseers@sourceware.org, gcc@gcc.gnu.org, binutils@sourceware.org, gdb@sourceware.org, libc-alpha@sourceware.org, "fortran@gcc.gnu.org" References: <20240417232725.GC25080@gnu.wildebeest.org> <5bde614c-224f-4ec6-8450-7c0911938cf9@netcologne.de> <4353C519-D023-45B0-A254-C7274B7CFC6F@gmail.com> Content-Language: en-US From: Tobias Burnus In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,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: Hi Janne, 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 think this will work – but we have to be super careful: With C++, there is the problem that we definitely do not want to add dependency on libstdc++ nor to use some features which require special hardware support (like exceptions [always bad], symbol aliases, ...). — On some systems, a full C++ support might be not available, like embedded systems (including some odd embedded OS) or offloading devices. The libstdc++ dependency would be detected by linking as we currently do. For in-language features, we have to ensure the appropriate flags -fno-exceptions (and probably a few more). And it should be clear what language features to use. If we do, I think that would surely be an option. > 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 > 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 > } Cheers, Tobias