Repository navigation
Model L: runtime weight packer (C++ port of l_pack.py, #109 layout) - #103
Merged
Merged
Conversation
phantoslayer21
marked this pull request as ready for review
November 13, 2026 23:32
phantoslayer21
marked this pull request as draft
November 13, 2026 23:35
…e_load on main #110 merged after #109 changed the structure table: the runtime's Model L tensor list still had the earlier layout and its test called table.encoder_shapes, which #109 removed. Now the map's stages (enc0, enc0_block, the ten shared stages, dec0_block, dec0, post), names and shapes; the test checks them against data/preset-L.v1.map.json and table.param_shapes. Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
wgrt::l::encoder_launches / decoder_launches mirror l_pack's launch lists for the default table (#109's layout, the map's stage and tensor names); pack_model packs every blob of pack_model_l: enc0.values, enc0.Win1, enc0.Win2, enc0_block, enc0.project, dec0.project, dec0_block, dec0.coef. model.h pack_parts gains rows_expand (the expand rows of dec0.project). Byte-identical to the Python packer (test_l_runtime_pack.py). Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
force-pushed
the
model-l/l-pack-cpp
branch
from
November 13, 2026 23:48
3f9884d to
abd12af
Compare
phantoslayer21
marked this pull request as ready for review
November 14, 2026 00:16
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.
The runtime's weight packer for Model L's own launches: a C++ port of
clean/l/runner/l_pack.pyon the layout #109settled, using the preset-L map's stage and tensor names. It packs byte-identical blobs for the default structure
table. It is not wired into the runtime library yet; that comes with the runtime frame for Model L (#111). Nothing
changes for Model M.
Rebased on main (#101, #109, #110 are in). The branch has two commits:
test_l_runtime_load.py, which failson main since Model L: structure table settled to the confirmed layout #109 and Runtime: raw model loading for any stage list; Model L's tensor list and loader #110 merged in that order, so this PR's CI is green on its own. It drops out when Model L tensor list: the confirmed layout (fixes test_l_runtime_load on main) #112
merges.
What is added (
clean/l/runtime/, namespacewgrt::l)encoder_launches()/decoder_launches(): mirrors ofl_pack.encoder_launches()/decoder_launches()for thedefault table, with every field the Python lists carry:
Win1(acc f16, ReLU then FP8) andWin2,enc0_block(offsets "first"), the projection of each token's 2 x 2 pixels (groups 4 x 32, clamp 6.28125);
dec0.project(with the depth-to-space),dec0_block(offsets "second"), coef (value positions fromthe table).
pack_linear,pack_project,pack_dec_project(rows R_E(32), K order in groups of 32),kord_groups32.pack_model(params, drow, out, err), with params holding the map's stagesenc0,enc0_block,dec0,dec0_block. It produces every blob ofpack_model_l:enc0.values,enc0.Win1,enc0.Win2,enc0_block,enc0.project,dec0.project,dec0_block,dec0.coef. It refuses a missing stage, a missing tensor or a wrongnumber of values, naming the stage and tensor.
clean/runtime/model.h:pack_parts::rows_expand, a wrapper of the existing function (Model M's packers are notedited).
tests/l_pack_dump.cppandtests/test_l_runtime_pack.py(CI runs them; host C++ compiler or MSVC).Refs #89
Tested (against the current Python packers on main, i.e. after #109)
test_l_runtime_pack.py: 3 tests, OK (clang++ and MSVC):l_pack.pack_model_lagainstwgrt::l::pack_model, byte for byte, fororacle.random_paramswith three seeds;
l_pack.encoder_launches()/decoder_launches(), and the coef valuepositions against
table.DEC0_VALUES;dec0.project.clean/l/runtime/tests/test_l_runtime_*.py: 8 tests, OK.clean.tests.test_model_pack_cpp,test_model_filter,clean.k.tests.test_k_runtime_pack,test_k_runtime_tables,clean.l.tests.test_l_pack,test_l_reference: 72 tests, OK.Not tested
merges first, this mirror is updated and re-run before the PR is marked ready.