DEFAULTTUNE overridden on imx8mprsb3720a2

Hi,

I have set up a mickledore build environment for my RSB3720(A2) board using:

EULA=1 MACHINE=imx8mprsb3720a2 UBOOT_CONFIG=4G DISTRO=fsl-imx-xwayland source imx-setup-release.sh -b build

When I look at the DEFAULTTUNE variable with bitbake -e, I see it being set correctly to "cortexa53-crypto" in the meta-advantech layer, but then it gets overridden by the meta-imx layer:

# $DEFAULTTUNE [27 operations]
#   set /home/adv/adv-release-bsp/build_tmp/conf/local.conf:24
#     "cortexa53-crypto"
#   set? /home/adv/adv-release-bsp/sources/poky/meta/conf/machine/include/arm/armv8a/tune-cortexa53.inc:1
#     "cortexa53"
#   set? /home/adv/adv-release-bsp/sources/poky/meta/conf/machine/include/arm/arch-armv8a.inc:1
#     "armv8a-crc"
#   set? /home/adv/adv-release-bsp/sources/poky/meta/conf/machine/include/arm/arch-arm64.inc:1
#     "aarch64"
#   set? /home/adv/adv-release-bsp/sources/poky/meta/conf/machine/include/arm/arch-armv7ve.inc:1
#     "armv7vethf"
#   set? /home/adv/adv-release-bsp/sources/poky/meta/conf/machine/include/arm/arch-armv7a.inc:1
#     "armv7athf"
#   set? /home/adv/adv-release-bsp/sources/poky/meta/conf/machine/include/arm/arch-armv6.inc:1
#     "armv6hf"
#   set? /home/adv/adv-release-bsp/sources/poky/meta/conf/machine/include/arm/arch-armv5.inc:1
#     "armv5"
#   set? /home/adv/adv-release-bsp/sources/poky/meta/conf/machine/include/arm/arch-armv4.inc:1
#     "armv4"
#   override[mx6-generic-bsp]:set? /home/adv/adv-release-bsp/sources/meta-freescale/conf/machine/include/imx-base.inc:157
#     "cortexa9thf-neon"
#   override[mx6ul-generic-bsp]:set? /home/adv/adv-release-bsp/sources/meta-freescale/conf/machine/include/imx-base.inc:158
#     "cortexa7thf-neon"
#   override[mx6ull-generic-bsp]:set? /home/adv/adv-release-bsp/sources/meta-freescale/conf/machine/include/imx-base.inc:159
#     "cortexa7thf-neon"
#   override[mx6ulz-generic-bsp]:set? /home/adv/adv-release-bsp/sources/meta-freescale/conf/machine/include/imx-base.inc:160
#     "cortexa7thf-neon"
#   override[mx7-generic-bsp]:set? /home/adv/adv-release-bsp/sources/meta-freescale/conf/machine/include/imx-base.inc:161
#     "cortexa7thf-neon"
#   override[vf-generic-bsp]:set? /home/adv/adv-release-bsp/sources/meta-freescale/conf/machine/include/imx-base.inc:162
#     "cortexa5thf-neon"
#   override[mx8m-generic-bsp]:set? /home/adv/adv-release-bsp/sources/meta-freescale/conf/machine/include/imx-base.inc:164
#     "cortexa53-crypto"
#   override[mx8qm-generic-bsp]:set? /home/adv/adv-release-bsp/sources/meta-freescale/conf/machine/include/imx-base.inc:165
#     "cortexa72-cortexa53-crypto"
#   override[mx8x-generic-bsp]:set? /home/adv/adv-release-bsp/sources/meta-freescale/conf/machine/include/imx-base.inc:166
#     "cortexa35-crypto"
#   override[mx8ulp-generic-bsp]:set? /home/adv/adv-release-bsp/sources/meta-freescale/conf/machine/include/imx-base.inc:167
#     "cortexa35-crypto"
#   override[mx93-generic-bsp]:set? /home/adv/adv-release-bsp/sources/meta-freescale/conf/machine/include/imx-base.inc:168
#     "cortexa55"
#   override[use-mainline-bsp]:set /home/adv/adv-release-bsp/sources/meta-advantech/meta-fsl-imx/conf/machine/include/adv-imx8mp-evk.inc:9
#     "cortexa53-crypto"
#   override[mx8-nxp-bsp]:set? /home/adv/adv-release-bsp/sources/meta-imx/meta-sdk/conf/distro/include/fsl-imx-base.inc:23
#     "armv8a-crc-crypto"
#   override[mx8m-nxp-bsp]:set? /home/adv/adv-release-bsp/sources/meta-imx/meta-sdk/conf/distro/include/fsl-imx-base.inc:24
#     "armv8a-crc-crypto"
#   override[mx8qm-nxp-bsp]:set? /home/adv/adv-release-bsp/sources/meta-imx/meta-sdk/conf/distro/include/fsl-imx-base.inc:25
#     "armv8a-crc-crypto"
#   override[mx8x-nxp-bsp]:set? /home/adv/adv-release-bsp/sources/meta-imx/meta-sdk/conf/distro/include/fsl-imx-base.inc:26
#     "armv8a-crc-crypto"
#   override[mx8ulp-nxp-bsp]:set? /home/adv/adv-release-bsp/sources/meta-imx/meta-sdk/conf/distro/include/fsl-imx-base.inc:27
#     "armv8a-crc-crypto"
#   override[mx93-nxp-bsp]:set? /home/adv/adv-release-bsp/sources/meta-imx/meta-sdk/conf/distro/include/fsl-imx-base.inc:28
#     "armv8a-crc-crypto"
# pre-expansion value:
#   "armv8a-crc-crypto"
DEFAULTTUNE="armv8a-crc-crypto"

