From patchwork Tue Mar 29 12:03:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 52444 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C59C03888832 for ; Tue, 29 Mar 2022 12:03:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C59C03888832 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1648555434; bh=g5KYJS13tyzJerGYZ3TEGZ/bYT9JjH+8bsfjJM2aYtM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=tJKeAdvJUNRdq7bWf+u/I3haeHupUw2NKoYSREwwmC88W0a/Kjn1/duUDit4Kd93p zJk+9ItUQLnduVD6nM+KdSz1Mq+5h9zr8/NPpDdOsZFBFMSVUC2ZQDdkB3MBGJG55I h+6Wc47GiyfFSzZaUU+6pjbv9k9DA0cKK+iMg/nM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 76C6D3858C50 for ; Tue, 29 Mar 2022 12:03:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 76C6D3858C50 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 57053210EA for ; Tue, 29 Mar 2022 12:03:24 +0000 (UTC) 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 3834D13A7E for ; Tue, 29 Mar 2022 12:03:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id U1RbDIz1QmIdEgAAMHmgww (envelope-from ) for ; Tue, 29 Mar 2022 12:03:24 +0000 Date: Tue, 29 Mar 2022 14:03:22 +0200 To: gcc-patches@gcc.gnu.org Subject: [committed][nvptx] Add march-map Message-ID: <20220329120321.GA29849@delia.home> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , X-Patchwork-Original-From: Tom de Vries via Gcc-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, Say we have an sm_50 board, and we want to run a benchmark using the highest possible march setting. Currently there's march=sm_30, march=sm_35, march=sm_53, but no march=sm_50. So, we'd need to pick march=sm_35. Likewise, for a test script that handles multiple boards, we'd need a mapping from native board sm_xx to march, which might have to be updated with newer gcc releases. Add an option march-map, such that we can just specify march-map=sm_50, and let the compiler map this to the appropriate march. The option is implemented as a list of aliases, such that we have a somewhat lengthy (17 lines in total): ... $ gcc --help=target ... -march-map=sm_30 Same as -misa=sm_30. -march-map=sm_32 Same as -misa=sm_30. ... -march-map=sm_87 Same as -misa=sm_80. -march-map=sm_90 Same as -misa=sm_80. ... This implementation was chosen in the hope that it'll be easier if we end up with some misa multilib. It would be nice to have the mapping list generated from an updated nvptx-sm.def, but for now it's spelled out in nvptx.opt. Tested on nvptx. Committed to trunk. Thanks, - Tom [nvptx] Add march-map gcc/ChangeLog: 2022-03-29 Tom de Vries PR target/104714 * config/nvptx/nvptx.opt (march-map=*): Add aliases. gcc/testsuite/ChangeLog: 2022-03-29 Tom de Vries PR target/104714 * gcc.target/nvptx/march-map.c: New test. --- gcc/config/nvptx/nvptx.opt | 51 ++++++++++++++++++++++++++++++ gcc/testsuite/gcc.target/nvptx/march-map.c | 5 +++ 2 files changed, 56 insertions(+) diff --git a/gcc/config/nvptx/nvptx.opt b/gcc/config/nvptx/nvptx.opt index b5d0170e9e9..58eddeeabf4 100644 --- a/gcc/config/nvptx/nvptx.opt +++ b/gcc/config/nvptx/nvptx.opt @@ -60,6 +60,57 @@ march= Target RejectNegative Joined Alias(misa=) Alias: +march-map=sm_30 +Target RejectNegative Alias(misa=,sm_30) + +march-map=sm_32 +Target RejectNegative Alias(misa=,sm_30) + +march-map=sm_35 +Target RejectNegative Alias(misa=,sm_35) + +march-map=sm_37 +Target RejectNegative Alias(misa=,sm_35) + +march-map=sm_50 +Target RejectNegative Alias(misa=,sm_35) + +march-map=sm_52 +Target RejectNegative Alias(misa=,sm_35) + +march-map=sm_53 +Target RejectNegative Alias(misa=,sm_53) + +march-map=sm_60 +Target RejectNegative Alias(misa=,sm_53) + +march-map=sm_61 +Target RejectNegative Alias(misa=,sm_53) + +march-map=sm_62 +Target RejectNegative Alias(misa=,sm_53) + +march-map=sm_70 +Target RejectNegative Alias(misa=,sm_70) + +march-map=sm_72 +Target RejectNegative Alias(misa=,sm_70) + +march-map=sm_75 +Target RejectNegative Alias(misa=,sm_75) + +march-map=sm_80 +Target RejectNegative Alias(misa=,sm_80) + +march-map=sm_86 +Target RejectNegative Alias(misa=,sm_80) + +march-map=sm_87 +Target RejectNegative Alias(misa=,sm_80) + +march-map=sm_90 +Target RejectNegative Alias(misa=,sm_80) + Enum Name(ptx_version) Type(int) Known PTX ISA versions (for use with the -mptx= option): diff --git a/gcc/testsuite/gcc.target/nvptx/march-map.c b/gcc/testsuite/gcc.target/nvptx/march-map.c new file mode 100644 index 00000000000..00838e55fc0 --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/march-map.c @@ -0,0 +1,5 @@ +/* { dg-options "-march-map=sm_50" } */ + +#include "main.c" + +/* { dg-final { scan-assembler-times "\\.target\tsm_35" 1 } } */