Repository navigation
Model L: exact speedup in the hybrid chain ends (-72.75 us at 1080p Q, -112.5 us at 1440p Q) - #284
Merged
Merged
Conversation
wg_h2f_lo(v) is f16tof32(v & 0xffff). f16tof32 reads only the low 16 bits anyway, but with the mask the driver copies the half into a register of its own first: one v_mov_b16 per FP16 pair at every hybrid chain end and in L's own projection, linear and coefficient kernels. The hybrid helpers (wg_hyb.hlsli) and those L files now call f16tof32 directly; the conversion instruction is the same. wg_platform.hlsli is unchanged (its text is part of Model K's softmax self-check digest), so Model M and K kernels are not touched. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Comment-only change. At each direct f16tof32 site in the L kernels (l_coef_px.hlsli, l_lin_px.hlsli, l_ops_linear.hlsl, l_ops_project.hlsl) a one-line comment points to hyb_h2f_lo (wg_hyb.hlsli), so the mask in wg_h2f_lo is not put back by a later cleanup. No code, no DXIL change. wg_platform.hlsli and the Model K softmax self-check digest closure are not touched; smx_selfcheck_digest.stale() is None after the edit. 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.
What changed
The low FP16 half is now widened with
f16tof32(v)directly instead off16tof32(v & 0xffff).f16tof32reads only the low 16 bits, so the result is the same, but the masked form made the driver copy the half into a register first: onev_mov_b16per FP16 pair at every hybrid chain end and in Model L's own projection, linear and coefficient kernels. The hybrid helpers inwg_hyb.hlsliand the L files (l_coef_px.hlsli,l_lin_px.hlsli,l_ops_linear.hlsl,l_ops_project.hlsl) now callf16tof32directly. The conversion instruction is unchanged.wg_platform.hlsliis not touched (its text is part of Model K's softmax self-check digest), so Model M and Model K kernels are not touched.Diff vs
2b31cbc: 5 files, 22 insertions, 18 deletions.Byte checks
l_*or*_hyb). Model M and K DXIL are byte-identical. Manifest provenance: PASS.f16tof32(v ^ 1)inwg_hyb.hlsli): byte check DIFFERENT, mutant caught.Timing (paired ABBA, 1500 frames, first 300 dropped, dx12)
Noise floor (A vs A): 1080p 6.0 us, 1440p 12.0 us. Both deltas are beyond it. An earlier session on the same commit measured -73.3 us (1080p Q) and -118.0 us (1440p Q), 6/6 both.
Evidence records are kept off-repo by the maintainer.
Unit tests
clean/l/tests:python -m unittest discover -s clean/l/tests -t .-> 121 tests, OK.clean/dx12/tests:python -m unittest discover -s clean/dx12/tests-> 49 tests, OK.Follow-up commit
d9e9590adds one-line rationale comments at the directf16tof32sites in the L kernels (comment-only; no code or DXIL change).Scope note: this PR is based on
2b31cbc. Later commits onmainare docs only and do not touch these files.