Reduce Windows ReadFileIntoBuffer chunk to 16 MB (AppContainer errcode 1450) - #29732
Conversation
A 1 GB ReadFile can fail with ERROR_NO_SYSTEM_RESOURCES (errcode 1450) under Windows AppContainer memory pressure (observed on Xbox UWP when loading ONNX models with large external .onnx.data). Smaller successive ReadFile calls lock fewer pages per transfer. Fixes: microsoft#29730
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Cross-ref: console validation and field numbers are also tracked in the xllama project (gianlucamazza/xllama#86). |
- vendor-genai-dml-patch.ps1 exits 1 if the cached DLL is missing (no silent vanilla NuGet under -PatchedGenAI). - scripts/check-vendor-nuget-status.sh compares packages.config pins to NuGet.org and reports drop readiness for PatchedGenAI / PatchedOrt. - ROADMAP/CHANGELOG/plan: upstream ReadFile PR microsoft/onnxruntime#29732; optional extdata catalogue deferred (license + HF flaky).
There was a problem hiding this comment.
Pull request overview
This PR adjusts the Windows filesystem implementation (WindowsEnv::ReadFileIntoBuffer) to reduce the maximum per-ReadFile transfer size from 1 GB to 16 MB. This targets intermittent ReadFile failures under Windows AppContainer/UWP environments (e.g., Xbox Dev Mode) when loading large ONNX external data blobs, improving reliability without changing total I/O semantics.
Changes:
- Reduced the maximum per-call
ReadFilechunk size to 16 MB to avoidERROR_NO_SYSTEM_RESOURCES (1450)under AppContainer memory pressure. - Added explanatory comments and linked the related tracker issue for context.
|
Could a maintainer authorize CI on this ( |
|
Copilot merge with main branch |
|
The failing checks all look infrastructure-related: the Windows pipelines timed out at exactly 24h waiting for runners, and web_Release died mid "E2E package consuming test" with no step conclusion (runner termination). Could a maintainer trigger a re-run? Happy to rebase if that helps. |
|
Merged with main as requested (Xavier Dupré (@xadupre)). The previous red check (web_Release / build_onnxruntime_web) and the cancelled jobs looked infra-related (24h runner timeout), so a fresh pipeline run on the updated branch should tell. /azp run when convenient — thanks! |
Description
WindowsEnv::ReadFileIntoBuffercurrently issues up to 1 GB perReadFilecall. On Windows AppContainer / UWP (observed on Xbox Series S Dev Mode) a large single transfer can fail intermittently with:This surfaces when loading ONNX models with large external
.onnx.data(e.g. ~0.5–1 GB tensors such as an un-quantized embedding table inside a multi-GB external file). AppContainer cannot use ORT's preferred mmap path (non-FromAppmapping APIs are blocked), so every large external read goes through this loop.Reducing the per-call cap to 16 MB keeps the same total I/O with far fewer pages locked in the MDL for each transfer. Desktop behavior is unchanged aside from more loop iterations.
Related: AppContainer path canonicalization was addressed in #28509; this is an independent I/O sizing issue. Tracker: #29730.
Motivation and Context
Alternatives considered
How was this tested?
ReadFile model.onnx.data.Happy to adjust the constant if maintainers prefer a different cap (e.g. 64 MB).
Checklist