As a result, my TARGET_FPU is not set to "hard" and TUNE_FEATURES does not include neon, etc.

I have tried adding a DEFAULTTUNE = "cortexa53-crypto" in my overall conf/local.conf, but it also gets overridden by meta-imx.

How do I get around this and make sure the proper machine optimizations are enabled?

Hello @Vasco_Santos
Please help to check your BSP version.
We need to check your version.

https://ess-wiki.advantech.com.tw/view/AIM-Linux/RSB-3720

Hi @Clayder_Huang,

I am currently building Yocto 4.2 (Kernel 6.1.22).
I have been following the instructions at
https://ess-wiki.advantech.com.tw/view/IoTGateway/BSP/Linux/iMX8/Yocto_LBVD_User_Guide#Build_Instructions.

This is how I init my repo:
repo init -u https://github.com/ADVANTECH-Corp/adv-arm-yocto-bsp.git -b imx-linux-mickledore -m adv-6.1.22-2.0.0.xml

Regards,
Vasco.

When I disassemble the library /usr/lib/libonnxruntime.so.1.13.1 in my BSP, for example, I cannot find any calls to NEON instructions.
If I do the same for the x86_64 libonnxruntime on my computer, I find many SSE/AVX instructions.

My build configuration looks like this:

Build Configuration:
BB_VERSION           = "2.4.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "aarch64-poky-linux"
MACHINE              = "imx8mprsb3720a2"
DISTRO               = "fsl-imx-xwayland"
DISTRO_VERSION       = "6.1-mickledore"
TUNE_FEATURES        = "aarch64 armv8a crc crypto"
TARGET_FPU           = ""

I was expecting at least neon or cortexa53 to be part of TUNE_FEATURES.
I think this is related to the override in my DEFAULTTUNE variable.

Or, is this expected?

Hi Vasco,

Thank you for your inquiry. The reason you’re not seeing NEON instructions in the disassembled libonnxruntime.so.1.13.1 library is because the current TUNE_FEATURES configuration does not enable NEON or Cortex-A53 optimizations.

Your configuration:

TUNE_FEATURES = "aarch64 armv8a crc crypto"

does not include neon or cortexa53, which are necessary for enabling SIMD (NEON) and ARM-specific optimizations.

Update your TUNE_FEATURES to explicitly include neon and cortexa53:

TUNE_FEATURES = "aarch64 armv8a crc crypto neon cortexa53"

This will ensure that NEON and Cortex-A53 optimizations are enabled during the build.

2 Likes