Repository navigation
Model L: encoder chain and decoder front kernels (HIP) - #104
Closed
phantoslayer21 wants to merge 4 commits into
Closed
phantoslayer21 wants to merge 4 commits into
phantoslayer21 wants to merge 4 commits into
Conversation
… check clean/kernels/encoder.hip: compile-time switch WG_ENC_VALUES_OUT (default 0) that stores the quantized values as a token map [fh/2][fw/2][80] instead of projecting them; built as its own code object for Model L. With the switch off the file preprocesses to the same text and encoder.co is byte-identical. clean/l/kernels/l_ops.hip: l_linear_80_32 and l_linear_32_32 (pointwise FP8 map linears, merge / expand section blobs), l_project_80_32 (the output projection over [raw | x | zeros] with an FP16 running sum per group of 32 channels, clamp and FP8), l_copy_channels (splits and joins channel ranges of token maps for the decoder block). clean/l/runner/l_chain_check.py (GPU, synthetic): every kernel in isolation on the GPU's own previous output against the oracle's step, the whole encoder chain against the oracle, and the decoder front. Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Owner
Author
|
Superseded by #115 (the same kernels, on the confirmed layout), which is merged. Closing. |
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.
Do not merge: superseded. A later answer on Model L's structure moves the encoder's extra network and both width-32 blocks to render resolution and puts the decoder projection before its block. This PR is being reworked to that structure (same building blocks: the C = 32 block of #102, pointwise linears, a 2x2 gather projection). The check records below are for this version.
Step P9 of Model L, stacked on #102 (the C = 32 block, which these chains use). Refs #89
clean/kernels/encoder.hip: a compile-time switchWG_ENC_VALUES_OUT(default 0). With the switch on, the kernel stores the quantized values as a token map [fh/2][fw/2][80] instead of projecting them. Model L builds it as its own code object (l_enc_values.co). With the switch off the file preprocesses to the same text, andencoder.cois byte-identical to main's (checked: same output name; the build's-cuidcomes from the output file name, so differently named outputs always differ).clean/l/kernels/l_ops.hip:l_linear_80_32andl_linear_32_32: pointwise FP8-map linears with merge / expand section blobs;l_project_80_32: the output projection over [raw | x | zeros], with an FP16 running sum per group of 32 channels, the clamp, and FP8;l_copy_channels: splits and joins channel ranges for the decoder block.clean/l/runner/l_chain_check.py: the GPU check below.clean/l/FORMATS.md: the kernels, arguments, blobs, buffers and launch order of a Model L frame (Model M's frame with its encoder and decoder steps replaced), and the launch names (l_enc_values.counder the taglev).What the GPU check proves
Run of 2026-11-13 on an RX 9070 XT:
python clean/l/runner/l_chain_check.py --build <dir> --rocm <ROCm> --seeds 4, synthetic data only. 24 cases: render sizes 40x24, 64x36 and 97x55, both parities, 4 seeds, random Model L weights. Every kernel is run in isolation on the GPU's own output of the step before and compared with the oracle's step on that same input (clean/l/reference/oracle.py, the block with the kernels' sigmoid GELU):input_encoderofl_enc_values.co)l_linear_80_32l_linear_32_32l_swin_block_c32l_project_80_32l_copy_channels)clean/tests/test_kernels_emu.py. The chain carries such differences into the projection.What stays unproven
Tested
encoder.coof this branch byte-identical to main's (e6500a8), same output name.python -m unittest discover -s clean/l/tests -t .: passes.python tools/ci/check_line_endings.py: 0 problems.Not tested