From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 92EF33858285 for ; Tue, 19 Jul 2022 10:01:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 92EF33858285 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 4F38234A2A; Tue, 19 Jul 2022 10:01:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1658224870; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JY96RS+ue9kpr3exox0pZ8dX6zHcyF/VK+BDPXw3eSY=; b=zEgPMG4vDIujW/c8yotAUSDEBJGRLdA+NXC5twVoUAjfnQW35L+yINtQ5wOoWmfiTodlac suq3/M3WmEzKIxtIaBwkgGlBJLxtvRA44XQ2ZCs5NgUQ8vbjeozZz6cYTPQkJb1MFqvncL T53OjlRrxCLo0PF3eDvjR5wP5kBOsWE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1658224870; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JY96RS+ue9kpr3exox0pZ8dX6zHcyF/VK+BDPXw3eSY=; b=1FF7JfLtTFN+pWg/OCSbk3DXd3ICeRm4ZvglIxWmMDZqMaFZBe545+bzVbOu5tF8f/UG72 6i+VPsUNiI0asnBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0CC5413488; Tue, 19 Jul 2022 10:01:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Aqp6OuWA1mIqdgAAMHmgww (envelope-from ); Tue, 19 Jul 2022 10:01:09 +0000 Message-ID: Date: Tue, 19 Jul 2022 12:01:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [RFC] Function Multi Versioning on Arm Content-Language: en-US To: Daniel Kiss , "gcc@gcc.gnu.org" Cc: Pavel Iliin References: <45073915-9D33-4097-9CFD-FFBCB9CE1A44@arm.com> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: <45073915-9D33-4097-9CFD-FFBCB9CE1A44@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, NICE_REPLY_A, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2022 10:01:17 -0000 On 7/18/22 12:36, Daniel Kiss via Gcc wrote: > Hello, > > We are going to add Function Multiversioning [1] support to Arm architectures. > The specification is made public as beta[2] to ensure toolchain that follows Arm > C Language Extension will implement it in the same way. > > A few tweaks considered to make the developers' life easier. > Since the `target` attribute is used widely on Arm, we would like to introduce a > new attribute `target_version` to avoid confusion and possible deployment > problems. The `target_clones` attribute will be supported too. Also the “default” > version to be made optional. > > We are looking for feedback on the specification (reply, github works too). > > Thanks so much, > Daniel > > [1] https://gcc.gnu.org/onlinedocs/gcc/Function-Multiversioning.html > [2] https://github.com/ARM-software/acle/blob/main/main/acle.md#function-multi-versioning > Hello. Thanks for working on the feature, it will be nice to cover the gap in between x86_64 and powerpc, which implement the FMV feature. As the person who's been involved with the current MVC code in the GCC, I have a few comments/questions about it: 1) both i386 and Powerpc also allow specifying an equivalent to -march (like `arch=bdver2`), in Arm case it seems to me only individual features are considered 2) about 'target_version' attribute - I like the idea as one can have a completely independent function implementation optimized for an ISA; note it's very close to 'target' attribute (supported in C++), where one needs to provide a resolver and have the pretty same functionality (see e.g. gcc/testsuite/g++.target/i386/mv1.C). However, the feature does not work in C and you will have the very same problem with target_version attribute (multiple functions with the same declaration): mv1.c:76:1: error: redefinition of ‘foo’ 76 | foo () | ^~~ 3) If you will implement 'target_version' attribute, I would like to see it available also for the existing targets supporting MVC 4) A small note about the mangling, the existing i386 naming scheme looks like: ... _Z3foov.avx2_ssse3 ... 5) Can you please define how will you evaluate priorities for a situation where multiple features are used (e.g. dotprod+sm)? Note we face the very same problem on i386, where it's very hard to specify a priority for the family of avx512 features. That said, an optional priority specifier might be possible. 6) Note that as opposed to i385 and Powerpc, we don't allow a combination of ISA flags for target_clone attribute (like sse2+avx512f). 7) FMV may be disabled in compile time by a compiler flag. In this case the default version shall be used. I would like to see the functionality also target agnostic. Anyway, looking forward to the Arm implementation. Hope the comments are constructive. Cheers, Martin