* [PATCH 1/2] config/arm: strict use of -mcpu for supported CPUs
@ 2024-10-28 23:31 Wathsala Vithanage
2024-10-28 23:31 ` [PATCH 2/2] config/arm: sort SOCs alphabetically Wathsala Vithanage
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Wathsala Vithanage @ 2024-10-28 23:31 UTC (permalink / raw)
To: Wathsala Vithanage, Bruce Richardson
Cc: nd, dev, 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 | 166 +++++++++++++++--------------------------
1 file changed, 60 insertions(+), 106 deletions(-)
diff --git a/config/arm/meson.build b/config/arm/meson.build
index 55be7c8711..04819e75eb 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -69,8 +69,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 +79,6 @@ part_number_config_arm = {
]
},
'0xd40': {
- 'march': 'armv8.4-a',
- 'march_features': ['sve'],
'mcpu': 'neoverse-v1',
'flags': [
['RTE_MACHINE', '"neoverse-v1"'],
@@ -94,9 +90,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 +99,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,14 +161,10 @@ implementer_cavium = {
'flags': flags_part_number_thunderx
},
'0xa3': {
- 'march': 'armv8-a',
- 'march_features': ['crc', 'crypto'],
'mcpu': 'thunderxt83',
'flags': flags_part_number_thunderx
},
'0xaf': {
- 'march': 'armv8.1-a',
- 'march_features': ['crc', 'crypto'],
'mcpu': 'thunderx2t99',
'flags': [
['RTE_MACHINE', '"thunderx2"'],
@@ -189,8 +175,6 @@ implementer_cavium = {
]
},
'0xb2': {
- 'march': 'armv8.2-a',
- 'march_features': ['crc', 'crypto', 'lse'],
'mcpu': 'octeontx2',
'flags': [
['RTE_MACHINE', '"cn9k"'],
@@ -212,8 +196,6 @@ implementer_ampere = {
],
'part_number_config': {
'0x0': {
- 'march': 'armv8-a',
- 'march_features': ['crc', 'crypto'],
'mcpu': 'emag',
'flags': [
['RTE_MACHINE', '"eMAG"'],
@@ -222,8 +204,6 @@ implementer_ampere = {
]
},
'0xac3': {
- 'march': 'armv8.6-a',
- 'march_features': ['crc', 'crypto'],
'mcpu': 'ampere1',
'flags': [
['RTE_MACHINE', '"AmpereOne"'],
@@ -232,8 +212,6 @@ implementer_ampere = {
]
},
'0xac4': {
- 'march': 'armv8.6-a',
- 'march_features': ['crc', 'crypto'],
'mcpu': 'ampere1a',
'flags': [
['RTE_MACHINE', '"AmpereOneAC04"'],
@@ -252,8 +230,6 @@ implementer_hisilicon = {
],
'part_number_config': {
'0xd01': {
- 'march': 'armv8.2-a',
- 'march_features': ['crypto'],
'mcpu': 'tsv110',
'flags': [
['RTE_MACHINE', '"Kunpeng 920"'],
@@ -263,8 +239,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 +248,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 +295,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 +321,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 +626,29 @@ 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']
+ }
+}
+
'''
Start of SoCs list
generic: Generic un-optimized build for armv8 aarch64 execution mode.
@@ -851,82 +841,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.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] config/arm: sort SOCs alphabetically
2024-10-28 23:31 [PATCH 1/2] config/arm: strict use of -mcpu for supported CPUs Wathsala Vithanage
@ 2024-10-28 23:31 ` Wathsala Vithanage
2024-10-29 1:06 ` [PATCH 1/2] config/arm: strict use of -mcpu for supported CPUs fengchengwen
2024-10-29 1:59 ` [PATCH v2 " Wathsala Vithanage
2 siblings, 0 replies; 9+ messages in thread
From: Wathsala Vithanage @ 2024-10-28 23:31 UTC (permalink / raw)
To: Wathsala Vithanage, Bruce Richardson
Cc: nd, dev, 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 | 72 +++++++++++++++++++++---------------------
1 file changed, 36 insertions(+), 36 deletions(-)
diff --git a/config/arm/meson.build b/config/arm/meson.build
index 04819e75eb..da69ddfa23 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -397,6 +397,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',
@@ -479,13 +490,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',
@@ -596,27 +600,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 = {
@@ -627,26 +627,26 @@ 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': {
'march': 'armv8-a',
'march_extensions': ['crc']
}
- 'mcpu_centriq2400': {
- 'march': 'armv8-a',
- 'march_extensions': ['crc']
- }
}
'''
@@ -668,7 +668,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
@@ -681,8 +680,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
'''
@@ -706,7 +706,6 @@ socs = {
'elba': soc_elba,
'emag': soc_emag,
'ft2000plus': soc_ft2000plus,
- 'tys2500': soc_tys2500,
'grace': soc_grace,
'graviton2': soc_graviton2,
'graviton3': soc_graviton3,
@@ -720,8 +719,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.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] config/arm: strict use of -mcpu for supported CPUs
2024-10-28 23:31 [PATCH 1/2] config/arm: strict use of -mcpu for supported CPUs Wathsala Vithanage
2024-10-28 23:31 ` [PATCH 2/2] config/arm: sort SOCs alphabetically Wathsala Vithanage
@ 2024-10-29 1:06 ` fengchengwen
2024-10-29 1:59 ` [PATCH v2 " Wathsala Vithanage
2 siblings, 0 replies; 9+ messages in thread
From: fengchengwen @ 2024-10-29 1:06 UTC (permalink / raw)
To: Wathsala Vithanage, Bruce Richardson
Cc: nd, dev, honnappa.nagarahalli, Dhruv Tripathi
On 2024/10/29 7:31, Wathsala Vithanage wrote:
> 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.
I couldn't understand the problem, current the arm build already prefer use mcpu and then march:
if (part_number_config.has_key('mcpu') and
elif part_number_config.has_key('march')
>
> 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]
Prefer extend or change already existed struct.
In addition, there are many structures in the arm build. But it seemed
there is no document to describe the structure to which a feature should be added.
> }
>
> 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>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/2] config/arm: strict use of -mcpu for supported CPUs
2024-10-28 23:31 [PATCH 1/2] config/arm: strict use of -mcpu for supported CPUs Wathsala Vithanage
2024-10-28 23:31 ` [PATCH 2/2] config/arm: sort SOCs alphabetically Wathsala Vithanage
2024-10-29 1:06 ` [PATCH 1/2] config/arm: strict use of -mcpu for supported CPUs fengchengwen
@ 2024-10-29 1:59 ` Wathsala Vithanage
2024-10-29 1:59 ` [PATCH v2 2/2] config/arm: sort SOCs alphabetically Wathsala Vithanage
2024-11-11 14:12 ` [PATCH v2 1/2] config/arm: strict use of -mcpu for supported CPUs Thomas Monjalon
2 siblings, 2 replies; 9+ messages in thread
From: Wathsala Vithanage @ 2024-10-29 1:59 UTC (permalink / raw)
To: Wathsala Vithanage, Bruce Richardson
Cc: nd, dev, 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 | 181 ++++++++++++++++-------------------------
1 file changed, 70 insertions(+), 111 deletions(-)
diff --git a/config/arm/meson.build b/config/arm/meson.build
index 55be7c8711..85ec6c0228 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,14 +158,10 @@ implementer_cavium = {
'flags': flags_part_number_thunderx
},
'0xa3': {
- 'march': 'armv8-a',
- 'march_features': ['crc', 'crypto'],
'mcpu': 'thunderxt83',
'flags': flags_part_number_thunderx
},
'0xaf': {
- 'march': 'armv8.1-a',
- 'march_features': ['crc', 'crypto'],
'mcpu': 'thunderx2t99',
'flags': [
['RTE_MACHINE', '"thunderx2"'],
@@ -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,37 @@ 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'],
+ }
+}
+
'''
Start of SoCs list
generic: Generic un-optimized build for armv8 aarch64 execution mode.
@@ -851,82 +846,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.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/2] config/arm: sort SOCs alphabetically
2024-10-29 1:59 ` [PATCH v2 " Wathsala Vithanage
@ 2024-10-29 1:59 ` Wathsala Vithanage
2024-11-11 14:12 ` [PATCH v2 1/2] config/arm: strict use of -mcpu for supported CPUs Thomas Monjalon
1 sibling, 0 replies; 9+ messages in thread
From: Wathsala Vithanage @ 2024-10-29 1:59 UTC (permalink / raw)
To: Wathsala Vithanage, Bruce Richardson
Cc: nd, dev, 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 | 72 +++++++++++++++++++++---------------------
1 file changed, 36 insertions(+), 36 deletions(-)
diff --git a/config/arm/meson.build b/config/arm/meson.build
index 85ec6c0228..c85474a7da 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,26 +624,26 @@ 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': {
'march': 'armv8-a',
'march_extensions': ['crc']
},
- 'mcpu_centriq2400': {
- 'march': 'armv8-a',
- 'march_extensions': ['crc']
- },
'mcpu_generic': {
'march': 'armv8-a',
'march_extensions': ['crc'],
@@ -673,7 +673,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
@@ -686,8 +685,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
'''
@@ -711,7 +711,6 @@ socs = {
'elba': soc_elba,
'emag': soc_emag,
'ft2000plus': soc_ft2000plus,
- 'tys2500': soc_tys2500,
'grace': soc_grace,
'graviton2': soc_graviton2,
'graviton3': soc_graviton3,
@@ -725,8 +724,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.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] config/arm: strict use of -mcpu for supported CPUs
2024-10-29 1:59 ` [PATCH v2 " Wathsala Vithanage
2024-10-29 1:59 ` [PATCH v2 2/2] config/arm: sort SOCs alphabetically Wathsala Vithanage
@ 2024-11-11 14:12 ` Thomas Monjalon
2024-11-11 17:57 ` Wathsala Wathawana Vithanage
1 sibling, 1 reply; 9+ messages in thread
From: Thomas Monjalon @ 2024-11-11 14:12 UTC (permalink / raw)
To: Wathsala Vithanage
Cc: Bruce Richardson, dev, nd, honnappa.nagarahalli, Dhruv Tripathi
Please check the CI results, there are some failures.
29/10/2024 02:59, Wathsala Vithanage:
> 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>
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v2 1/2] config/arm: strict use of -mcpu for supported CPUs
2024-11-11 14:12 ` [PATCH v2 1/2] config/arm: strict use of -mcpu for supported CPUs Thomas Monjalon
@ 2024-11-11 17:57 ` Wathsala Wathawana Vithanage
2024-11-11 18:14 ` Thomas Monjalon
0 siblings, 1 reply; 9+ messages in thread
From: Wathsala Wathawana Vithanage @ 2024-11-11 17:57 UTC (permalink / raw)
To: thomas
Cc: Bruce Richardson, dev, nd, Honnappa Nagarahalli, Dhruv Tripathi, nd
> Subject: Re: [PATCH v2 1/2] config/arm: strict use of -mcpu for supported
> CPUs
>
> Please check the CI results, there are some failures.
>
Hi Thomas,
CI is failing because gcc version 11 does not enable crypto extension for thunderx2,
with -mcpu=thunderx2t99 unless +crypto feature modifier is used.
Goal of this patch is to drop use of such feature modifiers when an -mcpu is available
for a given platform.
This issue is fixed in gcc version 13 for thunderx2t99.
Thanks.
--wathsala
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] config/arm: strict use of -mcpu for supported CPUs
2024-11-11 17:57 ` Wathsala Wathawana Vithanage
@ 2024-11-11 18:14 ` Thomas Monjalon
2024-11-11 19:46 ` Wathsala Wathawana Vithanage
0 siblings, 1 reply; 9+ messages in thread
From: Thomas Monjalon @ 2024-11-11 18:14 UTC (permalink / raw)
To: Wathsala Wathawana Vithanage
Cc: Bruce Richardson, dev, nd, Honnappa Nagarahalli, Dhruv Tripathi, nd
11/11/2024 18:57, Wathsala Wathawana Vithanage:
>
> > Subject: Re: [PATCH v2 1/2] config/arm: strict use of -mcpu for supported
> > CPUs
> >
> > Please check the CI results, there are some failures.
> >
>
> Hi Thomas,
>
> CI is failing because gcc version 11 does not enable crypto extension for thunderx2,
> with -mcpu=thunderx2t99 unless +crypto feature modifier is used.
> Goal of this patch is to drop use of such feature modifiers when an -mcpu is available
> for a given platform.
> This issue is fixed in gcc version 13 for thunderx2t99.
We cannot afford dropping the support of GCC 11.
Which solution do you propose?
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v2 1/2] config/arm: strict use of -mcpu for supported CPUs
2024-11-11 18:14 ` Thomas Monjalon
@ 2024-11-11 19:46 ` Wathsala Wathawana Vithanage
0 siblings, 0 replies; 9+ messages in thread
From: Wathsala Wathawana Vithanage @ 2024-11-11 19:46 UTC (permalink / raw)
To: thomas
Cc: Bruce Richardson, dev, nd, Honnappa Nagarahalli, Dhruv Tripathi, nd, nd
> > Hi Thomas,
> >
> > CI is failing because gcc version 11 does not enable crypto extension
> > for thunderx2, with -mcpu=thunderx2t99 unless +crypto feature modifier is
> used.
> > Goal of this patch is to drop use of such feature modifiers when an
> > -mcpu is available for a given platform.
> > This issue is fixed in gcc version 13 for thunderx2t99.
>
> We cannot afford dropping the support of GCC 11.
> Which solution do you propose?
>
Adding a pseudo mcpu for thunderx2t99 as described in the patch. I will send a v3
with that change.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-11-11 19:46 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-28 23:31 [PATCH 1/2] config/arm: strict use of -mcpu for supported CPUs Wathsala Vithanage
2024-10-28 23:31 ` [PATCH 2/2] config/arm: sort SOCs alphabetically Wathsala Vithanage
2024-10-29 1:06 ` [PATCH 1/2] config/arm: strict use of -mcpu for supported CPUs fengchengwen
2024-10-29 1:59 ` [PATCH v2 " Wathsala Vithanage
2024-10-29 1:59 ` [PATCH v2 2/2] config/arm: sort SOCs alphabetically Wathsala Vithanage
2024-11-11 14:12 ` [PATCH v2 1/2] config/arm: strict use of -mcpu for supported CPUs Thomas Monjalon
2024-11-11 17:57 ` Wathsala Wathawana Vithanage
2024-11-11 18:14 ` Thomas Monjalon
2024-11-11 19:46 ` Wathsala Wathawana 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).