Repository navigation
feat(hip): Inkling 2 Mini's text weights on one HIP rank, through CUDA's loader made generic - #5031
Merged
Merged
Conversation
4 of 8 tasks
Owner
|
Thank you @AbrahamCete. The generic loader preserves CUDA's tensor types, traversal, upload order and cleanup after the type substitutions, and the public aliases remain intact. The HIP adapter forwards raw bytes, while the query-row helper checks core-layer bounds. This looks safe to land as the preparatory loader slice. The recording-runtime fixtures are useful evidence; they do not yet qualify a HIP serving engine. When combining the refusal slice, retain both focused host test artifacts in the build wiring.
|
1 task done
AbrahamCete
marked this pull request as ready for review
November 27, 2026 15:50
ashhart
force-pushed
the
feat/hip-inkling2-weights
branch
from
November 28, 2026 04:58
fa5e2ab to
47af75c
Compare
…tral weights.zig loop_weights.zig's loader, its tensor walk, checkpointBytes and the controllers' naming move unchanged into weights.zig, with the CUDA device buffer made a type parameter. loop_weights.zig keeps its public names (Controller, Attention, Layer, Weights, load) over weights.Weights(cuda.DeviceBuffer), so loop_engine.zig and cuda_native.zig are untouched. Over the release's header (fixtures/mini_model_header.txt) and one recording buffer, the old CUDA walk and the shared one make the same allocation, the same 822 uploads in order and the same addresses.
hip_weights.zig loads the text checkpoint through the loader CUDA shares (weights.zig), over a HIP device buffer, into one 256-aligned allocation. It exposes each layer's attention, conv, router, expert (format, w13 and w2 codes, scales, amax, denominator) and controller addresses, and crossQueries, the two cross-pass query rows a core layer's messages read. Host tests in test-inkling2-hip-host run the loader on the release's header over a recording runtime: every text tensor uploaded once, 256 aligned, at the field that names it; one arena of the checkpoint's padded bytes; each layer's expert format the plan's; and the Inkling2LoopRequired and LoopWeightsOverflow refusals.
ashhart
force-pushed
the
feat/hip-inkling2-weights
branch
from
November 28, 2026 07:19
47af75c to
7c9813e
Compare
Owner
|
Thank you @AbrahamCete. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
This was referenced Nov 30, 2026
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.
What this changes
TensorFold cannot put Inkling 2 Mini's text weights on a HIP device. This adds the loader: HIP5a, the first of the five
HIP5 pull requests listed on #4274 (issuecomment-7158137239), and one of the two that need none of its questions
answered. No engine, kernel or registration.
loop_weights.zig's loader moves unchanged intoweights.zig, generic over the device buffer:Weights(Buffer),Loader(Buffer),load(Buffer, ...).loop_weights.zigkeeps its five public names overcuda.DeviceBuffer, soloop_engine.zigandcuda_native.zigdo not change. Against the old file, the body differs only in indentation,the
Bufferparameter, two declarations madepubandcontrollers(l: anytype).hip_weights.zigruns that loader on one HIP rank throughhip.DeviceBuffer: one 256-aligned arena sized from thecheckpoint, every text tensor uploaded once from its mapped bytes, the experts as stored (NVFP4 or MXFP8, as the plan
picks per layer) and the controllers.
crossQueriesreturns a core layer's two message query rows at the offsetsloop_engine.zig:378uses, and refuses any other layer.controllers and
crossQueriesfor perf(hip): Inkling 2's loop kernels (cross-pass message and message gate) at hidden 2,304 and 256 under named HIP baselines #5012's.Why one loader and not a HIP copy: the tensor walk, its checks and its refusals stay in one place, as
modelopt.loadalready does for the experts. CUDA's behavior is unchanged; the checks are below.
snapshots, forward, lane adapter, and registration, admission and refusals remain, and so does HIP2.
main1b12359. Commits:atc overlap --json(ATC 0.9.6, 2026-11-25 10:56Z, base 1b12359): no overlap among the pull requests it read, butthe run is incomplete (limits on pull requests, their files and time). My own feat(hip): Inkling 2's routed experts under HIP-DOT-Q4, the HIP column's serial dot baseline #4994 and perf(hip): Inkling 2's loop kernels (cross-pass message and message gate) at hidden 2,304 and 256 under named HIP baselines #5012 also append to
zig/build/hip_contract.zig; whichever lands second rebases.Checks on this head
main1b12359.python3 tools/zig/lean_check.py, on the base and on this head: 164 and 164, 0 new.zig build test-inkling2-hip-host -Dhip=true: 45 of 47 passed, 2 skipped (names_test.zig's two checkpointtests, which need
TF_INKLING2_TINYandTF_INKLING2_REAL). The new tests run the loader on a recording HIPruntime over Mini's release header (
fixtures/mini_model_header.txt), laid out on reserved memory:one allocation equals the checkpoint's padded bytes, and no tensor is left unused;
crossQuerieson all 24 visits that carry messages, and its refusals for other layers and a config without theloop;
zig build test-inkling2-host: 45 of 49 passed, 4 skipped.zig build test-inkling2-cuda-host: 43 of 43.zig build teston a clean tree of this head: 13,587 of 13,681 passed, 93 skipped, 1 failed. The failure isstage_hip_test"every staged call on HIP memory equals the reference, whole and in parts", which feat(hip): Inkling 2's routed experts under HIP-DOT-Q4, the HIP column's serial dot baseline #4994 reportsfailing on
mainon this machine as well.zig build test -Dhip=trueon the same tree: 1,529 of the 1,553 tests it ran passed, 23 skipped, and the samestage_hip_testfailed.zig fmt --check build.zig zigandgit diff --check: clean.has changed only Metal files of the family since):
over the same header in 9 cases (the load, each refusal, a failed allocation and a failed upload): the same
allocation of 18,889,368,576 bytes, the same 1,048 upload windows in order, the same 862 address fields and the
same errors. A planted alignment of 128 turns 6 of the 9 red.
loop_weights.zig: the same five public names, fields, defaults, sizes,methods,
loadsignature and 44 error names.zig build check-native-cuda-hostbuilds the CUDA server; a planted@compileErrorinloop_weights.loadfails it, so that build analyzes the loader.
weights.zig, the HIP host step stops withunable to load "weights.zig": FileNotFound. Three refusals of the shared loader have no test:UnusedCheckpointTensor,MissingTensorandUnexpectedTensor. Core reports each withstd.log.err, and Zig'stest runner fails any test that logs an error; the one-off differential above ran them.
machine.
Receipt
n/a: nothing calls this loader yet; no engine, server or kernel reaches it. The host tests and the CUDA checks above
are the evidence.
Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (n/a: no engine)--drafter, no slower than without it, greedy and sampled. (n/a: no engine)