Repository navigation
Model K on D3D12: the wide network stages, byte-identical to HIP - #206
Merged
Merged
Conversation
…ntical to HIP Refs #15. Ports of k_stagew2_e3, k_stagew4_e4, k_stagew2_e4, k_stagew4_m, k_stagew4_d4, k_stagew2_d4 and k_stagew2_d3 (the exact FP32 path; one workgroup of 128 NG lanes per window; weight stream, driver-channel matrix products, same operation orders as HIP). The port check's stage family covers them. 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 #204 (and through it #201, #198, #194): the diff is against that branch.
Preset K's wide network stages on D3D12, byte-identical to their HIP kernels on the exact FP32 path (no FP16-accumulating or FP8 forms).
What changes
clean/k/dx12/kernels/k_block_wide.hlslandhlsl/k_wide.hlsli: the wide block (k_block_wide.hip, templatek_block_wide<C, HEADS, softmax, IN, CIN, CNEXT, NG>) for the seven kernels the runtime launches:k_stagew2_e3,k_stagew4_e4,k_stagew2_e4,k_stagew4_m,k_stagew4_d4,k_stagew2_d4,k_stagew2_d3. One workgroup of 128 NG lanes per window;KBlkParamsby value (s184:p19.b32). Every matrix product is the driver's 16x16x16 FP16 multiply with FP32 accumulation, summed in HIP's order; the elementwise FP16 steps, the softmax (round-to-odd product, one rounding) and the normalization follow HIP operation by operation. The header lists the places where the D3D12 code is arranged differently without a change of result (weight stream ring, interleaved independent accumulators, a different LDS layout for NG = 4 to fit D3D12's 32 KB).kernel_sets.json: seven more kernels inmodel_k.k_port_check.py: the stage family (Model K on D3D12: the narrow network stages, byte-identical to HIP #204) now also runs thewidekernels.Tested
k_port_check.py --run --family wide --seeds 2, one GPU slot, random stage weights and inputs, six grids per kernel (8 x 8 to 33 x 17, ragged edges, fewer windows than a workgroup), window offsets from {0, 2, 4, 6}:0xA5, D3D120x5A).scale_rgb: identical.pr7-wide.json(counts and verdicts only).test_kernel_setspasses; line endings clean.public_gates.py: must-pass gates pass; the LOOK counts equal main's.Not tested
e4/d4change from NG = 4 to NG = 2 is covered by both kernels being checked, not by a frame.Accepted exceptions (review decision, 2026-11-14)