Repository navigation
Frame generation: net1 upscale kernel for HIP and D3D12, bit for bit against the CPU reference - #189
Merged
Merged
Conversation
…against the CPU reference fg_upscale_f16 (fg_net1.co) and its D3D12 port clean/dx12/kernels/fg_upscale.hlsl: bilinear, align corners, as net1.upscale_to. The ratios come from the caller as correctly rounded single-precision bits (no division on the GPU); positions in single precision one operation at a time (HIP without contraction), every product and sum rounded to float16. Built only with --only, as every fg_ kernel. fg_d3d12_check.py: upscale cases (net1's level pairs, other sizes, an output extent of 1, equal sizes, special values). Refs #96 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.
Adds the third frame-generation GPU kernel family: net1's bilinear upscale, for HIP and D3D12, byte-identical with each other and bit for bit against the CPU reference
net1.upscale_to(lane h). It stacks on #187 (max-pool); after #187 merges, its base becomes main.Kernel:
fg_upscale_f16(x, y, C, hi, wi, ho, wo, rx, ry)inclean/fg/kernels/fg_net1.hip(code objectfg_net1.co), with its D3D12 portclean/dx12/kernels/fg_upscale.hlsl.[C][hi][wi]to[C][ho][wo]float16 (net1's level sizes: the coarse level is the fine one halved with floor).rx,ryare(n_in − 1)/(n_out − 1)as correctly rounded single-precision bits from the caller (0 for an extent of 1), as the CPU reference computes them. No division runs on the GPU.s = r·o,i0 = trunc(s),i1 = trunc(s + 1)(bothn_in − 1at the edge),w1 = h(s − i0),w0 = h((i0 − s) + 1).top = h(h(wx0·P00) + h(wx1·P01)), bottom the same on row y1,out = h(h(wy0·top) + h(wy1·bottom)).0x7E00. Like everyfg_kernel, this one is built only with--only, so Model M's and Model L's kernel sets and DXILs are unchanged.Check (
clean/fg/runner/fg_d3d12_check.py): upscale cases covering net1's level pairs (for example 17×33 → 35×67, 1×2 → 2×4), other sizes (3×4 → 7×9, 5×2 → 11×4), output extents of 1, equal sizes, and special values (NaN, ±inf, subnormals, ±65504, −0) in the input.Refs #96
Tested
gpu_slot.py --cap-s 170), three seeds, all three kernel families in one run: 348 cases (63 upscale) and 2,211,618 output values.0xA5/0x5A).test_kernel_sets, theclean/fgunit tests, the line-ending check and the public gates pass, with no hits in the changed files.Not tested