Repository navigation
heliopause: open Windows direct writers without FILE_APPEND_DATA - #294
Merged
Merged
Conversation
Core export on Windows fails when Heliopause writes a payload through its direct (unbuffered) path. direct_reopen reopens the output file with ReOpenFile, FILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPED, and FILE_GENERIC_WRITE access. FILE_GENERIC_WRITE includes FILE_APPEND_DATA, and the unbuffered reopen fails with ERROR_INVALID_PARAMETER (os error 87) whenever the requested access includes it. The direct writer issues writes at explicit offsets and never appends, so it does not need append access. Direct writers now request FILE_GENERIC_WRITE without FILE_APPEND_DATA. Read reopens keep FILE_GENERIC_READ. Sharing flags, the unbuffered and overlapped flags, and the alignment the writer applies are unchanged. Expected result: export::io's direct-write tests pass on Windows, and core exports on Windows write their payloads through the unbuffered path instead of failing. Evidence, on Windows 11 build 26200 with an NTFS volume, Rust 1.100.0 and MSVC: - ReOpenFile with FILE_FLAG_NO_BUFFERING fails with error 87 for FILE_GENERIC_WRITE and for FILE_GENERIC_READ | FILE_GENERIC_WRITE, for handles originally opened read-only or read-write; it succeeds for the same masks with FILE_APPEND_DATA cleared and for FILE_GENERIC_READ. - `cargo test --release --manifest-path heliopause/Cargo.toml --lib --no-default-features export::io::tests`: with the preceding Helios import fix alone, five tests that write through the direct path fail with os error 87 (direct_tail_reads_and_writes_preserve_exact_length, one_buffer_without_scratch_transfers_exact_unaligned_tails, writes_progress_while_producer_fills_subsequent_block, unaligned_bulk_uses_reserved_direct_scratch_with_one_output_slot, unaligned_destination_preserves_neighbors_and_existing_extent); with this change all ten export::io tests pass. - The full heliopause library suite passes with this change except export::core::payload_export_tests::sync_parent_normalizes_a_relative_basename, which fails with "open export parent: Access is denied. (os error 5)" with and without this change. - A 15.5 GiB core exported through export_capture on Windows wrote its payload through this path and replays bit-identically to the exporting process. That export ran on an RTX 3090 (SM86, not a supported GPU) with local platform patches; no export on a supported GPU under Windows was run. Design-Signed-Off-By: Claude Opus 5.5 (Claude Code); design-review=ed22 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Garret Buell <gmbuell@gmail.com>
lukealonso
pushed a commit
that referenced
this pull request
Nov 14, 2026
…ce window, no-identity export (#297) * Check fixed reservations against the WDDM GPU address width Under WDDM, cuMemAddressReserve with a fixed address beyond the GPU's virtual address space does not return. docs/windows.md records this for host reservations at 16 TiB and 32 TiB on RTX Spark N1X. The same hang occurs for Heliopause's default Windows device window (4 TiB, 1 TiB per rank) on a GPU whose WDDM address space is 1 TiB. Export and load then stall inside the driver without an error, and the process must be killed. WDDM reports the address width per adapter, so a reservation that cannot fit can be rejected before it is requested. helios/src/runtime_core/address_space.rs adds virtual_address_bits, which maps a CUDA device to its WDDM adapter (cuDeviceGetLuid, then D3DKMTOpenAdapterFromLuid) and returns the VirtualAddressBitCount that D3DKMTQueryAdapterInfo reports for KMTQAITYPE_QUERY_GPUMMU_CAPS. It also adds check_fits, which rejects a range ending beyond 2^bits. Outside Windows, or when the query fails, the width is unknown and nothing is rejected. Helios checks each core reservation and each Windows host reservation before reserving it; Heliopause checks every rank's device window in flare_core_initialize. A reservation that fits behaves as before. docs/windows.md describes the check and what it does not cover: Linux, and Ignition's own host-region reservations during export. Result: on a GPU whose address space cannot hold a fixed window, export and load fail immediately with an error that names the reservation and the width, instead of hanging. Evidence, on Windows 11 build 26200 with an RTX 3090 (SM86, not a supported GPU; WDDM reports 40 bits) and NVIDIA driver 621.01: - heliopause's reports_the_device_address_width (ignored by default; run with --include-ignored) prints 40 bits for device 0, read through the CUDA LUID to adapter mapping. - CoreStorage() with the default Windows window fails after 0.02 s: "native core device window 0x40000000000+0x10000000000 exceeds the GPU's 40-bit virtual address space". Without this check the same call does not return. This ran on a tree that also contains the explicit device window and device identity changes that follow and #293/#294, which Windows builds and exports need. - With the check active, the Helios loader loaded a 15.5 GiB core exported at 256 GiB, and an existing core, and replayed all 13 of each one's graphs bit-identically to the export. - heliopause's library suite passes except sync_parent_normalizes_a_relative_basename, which fails with "Access is denied" with and without this change. check_fits's unit test is in Helios, whose library tests do not compile on Windows (execution/roce_fabric.rs uses std::os::unix); it was not run. Not tested: any supported GPU. Whether RTX Spark N1X reports 44 bits, which would explain the 16 TiB host hang, is unverified. Design-Signed-Off-By: Claude Opus 5.5 (Claude Code); design-review=ed22 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Garret Buell <gmbuell@gmail.com> * Accept an explicit fixed device window in CoreStorage Heliopause places each rank's fixed device window at a compile-time base: 4 TiB on Windows, 8 TiB on Linux, 1 TiB per rank. A caller whose GPU address space ends below that base cannot export, and with the preceding address-width check it now fails with an explicit error instead of hanging. The only remedies were to patch the constants in heliopause/src/allocator.rs and ignition/preparation/core_storage.py, or to add an environment override, which docs/design-review.md principle 10 prohibits. An explicit, typed argument lets a caller that drives CoreStorage and export_capture as a library place the window where the device can reserve it. CoreStorage gains a keyword argument, device_window=(base, extent). Rank r's window is then base + r * extent, extent bytes long; omitted, the defaults (DEVICE_BASE, RESERVATION_BYTES) apply as before. The base must lie at or above EXTERNAL_FLOOR and the extent must be nonzero, checked before CUDA is touched. Heliopause adds flare_core_initialize_window(rank, world, device, base, extent), and flare_core_initialize now calls it with the platform defaults. It rejects empty or overflowing windows, windows that are not aligned to the allocation granularity (the extent to twice it, since its halves serve the pool and persistent storage), and windows that overlap the host ranges. With the default window the overlap condition is the same as before. Host ranges keep their 1 TiB per rank stride, now named HOST_RESERVATION_BYTES in CoreStorage, and host bounds no longer depend on the device extent. docs/windows.md documents the argument. Result: on a GPU whose address space cannot hold the default window, export works with a window the caller chooses. Recipes and callers that do not pass device_window see no change. Evidence, on Windows 11 build 26200 with an RTX 3090 (SM86, not a supported GPU) and NVIDIA driver 621.01, on a tree that also contains the device identity change that follows and #293/#294: - CoreStorage(device_window=(0x4000000000, 0x1000000000)) initializes. Windows below EXTERNAL_FLOOR and empty windows raise ValueError. - A core export with that window captured 13 CUDA graphs (15.5 GiB mapped), and a separate process loaded the core through Helios and replayed all 13 bit-identically to the export. - heliopause's library suite passes, including explicit_device_windows_are_validated, except sync_parent_normalizes_a_relative_basename, which fails with "Access is denied" with and without this change. - tests/preparation/test_core_storage.py passes on Windows (8 tests, including the two device-window cases); its Linux layout test was skipped. Limits: the caller chooses a window that WDDM's own per-process placements leave free. One of four loads of that core failed with an address collision at the window base; the other three succeeded. No supported GPU or Linux system was tested. Design-Signed-Off-By: Claude Opus 5.5 (Claude Code); design-review=ed22 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Garret Buell <gmbuell@gmail.com> * Let capture exports record no device identity Heliopause's capture export names every core after the platform that the capture GPU's PCI id maps to in helios/src/core/naming.rs. It fails when the id maps to none ("NVML reports unsupported GPU PCI id"). A program that drives export_capture as a library on a development or test GPU outside that table therefore cannot export at all, unless it adds the GPU to the platform table, which would present it as a supported platform. Helios already defines cores without a device identity: they load, their cache entries use the unknown-device label (naming::unknown_device_candidate), and Flare's catalog and hub, which filter on naming::PLATFORMS, never list them as a supported platform. Export is the one path that cannot produce such a core. The capture request gains device_identity. "required", the default, keeps the current behavior: the PCI id must name a platform. "none" skips the lookup and records no platform. Export then names the core with the existing unknown-device scheme: - signed hardware_identity "unknown-device" (the schema requires a nonempty value); - deployment unknown-device-tp<N>, unless the cluster supplies an export id; - cache entry unknown-device-tp<N>-<UTC minute>, from deployment_candidate(None, ...). No request field can name a platform, so a capture is either identified by its hardware or claims none. docs/core-format-design.md describes the field. Result: export_capture can export on a GPU outside the platform table, and the resulting core is marked as claiming no platform. Requests that omit the field behave as before. Evidence, on Windows 11 build 26200 with an RTX 3090 (SM86, PCI id outside the platform table) and NVIDIA driver 621.01, on a tree that also contains the two preceding changes and #293/#294: - device_identity_defaults_to_required_and_accepts_none: an omitted field and "required" parse as Required, "none" as None, other values are rejected. - A capture export with device_identity "none" and an unmodified platform table produced a core whose deployment is unknown-device-tp1, cache entry unknown-device-tp1-202611141806. A separate process loaded it through Helios's VerifiedCore and NativeResources and replayed all 13 graphs bit-identically to the export. - heliopause's library suite passes except sync_parent_normalizes_a_relative_basename, which fails with "Access is denied" with and without this change. Not tested: the "required" path was not re-run, though it is the unchanged call to current_platform. flare run, the catalog, and the hub were not exercised with an unknown-device core. Design-Signed-Off-By: Claude Opus 5.5 (Claude Code); design-review=ed22 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Garret Buell <gmbuell@gmail.com> --------- Signed-off-by: Garret Buell <gmbuell@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Core export on Windows fails when Heliopause writes a payload through
its direct (unbuffered) path. direct_reopen reopens the output file with
ReOpenFile, FILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPED, and
FILE_GENERIC_WRITE access. FILE_GENERIC_WRITE includes FILE_APPEND_DATA,
and the unbuffered reopen fails with ERROR_INVALID_PARAMETER (os error
87) whenever the requested access includes it. The direct writer issues
writes at explicit offsets and never appends, so it does not need
append access.
Direct writers now request FILE_GENERIC_WRITE without FILE_APPEND_DATA.
Read reopens keep FILE_GENERIC_READ. Sharing flags, the unbuffered and
overlapped flags, and the alignment the writer applies are unchanged.
Expected result: export::io's direct-write tests pass on Windows, and
core exports on Windows write their payloads through the unbuffered path
instead of failing.
Evidence, on Windows 11 build 26200 with an NTFS volume, Rust 1.100.0
and MSVC:
FILE_GENERIC_WRITE and for FILE_GENERIC_READ | FILE_GENERIC_WRITE, for
handles originally opened read-only or read-write; it succeeds for the
same masks with FILE_APPEND_DATA cleared and for FILE_GENERIC_READ.
cargo test --release --manifest-path heliopause/Cargo.toml --lib --no-default-features export::io::tests: with only the Helios importfix from helios: import driver::Access in the Windows host allocator #293 applied, five tests that write through the direct path fail
with os error 87 (direct_tail_reads_and_writes_preserve_exact_length,
one_buffer_without_scratch_transfers_exact_unaligned_tails,
writes_progress_while_producer_fills_subsequent_block,
unaligned_bulk_uses_reserved_direct_scratch_with_one_output_slot,
unaligned_destination_preserves_neighbors_and_existing_extent); with
this change all ten export::io tests pass.
export::core::payload_export_tests::sync_parent_normalizes_a_relative_basename,
which fails with "open export parent: Access is denied. (os error 5)"
with and without this change.
payload through this path and replays bit-identically to the
exporting process. That export ran on an RTX 3090 (SM86, not a
supported GPU) with local platform patches; no export on a supported
GPU under Windows was run.
Merge order: heliopause depends on Helios with runtime-core, which does not
compile on Windows until #293 merges, so these tests can be run on Windows only
with #293 applied. The two changes touch different files and do not conflict.
🤖 Generated with Claude Code