Skip to content

MLAS: use vmlaq_f32 for ARMv7 targets - #26161

Merged
hariharans29 merged 2 commits into
microsoft:mainfrom
weidu-tpvision:fix/mlas-neon-armv7-fallback
Sep 25, 2025
Merged

MLAS: use vmlaq_f32 for ARMv7 targets#26161
hariharans29 merged 2 commits into
microsoft:mainfrom
weidu-tpvision:fix/mlas-neon-armv7-fallback

Conversation

@weidu-tpvision

Copy link
Copy Markdown
Contributor

Use vmlaq_f32 on MLAS_TARGET_ARM (armv7) so builds on Linux/Android arm32 don't attempt to use the armv8 (aarch64) vfmaq_f32 intrinsic.

Fixes build failures referencing vfmaq_f32 in arm_neon.h.

Description

On ARMv7 targets (32-bit ARM with NEON) the vfmaq_f32 intrinsic is unavailable and causes build failures like:
target specific option mismatch 1728 | vfmaq_f32 (float32x4_t __a, float32x4_t __b, float32x4_t __c).
The previous code only fell back to vmlaq_f32 when ANDROID was defined, which fixes Android but not Linux ARM32 builds.

Motivation and Context

The proposal is to change:
if defined(ANDROID) && defined(MLAS_TARGET_ARM)
to:
if defined(MLAS_TARGET_ARM)

This change ensures 32-bit ARM builds (Linux and Android) use vmlaq_f32 while 64-bit ARM uses vfmaq_f32.

This pr is related to issue #25949 which was opened also by me.

Use vmlaq_f32 on MLAS_TARGET_ARM (armv7) so builds on Linux/Android arm32 don't attempt to use the armv8 (aarch64) vfmaq_f32 intrinsic.

Fixes build failures referencing vfmaq_f32 in arm_neon.h.

Signed-off-by: Wei Du <wei.du@tpv-tech.com>
Comment thread onnxruntime/core/mlas/lib/mlasi.h Outdated
Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
@hariharans29

Copy link
Copy Markdown
Member

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 4 pipeline(s).

@hariharans29
hariharans29 merged commit 2109547 into microsoft:main Sep 25, 2025
90 checks passed
@weidu-tpvision

Copy link
Copy Markdown
Contributor Author

My first pr to open source, it is simple but seeing it merged still made me excited! Thank you ONNX!

@edgchen1

Copy link
Copy Markdown
Contributor

My first pr to open source, it is simple but seeing it merged still made me excited! Thank you ONNX!

@weidu-tpvision Thanks for your contribution!

fs-eire pushed a commit that referenced this pull request Oct 24, 2025
Use vmlaq_f32 on MLAS_TARGET_ARM (armv7) so builds on Linux/Android
arm32 don't attempt to use the armv8 (aarch64) vfmaq_f32 intrinsic.

Fixes build failures referencing vfmaq_f32 in arm_neon.h.

### Description
On ARMv7 targets (32-bit ARM with NEON) the vfmaq_f32 intrinsic is
unavailable and causes build failures like:
target specific option mismatch 1728 | vfmaq_f32 (float32x4_t __a,
float32x4_t __b, float32x4_t __c).
The previous code only fell back to vmlaq_f32 when __ANDROID__ was
defined, which fixes Android but not Linux ARM32 builds.

### Motivation and Context
The proposal is to change:
if defined(__ANDROID__) && defined(MLAS_TARGET_ARM)
to:
if defined(MLAS_TARGET_ARM)

This change ensures 32-bit ARM builds (Linux and Android) use vmlaq_f32
while 64-bit ARM uses vfmaq_f32.

This pr is related to issue #25949 which was opened also by me.

---------

Signed-off-by: Wei Du <wei.du@tpv-tech.com>
Co-authored-by: Hariharan Seshadri <shariharan91@gmail.com>
Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
naomiOvad pushed a commit to naomiOvad/onnxruntime that referenced this pull request Nov 2, 2025
Use vmlaq_f32 on MLAS_TARGET_ARM (armv7) so builds on Linux/Android
arm32 don't attempt to use the armv8 (aarch64) vfmaq_f32 intrinsic.

Fixes build failures referencing vfmaq_f32 in arm_neon.h.

### Description
On ARMv7 targets (32-bit ARM with NEON) the vfmaq_f32 intrinsic is
unavailable and causes build failures like:
target specific option mismatch 1728 | vfmaq_f32 (float32x4_t __a,
float32x4_t __b, float32x4_t __c).
The previous code only fell back to vmlaq_f32 when __ANDROID__ was
defined, which fixes Android but not Linux ARM32 builds.

### Motivation and Context
The proposal is to change:
if defined(__ANDROID__) && defined(MLAS_TARGET_ARM)
to:
if defined(MLAS_TARGET_ARM)

This change ensures 32-bit ARM builds (Linux and Android) use vmlaq_f32
while 64-bit ARM uses vfmaq_f32.

This pr is related to issue microsoft#25949 which was opened also by me.

---------

Signed-off-by: Wei Du <wei.du@tpv-tech.com>
Co-authored-by: Hariharan Seshadri <shariharan91@gmail.com>
Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants