You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 05bf233
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: clean/FORMATS.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -492,12 +492,12 @@ the runtime is a shared D3D12 object except the three fences.
492
492
493
493
| Buffer | Size | Content |
494
494
|---|---|---|
495
-
| color | max R × 16 |`[rh][rw]` 4 × f32 (alpha 0), the game's color in the active region |
495
+
| color | max R × 16 |`[rh][rw]` 4 × f32, the game's color in the active region; the fourth value +0 (model M), or for model K the texel's alpha, unmodified (1 for a format without an alpha channel): model K's output alpha follows it|
496
496
| depth | max R × 4 |`[rh][rw]` f32, the game's depth as given |
497
497
| motion | max R × 8 |`[rh][rw]` 2 × f32, m = motion_scale · raw + motion_offset (render pixels); with `WG_CREATE_MOTION_OUTPUT_RES` the texel ⌊(x + ½)·mw/rw⌋, ⌊(y + ½)·mh/rh⌋ (our point resampling: what the network reads with `motion_outres=point`; with `original` it reads `motion_hi`) |
498
498
| motion_hi | O × 4 + 8, or none | only with `WG_CREATE_MOTION_OUTPUT_RES` (model M; with `motion_outres=point` only while a frame capture is armed): `[oh][ow]` 2 × FP16, the raw motion texels of the output-size region ("Motion vectors at output resolution"). It follows `out` in each slot; without it every offset is what it was |
499
499
| expo | 256 bytes | f32 at offset 0: texel (0, 0) channel R of the exposure texture (exposure mode texture) |
500
-
| out | O × 12 |`[oh][ow]` 3 × f32, the network's result (the runtime's `filter.out` format) |
500
+
| out | O × 12 (model K: O × 16) |`[oh][ow]` 3 × f32, the network's result (the runtime's `filter.out` format); model K: `[oh][ow]` 4 × f32, the fourth value its output alpha (`FrameIo.out_rgba32f`), which the output pass stores|
501
501
502
502
Fences (shared, `hipImportExternalSemaphore`, D3D12 fence): `ready` (the split request's done fence: the front end's
503
503
queue signals v after the first part of the game's list, which ends with the input conversion), `done` (HIP signals v
@@ -524,7 +524,7 @@ whole texture; otherwise the frame uses the input pass (logged). The network's f
524
524
0.309 → 0.251 ms, output 0.856 → 0.838 ms against the FP32 slot).
525
525
- Model K's compact input pass (default for `model=K` when no copy is made; `k_input=f32`: the FP32 input pass):
526
526
where the game's colour is RGBA16F or R11G11B10 and its motion RG16F or RGBA16F (FP16-representable values), the
527
-
pass `inputs16` writes dense RGBA16F colour (rw·8-byte rows, alpha 0), R32F depth and the raw RG16F motion texel
527
+
pass `inputs16` writes dense RGBA16F colour (rw·8-byte rows, the texel's alpha kept; 1 for R11G11B10), R32F depth and the raw RG16F motion texel
528
528
(rw·4-byte rows; at output size the texel under the render pixel's centre, as the FP32 pass samples it) into the
529
529
slot's buffers, and the network reads them as it reads the copies (motion_scale / motion_offset applied on load).
530
530
Same output bits as the FP32 pass (`test_interop_d3d12 hipsame`, render- and output-size motion); logged as
@@ -568,7 +568,8 @@ pre-exposure and exposure, then signals `done = v`. Values only grow.
568
568
3. Network enqueued (above). If it cannot be enqueued, the runtime's own compute queue waits for the previous `done`
569
569
value and signals `done = v` (and `pipe = v`), so the game's queue cannot wait forever; the dispatch returns an error.
570
570
4. Output pass into the re-opened list: `out` of slot v (inline) or of the previous network frame (pipelined; the
571
-
first frame: bilinear upscale of the color) → the output texture (alpha 1; sRGB formats encoded), output
571
+
first frame: bilinear upscale of the color) → the output texture (alpha 1; model K: the result's fourth value, in
572
+
the upscale the bilinear of the color's alpha; sRGB formats encoded), output
572
573
transitioned to UNORDERED_ACCESS if needed and back (else a UAV barrier). Shaders: HLSL compiled at create with
573
574
`d3dcompiler_47.dll` (cs_5_0); the result buffer is read through an R32_FLOAT typed UAV.
Copy file name to clipboardExpand all lines: clean/dx12/README.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ as its HIP kernel (`clean/dx12/compare.py` proves it per kernel on synthetic fra
20
20
|`dxil_asm.cpp`| tool used by the build (assembles the rewritten DXIL listing) |
21
21
|`compare.py`| HIP vs hybrid D3D12, every stage output / state buffer byte for byte |
22
22
|`kernels/exposure.hlsl`| the reference port (`exposure_auto_diet`): copy its structure |
23
-
|`kernels/fg_*.hlsl`| frame generation's ports (#96, `co=fg_*.co`): groundwork, built only when `--only` names them, never by a full build (`is_frame_gen`), so the Model M / Model L sets stay as they are; checks: `clean/fg/runner/fg_d3d12_check.py` (each kernel), `clean/fg/runner/fg_net1_gpu.py` (net1's 32 steps as a `kernel_replay` chain) |
23
+
|`kernels/fg_*.hlsl`| frame generation's ports (#96, `co=fg_*.co`): groundwork, built only when `--only` names them, never by a full build (`is_frame_gen`), so the Model M / Model L sets stay as they are; checks: `clean/fg/runner/fg_d3d12_check.py` (each kernel), `clean/fg/runner/fg_net1_gpu.py` (net1's 32 steps as a `kernel_replay` chain), `clean/fg/runner/fg_net1_mma.py` (net1's fast path on the matrix instructions, fused / unfused / exact)|
24
24
|`tests/kernel_replay.cpp`| replays launches from a case file on the native D3D12 device; `chain` blocks run several launches on buffers that persist between them (a whole network, optionally timed) |
25
25
26
26
## Arithmetic mode (why build_dx12.py and nothing else)
@@ -71,6 +71,16 @@ The rules above hold per operation. Across operations the gfx1201 D3D12 shader c
71
71
(`n + (wg_grid_ >> 31)`; `swin_common.hlsli``sw_zero()`), and fold LDS offsets with `sw_zero_bits()`.
72
72
* HLSL 2021 `?:`, `&&`, `||` short-circuit and become branches (one load in flight per branch): use `select()`,
73
73
`and()`, `or()` in hot code.
74
+
***lanes past the end of the grid corrupted other lanes' matrix results** (frame generation's `fg_mpair`, 2026-11-14):
75
+
a per-lane `bool valid[]` with `pc = select(valid, p, 0)` for the pixel, then WMMAs, then `if (valid) store`. With part
76
+
of the last 16-pixel group past the end, the valid lanes got NaN in exactly the output rows whose A-fragment row sits in
77
+
an invalid lane; HIP was right. Remedy: no validity array; every lane computes a clamped pixel (`min(p, n - 1)`) and
78
+
only the store tests `p < n`. Check odd grid sizes in every matrix port.
79
+
***`wg_f2h` is software** (~20 instructions per value; a `(half)` cast rounds toward zero here). In a hot loop round
80
+
a whole fragment with the driver conversion, `wg_to_f16_ags` (v_cvt_f16_f32, HIP's `(_Float16)` bits), and widen back
81
+
with `wg_h2f`; for 8 values that are not a matrix result (an element-wise stage), XOR each with an opaque zero first
82
+
(`fg_f2h8` in `fg_mpair.hlsl`) so the producing multiply is not folded into the conversion (see above: a folded
83
+
product turns -0 into +0). Frame generation's net1 fast path went from 3.5x to 1.5x HIP's GPU time with this.
74
84
75
85
The native helper regression additionally constructed tiny exact values that round to the smallest normal FP32
76
86
number: `0x00800000 * 0x3f7fffff` and `0x00ffffff / 0x40000000`. The multiply flushes before rounding on this driver;
0 commit comments