From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 4988A3858D28 for ; Fri, 22 Mar 2024 15:55:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4988A3858D28 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 4988A3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::430 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711122909; cv=none; b=PUhMG3MOzDJDznNGF6fIKfktqwRn3YUFTX58wn7lpjzf3ajClzVPqchekxq7PUZWrtAdrRUtlwjs3nTczh5SvB+jslCabhiC/8ggxCiOa6uQNEcvUO2psxLwf1q3Av9Fms48i9EBdJDwV7tugwzRPgUQKZOSa2K+5oZWZcpueII= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711122909; c=relaxed/simple; bh=qNAnwx7kqSEB8O5mySTg5VnlhVVg/w7Fu23VrXQ7JRg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=hFqBqDn2yhDyUZzEIp1Pam3syUNqDW1n/ZwSGQi2CPEwXqDCGKxVY9ObMFc93Bg/6GELomALSf4tg9yZ5hllK9HgCRn0NvskCAhX1G/bajgvWcLe41BpoQdxS/vTsef5LrC3En9ZDMSg8AS5f079E6X05CDarxE96A7Y2lxggFs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-34100f4f9a2so1157857f8f.2 for ; Fri, 22 Mar 2024 08:55:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1711122904; x=1711727704; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=tpCD9Vxh0mlR+o402f15dHZAXFXOjgiNXudGqAe8kxY=; b=JoEontYppaAlHeBz9IOYFFmbJxZkFl8LuuFJ3W+hKkmZ5bQHU91HxDFaP+sApIuNS9 AU/cj3163oUGKnnriQBX3IpByDBsL66Qg48RqmIYwElk8NojJ4WNObvmT6vdwvvoOCpl ToxiIq1YUq9L9Vap3vRoOgelGQSK9FvF3B9nsb9PQRfxYlI6Twx7talA829rDT+sFIZ+ cCaCAsMBPLERjMbTjw/ZxRR4ErdpP3RfV2KSrMpPaZkz3iY7wRw62nGRzXhC+DBvvuHM FHQasjsvbFFqubJ9XDkMV846WxKh2JrSRSNM6ZtdROMrUnP3uFimSfAZMgkRWfAMdQmF mzJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711122904; x=1711727704; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tpCD9Vxh0mlR+o402f15dHZAXFXOjgiNXudGqAe8kxY=; b=cIJyjE1+r4nUgnCrVMy0dcmuRW7BsnAmmi+XLIPCacDS3H4q2J3q6f3yv9IW7TZwVK VaL1GXK9i9bedQPelTR5x/ejNx/l26Xe3SdhGMdmQhf8AwnOK0kLou4EPZ9u0ogPcQag vreQ2vrtR5zEa0pUPDrAQvuNM1blXDR1aQO3boYqvm4Mscvyl6uHTm2KXFYo12l4IKVB wcpDq1vLEaKDGN/WTyANeJS+NgldS9eK8K0iSTIdfP/srK2OH2nPHHiT6JM2M6oCiiH4 lscTJNBBScFRDG6Gu+SIrR3QTDy+ahPjhFvohaVXdkoi1e8YSYCeB9EteKfvFHwU7ASf LLeg== X-Gm-Message-State: AOJu0YyakDmplAaOmXXEL76Wu5X6BNp+4d2EIbDRFw0En8Bm2/CxUuNz zgmyO5mWq76dmsD9jO1RR422n/41l05goTxLHigFRDLvsCzsC/XEKsFMeIRuQZ9p9uCQLqMWNR/ j+Yf/MQ== X-Google-Smtp-Source: AGHT+IF/sPK7KzJzUrNb1qbwJdQxsCiJuLvCN+oQcLKuzxrODIfil1rRHs+KSM1DobGSJZTdSxnV3A== X-Received: by 2002:a05:6000:ec6:b0:33e:7333:d459 with SMTP id ea6-20020a0560000ec600b0033e7333d459mr1932919wrb.49.1711122904546; Fri, 22 Mar 2024 08:55:04 -0700 (PDT) Received: from localhost.localdomain (hawk-18-b2-v4wan-167765-cust1304.vm26.cable.virginm.net. [82.41.69.25]) by smtp.googlemail.com with ESMTPSA id z17-20020a056000111100b0033ecbfc6941sm2324548wrw.110.2024.03.22.08.55.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 08:55:04 -0700 (PDT) From: Andrew Stubbs To: gcc-patches@gcc.gnu.org Subject: [committed] amdgcn: Prefer V32 on RDNA devices Date: Fri, 22 Mar 2024 15:54:48 +0000 Message-ID: <20240322155449.747518-1-ams@baylibre.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,RCVD_IN_BARRACUDACENTRAL,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: This patch alters the default (preferred) vector size to 32 on RDNA devices to better match the actual hardware. 64-lane vectors will continue to be used where they are hard-coded (such as function prologues). We run these devices in wavefrontsize64 for compatibility, but they actually only have 32-lane vectors, natively. If the upper part of a V64 is masked off (as it is in V32) then RDNA devices will skip execution of the upper part for most operations, so this adjustment shouldn't leave too much performance on the table. One exception is memory instructions, so full wavefrontsize32 support would be better. The advantage is that we avoid the missing V64 operations (such as permute and vec_extract). Committed to mainline. Andrew gcc/ChangeLog: * config/gcn/gcn.cc (gcn_vectorize_preferred_simd_mode): Prefer V32 on RDNA devices. --- gcc/config/gcn/gcn.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc index 498146dcde9..efb73af50c4 100644 --- a/gcc/config/gcn/gcn.cc +++ b/gcc/config/gcn/gcn.cc @@ -5226,6 +5226,32 @@ gcn_vector_mode_supported_p (machine_mode mode) static machine_mode gcn_vectorize_preferred_simd_mode (scalar_mode mode) { + /* RDNA devices have 32-lane vectors with limited support for 64-bit vectors + (in particular, permute operations are only available for cases that don't + span the 32-lane boundary). + + From the RDNA3 manual: "Hardware may choose to skip either half if the + EXEC mask for that half is all zeros...". This means that preferring + 32-lanes is a good stop-gap until we have proper wave32 support. */ + if (TARGET_RDNA2_PLUS) + switch (mode) + { + case E_QImode: + return V32QImode; + case E_HImode: + return V32HImode; + case E_SImode: + return V32SImode; + case E_DImode: + return V32DImode; + case E_SFmode: + return V32SFmode; + case E_DFmode: + return V32DFmode; + default: + return word_mode; + } + switch (mode) { case E_QImode: -- 2.41.0