Repository navigation
Model K on D3D12: the output stage, byte-identical to HIP - #210
Merged
Merged
Conversation
Refs #15. Ports of k_out_color, k_out_pixel_c (compact pixel head) and k_out_pixel (full head map): the exact path only (the k_fast _f kernels and k_out_hidden keep running on HIP). KOutParams by value as s312 (the fields that are dead in the runtime are skipped); the output's fourth channel is the colour input's alpha through the current-colour bilinear on every output format (issue 26). The forms that read the game's textures are in the source but not declared yet. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
… forms With the D3D12 input and output ports in the tree the source checks of test_k_direct_motion run; the check of the k_out_pixel_direct declaration applies once the direct forms are declared (with the runtime wiring). 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 #15. Stacked on #208 (the input stage; through it #206, #204, #201, #198, #207): the diff is against that branch.
Preset K's output stage on D3D12, byte-identical to its HIP kernels in
k_io.coon the exact path. With this PR every network stage and both I/O stages of the exact path have a D3D12 port; the runtime wiring is the next PR.What changes
clean/k/dx12/kernels/k_out.hlslandhlsl/k_out.hlsli:k_out_color(per render pixel: the stored colour tap and the filter-tap value),k_out_pixel_c(compact pixel head, the default) andk_out_pixel(the 40-channel head map,k_head=full). Same lane-to-pixel mapping and launch geometry as HIP (64 x 2 pixels per workgroup of 128 lanes, one row per wave64, the group exchange of the luma through LDS).KOutParamsby value ass312:...: the fields that are dead in the runtime (subrect bases, the host's kappa / rho / lambda, which the kernels take from the device scalars, padding and the emulator's 2^E table) are skipped; the header says why each is dead. The output's fourth channel is the colour input's alpha through the current-colour bilinear, on all three game-output formats (issue Preset K: visual fixes (output alpha, motion rounding) #26, as Model K: output alpha follows the colour input's alpha; motion rounding on the raw-buffer routes #207).v_rcp_f32,v_exp_f16) are used where HIP uses them. The source lists each deviation from HIP and why it gives the same bits._fkernels ofk_fast=1andk_out_hidden(they keep running on HIP). The forms that read the game's textures (_direct) are in the sources for the runtime's use but are not declared yet; they are declared and checked with the runtime wiring.kernel_sets.json: three kernels.k_port_check.py: theoutputfamily.Tested
k_port_check.py --run --family expo,warm,narrow,wide,input,output --seeds 3, one GPU slot (the whole stack in one run):output: 48 of 48 cases raw-byte identical to HIP,k_out_pixel_c25 andk_out_pixel23; all three game-output formats; 16 flag sets (HDR, low-resolution motion, inverted depth, reset) on base grids 1 x 1, 7 x 9, 8 x 8, 9 x 7, 33 x 17; exposure scalars from a device buffer; alphas negative, above 1 and 7e4; 18 cases with infinity, huge values, zero and -0 in the colour, depth, motion, head map and histories, 12 more with NaN as well; none differs, not even in a NaN's sign. The image (out), the luma and colour histories andk_out_color's tap buffers are compared; every slack byte kept its sentinel (HIP0xA5, D3D120x5A). Negative control (half grid) caught, 23203 bytes differ.scale_rgb) identical; replay exit 0.pr8-output.json(counts and verdicts only).test_kernel_setspasses; line endings clean.public_gates.py: must-pass gates pass, LOOK counts equal main's.Not tested
_directforms; the runtime on D3D12 (next PR); whole frames; real inputs.Accepted exceptions (review decision, 2026-11-14)