From patchwork Wed Aug 5 13:29:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 1341239 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 ozlabs.org (Postfix) with ESMTPS id 4BMCCk2vKYz9sPB for ; Wed, 5 Aug 2020 23:29:53 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5532A3851C31; Wed, 5 Aug 2020 13:29:44 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 103D13851C17 for ; Wed, 5 Aug 2020 13:29:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 103D13851C17 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Andrew_Stubbs@mentor.com IronPort-SDR: w3nsw9R2eb6SCXBkA5Sn3j1twRT1+fKn7puUgkcGWrJ7Yt4ku/UCCd8I5K1gq94gRyfodkT9Kz XmNbdqpTosRV3zfZr2f6qOK8dtlSYahKoJ71NLg1dKzv7hV2B0rih5eDzPvbfGWZ4OfPq9j3d7 Z/4yWAM54XiUA5hCBdS8JAtupt/3/L7In5026KZl4XWt3VkUsQSElmoXs+2QaDIhmQRxEQPHcL O8mPuoXBsVaCscdvXLoCHXNJ/u2AzIToI+/WT8vd6RAHCLH4YeYVAPR7RX7OBlBkvr5SGErUrx lkw= X-IronPort-AV: E=Sophos;i="5.75,436,1589270400"; d="scan'208";a="51750511" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 05 Aug 2020 05:29:37 -0800 IronPort-SDR: IcySQM1AY7/XfYzuVUdGgmpqJRoCU8LeozTGtpuob2GlpX0/Uh7xq+fnMvo5fn87uEYHMTRuAf Wc+m8wur2xeSGmaxEWWPSHRGF0uvOpBWrIlxCfRgtxCmD4kOP/3UTkRzp0d6bqjphsyM7X1Nrd JjxqCeoSkdrjyn9JOe0qyuZDXiUODVaSI6gQjgyY77A/2zHDZZTMetaRuJGHFJsBYRCDHLsQ/s 1IzVbrLuZ8w0Z6j6duNQWSBM7zZY+kA5LB1+5ExYW2wNNyergRorSowRmTYsLOFVmnTBWItYcf 5Fo= From: Andrew Stubbs Subject: [PATCH] vect: Try smaller vector size when SLP split fails To: "gcc-patches@gcc.gnu.org" Message-ID: Date: Wed, 5 Aug 2020 14:29:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Language: en-GB X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-06.mgc.mentorg.com (139.181.222.6) To SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" This patch improves SLP performance in combination with some patches I have in development to add multiple vector sizes to amdgcn. The problem is that amdgcn's preferred vector size has 64 lanes, and SLP does not support lane masking. My patches will add smaller vector sizes (32, 16, 8, 4, 2) which make the lane masking implicit, but still SLP doesn't use them; it simply rejects the first size it sees and gives up. This patch detects the rejection early and looks to see if there is a smaller, more suitable vector size. The result is many more successful SLP testcases. OK to commit? (I have an x86_64 bootstrap and test in progress.) Andrew vect: Try smaller vector size when SLP split fails If the preferred vector size is larger than can be used then try again with a smaller size. This allows SLP to work more effectively on targets with very large vectors. gcc/ChangeLog: * tree-vect-slp.c (vect_analyze_slp_instance): Reduce vector size if the default mode is too large. diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 72192b5a813..95518a263c7 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -2367,6 +2367,16 @@ vect_analyze_slp_instance (vec_info *vinfo, for (i = 0; i < group_size; i++) if (!matches[i]) break; + if (i > 1 && i < group_size && i < const_nunits && scalar_type) + { + tree vec = get_vectype_for_scalar_type (vinfo, scalar_type, i); + if (vec) + { + nunits = TYPE_VECTOR_SUBPARTS (vec); + const_nunits = nunits.to_constant (); + } + } + if (i >= const_nunits && i < group_size) { /* Split into two groups at the first vector boundary before i. */