Skip to content

Fix --enable_arm_neon_nchwc being a silent no-op on Windows ARM64 - #32094

Open
Hariharan Seshadri (hariharans29) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-arm-neon-nchwc-build
Open

Fix --enable_arm_neon_nchwc being a silent no-op on Windows ARM64#32094
Hariharan Seshadri (hariharans29) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-arm-neon-nchwc-build

Conversation

Copilot AI commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Description

setup_arm_neon_nchwc() exported MLAS_USE_ARM_NEON_NCHWC with a single set(... PARENT_SCOPE). On Windows ARM64 it is called from inside setup_mlas_source_for_windows(), so the value landed in that function's local scope and was discarded on return — it never reached the directory-scope target_compile_definitions(). Linux/macOS aarch64 call it at directory scope, where one hop is enough.

Changes in cmake/onnxruntime_mlas.cmake:

  • New helper mlas_add_private_compile_definitions() — accumulates definitions in a directory property. Directory properties are unaffected by CMake function scopes, so call depth stops mattering.
  • Merge step before consumption — the property is folded back into mlas_private_compile_definitions just before the foreach(mlas_target ...) loop, and ahead of onnxruntime_unittests.cmake being included. This is why the fix is not simply target_compile_definitions(onnxruntime_mlas ...) inside the function: the mlas test and benchmark targets also consume this list.
  • MLAS_USE_SVE in the Windows branch switched to the same helper. It happens to work today (its PARENT_SCOPE is one hop from directory scope) but carries the same latent trap.

Directory-scope list(APPEND ...) sites (Linux/macOS aarch64, RVV) are untouched.

function(mlas_add_private_compile_definitions)
  set_property(DIRECTORY APPEND PROPERTY mlas_private_compile_definitions_from_functions ${ARGN})
endfunction()

Motivation and Context

Every #if defined(MLAS_USE_ARM_NEON_NCHWC) guard evaluated false on Windows ARM64: MlasNchwcGetBlockSize() returned 1, NchwcTransformer never ran, and sconv_nchwc_kernel_neon.cpp / spool_nchwc_kernel_neon.cpp compiled into empty translation units. The flag was accepted and silently dropped, producing a binary identical to one built without it.

Because the failure mode is a missing define rather than a build error, win-qnn-arm64-ci-pipeline.yml — which passes --enable_arm_neon_nchwc explicitly for NCHWc coverage — has been testing the non-NCHWc path. That pipeline now exercises the code paths it was added to cover.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: hariharans29 <9969784+hariharans29@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix silent no-op for --enable_arm_neon_nchwc on Windows ARM64 Fix --enable_arm_neon_nchwc being a silent no-op on Windows ARM64 Aug 14, 2026
@hariharans29
Hariharan Seshadri (hariharans29) marked this pull request as ready for review August 14, 2026 23:39
Copilot AI balanced review requested due to automatic review settings August 14, 2026 23:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Windows ARM64 NCHWc builds silently dropping required MLAS compile definitions across nested CMake function scopes.

Changes:

  • Adds a directory-property helper for scope-independent compile definitions.
  • Migrates ARM NCHWc and Windows SVE definitions to the helper.
  • Merges accumulated definitions before applying them to MLAS targets and tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

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.

[Build] --enable_arm_neon_nchwc is silently a no-op on Windows ARM64 (MLAS_USE_ARM_NEON_NCHWC dropped by CMake function scope)

3 participants