weight-sync(jax): fail-loud runtime-derived tile-representability guard - #666
Open
lokic233 wants to merge 1 commit into
Open
weight-sync(jax): fail-loud runtime-derived tile-representability guard#666lokic233 wants to merge 1 commit into
lokic233 wants to merge 1 commit into
Conversation
A tiled leaf whose on-device representation cannot be faithfully reconstructed at the destination (on-device/tiled bytes > logical bytes) previously published silent zeros: the D2H stages LOGICAL bytes but completion is accounted in TILED bytes, so the receiver waits for bytes that never arrive after detiling, H2D never fires, and the destination silently stays zero-initialized (BUG1 class). Add a runtime-derived guard (assert_tile_representable_v2) invoked from WeightSynchronizer.__init__ and bind_weights that rejects a leaf iff sum(on_device_size_in_bytes(shards)) > logical_bytes. It is dtype-proof (reads the runtime's own device layout, no hardcoded tile constant) and does not false- positive when the on-device size is unavailable. Fail-loud, pre-publication. Deterministically validated: rejects tiled>logical (single + sharded), allows odb==logical, no false reject on unknown odb. This is a fail-closed guard, not a substitute for the D2H event-completion fix (separate PR) which addresses the distinct silent rank-1 byte-drop.
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.
Problem
A tiled leaf whose on-device representation cannot be faithfully reconstructed at the destination previously published silent zeros (BUG1 class). The D2H stages logical bytes but transfer completion is accounted in tiled (on-device) bytes; when
on_device_size > logical_sizethe receiver waits for bytes that never arrive after detiling, H2D never fires, and the destination silently remains zero-initialized — withsuccess == true.Fix (fail-loud, runtime-derived, dtype-proof)
Add
assert_tile_representable_v2(jax_arrays), invoked fromWeightSynchronizer.__init__andbind_weights. It rejects a leaf iffsum(on_device_size_in_bytes(shards)) > logical_bytes:(8,128), bf16(8,128)+(2,1), int8(8,128)+(4,1), MoE/1-D/narrow, and any future dtype.-1).Validation
Deterministic unit checks: rejects
tiled>logical(single-array and sharded), allowson_device==logical, allows unknown on-device size (no false reject). Prior silicon matrix (LANDING, 24 cells): 14/14 tiled>logical rejected, 10/10 byte-safe allowed, 0 silent-zero survivors; 296×512 bf16 byte-exact.Scope / non-goals
This is a fail-closed guard. It does not replace the separate D2H event-completion correctness fix (which addresses the distinct silent rank-1 byte-drop of a present var) or the coverage guard (missing-var class). No subset-sync semantics.
Authored with agentic assistance (Navi); guard logic validated deterministically and consistent with prior silicon runs.