From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A03B4A09FF; Wed, 6 Jan 2021 15:42:58 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 29336160989; Wed, 6 Jan 2021 15:42:58 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 01B08160983 for ; Wed, 6 Jan 2021 15:42:55 +0100 (CET) IronPort-SDR: Idg9jO0f6x6f8So6CsWeFZLzM4KtKGAzScV5JYs7q1UYhudbyF2n85LA3DG6LlK2+BnQdWNluc vAYHuwP7A2Bw== X-IronPort-AV: E=McAfee;i="6000,8403,9855"; a="177384900" X-IronPort-AV: E=Sophos;i="5.78,480,1599548400"; d="scan'208";a="177384900" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2021 06:42:54 -0800 IronPort-SDR: eXVBivB9YZNa1H+WI9pM05+2fS1CrjGKeI2mQthUSp+seXjcoV+j/WOdDrEMWF+9BBfZ2vAXG6 1dZIIbAiJ+0g== X-IronPort-AV: E=Sophos;i="5.78,480,1599548400"; d="scan'208";a="379306573" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.27.188]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 06 Jan 2021 06:42:53 -0800 Date: Wed, 6 Jan 2021 14:42:49 +0000 From: Bruce Richardson To: David Christensen Cc: Juraj =?utf-8?Q?Linke=C5=A1?= , "thomas@monjalon.net" , "Honnappa.Nagarahalli@arm.com" , "dev@dpdk.org" Message-ID: <20210106144249.GB1969@bricha3-MOBL.ger.corp.intel.com> References: <1606405649-4308-1-git-send-email-juraj.linkes@pantheon.tech> <1609761130-4627-1-git-send-email-juraj.linkes@pantheon.tech> <2c52c961e32643f385c9ce76d9d78236@pantheon.tech> <1be8e489-db41-c0d6-8518-d2844c8145c4@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1be8e489-db41-c0d6-8518-d2844c8145c4@linux.vnet.ibm.com> Subject: Re: [dpdk-dev] [RFC PATCH v2] build: add platform meson option 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 Sender: "dev" On Tue, Jan 05, 2021 at 02:17:44PM -0800, David Christensen wrote: > > > The current meson option 'machine' should only specify the ISA, which is not > > > sufficient for Arm, where setting ISA implies other setting as well. > > > Add a new meson option, 'platform', which differentiates the type of the build > > > (native/generic) and sets machine accordingly, unless the user chooses to > > > override it. > > > The 'machine' option also doesn't describe very well what it sets, so introduce a > > > new option 'cpu_instruction_set', but keep 'machine' for backward > > > compatibility. > > > These two new variables, taken together, achieve what 'machine' was setting > > > per architecture - setting the ISA in x86 build and setting native/default 'build > > > type' in aarch64 build - is now properly being set for all architectures in a > > > uniform manner. > > > > > > Signed-off-by: Juraj Linkeš > > > --- > > > config/arm/meson.build | 4 +-- > > > config/meson.build | 47 +++++++++++++++++++++++++---------- > > > devtools/test-meson-builds.sh | 9 ++++--- > > > meson_options.txt | 8 ++++-- > > > 4 files changed, 47 insertions(+), 21 deletions(-) > > > > > > diff --git a/config/arm/meson.build b/config/arm/meson.build index > > > 42b4e43c7..6b09a74a7 100644 > > > --- a/config/arm/meson.build > > > +++ b/config/arm/meson.build > > > @@ -3,10 +3,10 @@ > > > # Copyright(c) 2017 Cavium, Inc > > > > > > # for checking defines we need to use the correct compiler flags -march_opt = '- > > > march=@0@'.format(machine) > > > +march_opt = '-march=@0@'.format(cpu_instruction_set) > > > > > > arm_force_native_march = false > > > -arm_force_default_march = (machine == 'default') > > > +arm_force_default_march = (platform == 'generic') > > > > > > flags_common_default = [ > > > # Accelarate rte_memcpy. Be sure to run unit test > > > (memcpy_perf_autotest) diff --git a/config/meson.build b/config/meson.build > > > index a3154e29c..647116513 100644 > > > --- a/config/meson.build > > > +++ b/config/meson.build > > > @@ -63,42 +63,63 @@ if not is_windows > > > pmd_subdir_opt) > > > endif > > > > > > -# set the machine type and cflags for it > > > +platform = get_option('platform') > > > + > > > +# set the cpu_instruction_set type and cflags for it > > > if meson.is_cross_build() > > > - machine = host_machine.cpu() > > > + cpu_instruction_set = host_machine.cpu() > > > else > > > - machine = get_option('machine') > > > + cpu_instruction_set = get_option('cpu_instruction_set') > > > + if get_option('machine') != 'auto' > > > + warning('The "machine" option is deprecated. ' + > > > + 'Please use "cpu_instruction_set" instead.') > > > + if cpu_instruction_set != 'auto' > > > + error('Setting both "machine" and ' + > > > + '"cpu_instruction_set" is unsupported.') > > > + endif > > > + cpu_instruction_set = get_option('machine') > > > + endif > > > +endif > > > + > > > +if platform == 'native' > > > + if cpu_instruction_set == 'auto' > > > + cpu_instruction_set = 'native' > > > + endif > > > +elif platform == 'generic' > > > + if cpu_instruction_set == 'auto' > > > + cpu_instruction_set = 'default' > > > + endif > > > endif > > > > > > -# machine type 'default' is special, it defaults to the per arch agreed common > > > +if cpu_instruction_set == 'default' > > > +# cpu_instruction_set type 'default' is special, it defaults to the per > > > +arch agreed common > > > # minimal baseline needed for DPDK. > > > # That might not be the most optimized, but the most portable version while # > > > still being able to support the CPU features required for DPDK. > > > # This can be bumped up by the DPDK project, but it can never be an # invariant > > > like 'native' > > > -if machine == 'default' > > > if host_machine.cpu_family().startswith('x86') > > > # matches the old pre-meson build systems default > > > - machine = 'corei7' > > > + cpu_instruction_set = 'corei7' > > > elif host_machine.cpu_family().startswith('arm') > > > - machine = 'armv7-a' > > > + cpu_instruction_set = 'armv7-a' > > > elif host_machine.cpu_family().startswith('aarch') > > > # arm64 manages defaults in config/arm/meson.build > > > - machine = 'default' > > > + cpu_instruction_set = 'default' > > > elif host_machine.cpu_family().startswith('ppc') > > > - machine = 'power8' > > > + cpu_instruction_set = 'power8' > > > endif > > > endif > > This change forces the build on a P9 system to use the P8 instruction set. > Prior to this change the "native" machine type was used which resulted in P9 > instructions when built on a P9 system. How do I force the build to use the > power9 instruction set in this case? > > Dave >From looking at the patch, setting the "platform" to "native", or the instruction_set to "native" should do this. While I consider generic builds a good thing, I wonder if there is an expectation that "native" is always the default build type for DPDK builds? /Bruce