Message ID | 87e1164d-1377-8025-223e-7c377ae1752d@rivosinc.com |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp226331wrd; Thu, 2 Mar 2023 20:53:18 -0800 (PST) X-Google-Smtp-Source: AK7set+2VnSYv7zxsedGSsg0Nkj9aA9ytaO5C4EpkHK72EfmxvBX4La/Im99lRsh/p3I+HLEY+lk X-Received: by 2002:aa7:cb4c:0:b0:4ac:dac1:3f95 with SMTP id w12-20020aa7cb4c000000b004acdac13f95mr674048edt.1.1677819198232; Thu, 02 Mar 2023 20:53:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677819198; cv=none; d=google.com; s=arc-20160816; b=jw3luVodE39xZ1ZOP1gj3vANrEXSTHpfYjI3SUD6NZXstQNoognEMgnVvNkRObpOJm zQeYx4pYvsn5mFKXwHu7fkCkhsCtCgrbpqPRmpsa0v7+9P3q5kfeOHzWT+ip9eYxLHxY LibIoUJqxTpe9yIiXUEHNn4DtB843u6Z0GcFWQYnD+zmRjkX2N03+6eyJ3FKNgvKYp5G Rx3/8rSuBV36Y/2Yd2V02/yiZN6WWHdrrTbB2hIF8CwTGobj1WrJ8qDzRBr2VbRboFhX ngV81r4J6rNEmnY9OvpJAXhE1/b8gB2zTYMcr0D4agWNi0ChNVQEVI0XJn9qsNP6n0mv Rv7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :content-language:to:subject:from:user-agent:mime-version:date :message-id:dkim-signature:dmarc-filter:delivered-to; bh=t+PnqXZ6Q8V0eFV64hkaiVuCLrsWOtzW/Q3GFvs/9sE=; b=Z5KqLh5dJJOamEHHv4MYElcXxjVRhJi0bjfzNmD3+EB5vopXBdVJio+RIu7MK6jFS8 HWj3okU5rm/l5oJkkEPmPWxZrL80u8M0pBook6N1JOCm1KrZI2HmbGBd/eNY9mBgaqCs lXkfiuZejV4EaIRcoOiavD0UtqHlvxktOGjF3i/mFBVO8uS+7FxmxIVj6iKdYwxHL9ev F243LPRu26iFJInFBFvrRHzYzRu1zFI6gipLvIYeHL83G4D/oEOcAvkqR3VK6JbqwBKo cuO4Tta8SUWPojqYHjIP0IKBSeX2nukdQroOMlyku02co6xlRQ3JECv4nR7A0bLKYhp/ x/hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=zXil0fWm; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id o25-20020aa7d3d9000000b004add4da41f8si1586732edr.623.2023.03.02.20.53.18 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 20:53:18 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=zXil0fWm; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7799A38555A1 for <ouuuleilei@gmail.com>; Fri, 3 Mar 2023 04:52:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) by sourceware.org (Postfix) with ESMTPS id 0BEF83858D33 for <gcc-patches@gcc.gnu.org>; Fri, 3 Mar 2023 04:52:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0BEF83858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-qv1-xf2c.google.com with SMTP id o3so1073468qvr.1 for <gcc-patches@gcc.gnu.org>; Thu, 02 Mar 2023 20:52:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:content-language:to:subject:from :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=t+PnqXZ6Q8V0eFV64hkaiVuCLrsWOtzW/Q3GFvs/9sE=; b=zXil0fWmFlFb8yV5EqZNOFaCsj/9RSc1bmWQEowf6oQ/lGVdWnFp7fAkkOBBWotC3V F89CvcvQItw/2ScYfG54SkEj+X9bAdrpEAIDIL3J71BJ53VVjFSlEfI/yGCwjOLNWI2/ nK8SsdiMY8PX13I1CXLR15KGVjcTyz8J4b/DBaxCnY7IAT8QUp++B8dGk3KMchv5EZxO c5vjHzudL0pgao46o8mlmQHl4/zgJqxX96GhZmor82yMyWlEXFgQPdbXaDrZoQcKJFMz O5CQE16eFcVNr+mLVNiFO/A6tyCpMHRAfN/LvZa49S9SbfjQFRc8dVFiXwT9TzkX8Owe ODWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:content-language:to:subject:from :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=t+PnqXZ6Q8V0eFV64hkaiVuCLrsWOtzW/Q3GFvs/9sE=; b=2jNc9GWvfSqm3trI5FthjCGX3mcOqRAIC2+mG7KCVWt60SrH7LFLZ5qdZ7rkKIZf4b j4eANP85a6HhaprJbC4yMup2hBnbzg26WA2Ce0zX/JNT9ecbaOQHo986ygbfCgOcz8v6 crvv5GQU9yTZoEuw4k8FVPjJKW7S+Xa0725NokkvWocA8rMui5F6ZhXk0N6SR/znAOaN xX8P8HH4JxtNICjmWU7BKL72H0oOSDXAOscGkChiUSgoo8A4oBy7Fkb37T9w/dQ7GPgD sLH2DP+iIEyujy+t8UQLSga/eNiEQjVTltkwjaBGWTcna+8DO/P7GUi+0WvodD2mesEZ Osqw== X-Gm-Message-State: AO0yUKUD4i7/gPpKjd+Xbet6A1xxNn+ry0WbEjl71WchHuVc32fZsdYK BNdnQK7IpXzhQqo6QILSzBFJyL/xOftc+ufB X-Received: by 2002:a05:6214:268c:b0:56b:f28a:ee2d with SMTP id gm12-20020a056214268c00b0056bf28aee2dmr8273836qvb.5.1677819154178; Thu, 02 Mar 2023 20:52:34 -0800 (PST) Received: from [192.168.86.117] ([136.57.172.92]) by smtp.gmail.com with ESMTPSA id 6-20020a370b06000000b0074230493ccfsm995880qkl.73.2023.03.02.20.52.33 for <gcc-patches@gcc.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Mar 2023 20:52:33 -0800 (PST) Message-ID: <87e1164d-1377-8025-223e-7c377ae1752d@rivosinc.com> Date: Thu, 2 Mar 2023 23:52:33 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 From: Michael Collison <collison@rivosinc.com> Subject: [PATCH 00/07] RISC-V: Add auto-vectorization support To: gcc-patches <gcc-patches@gcc.gnu.org> Content-Language: en-US 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, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, KAM_SHORT, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759320943558004716?= X-GMAIL-MSGID: =?utf-8?q?1759320943558004716?= |
Series |
RISC-V: Add auto-vectorization support
|
|
Message
Michael Collison
March 3, 2023, 4:52 a.m. UTC
This series of patches adds foundational support for RISC-V autovectorization. These patches are based on the current upstream rvv vector intrinsic support and is not a new implementation. Most of the implementation consists of adding the new vector cost model, the autovectorization patterns themselves and target hooks. This implementation only provides support for integer addition and subtraction as a proof of concept. As discussed on this list, if these patches are approved they will be merged into a "auto-vectorization" branch once gcc-13 branches for release. There are two known issues related to crashes (assert failures) associated with tree vectorization; one of which I have sent a patch for and have received feedback. I will be sending a patch for the second issue tomorrow. gcc/common/config/riscv/riscv-common.cc | 2 +- gcc/config.gcc | 2 +- gcc/config/riscv/predicates.md | 13 + gcc/config/riscv/riscv-cores.def | 14 +- gcc/config/riscv/riscv-opts.h | 40 ++ gcc/config/riscv/riscv-protos.h | 15 + gcc/config/riscv/riscv-v.cc | 178 ++++- gcc/config/riscv/riscv-vector-builtins.cc | 4 +- gcc/config/riscv/riscv-vector-builtins.h | 2 + gcc/config/riscv/riscv-vector-cost.cc | 620 ++++++++++++++++++ gcc/config/riscv/riscv-vector-cost.h | 400 +++++++++++ gcc/config/riscv/riscv.cc | 321 ++++++++- gcc/config/riscv/riscv.md | 1 + gcc/config/riscv/riscv.opt | 20 + gcc/config/riscv/t-riscv | 5 + gcc/config/riscv/vector-auto.md | 172 +++++ gcc/config/riscv/vector-iterators.md | 2 + gcc/config/riscv/vector.md | 4 +- .../riscv/rvv/autovec/loop-add-rv32.c | 24 + .../gcc.target/riscv/rvv/autovec/loop-add.c | 24 + .../riscv/rvv/autovec/loop-sub-rv32.c | 24 + .../gcc.target/riscv/rvv/autovec/loop-sub.c | 24 + 22 files changed, 1893 insertions(+), 18 deletions(-) create mode 100644 gcc/config/riscv/riscv-vector-cost.cc create mode 100644 gcc/config/riscv/riscv-vector-cost.h create mode 100644 gcc/config/riscv/vector-auto.md create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/loop-add-rv32.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/loop-add.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/loop-sub-rv32.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/loop-sub.c