Skip to content

Use ARm64EC libraries for X64 support on ARM64 systems#18570

Merged
seanbudd merged 12 commits into
nvaccess:masterfrom
LeonarddeR:arm64ecPoc
Sep 3, 2025
Merged

Use ARm64EC libraries for X64 support on ARM64 systems#18570
seanbudd merged 12 commits into
nvaccess:masterfrom
LeonarddeR:arm64ecPoc

Conversation

@LeonarddeR

@LeonarddeR LeonarddeR commented Jul 28, 2025

Copy link
Copy Markdown
Collaborator

Link to issue number:

Closes #18445

Summary of the issue:

On ARM64 systems. an emulation layer is used to support X64 software. However, Microsoft developed ARm64EC, an X64 compatible ABi that is X64 compatible while delivering almost native ARM64 performance.

Description of user facing changes:

Probably slightly better performance as soon as we're on X64 builds.

Description of developer facing changes:

None

Description of development approach:

  • Build relevant libraries as ARM64EC. Use the ARM64EC path on ARM64 systems to load X64 dlls from.
  • Install JAVA access bridge in source dir for the NVDA core arch. There's no need in bundling an x86 bridge with an x64 NVDA and vise versa, as it will never be used.

Testing strategy:

  • Tested basic usage and working display model on an ARM64 vm with a x86 Python build of NVDA
  • Tested basic usage and working display model on an ARM64 vm with a x64 Python build of NVDA

Known issues with pull request:

None

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@LeonarddeR LeonarddeR requested a review from a team as a code owner July 28, 2025 05:36
@LeonarddeR LeonarddeR requested review from SaschaCowley and removed request for a team July 28, 2025 05:36
@LeonarddeR LeonarddeR marked this pull request as draft July 28, 2025 08:21
@LeonarddeR LeonarddeR changed the title POC: Use ARm64EC libraries for X64 support on ARM64 systems Use ARm64EC libraries for X64 support on ARM64 systems Aug 8, 2025
@LeonarddeR LeonarddeR marked this pull request as ready for review August 8, 2025 14:42
@LeonarddeR LeonarddeR requested a review from Copilot August 8, 2025 14:42

This comment was marked as outdated.

@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Aug 12, 2025
@seanbudd seanbudd added this to the 2026.1 milestone Aug 12, 2025
@seanbudd seanbudd deleted the branch nvaccess:master August 26, 2025 00:31
@seanbudd seanbudd closed this Aug 26, 2025
@seanbudd

Copy link
Copy Markdown
Member

Sorry - this got automatically closed when the base PR was merged. Feel free to open a new PR

@LeonarddeR

LeonarddeR commented Aug 26, 2025

Copy link
Copy Markdown
Collaborator Author

@seanbudd Could you please temporarily restore the wip-buildX64 branch? Otherwise it will be very painful for me to rebase this. Restoring the branch will also allow me to reopen the pr and do a cleaner rebase in Github itself, preserving the pr.

@seanbudd

Copy link
Copy Markdown
Member

@LeonarddeR - done

@LeonarddeR LeonarddeR reopened this Aug 26, 2025
@LeonarddeR LeonarddeR requested a review from a team as a code owner August 26, 2025 05:57
@LeonarddeR LeonarddeR requested review from Qchristensen and removed request for a team August 26, 2025 05:57
@LeonarddeR LeonarddeR changed the base branch from wip-buildX64 to master August 26, 2025 05:57
@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

Thanks @seanbudd, feel free to remove it again.

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

This PR implements ARM64EC library support to improve performance on ARM64 systems by using native ARM64EC libraries instead of emulated x64 libraries when running x64 builds of NVDA on ARM64 Windows.

  • Adds ARM64EC build target and library path configuration
  • Updates library path resolution to use ARM64EC libraries on ARM64 systems for x64 builds
  • Simplifies Java Access Bridge installation to copy the appropriate architecture-specific DLL directly to the source directory

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
user_docs/en/changes.md Documents performance improvements and ARM64EC library implementation
source/setup.py Adds ARM64EC library path to installer manifest
source/NVDAState.py Updates library path resolution to use ARM64EC on ARM64 systems
source/NVDAHelper/init.py Fixes remote loader path for ARM64 systems
source/JABHandler.py Simplifies Java Access Bridge DLL loading
sconstruct Adds ARM64EC build environment and configuration
nvdaHelper/uwp/sconscript Extracts UWP redistributable logic to separate script
nvdaHelper/localWin10/sconscript Removes duplicated UWP redistributable code
nvdaHelper/javaAccessBridge/sconscript Adds Java Access Bridge DLL installation logic
nvdaHelper/archBuild_sconscript Implements ARM64EC build support and updates architecture detection

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread user_docs/en/changes.md Outdated
Comment thread user_docs/en/changes.md Outdated
Comment thread source/JABHandler.py Outdated
Comment thread nvdaHelper/javaAccessBridge/sconscript Outdated
Comment thread nvdaHelper/archBuild_sconscript Outdated
Comment thread nvdaHelper/archBuild_sconscript
Comment thread nvdaHelper/uwp/sconscript Outdated
@seanbudd seanbudd merged commit ae6a772 into nvaccess:master Sep 3, 2025
40 checks passed
seanbudd pushed a commit that referenced this pull request Sep 28, 2025
Summary of the issue:

AMD64 builds of NvDA are not currently functioning on ARM64 devices such as Copilot PC.
NVDA seems to crash when initializing NVDAHelper.
The crash seems to occur when trying to set the first nvdaControllerInternal function pointer for nvdaHelperLocal.dll in NVDAHelper.initialize. Yet all the previous function pointers for nvdaController are set correctly.

With the merging of pr #18570, for performance improvements NVDA loads ARM64EC dlls for AMD64 processes when running on ARM64. If NVDA itself is build as AMD64, this will include nvdahelperLocal.dll. There may be some kind of ARM64EC to AMD64 thunking issue going on here between nvdaHelperLocal.dll and Python ctypes callbacks. Though only specific to nvdaControllerInternal, not nvdaController.
Interestingly, nvdaController is c++, but nvdaControllerInternal is only c. Perhaps the compiler / headers only manage thunking for c++. Noting that with ARM64EC, I believe functions may get multiple entry points depending on whether being called with ARM64 or AMD64 code to appropriately handle arguments.
Description of user facing changes:

AMD64 builds of NVDA will run correctly on ARM64 devices such as Copilot PC.
Description of developer facing changes:
Description of development approach:

    Rename nvdaHelperLocal's nvdaControllerInternal.c to nvdaControllerInternal.cpp, now compiling with C++.
    nvdaHelper.initialize: rewrite the code that chooses which NVDA Helper Remote Loader processes to start, to be more accurate and readable. The logic now groups by specific OS archetecture, making it very clear which ones apply to which OS archetecture. This rewrite also ensures that particular checks are no longer skipped if an earlier check succeeded. E.g. previously ARM64 remote loader was never started on ARM64 if NVDA was compiled as AMD64.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider ARM64EC support as part of the 64 bit migration

4 participants