From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 919154399B; Mon, 22 Jan 2024 17:27:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5F755402DA; Mon, 22 Jan 2024 17:27:03 +0100 (CET) Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by mails.dpdk.org (Postfix) with ESMTP id 01FB7402C9 for ; Mon, 22 Jan 2024 17:27:01 +0100 (CET) Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a3046221b0eso104056566b.1 for ; Mon, 22 Jan 2024 08:27:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1705940821; x=1706545621; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5lQYaefAO3wtkwnfsPYuSoS+UM66r6Q8lfIod1KLzRM=; b=LGW64jWO/7f9SWwyt/pBFLddK9ocMvo575IyNRV8kuKbjDlmsfKmH5fqETIwsyiWng y2IPCjE003hFQkRimOHgoo+Gg+/ZghY+40oa85cesm+Ep9rut4DLSIpQlMccPeFz/NAG 0I+QG+Pb3sSJ59m86VQBpGA7j6godSRwsOs0XK2cyaheOp2Xb3O6YYAs5IimBiccS63K FQ8lGRd8QOn6qk+DEvwmdMmCvcP6YQYHyNhLKnY3UP3adF82xm0zV8+6eUVRsn9RG9P1 6RBBFbuWQluBGYXpnolCLBvtChOO/aFNU26e3b4qjvfgZjy+tKEg9l/oMiV9nMfgfFr1 fEkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705940821; x=1706545621; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5lQYaefAO3wtkwnfsPYuSoS+UM66r6Q8lfIod1KLzRM=; b=WH9PPyTdCxrGnZYaTU1Upm3gSXr49Cbt32d3cR02I4l7YRJ8DXh8e0lV/tG7KjmcBC /HECCuYDu+lqfUrzCA/agY5FN20E9JmS0nJRjdgERotOIAl1b2FXRITPiQCk2AYLI/EI Eoo3RlPlXE59BMLPxt3IKTyXVQbIECJDnk7JuZ+f/tix9GmVdUMNA4MVSZOkS9h1FR47 CB/2FiyekMbiFkio6gm6X5GSfmd63DvKGUO37bYvWJMpJtLaQFv1IETHJdfIf8OCYw8v yF90eRYx5N6cpWEE89nexbF/5ks3tBMwT6mxEtaxovb6HK/tiTZS6X0vhW/earmH5737 ux9w== X-Gm-Message-State: AOJu0Yw5lGac/pZ6wK0P9Py1i10ZLHgV9t/Dx3/n3aXrCjyEOvxaX8ZG Y5a0uMlLOUFMpV6wS9moUqgSpalC12UjK6ocab66IK6t+PnnOa41FnSanxdOHJKwt3PuycTNILa kNVhNNzPm/ZnF0K0OETHajCHBslcPf1F+DVNWNw== X-Google-Smtp-Source: AGHT+IEvvOahP+eUCPRJ+vUrQoLQYSI/t/TsiSlS2/uinU5hWG+phevF7YzGV+PzOa6186XrTOx5J5dNtFWi+JTDQnI= X-Received: by 2002:a17:907:a809:b0:a30:2e6b:99bf with SMTP id vo9-20020a170907a80900b00a302e6b99bfmr1494135ejc.109.1705940820746; Mon, 22 Jan 2024 08:27:00 -0800 (PST) MIME-Version: 1.0 References: <20240121093653.2890-1-pbhagavatula@marvell.com> In-Reply-To: From: =?UTF-8?Q?Juraj_Linke=C5=A1?= Date: Mon, 22 Jan 2024 17:26:49 +0100 Message-ID: Subject: Re: [EXT] Re: [PATCH 1/2] config/arm: avoid mcpu and march conflicts To: Pavan Nikhilesh Bhagavatula Cc: Jerin Jacob , "Ruifeng.Wang@arm.com" , "nd@arm.com" , Bruce Richardson , "dev@dpdk.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, Jan 22, 2024 at 12:54=E2=80=AFPM Pavan Nikhilesh Bhagavatula wrote: > > > On Sun, Jan 21, 2024 at 10:37=E2=80=AFAM wro= te: > > > > > > From: Pavan Nikhilesh > > > > > > The compiler options march and mtune are a subset > > > of mcpu and will lead to conflicts if improper march > > > is chosen for a given mcpu. > > > To avoid conflicts, force part number march when > > > mcpu is available and is supported by the compiler. > > > > > > Example: > > > march =3D armv9-a > > > mcpu =3D neoverse-n2 > > > > > > mcpu supported, march supported > > > machine_args =3D ['-mcpu=3Dneoverse-n2', '-march=3Darmv9-a'] > > > > > > mcpu supported, march not supported > > > machine_args =3D ['-mcpu=3Dneoverse-n2'] > > > > > > mcpu not supported, march supported > > > machine_args =3D ['-march=3Darmv9-a'] > > > > > > mcpu not supported, march not supported > > > machine_args =3D ['-march=3Darmv8.6-a'] > > > > > > Signed-off-by: Pavan Nikhilesh > > > --- > > > config/arm/meson.build | 109 +++++++++++++++++++++++++-------------- > > -- > > > 1 file changed, 67 insertions(+), 42 deletions(-) > > > > > > diff --git a/config/arm/meson.build b/config/arm/meson.build > > > index 36f21d2259..8c8cfccca0 100644 > > > --- a/config/arm/meson.build > > > +++ b/config/arm/meson.build > > > > > @@ -127,21 +128,22 @@ implementer_cavium =3D { > > > ], > > > 'part_number_config': { > > > '0xa1': { > > > - 'compiler_options': ['-mcpu=3Dthunderxt88'], > > > + 'mcpu': 'thunderxt88', > > > 'flags': flags_part_number_thunderx > > > }, > > > '0xa2': { > > > - 'compiler_options': ['-mcpu=3Dthunderxt81'], > > > + 'mcpu': 'thunderxt81', > > > 'flags': flags_part_number_thunderx > > > }, > > > '0xa3': { > > > - 'compiler_options': ['-march=3Darmv8-a+crc', '-mcpu=3Dth= underxt83'], > > > + 'mcpu': 'thunderxt83', > > > + 'compiler_options': ['-march=3Darmv8-a+crc'], > > > > Let's unify this with the rest and specify 'march': 'armv8-a+crc' > > instead of having it under compiler_options. > > Ack. > > > > > > 'flags': flags_part_number_thunderx > > > }, > > > '0xaf': { > > > 'march': 'armv8.1-a', > > > 'march_features': ['crc', 'crypto'], > > > - 'compiler_options': ['-mcpu=3Dthunderx2t99'], > > > + 'mcpu': 'thunderx2t99', > > > 'flags': [ > > > ['RTE_MACHINE', '"thunderx2"'], > > > ['RTE_ARM_FEATURE_ATOMICS', true], > > > @@ -153,7 +155,7 @@ implementer_cavium =3D { > > > '0xb2': { > > > 'march': 'armv8.2-a', > > > 'march_features': ['crc', 'crypto', 'lse'], > > > - 'compiler_options': ['-mcpu=3Docteontx2'], > > > + 'mcpu': 'octeontx2', > > > 'flags': [ > > > ['RTE_MACHINE', '"cn9k"'], > > > ['RTE_ARM_FEATURE_ATOMICS', true], > > > @@ -176,7 +178,7 @@ implementer_ampere =3D { > > > '0x0': { > > > 'march': 'armv8-a', > > > 'march_features': ['crc', 'crypto'], > > > - 'compiler_options': ['-mtune=3Demag'], > > > + 'mcpu': 'emag', > > > > We're changing mtune to mcpu, is this equivalent? > > > > Both march and mtune are a subset of mcpu. > Sure, but we replaced '-mtune=3Demag' with '-mcpu=3Demag'. Are these two builds going to be different or the same? > > > 'flags': [ > > > ['RTE_MACHINE', '"eMAG"'], > > > ['RTE_MAX_LCORE', 32], > > > @@ -186,7 +188,7 @@ implementer_ampere =3D { > > > '0xac3': { > > > 'march': 'armv8.6-a', > > > 'march_features': ['crc', 'crypto'], > > > - 'compiler_options': ['-mcpu=3Dampere1'], > > > + 'mcpu': 'ampere1', > > > 'flags': [ > > > ['RTE_MACHINE', '"AmpereOne"'], > > > ['RTE_MAX_LCORE', 320], > > > @@ -206,7 +208,7 @@ implementer_hisilicon =3D { > > > '0xd01': { > > > 'march': 'armv8.2-a', > > > 'march_features': ['crypto'], > > > - 'compiler_options': ['-mtune=3Dtsv110'], > > > + 'mcpu': 'tsv110', > > > 'flags': [ > > > ['RTE_MACHINE', '"Kunpeng 920"'], > > > ['RTE_ARM_FEATURE_ATOMICS', true], > > > @@ -695,11 +697,23 @@ if update_flags > > > > > > machine_args =3D [] # Clear previous machine args > > > > > > + candidate_mcpu =3D '' > > > + support_mcpu =3D false > > > + if part_number_config.has_key('mcpu') > > > + mcpu =3D part_number_config['mcpu'] > > > + if (cc.has_argument('-mcpu=3D' + mcpu)) > > > + candidate_mcpu =3D mcpu > > > + support_mcpu =3D true > > > + endif > > > + endif > > > + > > > # probe supported archs and their features > > > candidate_march =3D '' > > > if part_number_config.has_key('march') > > > - if part_number_config.get('force_march', false) > > > - candidate_march =3D part_number_config['march'] > > > + if part_number_config.get('force_march', false) or support_m= cpu > > > > Instead of using the extra "support_mcpu" variable, we could do the > > same check as with candidate march (if candidate_mcpu !=3D '', which we > > actually do below in the last lines of the patch). > > > > Ack. > > > If I understand the logic correctly, we don't want to do the march > > fallback if mcpu is specified - either the march works with the given > > mcpu or we do without it (because we don't actually need it with > > mcpu). Is that correct? > > > > Yes, but still exact march defined in part_number_config should be presen= t for setting extra_march_features. > specially for expressing crypto support. > Ok, thanks. > > > + if cc.has_argument('-march=3D' + part_number_config['ma= rch']) > > > > Now that we've added mcpu into the mix, is this still the right > > condition? Can the below happen? > > > > This check finds that machine_args =3D ['-march=3Darmv9-a'] is supporte= d. > > > > But taken together with mcpu (machine_args =3D ['-mcpu=3Dneoverse-n2', > > '-march=3Darmv9-a']), it is not supported? In this case we'll end up > > with invalid configuration. > > This is the only correct option and evolves into -march=3Darmv9-a+sve2+cr= ypto for cn10k > whereas other neoverse-n2 might only have -march=3Darmv9-a+sve2. > Maybe I should rephrase my question a bit: The correct options are ['-mcpu=3Dneoverse-n2', '-march=3Darmv9-a']. Is it possible that the compiler will say: ['-mcpu=3Dneoverse-n2', '-march=3Darmv9-a'] is supported ['-mcpu=3Dneoverse-n2'] is supported ['-march=3Darmv9-a'] is not supported So basically the question is are we risking that the compiler will say it supports both options only when both are passed while also saying it doesn't support one or both of them when checked alone. We've seen this behavior with newer compilers in aarch32 builds (-march=3Darmv8-a+simd -mfpu=3Dauto are supported when both are passed, but -march=3Darmv8-a is not supported alone), so I wanted to be sure. > Example: > > Good: > #aarch64-linux-gnu-gcc -march=3Darmv9-a+sve2+crypto -mcpu=3Dneoverse-n2 = shrn.c > #aarch64-linux-gnu-gcc -march=3Darmv9-a+sve2 -mcpu=3Dneoverse-n2 shrn.c > #aarch64-linux-gnu-gcc -march=3Darmv9-a -mcpu=3Dneoverse-n2 shrn.c > > Bad: > #aarch64-linux-gnu-gcc -mcpu=3Dneoverse-n2 -march=3Darmv8-a shrn.c > cc1: warning: switch '-mcpu=3Dneoverse-n2' conflicts with '-march=3Darmv8= -a' switch > #aarch64-linux-gnu-gcc -mcpu=3Dneoverse-n2 -march=3Darmv8.1-a shrn.c > cc1: warning: switch '-mcpu=3Dneoverse-n2' conflicts with '-march=3Darmv8= .1-a' switch > #aarch64-linux-gnu-gcc -mcpu=3Dneoverse-n2 -march=3Darmv8.2-a shrn.c > cc1: warning: switch '-mcpu=3Dneoverse-n2' conflicts with '-march=3Darmv8= .2-a' switch > #aarch64-linux-gnu-gcc -mcpu=3Dneoverse-n2 -march=3Darmv8.3-a shrn.c > cc1: warning: switch '-mcpu=3Dneoverse-n2' conflicts with '-march=3Darmv8= .3-a' switch > #aarch64-linux-gnu-gcc -mcpu=3Dneoverse-n2 -march=3Darmv8.4-a shrn.c > cc1: warning: switch '-mcpu=3Dneoverse-n2' conflicts with '-march=3Darmv8= .4-a' switch > #aarch64-linux-gnu-gcc -mcpu=3Dneoverse-n2 -march=3Darmv8.5-a shrn.c > cc1: warning: switch '-mcpu=3Dneoverse-n2' conflicts with '-march=3Darmv8= .5-a' switch > #aarch64-linux-gnu-gcc -mcpu=3Dneoverse-n2 -march=3Darmv8.6-a shrn.c > cc1: warning: switch '-mcpu=3Dneoverse-n2' conflicts with '-march=3Darmv8= .6-a' switch > #aarch64-linux-gnu-gcc -mcpu=3Dneoverse-n2 -march=3Darmv8.7-a shrn.c > cc1: warning: switch '-mcpu=3Dneoverse-n2' conflicts with '-march=3Darmv8= .7-a' switch > > > > > > + candidate_march =3D part_number_config['march'] > > > + endif > > > else > > > supported_marchs =3D ['armv8.6-a', 'armv8.5-a', 'armv8.4= -a', 'armv8.3- > > a', > > > 'armv8.2-a', 'armv8.1-a', 'armv8-a']