Repository navigation
Post reference: motion candidate positions in float32, as the kernel computes them - #142
Merged
Merged
Conversation
…computes them The validity test 0 <= q <= D is a discontinuity. With real Model L weights a candidate position landed exactly on the bottom edge: float32 (the kernel) gave qy = 108 = Dh, valid; the reference's float64 bilinear and sum gave 108.0000089, invalid, so it took the fallback where the kernel took the history sample (79 FP16 ulps, 6 reduced codes apart on that pixel). reconstruct now computes the render position, the point reads' texel, m_center's bilinear and q = X + m in float32 in the kernel's order (post.hip pos_x / pos_y, motion_bilinear), each operation rounded on its own (fused multiply-adds there were measured to match the kernel less well). The gather, history sample and blend stay float64; motion at output resolution is unchanged. Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
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 post reference (
clean/reference/post.py) now computes the motion candidate positions in float32, as the kerneldoes: the render position, the point reads' texel, m_center's bilinear read and q = X + m (spec item 3: float32
unless stated; kernel order of
post.hippos_x/pos_y,motion_bilinear,q = X + m). The gather, historysample and blend stay float64. Motion at output resolution is unchanged.
Why: #133's real-weight run failed post on one frame. The cause: the validity test 0 <= q <= D is a
discontinuity, and the center candidate's position landed exactly on the bottom edge. In float32 (the kernel)
qy = 108 = Dh, so valid, and the history sample was used; in float64 (the reference) qy = 108.0000089, so invalid,
and the fallback was used. That pixel was 79 FP16 ulps and 6 reduced codes apart. With the center candidate taken as
valid, the old reference reproduced the kernel's history exactly (0 ulp in all three channels). The gather was not
involved (W 1.2588 in float64 and 1.2589 at the kernel's half precision).
Each multiply and add is rounded on its own. Fused multiply-adds were tried against the kernel's outputs: fusing the
bilinear kept the edge case apart, and fusing the position matched fewer reduced codes.
Record
Saved HIP outputs of #133's runs (main 26eb21e + #133,
l_frame_check.py, GPU slot), re-compared on the CPU with thisreference; no new GPU run.
The full
--comparenow passes for real-weight Model L: every stage on all 11 frames. Largest post difference withreal weights: 79 -> 2 FP16 ulps in the history, 6 -> 1 in the reduced codes.
Against the same saved kernel outputs, the synthetic runs: Model L unchanged (8 reduced codes differ, max 1); Model M
reduced codes differing 13 -> 10.
Model M values that change in the reference itself (old against new reference on
post.random_inputs, 720cases: 6 sizes including odd D, 60 seeds, with and without reset, motion scale 3 to 12): 30 of 17,719,920 history
values and 46 display values (in 57 cases), 0 of 4,420,080 reduced codes. These are FP16 roundings at
float32-level position differences.
Tested
test_post_reference(7),test_motion_hi_reference(13),test_model_filter(19),clean/l/tests/test_l_recon(14): pass.
Not tested
*_emupost tests (they need the host emulator library and skip on Windows, as on CI).clean/l/reference/recon.py) still forms its candidatepositions in float64 (same pattern); it is not in the frame yet and is not changed here.
Refs #89