Skip to content

Model L reference: confirmed encoder and decoder arithmetic (FP16 block maps, block borders, L's per-pixel functions) - #113

Merged
phantoslayer21 merged 7 commits into
mainfrom
model-l/p3-items
Nov 14, 2026
Merged

phantoslayer21 merged 7 commits into
mainfrom
model-l/p3-items

Conversation

@phantoslayer21

@phantoslayer21 phantoslayer21 commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Refs #89

The Model L CPU reference (structure table, NumPy oracle, packer launch lists) is updated to the confirmed
arithmetic of the input encoder and the coefficient decoder. The reconstruction is still open
(PROVISIONAL I7 and I8).

Encoder

  • The second input linear's output stays FP16. The encoder block starts from that FP16 map, not from FP8.
  • The encoder block's window members outside the grid get their values from the per-pixel chain at those
    positions, with the new swin border "input". The chain samples the 20 values at the mirrored render position and
    applies the dither at the unmirrored position. So the per-pixel maps carry a 2-pixel halo (table.block_halo).

Decoder

  • The decoder block mirrors on the token grid and keeps the sub-pixel (border "coarse"). This is not a
    pixel-grid mirror.
  • The decoder block's output stays FP16.
  • A new per-pixel variant dec_pixel "l" (oracle.coefficients_l):
    • 13 values (table.L_DEC_VALUES);
    • A, B and C in Model M's forms;
    • latent = tanh(candidate), with no gate and no previous latent. The decoder reads no motion, jitter or reset.
  • Model M's variant stays available as dec_pixel "m" for the reductions to Model M.

Table bookkeeping

  • Settled entries leave PROVISIONAL.
  • A new UNCONFIRMED list names one edge case the reference had to choose. For render sizes close to the padding,
    a mirrored halo position below 0 is clamped to 0.

Runtime packer (clean/l/runtime/l_pack.cpp, merged in #103)

  • Its launch list follows the table: the Win2 output stays FP16, and the coefficient step takes Model L's 13 value
    positions. Its blobs are unchanged.

Packer launch lists (l_pack)

  • New fields: in_format / out_format (fp8 / fp16) per map, border on swin launches, and dec_pixel on the
    coefficient launch.
  • Blob bytes are unchanged.

Tested

  • python -m unittest clean.l.runtime.tests.test_l_runtime_pack clean.l.runtime.tests.test_l_runtime_load: 8 tests pass (the C++ packer against l_pack.py).
  • python -m unittest discover -s clean/l/tests -t .: 30 tests pass (CPU, synthetic data). They include:
    • The encoder recomputed position by position, both parities, against an independent window-by-window block.
      Halo values come from the per-pixel chain at mirrored positions, with the unmirrored dither.
    • The decoder block window by window with the token-grid mirror. It differs from a pixel-grid mirror only in the
      edge windows.
    • The per-pixel functions value by value, and that the decoder output ignores the previous latent, motion, jitter
      and reset.
    • Byte-exact reductions to Model M's oracle (encoder, decoder with dec_pixel "m", whole chain), unchanged.
    • Launch-list formats and borders.

Not tested

  • No kernels change in this PR. The HIP and D3D12 kernels for the FP16 block input, the halo and token-grid
    borders, and the new per-pixel functions follow in their own PRs.
  • The reconstruction (pending).

…stage (encoder halo, token-grid mirror in the decoder)

Refs #89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
… output, latent without history); launch formats

Refs #89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…d, planned kernels marked); C = 32 GPU check on the current packer API

Refs #89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…ut FP16, Model L's 13 value positions)

Refs #89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21 added a commit that referenced this pull request Nov 14, 2026
…ncoder and decoder (FORMATS.md interface)

Builds with WG_MODEL_L (clean/l/runtime compiled in) accept model=L: raw tensors from <model_dir>/L (the preset-L map's stages), Model M's ten Swin stages packed as before, Model L's blobs from wgrt::l::pack_model, code objects l_enc_values.co (tag lev), l_ops.co, l_swin.co. Step 2: the values into the halo map, the two per-pixel linears (FP8, then FP16), the encoder block, the gather projection into enc0's features. Step 4: the decoder projection, the decoder block (FP16 out), l_coef into Model M's coefficient buffers. Kernel names, arguments, grids and maps as clean/l/FORMATS.md (#113). Model L runs without pack12 (l_coef writes the base format); the fused dec1 + dec0, recon=output, motion_outres=original, enc0 variants and backends 1 to 3 are refused for it. Without WG_MODEL_L nothing changes.

Refs #89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…s, border and coefficient variant in the C++ Launch, compared field by field with the Python list; M's 17-value list renamed, L's 13-value sequence asserted

Refs #89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
@phantoslayer21
phantoslayer21 marked this pull request as ready for review November 14, 2026 01:30
phantoslayer21 added a commit that referenced this pull request Nov 14, 2026
…ncoder and decoder (FORMATS.md interface)

Builds with WG_MODEL_L (clean/l/runtime compiled in) accept model=L. Model data: only the converter's model.wgcm in <model_dir>/L, checked against the preset-L map (l::load_wgcm_model); raw tensors are refused. Model M's ten Swin stages packed as before, Model L's blobs from wgrt::l::pack_model, code objects l_enc_values.co (tag lev), l_ops.co, l_swin.co. Step 2: values into the halo map, the two per-pixel linears, the encoder block, the gather projection. Step 4: the decoder projection, the decoder block, l_coef. Kernel names, arguments, grids and maps as clean/l/FORMATS.md (#113). No pack12 for Model L; the fused dec1 + dec0, recon=output, motion_outres=original, enc0 variants and backends 1 to 3 are refused. Without WG_MODEL_L nothing changes.

Refs #89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
@phantoslayer21
phantoslayer21 merged commit 001c863 into main Nov 14, 2026
9 checks passed
@phantoslayer21
phantoslayer21 deleted the model-l/p3-items branch November 14, 2026 01:34
phantoslayer21 added a commit that referenced this pull request Nov 14, 2026
…ncoder and decoder (FORMATS.md interface)

Builds with WG_MODEL_L (clean/l/runtime compiled in) accept model=L. Model data: only the converter's model.wgcm in <model_dir>/L, checked against the preset-L map (l::load_wgcm_model); raw tensors are refused. Model M's ten Swin stages packed as before, Model L's blobs from wgrt::l::pack_model, code objects l_enc_values.co (tag lev), l_ops.co, l_swin.co. Step 2: values into the halo map, the two per-pixel linears, the encoder block, the gather projection. Step 4: the decoder projection, the decoder block, l_coef. Kernel names, arguments, grids and maps as clean/l/FORMATS.md (#113). No pack12 for Model L; the fused dec1 + dec0, recon=output, motion_outres=original, enc0 variants and backends 1 to 3 are refused. Without WG_MODEL_L nothing changes.

Refs #89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21 added a commit that referenced this pull request Nov 14, 2026
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21 added a commit that referenced this pull request Nov 14, 2026
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21 added a commit that referenced this pull request Nov 14, 2026
…ncoder and decoder (FORMATS.md interface)

Builds with WG_MODEL_L (clean/l/runtime compiled in) accept model=L. Model data: only the converter's model.wgcm in <model_dir>/L, checked against the preset-L map (l::load_wgcm_model); raw tensors are refused. Model M's ten Swin stages packed as before, Model L's blobs from wgrt::l::pack_model, code objects l_enc_values.co (tag lev), l_ops.co, l_swin.co. Step 2: values into the halo map, the two per-pixel linears, the encoder block, the gather projection. Step 4: the decoder projection, the decoder block, l_coef. Kernel names, arguments, grids and maps as clean/l/FORMATS.md (#113). No pack12 for Model L; the fused dec1 + dec0, recon=output, motion_outres=original, enc0 variants and backends 1 to 3 are refused. Without WG_MODEL_L nothing changes.

Refs #89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21 added a commit that referenced this pull request Nov 14, 2026
…ncoder and decoder (FORMATS.md interface)

Builds with WG_MODEL_L (clean/l/runtime compiled in) accept model=L. Model data: only the converter's model.wgcm in <model_dir>/L, checked against the preset-L map (l::load_wgcm_model); raw tensors are refused. Model M's ten Swin stages packed as before, Model L's blobs from wgrt::l::pack_model, code objects l_enc_values.co (tag lev), l_ops.co, l_swin.co. Step 2: values into the halo map, the two per-pixel linears, the encoder block, the gather projection. Step 4: the decoder projection, the decoder block, l_coef. Kernel names, arguments, grids and maps as clean/l/FORMATS.md (#113). No pack12 for Model L; the fused dec1 + dec0, recon=output, motion_outres=original, enc0 variants and backends 1 to 3 are refused. Without WG_MODEL_L nothing changes.

Refs #89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21 added a commit that referenced this pull request Nov 14, 2026
…ncoder and decoder (FORMATS.md interface)

Builds with WG_MODEL_L (clean/l/runtime compiled in) accept model=L. Model data: only the converter's model.wgcm in <model_dir>/L, checked against the preset-L map (l::load_wgcm_model); raw tensors are refused. Model M's ten Swin stages packed as before, Model L's blobs from wgrt::l::pack_model, code objects l_enc_values.co (tag lev), l_ops.co, l_swin.co. Step 2: values into the halo map, the two per-pixel linears, the encoder block, the gather projection. Step 4: the decoder projection, the decoder block, l_coef. Kernel names, arguments, grids and maps as clean/l/FORMATS.md (#113). No pack12 for Model L; the fused dec1 + dec0, recon=output, motion_outres=original, enc0 variants and backends 1 to 3 are refused. Without WG_MODEL_L nothing changes.

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
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