Repository navigation
Frame generation: net1 convolution kernel for HIP and D3D12, bit for bit against the CPU reference - #183
Merged
Conversation
…bit against the CPU reference fg_conv_f16 (clean/fg/kernels/fg_net1.hip, code object fg_net1.co) and its D3D12 port (clean/dx12/kernels/fg_conv.hlsl): one net1 convolution, 3x3 or 1x1, zero border, float16 accumulator from the bias in exact 16-term chunks in the layer's chunk order, leaky ReLU (slope 0x211E) or none. The arithmetic is integer code shared by both back ends (clean/fg/kernels/fg_exact16.h, the method of fp16acc.py). build_dx12.py builds fg_ kernels only when --only names them, so the Model M and Model L kernel sets (kernel_sets.json) and their DXILs stay as they are; test_kernel_sets checks it. clean/fg/runner/fg_d3d12_check.py: HIP against D3D12 (raw bytes, sentinels 0xA5 / 0x5A, slack, half-grid negative control) and HIP against the CPU reference, on every net1 layer shape and special values. Refs #96 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
marked this pull request as ready for review
November 14, 2026 18:36
This was referenced Nov 14, 2026
Frame generation: net1 max-pool kernel for HIP and D3D12, bit for bit against the CPU reference
#187
Merged
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 first frame-generation GPU kernel family: net1's FP16 convolution, for HIP and D3D12, byte-identical with each other and bit for bit against the CPU reference
net1.conv16(lane h).Kernel:
fg_conv_f16(x, w, b, y, cin, cout, H, W, k, order, act), inclean/fg/kernels/fg_net1.hip(code objectfg_net1.co), with its D3D12 portclean/dx12/kernels/fg_conv.hlsl.[out][in][k][k].act: 0 none, 1 leaky ReLU (slope0x211E).clean/fg/kernels/fg_exact16.hholds the integer code both back ends include, using the same method asfp16acc.py(exact 64-bit partial sums, one nearest-even rounding, IEEE inf/NaN, NaN written as0x7E00). Both back ends therefore run the same operations, and no floating-point rounding happens before the single float16 rounding.Model M and Model L stay unchanged
build_dx12.pygetsis_frame_gen: kernels withco=fg_*.coor namedfg_*are built only when--onlynames them, never by a full build, with or without--model-l.kernel_sets.jsonis unchanged.test_kernel_setsgains a test that frame-generation kernels enter neither set.Check:
clean/fg/runner/fg_d3d12_check.py.--prepare(CPU) buildsfg_net1.co, the port (--only) andkernel_replay.--run(inside one GPU slot):0xA5/ D3D120x5Asentinels, and 64 slack bytes after each output must keep each back end's own sentinel;Refs #96
Tested
gpu_slot.py --cap-s 170), three seeds: 264 cases and 1,838,160 output values.test_kernel_sets(4 tests), theclean/fgunit tests, the line-ending check and the public gates pass, with no hits in the changed files.Not tested