Use ARm64EC libraries for X64 support on ARM64 systems#18570
Conversation
|
Sorry - this got automatically closed when the base PR was merged. Feel free to open a new PR |
|
@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. |
|
@LeonarddeR - done |
|
Thanks @seanbudd, feel free to remove it again. |
There was a problem hiding this comment.
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
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.
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:
Testing strategy:
Known issues with pull request:
None
Code Review Checklist: