Skip to content

Runtime: raw model loading for any stage list; Model L's tensor list and loader - #110

Merged
phantoslayer21 merged 1 commit into
mainfrom
model-l/l-raw-load
Nov 13, 2026
Merged

phantoslayer21 merged 1 commit into
mainfrom
model-l/l-raw-load

Conversation

@phantoslayer21

Copy link
Copy Markdown
Owner

The runtime can now load Model L's model data in the raw layout. This is the second piece of the Model L runtime
frame (P13), after #108 (CPU frame trace). Nothing changes for Model M: the same tensors load from the same files,
with the same checks and messages.

What changes

  • clean/runtime/model.h/.cpp:

    • TensorSpec and stage_specs (Model M's tensors of one stage) are now public;
    • new load_raw_stages(model_dir, stages, out, err) loads <root>/<stage>/<name>.bin for any list of stages. It
      uses the same root rule (model_dir/raw when that holds the first tensor of the first stage), the same size,
      finite-value and T checks, and the same optional group filter;
    • load_raw_model is Model M's list through it.
  • clean/l/runtime/l_model.h/.cpp (new), namespace wgrt::l:

    • stage_specs() returns Model L's stages: enc0 (Model M's W, b, T, sigma1, sigma2, with W the 64 x 128
      projection; the linears Wa/ba 32 x 20 and Wb/bb 32 x 32; the width-32 block blk.*), Model M's ten Swin
      stages, dec0 (Model M's W, b, S, T plus blk.*), and post;
    • load_raw_model() loads them.

    The names are the logical names of clean/l/reference/table.py. The translation from the preset-L map's names
    (separate block stages, other linear names) comes when that map and the table agree; that is noted on the Model L
    coordination page.

  • clean/l/runtime/tests/l_load_dump.cpp and test_l_runtime_load.py (CI runs them; host C++ compiler or MSVC).

Refs #89

Tested

  • test_l_runtime_load.py: 4 tests, OK:
    • the tensor list against table.encoder_shapes() / decoder_shapes() (names, number of values, uint8 only for
      enc0 T);
    • the ten Swin stages, post and Model M's enc0/dec0 tensors against Model M's raw shapes
      (synthetic_model.synthetic_tensors);
    • a synthetic Model L (oracle.random_params) written in the raw layout loads with every tensor's SHA-256
      unchanged, from the model folder and from raw/ itself;
    • refusals: missing tensor, wrong size, T above 127.
  • Model M unchanged:
    • clean.tests.test_model_filter and clean.tests.test_model_select: 20 tests, OK (the raw and model.wgcm
      loaders, the optional group);
    • the runtime's frame trace from Runtime frame trace on the CPU (recording device, no GPU) #108 (synthetic Model M, 64 x 64 to 96 x 96, four frames) is byte-identical
      before and after this change (107 lines);
    • the runtime library builds with the ROCm 7.2 clang++ (build.py --runtime-only --no-embed), 0 warnings.
  • Line endings: 0 problems.

Not tested

  • No GPU run (nothing in the frame uses Model L's tensors yet).
  • No model.wgcm for Model L: it waits for the preset-L map.

…and loader

load_raw_stages loads <stage>/<name>.bin for a given list of stages; load_raw_model is Model M's list through it (unchanged behaviour). clean/l/runtime/l_model.cpp: Model L's stages and tensors (the default table's logical names) and its raw loader, checked against the table and Model M's raw tensors.

Refs #89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
@phantoslayer21
phantoslayer21 marked this pull request as ready for review November 13, 2026 23:31
@phantoslayer21
phantoslayer21 merged commit cf8e8ac into main Nov 13, 2026
2 checks passed
@phantoslayer21
phantoslayer21 deleted the model-l/l-raw-load branch November 13, 2026 23:31
phantoslayer21 added a commit that referenced this pull request Nov 13, 2026
…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>
j0nsh1n pushed a commit to j0nsh1n/wronggpu that referenced this pull request Nov 14, 2026
… test_l_runtime_load on main

phantoslayer21#110 merged after phantoslayer21#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 phantoslayer21#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 phantoslayer21#89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
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