Repository navigation
D3D12 l_post_recon(_p12): smaller and faster, byte for byte the same (l_post=own speed, step 1) - #166
Merged
Merged
Conversation
- The taps run column by column in a loop; per column the eight tap weights (four rows, two pixels) are rounded to FP16 by one driver conversion (v_cvt_f16_f32: the same bits as wg_f2h). - The texel staging runs in wave-uniform rounds, so its six roundings (E_in of the colour, the kernel shape's products as round-to-odd values) use the driver conversion too; the unstaged route uses the same loader. The codes' k / 255 come from a per-workgroup LDS table of their FP16 bits (wg_div, then the driver conversion). - The pair's two rows run in a loop; each row's full-history and display values in one conversion. - D(h) / e_prev: the per-launch reciprocal window of the direct route's colour division (native_direct_pi.h; three fused operations on the lanes in the window, wg_div elsewhere). - l_d3d12_ops_check.py: post cases with extreme or invalid e_prev in the exposure pair. 1080p Quality: 0.894 -> 0.593 ms; 1440p Quality: 1.606 -> 1.050 ms (synthetic model, GPU timestamps). Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
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.
Refs #89
Step 1 of the
l_post=ownspeed work: a smaller and faster D3D12l_post_recon/l_post_recon_p12, byte for byte the same as before (and as HIP). Stacked on #162; its diff against #162 is one kernel file and one check file.Why
In the profile on #162,
l_post_recon_p12was 0.894 ms at 1080p Quality, against 0.323 ms for Model M's whole fused post. Its D3D12 code was 93.9 KB: every tap, the unstaged fallback inside every tap, and both rows of the finish were unrolled. Every FP16 rounding was software (wg_f2h), and the history divisions were software IEEE divisions.What (
clean/dx12/kernels/l_post.hlsl)wg_to_f16_ags,v_cvt_f16_f32: the same bits aswg_f2h).wg_mul_f16's single rounding). The unstaged route uses the same loader.wg_div, then the driver conversion.native_direct_pi.h,native_direct_color_div3): three fused operations on lanes whose |a| is in [lo, hi),wg_diveverywhere else (NaN, infinity, zero, quotients near the FP32 range ends, an e_prev outside the window's domain).opq) or a round-to-odd value, so the driver can't fold an FP32 operation into the conversion.clean/l/runner/l_d3d12_ops_check.py: two post cases whose exposure pair holds an extreme or invalid e_prev (1e-30, 3e-38, 1e30, 3e38, NaN, -1.5, infinity, 2^-126). They exercise the division fallback.Byte identity (GPU, one slot per run)
l_d3d12_ops_check.py --seeds 6, against HIP'sl_post_recon(sentinels HIP 0xA5 / D3D12 0x5A, slack, raw bytes; specials; extreme exposures)l_post_recon72 / 72 identical;l_post_recon_p1272 / 72 (2,271,840 bytes each); HIP p12 = base 72 / 72swin_block_c96_ncl_d3d12_fallback_check.py --seeds 2: unpackedl_coef→l_post_recon→ filter, edge tiles)l_post=ownagainst the HIP Model L frame (l_d3d12_own_post_check.py)native_direct_test, Model L,l_post=own, matrix)native_direct_testwithout the option)Timing
clean/l/runner/l_d3d12_profile.py, 200 frames, synthetic model, GPU timestamps (attribution; the frame span is measured without timestamps).l_post_recon_p12, 1080p Qualityl_post_recon_p12, 1440p QualityWhere the remaining 0.59 ms (1080p Q) goes, from throwaway ablations that are not in this PR:
The synthetic frames have random motion, so their history reads scatter more than a game's would. Next steps: fusing the filter and the store (step 2), folding
l_direct_color(step 3), then the history fetch.Tested
clean/l/runtime/tests(33).Not tested
Update: on main after #162 (merge d555032)
Base is now main (93461bb, #162 merged). The merge brings only #162's last commit (the raw-byte check API); the D3D12
kernel source of this PR is unchanged. Re-checked on the merged tree with
l_d3d12_own_post_check.py(raw-byte API,sentinels HIP 0xA5 / D3D12 0x5A / D3D12 stages 0x3C), GPU record:
caught (dropped history write, dropped reduced write, whole reduced write, missing output);
display);