Skip to content

Internal Change - #3473

Merged
copybara-service[bot] merged 6 commits into
mainfrom
test_947822041
Jul 14, 2026
Merged

copybara-service[bot] merged 6 commits into
mainfrom
test_947822041

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

Internal Change

FUTURE_COPYBARA_INTEGRATE_REVIEW=#3455

Restructure the safetensors loader around the target sharding: per host, resolve the byte runs each local-device shard needs from the file blob, coalesce neighbouring runs per file, and serve each coalesced block as a ranged read. An over-read ratio caps block_size/needed_bytes so inner-dim (row-parallel TP) shardings don't amplify cross-host egress to N*file_size; leading-dim FSDP stays one contiguous read per host.

Bound peak in-flight memory by the shared restore budget (MemoryOptions.read_concurrent_bytes) rather than a per-block cap: one limiter across every file's scheduler streams oversized blocks in budget-sized chunks, so host memory beyond the destination shard buffers is bounded regardless of block, shard, or file size.

Expose the loader tuning knobs (max_over_read_ratio) on SafetensorsOptions and the load benchmark, add a TP ratio-sweep config, and extend the single- and multi-process layout tests to cover the sharded read paths.
…r file

Replace the per-file scheduler and its cursor-callback contract with a pure
read plan: byte runs carry their destination buffer views and every chunk's
buffer copies are precomputed, so chunks are order-independent. Blocks larger
than a fixed chunk size (128 MiB) are now fetched as parallel ranged reads
under the same shared in-flight byte budget, instead of streaming
sequentially at single-stream throughput -- the single-host whole-file case
especially.

Read all file headers (and length checks / stats) concurrently instead of
one round trip at a time, and assemble each file's tensors as soon as its
reads complete, overlapping host-to-device transfer with the remaining reads
and releasing host buffers earlier.
The generator referenced the pre-rename singular module path and the
fixture URIs predate the st_fixtures/ convention; the sweep failed at
generator import. Also point the pair reference at mistral7b_tp.yaml.
The 128 MiB chunk size that splits coalesced blocks into concurrent
ranged reads was a module constant; the right value is storage-backend
dependent (request-rate quotas and per-request overhead vs parallel
stream throughput). SafetensorsOptions.read_chunk_bytes overrides it,
clamped to the in-flight budget as before, and the load benchmark gains
a sweepable safetensors_read_chunk_mb knob to measure the tradeoff.
@copybara-service
copybara-service Bot force-pushed the test_947822041 branch 15 times, most recently from fb97517 to e2a5d1e Compare July 14, 2026 20:15
PiperOrigin-RevId: 947871158
@copybara-service
copybara-service Bot merged commit 549d786 into main Jul 14, 2026
13 of 14 checks passed
@copybara-service
copybara-service Bot deleted the test_947822041 branch July 14, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant