* [PATCH v3 1/2] config/arm: strict use of -mcpu for supported CPUs
@ 2024-11-29 23:47 Wathsala Vithanage
2024-11-29 23:47 ` [PATCH v3 2/2] config/arm: sort SOCs alphabetically Wathsala Vithanage
0 siblings, 1 reply; 2+ messages in thread
From: Wathsala Vithanage @ 2024-11-29 23:47 UTC (permalink / raw)
To: Wathsala Vithanage, Bruce Richardson
Cc: dev, nd, thomas, honnappa.nagarahalli, Dhruv Tripathi
Arm recommends using -mcpu over -march and march-extensions when the
compiler supports the target CPU (neoverse-n1 etc.). Arm build so far
has been an amalgam of -mcpu and -march. When march is in use, it has
been the case so far to silently fall back to a downgraded march when
the compiler does not support the requested march. This is unnecessary
and confusing to an end user who could be building DPDK with a
particular ISA version and performance expectations in mind.
This patch aims to rectify both the above issues. For part numbers that
has a corresponding -mcpu, this patch removes all references to march
and march_features from meson.build. For those SOCs that do not have a
corresponding -mcpu, a pseudo cpu name in the format mcpu_<soc_name> is
introduced and referenced in the mcpu field in the part number
dictionary of the part_number_config dictionary. The definition of the
mcpu_<soc_name> must be provided in the mcpu_defs dictionary.
Each mcpu_<soc_name> dictionary in the mcpu_defs have a march field and
a march_extensions field to construct the optimal compiler setting for
an SOC that has no corresponding -mcpu value. This patch alters the
behavior of the build system such that it will no longer silently fall
back to an older ISA version, it will only perform what's specified in
the build dictionaries, if the compiler does not support the specified
configuration it will fail with an error message.
How to add a new SOC to the build system with these changes?
If compiler supports mcpu follow the usual practice but without march
and march_features fields in the part number dictionary. If mcpu is not
available or buggy (misses certain features) for some reason follow the
same process but set mcpu field to a string in the form 'mcpu_foo'
(pseudo mcpu mentioned earlier). Then in the mcpu_defs dictionary add
mcpu_foo dictionary as shown.
'mcpu_foo': {
'march': 'armv8.2-a',
'march_extensions': [rcpc]
}
march_extensions is a comma separated list of march extensions supported
by the compiler such as sve, crypto etc. Empty match_extensions allowed
as use of such extensions are optional.
Signed-off-by: Wathsala Vithanage <wathsala.vithanage@arm.com>
Reviewed-by: Dhruv Tripathi <dhruv.tripathi@arm.com>
---
config/arm/meson.build | 193 +++++++++++++++++------------------------
1 file changed, 80 insertions(+), 113 deletions(-)
diff --git a/config/arm/meson.build b/config/arm/meson.build
index 55be7c8711..9ed36d9907 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -39,14 +39,11 @@ implementer_generic = {
],
'part_number_config': {
'generic': {
- 'march': 'armv8-a',
- 'march_features': ['crc'],
+ 'mcpu': 'mcpu_generic',
'compiler_options': ['-moutline-atomics']
},
'generic_aarch32': {
- 'march': 'armv8-a',
- 'force_march': true,
- 'march_features': ['simd'],
+ 'mcpu': 'mcpu_generic_aarch32',
'compiler_options': ['-mfpu=auto'],
'flags': [
['RTE_ARCH_ARM_NEON_MEMCPY', false],
@@ -69,8 +66,6 @@ part_number_config_arm = {
'0xd0a': {'mcpu': 'cortex-a75'},
'0xd0b': {'mcpu': 'cortex-a76'},
'0xd0c': {
- 'march': 'armv8.2-a',
- 'march_features': ['crypto', 'rcpc'],
'mcpu': 'neoverse-n1',
'flags': [
['RTE_MACHINE', '"neoverse-n1"'],
@@ -81,8 +76,6 @@ part_number_config_arm = {
]
},
'0xd40': {
- 'march': 'armv8.4-a',
- 'march_features': ['sve'],
'mcpu': 'neoverse-v1',
'flags': [
['RTE_MACHINE', '"neoverse-v1"'],
@@ -94,9 +87,6 @@ part_number_config_arm = {
'march': 'armv8.4-a',
},
'0xd49': {
- 'march': 'armv9-a',
- 'march_features': ['sve2'],
- 'fallback_march': 'armv8.5-a',
'mcpu': 'neoverse-n2',
'flags': [
['RTE_MACHINE', '"neoverse-n2"'],
@@ -106,10 +96,7 @@ part_number_config_arm = {
]
},
'0xd4f': {
- 'march': 'armv9-a',
- 'march_features': ['sve2'],
'mcpu' : 'neoverse-v2',
- 'fallback_march': 'armv8.5-a',
'flags': [
['RTE_MACHINE', '"neoverse-v2"'],
['RTE_ARM_FEATURE_ATOMICS', true],
@@ -171,15 +158,11 @@ implementer_cavium = {
'flags': flags_part_number_thunderx
},
'0xa3': {
- 'march': 'armv8-a',
- 'march_features': ['crc', 'crypto'],
- 'mcpu': 'thunderxt83',
+ 'mcpu': 'mcpu_thunderxt83',
'flags': flags_part_number_thunderx
},
'0xaf': {
- 'march': 'armv8.1-a',
- 'march_features': ['crc', 'crypto'],
- 'mcpu': 'thunderx2t99',
+ 'mcpu': 'mcpu_thunderx2t99',
'flags': [
['RTE_MACHINE', '"thunderx2"'],
['RTE_ARM_FEATURE_ATOMICS', true],
@@ -189,8 +172,6 @@ implementer_cavium = {
]
},
'0xb2': {
- 'march': 'armv8.2-a',
- 'march_features': ['crc', 'crypto', 'lse'],
'mcpu': 'octeontx2',
'flags': [
['RTE_MACHINE', '"cn9k"'],
@@ -212,8 +193,6 @@ implementer_ampere = {
],
'part_number_config': {
'0x0': {
- 'march': 'armv8-a',
- 'march_features': ['crc', 'crypto'],
'mcpu': 'emag',
'flags': [
['RTE_MACHINE', '"eMAG"'],
@@ -222,8 +201,6 @@ implementer_ampere = {
]
},
'0xac3': {
- 'march': 'armv8.6-a',
- 'march_features': ['crc', 'crypto'],
'mcpu': 'ampere1',
'flags': [
['RTE_MACHINE', '"AmpereOne"'],
@@ -232,8 +209,6 @@ implementer_ampere = {
]
},
'0xac4': {
- 'march': 'armv8.6-a',
- 'march_features': ['crc', 'crypto'],
'mcpu': 'ampere1a',
'flags': [
['RTE_MACHINE', '"AmpereOneAC04"'],
@@ -252,8 +227,6 @@ implementer_hisilicon = {
],
'part_number_config': {
'0xd01': {
- 'march': 'armv8.2-a',
- 'march_features': ['crypto'],
'mcpu': 'tsv110',
'flags': [
['RTE_MACHINE', '"Kunpeng 920"'],
@@ -263,8 +236,7 @@ implementer_hisilicon = {
]
},
'0xd02': {
- 'march': 'armv8.2-a',
- 'march_features': ['crypto', 'sve'],
+ 'mcpu': 'mcpu_kunpeng930',
'flags': [
['RTE_MACHINE', '"Kunpeng 930"'],
['RTE_ARM_FEATURE_ATOMICS', true],
@@ -273,8 +245,7 @@ implementer_hisilicon = {
]
},
'0xd03': {
- 'march': 'armv8.5-a',
- 'march_features': ['crypto', 'sve'],
+ 'mcpu': 'mcpu_hip10',
'flags': [
['RTE_MACHINE', '"hip10"'],
['RTE_ARM_FEATURE_ATOMICS', true],
@@ -321,16 +292,14 @@ implementer_phytium = {
],
'part_number_config': {
'0x662': {
- 'march': 'armv8-a',
- 'march_features': ['crc'],
+ 'mcpu': 'mcpu_ft2000plus',
'flags': [
['RTE_MAX_LCORE', 64],
['RTE_MAX_NUMA_NODES', 8]
- ]
+ ]
},
- '0x663': {
- 'march': 'armv8-a',
- 'march_features': ['crc'],
+ '0x663': {
+ 'mcpu': 'mcpu_tys2500',
'flags': [
['RTE_MAX_LCORE', 256],
['RTE_MAX_NUMA_NODES', 32]
@@ -349,13 +318,8 @@ implementer_qualcomm = {
['RTE_MAX_NUMA_NODES', 1]
],
'part_number_config': {
- '0x800': {
- 'march': 'armv8-a',
- 'march_features': ['crc']
- },
'0xc00': {
- 'march': 'armv8-a',
- 'march_features': ['crc']
+ 'mcpu': 'mcpu_centriq2400'
}
}
}
@@ -659,6 +623,45 @@ soc_v2 = {
'numa': true
}
+mcpu_defs = {
+ 'mcpu_kunpeng930': {
+ 'march': 'armv8.2-a',
+ 'march_extensions': ['crypto', 'sve']
+ },
+ 'mcpu_hip10': {
+ 'march': 'armv8.5-a',
+ 'march_extensions': ['crypto', 'sve']
+ },
+ 'mcpu_ft2000plus': {
+ 'march': 'armv8-a',
+ 'march_extensions': ['crc']
+ },
+ 'mcpu_tys2500': {
+ 'march': 'armv8-a',
+ 'march_extensions': ['crc']
+ },
+ 'mcpu_centriq2400': {
+ 'march': 'armv8-a',
+ 'march_extensions': ['crc']
+ },
+ 'mcpu_generic': {
+ 'march': 'armv8-a',
+ 'march_extensions': ['crc'],
+ },
+ 'mcpu_generic_aarch32': {
+ 'march': 'armv8-a',
+ 'march_extensions': ['simd'],
+ }
+ 'mcpu_thunderx2t99': {
+ 'march': 'armv8.1-a',
+ 'march_extensions': ['crc', 'crypto']
+ },
+ 'mcpu_thunderxt83': {
+ 'march': 'armv8-a',
+ 'march_extensions': ['crc', 'crypto']
+ },
+}
+
'''
Start of SoCs list
generic: Generic un-optimized build for armv8 aarch64 execution mode.
@@ -851,82 +854,46 @@ if update_flags
dpdk_flags = flags_common + implementer_config['flags'] + part_number_config.get('flags', []) + soc_flags
machine_args = [] # Clear previous machine args
-
- march_features = []
- if part_number_config.has_key('march_features')
- march_features += part_number_config['march_features']
- endif
- if soc_config.has_key('extra_march_features')
- march_features += soc_config['extra_march_features']
+ mcpu = part_number_config.get('mcpu', '')
+ if mcpu == ''
+ error('No suitable Arm mcpu name or custom mcpu definition object found.')
endif
- candidate_mcpu = ''
- candidate_march = ''
+ if mcpu.contains('mcpu_')
+ mcpu_def = mcpu_defs.get(mcpu, {})
+ if mcpu_def.keys().length() == 0
+ error('Custom mcpu definition @0@ is not found.'.format(mcpu))
+ endif
- if (part_number_config.has_key('mcpu') and
- cc.has_argument('-mcpu=' + part_number_config['mcpu']))
- candidate_mcpu = '-mcpu=' + part_number_config['mcpu']
- foreach feature: march_features
- if cc.has_argument('+'.join([candidate_mcpu, feature]))
- candidate_mcpu = '+'.join([candidate_mcpu, feature])
- else
- warning('The compiler does not support feature @0@'
- .format(feature))
- endif
- endforeach
- machine_args += candidate_mcpu
- elif part_number_config.has_key('march')
- # probe supported archs and their features
- if part_number_config.get('force_march', false)
- candidate_march = part_number_config['march']
- else
- supported_marchs = ['armv9-a', 'armv8.7-a', 'armv8.6-a', 'armv8.5-a', 'armv8.4-a', 'armv8.3-a',
- 'armv8.2-a', 'armv8.1-a', 'armv8-a']
- check_compiler_support = false
- foreach supported_march: supported_marchs
- if supported_march == part_number_config['march']
- # start checking from this version downwards
- check_compiler_support = true
- endif
- if (check_compiler_support and
- cc.has_argument('-march=' + supported_march))
- candidate_march = supported_march
- # highest supported march version found
- break
- endif
- endforeach
- if (part_number_config.has_key('fallback_march') and
- candidate_march != part_number_config['march'] and
- cc.has_argument('-march=' + part_number_config['fallback_march']))
- candidate_march = part_number_config['fallback_march']
- endif
+ march = mcpu_def.get('march', '')
+ if march == ''
+ error(('march not specified in the custom mcpu definition.'
+ .format(march)))
endif
+ march = '-march=' + march
- if candidate_march != part_number_config['march']
- warning('Configuration march version is @0@, not supported.'
- .format(part_number_config['march']))
- if candidate_march != ''
- warning('Using march version @0@.'.format(candidate_march))
- endif
+ if not cc.has_argument(march)
+ error('Compiler does not support @0@.'.format(march))
endif
- if candidate_march != ''
- candidate_march = '-march=' + candidate_march
- foreach feature: march_features
- if cc.has_argument('+'.join([candidate_march, feature]))
- candidate_march = '+'.join([candidate_march, feature])
- else
- warning('The compiler does not support feature @0@'
- .format(feature))
- endif
- endforeach
- machine_args += candidate_march
+ march_exts = mcpu_def.get('march_extensions', [])
+ foreach ext: march_exts
+ if cc.has_argument('+'.join([march, ext]))
+ march = '+'.join([march, ext])
+ else
+ error('Compiler does not support march extension @0@.'.format(ext))
+ endif
+ endforeach
+ machine_args += march
+ else
+ candidate_mcpu = '-mcpu=' + mcpu
+ if (cc.has_argument(candidate_mcpu))
+ machine_args += candidate_mcpu
+ else
+ error('Compiler does not support -mcpu=@0@.'.format(mcpu))
endif
endif
- if candidate_mcpu == '' and candidate_march == ''
- error('No suitable ARM march/mcpu version found.')
- endif
# apply supported compiler options
if part_number_config.has_key('compiler_options')
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v3 2/2] config/arm: sort SOCs alphabetically
2024-11-29 23:47 [PATCH v3 1/2] config/arm: strict use of -mcpu for supported CPUs Wathsala Vithanage
@ 2024-11-29 23:47 ` Wathsala Vithanage
0 siblings, 0 replies; 2+ messages in thread
From: Wathsala Vithanage @ 2024-11-29 23:47 UTC (permalink / raw)
To: Wathsala Vithanage, Bruce Richardson
Cc: dev, nd, thomas, honnappa.nagarahalli, Dhruv Tripathi
Order SOC configurations and names alphabetically.
Signed-off-by: Wathsala Vithanage <wathsala.vithanage@arm.com>
Reviewed-by: Dhruv Tripathi <dhruv.tripathi@arm.com>
---
config/arm/meson.build | 86 +++++++++++++++++++++---------------------
1 file changed, 43 insertions(+), 43 deletions(-)
diff --git a/config/arm/meson.build b/config/arm/meson.build
index 9ed36d9907..7f6a0e1b16 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -394,6 +394,17 @@ soc_bluefield = {
'numa': false
}
+soc_bluefield3 = {
+ 'description': 'NVIDIA BlueField-3',
+ 'implementer': '0x41',
+ 'flags': [
+ ['RTE_MAX_LCORE', 32],
+ ['RTE_MAX_NUMA_NODES', 1]
+ ],
+ 'part_number': '0xd42',
+ 'numa': false
+}
+
soc_capri = {
'description': 'AMD Pensando Capri',
'implementer': '0x75',
@@ -476,13 +487,6 @@ soc_ft2000plus = {
'numa': true
}
-soc_tys2500 = {
- 'description': 'Phytium TengYun S2500',
- 'implementer': '0x70',
- 'part_number': '0x663',
- 'numa': true
-}
-
soc_grace = {
'description': 'NVIDIA Grace',
'implementer': '0x41',
@@ -593,27 +597,23 @@ soc_thunderx2 = {
'part_number': '0xaf'
}
-soc_thunderxt88 = {
- 'description': 'Marvell ThunderX T88',
- 'implementer': '0x43',
- 'part_number': '0xa1'
-}
-
soc_thunderxt83 = {
'description': 'Marvell ThunderX T83',
'implementer': '0x43',
'part_number': '0xa3'
}
-soc_bluefield3 = {
- 'description': 'NVIDIA BlueField-3',
- 'implementer': '0x41',
- 'flags': [
- ['RTE_MAX_LCORE', 32],
- ['RTE_MAX_NUMA_NODES', 1]
- ],
- 'part_number': '0xd42',
- 'numa': false
+soc_thunderxt88 = {
+ 'description': 'Marvell ThunderX T88',
+ 'implementer': '0x43',
+ 'part_number': '0xa1'
+}
+
+soc_tys2500 = {
+ 'description': 'Phytium TengYun S2500',
+ 'implementer': '0x70',
+ 'part_number': '0x663',
+ 'numa': true
}
soc_v2 = {
@@ -624,23 +624,31 @@ soc_v2 = {
}
mcpu_defs = {
- 'mcpu_kunpeng930': {
- 'march': 'armv8.2-a',
- 'march_extensions': ['crypto', 'sve']
+ 'mcpu_centriq2400': {
+ 'march': 'armv8-a',
+ 'march_extensions': ['crc']
+ },
+ 'mcpu_ft2000plus': {
+ 'march': 'armv8-a',
+ 'march_extensions': ['crc']
},
'mcpu_hip10': {
'march': 'armv8.5-a',
'march_extensions': ['crypto', 'sve']
},
- 'mcpu_ft2000plus': {
- 'march': 'armv8-a',
- 'march_extensions': ['crc']
+ 'mcpu_kunpeng930': {
+ 'march': 'armv8.2-a',
+ 'march_extensions': ['crypto', 'sve']
},
- 'mcpu_tys2500': {
+ 'mcpu_thunderxt83': {
'march': 'armv8-a',
- 'march_extensions': ['crc']
+ 'march_extensions': ['crc', 'crypto']
},
- 'mcpu_centriq2400': {
+ 'mcpu_thunderx2t99': {
+ 'march': 'armv8.1-a',
+ 'march_extensions': ['crc', 'crypto']
+ },
+ 'mcpu_tys2500': {
'march': 'armv8-a',
'march_extensions': ['crc']
},
@@ -652,14 +660,6 @@ mcpu_defs = {
'march': 'armv8-a',
'march_extensions': ['simd'],
}
- 'mcpu_thunderx2t99': {
- 'march': 'armv8.1-a',
- 'march_extensions': ['crc', 'crypto']
- },
- 'mcpu_thunderxt83': {
- 'march': 'armv8-a',
- 'march_extensions': ['crc', 'crypto']
- },
}
'''
@@ -681,7 +681,6 @@ dpaa: NXP DPAA
elba: AMD Pensando Elba
emag: Ampere eMAG
ft2000plus: Phytium FT-2000+
-tys2500: Phytium TengYun S2500
grace: NVIDIA Grace
graviton2: AWS Graviton2
graviton3: AWS Graviton3
@@ -694,8 +693,9 @@ n2: Arm Neoverse N2
odyssey: Marvell Odyssey
stingray: Broadcom Stingray
thunderx2: Marvell ThunderX2 T99
-thunderxt88: Marvell ThunderX T88
thunderxt83: Marvell ThunderX T83
+thunderxt88: Marvell ThunderX T88
+tys2500: Phytium TengYun S2500
v2: Arm Neoverse V2
End of SoCs list
'''
@@ -719,7 +719,6 @@ socs = {
'elba': soc_elba,
'emag': soc_emag,
'ft2000plus': soc_ft2000plus,
- 'tys2500': soc_tys2500,
'grace': soc_grace,
'graviton2': soc_graviton2,
'graviton3': soc_graviton3,
@@ -733,8 +732,9 @@ socs = {
'odyssey' : soc_odyssey,
'stingray': soc_stingray,
'thunderx2': soc_thunderx2,
- 'thunderxt88': soc_thunderxt88,
'thunderxt83': soc_thunderxt83,
+ 'thunderxt88': soc_thunderxt88,
+ 'tys2500': soc_tys2500,
'v2': soc_v2,
}
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-29 23:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-29 23:47 [PATCH v3 1/2] config/arm: strict use of -mcpu for supported CPUs Wathsala Vithanage
2024-11-29 23:47 ` [PATCH v3 2/2] config/arm: sort SOCs alphabetically Wathsala Vithanage
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).