From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id A0DA13858D20 for ; Wed, 31 Jan 2024 14:41:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A0DA13858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A0DA13858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706712062; cv=none; b=SLHuzpAop5qdYJX4mb1Qv4pRCe9sH6R76zKTo3zFqBvLXiAaoQQ+30mCWWG+YszIVeA2c3iJAPo/u0UZS4gOnYWmkl0+ByImLffH7ImZPbOuz200TguU5qk5INekVvGpZk5tM1bVqW0W1Eolch0ex2OesgYWjlPY9B6n61VGIM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706712062; c=relaxed/simple; bh=ikHazUKKbnvER6XR6++jNWQTagTwDTQVmTVg79ukzvQ=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:Message-ID:MIME-Version; b=NhZPn9kHcvBvpJS1pVRKOTJWrXhx32EuCwUFeSLnGspO01E4r0rm7IKq91zd5SEVWiZZRJF/tkguS4aRolMYI4iYWBzoTv/F2dQVkskfE/ZlyncqyBeympRMr1r9zJrBzEcCxT+9P96vQQq3pHuC4G7v9Zojggd26j5+lbfe1Dg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [10.168.4.150] (unknown [10.168.4.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 9CEF01FB87; Wed, 31 Jan 2024 14:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1706712059; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZlfVinW3K3lo0X8NE+ILjmit8uYj+Yy2+99tG+iStUM=; b=OcuwJqCQOtrCceQBpjyPXYvncaKX0bM6RQt1z4khbDYd7a8ZVbBMkFPb0CydreE7JbUNb1 E8pNZvCflvfv+zWj2aiOBmoqNG83x/A8yCDza13P2RBgbPgSrFTAbuam7Lq5yS9pfjJedt z1xpYRHQc05sOzUV/f+kGlpkqJZmL1I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1706712059; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZlfVinW3K3lo0X8NE+ILjmit8uYj+Yy2+99tG+iStUM=; b=O+XyKvYuPbDssUGm6LqDmJ6nhXBtV1rAejHpfY45xmVn0WsjuM9okrhYFUSCPfDidEgUxZ J6OPKh/EnEhxjiCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1706712059; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZlfVinW3K3lo0X8NE+ILjmit8uYj+Yy2+99tG+iStUM=; b=OcuwJqCQOtrCceQBpjyPXYvncaKX0bM6RQt1z4khbDYd7a8ZVbBMkFPb0CydreE7JbUNb1 E8pNZvCflvfv+zWj2aiOBmoqNG83x/A8yCDza13P2RBgbPgSrFTAbuam7Lq5yS9pfjJedt z1xpYRHQc05sOzUV/f+kGlpkqJZmL1I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1706712059; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZlfVinW3K3lo0X8NE+ILjmit8uYj+Yy2+99tG+iStUM=; b=O+XyKvYuPbDssUGm6LqDmJ6nhXBtV1rAejHpfY45xmVn0WsjuM9okrhYFUSCPfDidEgUxZ J6OPKh/EnEhxjiCg== Date: Wed, 31 Jan 2024 15:35:21 +0100 (CET) From: Richard Biener To: "Andre Vieira (lists)" cc: gcc-patches@gcc.gnu.org, Richard.Sandiford@arm.com Subject: Re: [PATCH 1/3] vect: Pass stmt_vec_info to TARGET_SIMD_CLONE_USABLE In-Reply-To: Message-ID: <3rq8sn71-8188-o4rq-9spp-q9spn98163q5@fhfr.qr> References: <20240130143132.9575-1-andre.simoesdiasvieira@arm.com> <20240130143132.9575-2-andre.simoesdiasvieira@arm.com> <47e1aeb2-94ac-4733-b49f-ea97932cc49f@arm.com> <545r8s73-675p-4o48-sr66-q6956nqp6r6p@fhfr.qr> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: -3.52 X-Spamd-Result: default: False [-3.52 / 50.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM_SHORT(0.50)[0.167]; NEURAL_HAM_LONG(-0.92)[-0.924]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-3.00)[100.00%] X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: On Wed, 31 Jan 2024, Andre Vieira (lists) wrote: > > > On 31/01/2024 13:58, Richard Biener wrote: > > On Wed, 31 Jan 2024, Andre Vieira (lists) wrote: > > > >> > >> > >> On 31/01/2024 12:13, Richard Biener wrote: > >>> On Wed, 31 Jan 2024, Richard Biener wrote: > >>> > >>>> On Tue, 30 Jan 2024, Andre Vieira wrote: > >>>> > >>>>> > >>>>> This patch adds stmt_vec_info to TARGET_SIMD_CLONE_USABLE to make sure > >>>>> the > >>>>> target can reject a simd_clone based on the vector mode it is using. > >>>>> This is needed because for VLS SVE vectorization the vectorizer accepts > >>>>> Advanced SIMD simd clones when vectorizing using SVE types because the > >>>>> simdlens > >>>>> might match. This will cause type errors later on. > >>>>> > >>>>> Other targets do not currently need to use this argument. > >>>> > >>>> Can you instead pass down the mode? > >>> > >>> Thinking about that again the cgraph_simd_clone info in the clone > >>> should have sufficient information to disambiguate. If it doesn't > >>> then we should amend it. > >>> > >>> Richard. > >> > >> Hi Richard, > >> > >> Thanks for the review, I don't think cgraph_simd_clone_info is the right > >> place > >> to pass down this information, since this is information about the caller > >> rather than the simdclone itself. What we are trying to achieve here is > >> making > >> the vectorizer being able to accept or reject simdclones based on the ISA > >> we > >> are vectorizing for. To distinguish between SVE and Advanced SIMD ISAs we > >> use > >> modes, I am also not sure that's ideal but it is what we currently use. So > >> to > >> answer your earlier question, yes I can also pass down mode if that's > >> preferable. > > > > Note cgraph_simd_clone_info has simdlen and we seem to check elsewhere > > whether that's POLY or constant. I wonder how aarch64_sve_mode_p > > comes into play here which in the end classifies VLS SVE modes as > > non-SVE? > > > > Using -msve-vector-bits=128 > (gdb) p TYPE_MODE (STMT_VINFO_VECTYPE (stmt_vinfo)) > $4 = E_VNx4SImode > (gdb) p TYPE_SIZE (STMT_VINFO_VECTYPE (stmt_vinfo)) > $5 = (tree) 0xfffff741c1b0 > (gdb) p debug (TYPE_SIZE (STMT_VINFO_VECTYPE (stmt_vinfo))) > 128 > (gdb) p aarch64_sve_mode_p (TYPE_MODE (STMT_VINFO_VECTYPE (stmt_vinfo))) > $5 = true > > and for reference without vls codegen: > (gdb) p TYPE_MODE (STMT_VINFO_VECTYPE (stmt_vinfo)) > $1 = E_VNx4SImode > (gdb) p debug (TYPE_SIZE (STMT_VINFO_VECTYPE (stmt_vinfo))) > POLY_INT_CST [128, 128] > > Having said that I believe that the USABLE targethook implementation for > aarch64 should also block other uses, like an Advanced SIMD mode being used as > input for a SVE VLS SIMDCLONE. The reason being that for instance 'half' > registers like VNx2SI are packed differently from V2SI. > > We could teach the vectorizer to support these of course, but that requires > more work and is not extremely useful just yet. I'll add the extra check that > to the patch once we agree on how to pass down the information we need. Happy > to use either mode, or stmt_vec_info and extract the mode from it like it does > now. As said, please pass down 'mode'. But I wonder how to document it, which mode is that supposed to be? Any of result or any argument mode that happens to be a vector? I think that we might be able to mix Advanced SIMD modes and SVE modes with -msve-vector-bits=128 in the same loop? Are the simd clones you don't want to use with -msve-vector-bits=128 having constant simdlen? If so why do you generate them in the first place? That said, I wonder how we end up mixing things up in the first place. Richard.