Skip to content

glm load: read-ahead uses the checkpoint's model prefix (refs #5256) - #5264

Merged
ashhart merged 5 commits into
mainfrom
lead/glm-readahead-prefix
Nov 27, 2026
Merged

ashhart merged 5 commits into
mainfrom
lead/glm-readahead-prefix

Conversation

@ashhart

@ashhart ashhart commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • cuda_weights.zig already picks the checkpoint's model prefix (model.language_model. for Flash, model. for full GLM/DSA) and passes it to the layer loader, but the read-ahead path dropped it: cuda_load_prefetch.zig hardcoded model.language_model.layers.{d}..
  • On a full GLM/DSA checkpoint the read-ahead readers therefore matched no tensors and read nothing ahead of the loader. The loader itself was unaffected, so output tokens never changed; only the read-ahead was missing.
  • The prefix is now threaded through cuda_load_ahead.zig and cuda_load_prefetch.zig. Flash keeps its previous prefix, so its read spans are unchanged.

Host coverage

zig/load_prefetch_host.zig adds a full GLM fixture beside the existing ones and checks exact per-layer byte counts, exact absolute spans for Flash and full GLM, exclusion of other layers, joined readers, failed-read propagation and allocation-failure cleanup.

  • On unchanged main the new case fails as expected (9 pass, 3 fail: full GLM read 0 bytes instead of 4 and 8, and returned success instead of LoadPrefetchRead).
  • With the fix, test-load-prefetch-host passes, also after applying the mailbox to a fresh main.
  • Zig formatting and AST checks, diff hygiene, line caps and the lean delta (123 before and after) pass.

Not covered

No CUDA device run, real checkpoint, disk-traffic or load-time measurement. This does not implement the per-rank byte ranges proposed in #5256; it fixes a separate prefix bug found while studying it.

Refs #5256.

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