[v14,07/12] build: use native machine args in Arm native build
Checks
Commit Message
Letting the compiler decide is going to yield the best results for
native builds, so use native machine args usable for both GCC and Clang.
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
config/arm/meson.build | 54 ++++++++++++++++++++++--------------------
1 file changed, 28 insertions(+), 26 deletions(-)
Comments
> -----Original Message-----
> From: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Sent: Wednesday, December 23, 2020 7:48 PM
> To: bruce.richardson@intel.com; Ruifeng Wang <Ruifeng.Wang@arm.com>;
> Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; Phil Yang
> <Phil.Yang@arm.com>; vcchunga@amazon.com; Dharmik Thakkar
> <Dharmik.Thakkar@arm.com>; jerinjacobk@gmail.com;
> hemant.agrawal@nxp.com; Ajit Khaparde (ajit.khaparde@broadcom.com)
> <ajit.khaparde@broadcom.com>; ferruh.yigit@intel.com
> Cc: dev@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech>
> Subject: [PATCH v14 07/12] build: use native machine args in Arm native build
>
> Letting the compiler decide is going to yield the best results for native builds,
> so use native machine args usable for both GCC and Clang.
>
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> ---
> config/arm/meson.build | 54 ++++++++++++++++++++++--------------------
> 1 file changed, 28 insertions(+), 26 deletions(-)
>
> diff --git a/config/arm/meson.build b/config/arm/meson.build index
> 403e1a02f..4508f369c 100644
> --- a/config/arm/meson.build
> +++ b/config/arm/meson.build
> @@ -2,8 +2,6 @@
> # Copyright(c) 2017 Intel Corporation.
> # Copyright(c) 2017 Cavium, Inc
>
> -arm_force_native_march = false
> -
> # common flags to all aarch64 builds, with lowest priority flags_common = [
> # Accelerate rte_memcpy. Be sure to run unit test
> (memcpy_perf_autotest) @@ -26,6 +24,7 @@ flags_common = [
> ['RTE_ARCH_ARM64', true],
> ['RTE_CACHE_LINE_SIZE', 128]
> ]
> +native_machine_args = ['-mcpu=native']
>
> ## Part numbers are specific to Arm implementers # implementer specific
> aarch64 flags have middle priority @@ -47,7 +46,6 @@ implementer_generic
> = { }
>
> part_number_config_arm = {
> - 'native': {'machine_args': ['-march=native']},
> '0xd03': {'machine_args': ['-mcpu=cortex-a53']},
> '0xd04': {'machine_args': ['-mcpu=cortex-a35']},
> '0xd07': {'machine_args': ['-mcpu=cortex-a57']}, @@ -95,7 +93,6 @@
> implementer_cavium = {
> ['RTE_MAX_NUMA_NODES', 2]
> ],
> 'part_number_config': {
> - 'native': {'machine_args': ['-march=native']},
> '0xa1': {
> 'machine_args': ['-mcpu=thunderxt88'],
> 'flags': flags_part_number_thunderx
> @@ -145,8 +142,7 @@ implementer_ampere = {
> ],
> 'part_number_config': {
> '0x0': {'machine_args': ['-march=armv8-a+crc+crypto',
> - '-mtune=emag']},
> - 'native': {'machine_args': ['-march=native']}
> + '-mtune=emag']}
> }
> }
>
> @@ -195,26 +191,27 @@ if dpdk_conf.get('RTE_ARCH_32')
> machine_args += '-mfpu=neon'
> else
> # aarch64 build
> - if machine == 'default' and not meson.is_cross_build()
> - # default build
> - implementer_id = 'generic'
> - part_number = 'generic'
> - elif not meson.is_cross_build()
> - # native build
> - # The script returns ['Implementer', 'Variant', 'Architecture',
> - # 'Primary Part number', 'Revision']
> - detect_vendor = find_program(join_paths(
> - meson.current_source_dir(),
> 'armv8_machine.py'))
> - cmd = run_command(detect_vendor.path())
> - if cmd.returncode() == 0
> - cmd_output = cmd.stdout().to_lower().strip().split(' ')
> - implementer_id = cmd_output[0]
> - part_number = cmd_output[3]
> + use_native_machine_args = false
> + if not meson.is_cross_build()
> + if machine == 'default'
> + # default build
> + implementer_id = 'generic'
> + part_number = 'generic'
> else
> - error('Error when getting Arm Implementer ID and
> part number.')
> - endif
> - if arm_force_native_march == true
> - part_number = 'native'
> + # native build
> + # The script returns ['Implementer', 'Variant',
> 'Architecture',
> + # 'Primary Part number', 'Revision']
> + detect_vendor = find_program(join_paths(
> + meson.current_source_dir(),
> 'armv8_machine.py'))
> + cmd = run_command(detect_vendor.path())
> + if cmd.returncode() == 0
> + cmd_output =
> cmd.stdout().to_lower().strip().split(' ')
> + implementer_id = cmd_output[0]
> + part_number = cmd_output[3]
> + else
> + error('Error when getting Arm Implementer
> ID and part number.')
> + endif
> + use_native_machine_args = true
> endif
> else
> # cross build
> @@ -250,7 +247,12 @@ else
>
> # apply supported machine args
> machine_args = [] # Clear previous machine args
> - foreach flag: part_number_config['machine_args']
> + if use_native_machine_args
> + candidate_machine_args = native_machine_args
> + else
> + candidate_machine_args =
> part_number_config['machine_args']
> + endif
> + foreach flag: candidate_machine_args
> if cc.has_argument(flag)
> machine_args += flag
> endif
> --
> 2.20.1
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
@@ -2,8 +2,6 @@
# Copyright(c) 2017 Intel Corporation.
# Copyright(c) 2017 Cavium, Inc
-arm_force_native_march = false
-
# common flags to all aarch64 builds, with lowest priority
flags_common = [
# Accelerate rte_memcpy. Be sure to run unit test (memcpy_perf_autotest)
@@ -26,6 +24,7 @@ flags_common = [
['RTE_ARCH_ARM64', true],
['RTE_CACHE_LINE_SIZE', 128]
]
+native_machine_args = ['-mcpu=native']
## Part numbers are specific to Arm implementers
# implementer specific aarch64 flags have middle priority
@@ -47,7 +46,6 @@ implementer_generic = {
}
part_number_config_arm = {
- 'native': {'machine_args': ['-march=native']},
'0xd03': {'machine_args': ['-mcpu=cortex-a53']},
'0xd04': {'machine_args': ['-mcpu=cortex-a35']},
'0xd07': {'machine_args': ['-mcpu=cortex-a57']},
@@ -95,7 +93,6 @@ implementer_cavium = {
['RTE_MAX_NUMA_NODES', 2]
],
'part_number_config': {
- 'native': {'machine_args': ['-march=native']},
'0xa1': {
'machine_args': ['-mcpu=thunderxt88'],
'flags': flags_part_number_thunderx
@@ -145,8 +142,7 @@ implementer_ampere = {
],
'part_number_config': {
'0x0': {'machine_args': ['-march=armv8-a+crc+crypto',
- '-mtune=emag']},
- 'native': {'machine_args': ['-march=native']}
+ '-mtune=emag']}
}
}
@@ -195,26 +191,27 @@ if dpdk_conf.get('RTE_ARCH_32')
machine_args += '-mfpu=neon'
else
# aarch64 build
- if machine == 'default' and not meson.is_cross_build()
- # default build
- implementer_id = 'generic'
- part_number = 'generic'
- elif not meson.is_cross_build()
- # native build
- # The script returns ['Implementer', 'Variant', 'Architecture',
- # 'Primary Part number', 'Revision']
- detect_vendor = find_program(join_paths(
- meson.current_source_dir(), 'armv8_machine.py'))
- cmd = run_command(detect_vendor.path())
- if cmd.returncode() == 0
- cmd_output = cmd.stdout().to_lower().strip().split(' ')
- implementer_id = cmd_output[0]
- part_number = cmd_output[3]
+ use_native_machine_args = false
+ if not meson.is_cross_build()
+ if machine == 'default'
+ # default build
+ implementer_id = 'generic'
+ part_number = 'generic'
else
- error('Error when getting Arm Implementer ID and part number.')
- endif
- if arm_force_native_march == true
- part_number = 'native'
+ # native build
+ # The script returns ['Implementer', 'Variant', 'Architecture',
+ # 'Primary Part number', 'Revision']
+ detect_vendor = find_program(join_paths(
+ meson.current_source_dir(), 'armv8_machine.py'))
+ cmd = run_command(detect_vendor.path())
+ if cmd.returncode() == 0
+ cmd_output = cmd.stdout().to_lower().strip().split(' ')
+ implementer_id = cmd_output[0]
+ part_number = cmd_output[3]
+ else
+ error('Error when getting Arm Implementer ID and part number.')
+ endif
+ use_native_machine_args = true
endif
else
# cross build
@@ -250,7 +247,12 @@ else
# apply supported machine args
machine_args = [] # Clear previous machine args
- foreach flag: part_number_config['machine_args']
+ if use_native_machine_args
+ candidate_machine_args = native_machine_args
+ else
+ candidate_machine_args = part_number_config['machine_args']
+ endif
+ foreach flag: candidate_machine_args
if cc.has_argument(flag)
machine_args += flag
endif