From patchwork Fri Nov 4 08:11:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiang, Haochen" X-Patchwork-Id: 15419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp244446wru; Fri, 4 Nov 2022 01:15:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ehd5mi3tqxGpuK71jbi1f+sVjTnvcNCoIiyoKThmxxj0+8ge+NzQSQXe4ifFl51bNhzaw X-Received: by 2002:a17:907:3ea2:b0:7ad:86f9:7b15 with SMTP id hs34-20020a1709073ea200b007ad86f97b15mr32824282ejc.272.1667549710380; Fri, 04 Nov 2022 01:15:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667549710; cv=none; d=google.com; s=arc-20160816; b=aR21MMurmrbW+5ySnhP68sT5qteEBEaeTpM3klQaokzAItm6UouNrotCQd0qEE7UbY /Ea8ancy510m6MktlyUe5MsvkKJd/GFThDNr4kSlorjblDLfGJxrI1iSn+DQkRjYAosU 77+u99xmZ0z2k0XB04H0ejErIywpXozJ8MmgJ25uryRhcC3eTuJu23x7zv3zLULUtc66 Srzg6DrhVFWoQC3zLdFUksG1FhCePTrkef8ml6TI/L+54nHDkm6oNTBjKKpz+nnzl3Ya c09eXKphXHMtUHhMXIcvFd4ERjlrbDF6D+JNeKVwqwqIEciXitlkl86IfV5rTAmw7m5j /9Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=6cXNCbAzJcBU2xBSds4Keuwqbj/c4YPR7JMJVBStP4A=; b=laD+WZ8VeGLwp+hbGKcfLZ1yuEY+XDHFmY9zZhDEjQ7v65ywvqBznDTf1SKWP4v+BE Qpsidq2YO+PP0HSMDgCWv/q9ly4Tr2oM9Pw7j1w3c9Bw3kjs2lQMQElMRRICxS2QMX6j 9S+1jqATPW4S4SsCRVVpECRH5Q9WkTdO8lLjj7S5MkAw5EBYM3EXyMs4mRG294jwpV+B J0Q4kdrTQ2qMzB1svtz6fbSo1mJQgecVhMqFDyH9/SVqAYJLseGuQTjLCiY7Jq4qUeey ysty1ItJrtX6fQojlyV4+EcrCYJewcJjuonET0QoiE/MPJ3jyos0INuGE0UG0e+YyE2C hFKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=qR9AX1Z4; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id xa11-20020a170906fd8b00b007ae3958c7b3si308640ejb.279.2022.11.04.01.15.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 01:15:10 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=qR9AX1Z4; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 62B2E385842B for ; Fri, 4 Nov 2022 08:15:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 62B2E385842B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667549708; bh=6cXNCbAzJcBU2xBSds4Keuwqbj/c4YPR7JMJVBStP4A=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=qR9AX1Z4h7HGxGWLDVDxAeujMOLXD1UVepjjLoPPbhn19CevDf6A8c8KTN/h9gfL6 H+WhJGOCzbDF7j6HPUHXp7pbJyodvytzwmvA27dwxTWrW9JBh6hl0S6puUn65BTcbj yEHdMqJDsKVChZzVB/wP8c+2MkspQalh7q0l9PyE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by sourceware.org (Postfix) with ESMTPS id E0F773858419 for ; Fri, 4 Nov 2022 08:13:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E0F773858419 X-IronPort-AV: E=McAfee;i="6500,9779,10520"; a="290298840" X-IronPort-AV: E=Sophos;i="5.96,136,1665471600"; d="scan'208";a="290298840" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 01:13:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10520"; a="760251772" X-IronPort-AV: E=Sophos;i="5.96,136,1665471600"; d="scan'208";a="760251772" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by orsmga004.jf.intel.com with ESMTP; 04 Nov 2022 01:13:53 -0700 Received: from shliclel320.sh.intel.com (shliclel320.sh.intel.com [10.239.240.127]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 4D31110056B0; Fri, 4 Nov 2022 16:13:52 +0800 (CST) To: gcc-patches@gcc.gnu.org Subject: [PATCH] Initial Granite Rapids support Date: Fri, 4 Nov 2022 16:11:50 +0800 Message-Id: <20221104081150.22062-1-haochen.jiang@intel.com> X-Mailer: git-send-email 2.18.1 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_NONE, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Haochen Jiang via Gcc-patches From: "Jiang, Haochen" Reply-To: Haochen Jiang Cc: "Hu, Lin1" , hongtao.liu@intel.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748552605544601446?= X-GMAIL-MSGID: =?utf-8?q?1748552605544601446?= From: "Hu, Lin1" Hi all, This patch aimed to add initial Granite Rapids support for GCC. It needs to be checked in after prefetchit0/t1 patch. The information for Granite Rapids comes following: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html Regtested on x86_64-pc-linux-gnu. Ok for trunk? BRs, Haochen gcc/Changelog: * common/config/i386/cpuinfo.h: (get_intel_cpu): Handle Granite Rapids. * common/config/i386/i386-common.cc: (processor_names): Add graniterapids. (processor_alias_table): Ditto. * common/config/i386/i386-cpuinfo.h: (enum processor_types): Add INTEL_GRANITERAPIDS. * config.gcc: Add -march=graniterapids. * config/i386/driver-i386.cc (host_detect_local_cpu): Handle graniterapids. * config/i386/i386-c.cc (ix86_target_macros_internal): Ditto. * config/i386/i386-options.cc (m_GRANITERAPIDS): New define. (processor_cost_table): Add graniterapids. * config/i386/i386.h (enum processor_type): Add PROCESSOR_GRANITERAPIDS. (PTA_GRANITERAPIDS): Ditto. * doc/extend.texi: Add graniterapids. * doc/invoke.texi: Ditto. gcc/testsuite/ChangeLog: * gcc/testsuite/g++.target/i386/mv16.C: Add graniterapids. * gcc.target/i386/funcspec-56.inc: Handle new march. --- gcc/common/config/i386/cpuinfo.h | 9 +++++++++ gcc/common/config/i386/i386-common.cc | 3 +++ gcc/common/config/i386/i386-cpuinfo.h | 1 + gcc/config.gcc | 2 +- gcc/config/i386/driver-i386.cc | 5 ++++- gcc/config/i386/i386-c.cc | 7 +++++++ gcc/config/i386/i386-options.cc | 4 +++- gcc/config/i386/i386.h | 3 +++ gcc/doc/extend.texi | 3 +++ gcc/doc/invoke.texi | 11 +++++++++++ gcc/testsuite/g++.target/i386/mv16.C | 6 ++++++ gcc/testsuite/gcc.target/i386/funcspec-56.inc | 1 + 12 files changed, 52 insertions(+), 3 deletions(-) diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h index ac7761699af..42c25b8a636 100644 --- a/gcc/common/config/i386/cpuinfo.h +++ b/gcc/common/config/i386/cpuinfo.h @@ -564,6 +564,15 @@ get_intel_cpu (struct __processor_model *cpu_model, CHECK___builtin_cpu_is ("sierraforest"); cpu_model->__cpu_type = INTEL_SIERRAFOREST; break; + case 0xad: + case 0xae: + /* Granite Rapids. */ + cpu = "graniterapids"; + CHECK___builtin_cpu_is ("corei7"); + CHECK___builtin_cpu_is ("graniterapids"); + cpu_model->__cpu_type = INTEL_COREI7; + cpu_model->__cpu_subtype = INTEL_COREI7_GRANITERAPIDS; + break; case 0x17: case 0x1d: /* Penryn. */ diff --git a/gcc/common/config/i386/i386-common.cc b/gcc/common/config/i386/i386-common.cc index 9bcae020a00..c828ae5b7d7 100644 --- a/gcc/common/config/i386/i386-common.cc +++ b/gcc/common/config/i386/i386-common.cc @@ -1918,6 +1918,7 @@ const char *const processor_names[] = "sapphirerapids", "alderlake", "rocketlake", + "graniterapids", "intel", "lujiazui", "geode", @@ -2037,6 +2038,8 @@ const pta processor_alias_table[] = M_CPU_SUBTYPE (INTEL_COREI7_ALDERLAKE), P_PROC_AVX2}, {"meteorlake", PROCESSOR_ALDERLAKE, CPU_HASWELL, PTA_ALDERLAKE, M_CPU_SUBTYPE (INTEL_COREI7_ALDERLAKE), P_PROC_AVX2}, + {"graniterapids", PROCESSOR_GRANITERAPIDS, CPU_HASWELL, PTA_GRANITERAPIDS, + M_CPU_SUBTYPE (INTEL_COREI7_GRANITERAPIDS), P_PROC_AVX512F}, {"bonnell", PROCESSOR_BONNELL, CPU_ATOM, PTA_BONNELL, M_CPU_TYPE (INTEL_BONNELL), P_PROC_SSSE3}, {"atom", PROCESSOR_BONNELL, CPU_ATOM, PTA_BONNELL, diff --git a/gcc/common/config/i386/i386-cpuinfo.h b/gcc/common/config/i386/i386-cpuinfo.h index 68eda7a8696..c06f089b0c5 100644 --- a/gcc/common/config/i386/i386-cpuinfo.h +++ b/gcc/common/config/i386/i386-cpuinfo.h @@ -96,6 +96,7 @@ enum processor_subtypes INTEL_COREI7_ROCKETLAKE, ZHAOXIN_FAM7H_LUJIAZUI, AMDFAM19H_ZNVER4, + INTEL_COREI7_GRANITERAPIDS, CPU_SUBTYPE_MAX }; diff --git a/gcc/config.gcc b/gcc/config.gcc index 5c782b2f298..03c1523f7af 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -668,7 +668,7 @@ silvermont knl knm skylake-avx512 cannonlake icelake-client icelake-server \ skylake goldmont goldmont-plus tremont cascadelake tigerlake cooperlake \ sapphirerapids alderlake rocketlake eden-x2 nano nano-1000 nano-2000 nano-3000 \ nano-x2 eden-x4 nano-x4 lujiazui x86-64 x86-64-v2 x86-64-v3 x86-64-v4 \ -sierraforest native" +sierraforest graniterapids native" # Additional x86 processors supported by --with-cpu=. Each processor # MUST be separated by exactly one space. diff --git a/gcc/config/i386/driver-i386.cc b/gcc/config/i386/driver-i386.cc index a265b1c39f9..3117d83de00 100644 --- a/gcc/config/i386/driver-i386.cc +++ b/gcc/config/i386/driver-i386.cc @@ -591,8 +591,11 @@ const char *host_detect_local_cpu (int argc, const char **argv) /* This is unknown family 0x6 CPU. */ if (has_feature (FEATURE_AVX)) { + /* Assume Granite Rapids. */ + if (has_feature (FEATURE_AMX_FP16)) + cpu = "graniterapids"; /* Assume Sierra Forest. */ - if (has_feature (FEATURE_AVXVNNIINT8)) + else if (has_feature (FEATURE_AVXVNNIINT8)) cpu = "sierraforest"; /* Assume Tiger Lake */ else if (has_feature (FEATURE_AVX512VP2INTERSECT)) diff --git a/gcc/config/i386/i386-c.cc b/gcc/config/i386/i386-c.cc index 07ce0f8a5a7..c92796281e0 100644 --- a/gcc/config/i386/i386-c.cc +++ b/gcc/config/i386/i386-c.cc @@ -250,6 +250,10 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag, def_or_undef (parse_in, "__sapphirerapids"); def_or_undef (parse_in, "__sapphirerapids__"); break; + case PROCESSOR_GRANITERAPIDS: + def_or_undef (parse_in, "__graniterapids"); + def_or_undef (parse_in, "__graniterapids__"); + break; case PROCESSOR_ALDERLAKE: def_or_undef (parse_in, "__alderlake"); def_or_undef (parse_in, "__alderlake__"); @@ -433,6 +437,9 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag, case PROCESSOR_ROCKETLAKE: def_or_undef (parse_in, "__tune_rocketlake__"); break; + case PROCESSOR_GRANITERAPIDS: + def_or_undef (parse_in, "__tune_graniterapids__"); + break; case PROCESSOR_INTEL: case PROCESSOR_GENERIC: break; diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index 625739658c9..633d5dd7eea 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -127,10 +127,11 @@ along with GCC; see the file COPYING3. If not see #define m_SAPPHIRERAPIDS (HOST_WIDE_INT_1U<