feat: d16 typed buffer loads and stores (buffer/tbuffer_*_format_d16_*) in the RDNA 2 interpreter and HLSL — 1,156/1,490 #230

Manually merged
github merged 1 commit from gh-pr/230/head into gh-pr/230/base 2026-11-26 05:38:55 +00:00
Owner

@⁠KainanP on GitHub · 2026-11-25 19:39 UTC · original
KainanP:feat/buffer-format-d16 → main · +816 −54 · 17 files · 1 commits · merged 2026-11-26 00:15 UTC

Supersedes #223 (closed by the maintainer for conflicts; now rebased onto main e921268)

Only the README lines conflicted; numbers recomputed. The float32 → float16 narrowing here keeps NaN payloads (buffer conversion, #150), so it stays separate from the f16 ALU helpers of #218, which give the canonical NaN.

Change

The 18 d16 typed buffer encodings that main still refused now run in the reference interpreter and translate to HLSL: buffer_load_format_d16_{x,xy,xyz,xyzw,hi_x}, buffer_store_format_d16_{x,xy,xyz,xyzw,hi_x}, tbuffer_load_format_d16_{x,xy,xyz,xyzw}, tbuffer_store_format_d16_{x,xy,xyz,xyzw} (the full list of _format_d16 names in MNEMONICS where rdna2_exec.executable was false). The PR builds on the 32-bit typed formats of #150 and reuses its format tables, DST_SEL handling, bounds and conversions.

Interpreter coverage, recounted on the tree merged with main e921268: 1,208 → 1,226 of 1,490 encodings (rdna2_exec.coverage()), 81% → 82% in all 9 READMEs; the test count stays 1400+ (1,481 collected). #232 moves the same coverage line from the same base (1,208), and neither PR has merged yet, so the figures stay as they are. Whichever PR lands second will get the combined figure recomputed.

Rules and sources

AMD, "RDNA 2" Instruction Set Architecture, November 2020 (archived copy from docs/research/rdna2-sources.md, SHA-256 22aec03f…4795, printed page numbers):

Rule Source
RDNA 2 is packed d16: component i goes in VGPR VDATA + i/2, low half first (xyzw uses 2 VGPRs) §8.1.2 p. 56 ("BUFFER_LOAD_FORMAT_D16_XYZW writes two VGPRs"), §8.1.4 p. 59 ("a pair of data are stored in each 32-bit VGPR (LSBs first, then MSBs)"); LLVM 20.1.8: FeatureUnpackedD16VMem is set only for GFX8 (AMDGPU.td), and the packed TBUFFER_LOAD_FORMAT_D16_XY uses VGPR_32 (BUFInstructions.td)
_d16_x writes bits 15-0, _d16_hi_x bits 31-16, and the other half is kept §12.14 p. 215 / p. 211 pseudo-code D0[15:0] = MEM[ADDR] / D0[31:16] = MEM[ADDR]; §8.1.6 p. 64; AMD RDNA 2 XML: "store the result into the low/high 16 bits of a 32-bit vector register"
A d16 load converts the 32-bit result of the matching non-d16 load to 16 bits §8.1.4 p. 59: "data returned from the texture unit is converted to 16 bits … Control over int vs. float is controlled by FORMAT"; §8.1.3 p. 58: integer formats come back as integers of the storage type
Stores: the texture unit converts each 16-bit half to the memory format §8.1.4 p. 59; XML: "Convert 16 bits of data from the low/high 16 bits of a 32-bit vector input register"

Applied conversions:

  • Loads. UINT/SINT formats of 16 bits or less give the low 16 bits of the zero- or sign-extended field. UNORM and SNORM round the exact quotient c / (2^n − 1) (SNORM: c / (2^(n−1) − 1), with −2^(n−1) giving −1.0) once to float16, to nearest even, float16 subnormals kept. 32-bit FLOAT formats narrow toward zero: finite values past the range give ±65504, float16 subnormals are kept, and a NaN keeps its sign and its top 10 payload bits without being quieted (payload 1 if those bits are all zero, 0x7F800001 → 0x7C01). A 16-bit FLOAT field comes back unchanged. USCALED and SSCALED go float32 (the exact integer) → float16 to nearest even, overflow to infinity.
  • Stores. Each half is widened to the value the non-d16 store takes: UINT is zero-extended, SINT sign-extended, float16 → float32 is exact for 32-bit FLOAT formats (NaN payload shifted left by 13, as #150 widens 16_FLOAT), and a 16-bit FLOAT field is copied. The value then goes through #150's saturation (UINT to 2^n−1, SINT to the field's range).
  • DST_SEL = 1 gives 1.0 (0x3C00) for float, normalized and scaled formats and the integer 1 otherwise, #150's value narrowed like any other component.

UNORM/SNORM and FLOAT narrowing: assumed, measurement requested

The ISA only says "data returned from the texture unit is converted to 16 bits" (§8.1.4, p. 59). No public source says how the data is rounded, so both rules are labelled assumed in the code, and akimfomin/PortBridge#85 asks for the decisive words. Only four 16-bit values separate one rounding of the exact quotient from two: 16_UNORM 0xFFAF → 0x3BFD and 0xFFEF → 0x3BFF, 16_SNORM 0x7FF7 → 0x3BFF and 0x8009 → 0xBBFF. Narrowing the float32 instead gives 0x3BFE, 0x3C00, 0x3C00 and 0xBC00. The other widths give the same half under both roundings, and a test checks this.

Since the review, 32-bit FLOAT formats narrow toward zero (65504 past the range, NaN payload 1 when its top 10 bits are zero). The SPIR-V path third_party/leonida/rdna2spirv.py already narrows them this way, so both translators of AnyXboxX now agree. The previous version of this PR rounded to nearest with infinity past the range and refused that NaN. Both choices are still assumptions until PortBridge#85 answers.

Assumptions (not measured, stated in emu/rdna2_buffer_d16.py)

  1. UNORM/SNORM rounded once, and 32-bit FLOAT narrowed toward zero (above; PortBridge#85).
  2. SCALED → float16 to nearest even, overflow to infinity; 16_FLOAT fields unchanged, NaNs included (PortBridge#85, section C).
  3. The high half of the second VGPR of _d16_xyz is kept, like the high half of _d16_x. The ISA only gives pseudo-code for _x and _hi_x.

Refused by name (no fake success)

  • d16 loads of 32-bit integer formats (32_UINT, 32_32_SINT, …): whether 32 → 16 bits truncates or clamps is not documented.
  • d16 stores to UNORM/SNORM/SCALED formats. They stay refused, as in #150.

The HLSL follows the module's existing convention: what the interpreter refuses at run time (a MUBUF format read from the V#) reads zeros there.

HLSL

BufHalfRatio rounds the exact quotient by integer long division (the remainder stays below the 16-bit denominator), and BufHalfFromFloat (to nearest even, or toward zero for FLOAT formats) uses integer operations only, with no double and no f32tof16 (Intel UHD has no FP64, and f32tof16 rounding is driver-defined). BufNarrow and BufWiden sit on top of #150's BufDecode and BufEncode. BufField now copies a 16-bit FLOAT field, a path #150 could not reach. Only the halves a load fills are written.

Verification

Branch rebased on main e921268 (head 2d2a7a7). Tests were run on the same tree rebased on 9a06443; e921268 only adds launcher/docs changes.

python -m pytest (RTX 4060, default)  → 1463 passed, 17 skipped
python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools → All checks passed!
ANYXBOXX_GPU=warp  python -m pytest tests/test_rdna2_exec_format_d16.py tests/test_rdna2_hlsl_format_d16.py tests/test_rdna2_hlsl_format.py tests/test_rdna2_exec_format.py → 98 passed
ANYXBOXX_GPU=Intel python -m pytest (same files) → 98 passed (Intel UHD, no FP64)

Oracle and test data

  • tests/test_rdna2_exec_format_d16.py (hand-computed values):
    • float32 → float16 both ways (to nearest even and toward zero): ties, overflow (65520 → inf / 65504), subnormals (2^-25 → 0, 1.5×2^-24 → 2^-23 / 2^-24), NaN payloads including 0x7F800001 → 0x7C01, −0.0 and float32 subnormals; 32_FLOAT through the instruction gives the toward-zero half;
    • as independent oracles, Python's binary16 rounding (struct format e) for nearest even, and the largest float16 not above |x| for toward zero, each over 20,000 random float32 values and the subnormal range;
    • the four values that separate one rounding from two pinned through the instruction (assumed, PortBridge#85), and every UNORM/SNORM field of widths 2, 4, 5, 6, 8, 10, 11 and 16 against an exact-fraction oracle (fractions.Fraction, nearest float16 by exact distance), which also checks that only two UNORM16 and two SNORM16 values differ from narrowing the float32;
    • scaled (2049 → 2048, 65535 → inf), integer extension (8_SINT 0x80 → 0xFF80), 16-bit FLOAT pass-through;
    • packing of x/xy/xyz/xyzw/hi_x with the untouched halves kept, partial EXEC, DST_SEL 0/1 and out-of-range reads, MTBUF format and the INVALID V#;
    • stores: float16 copied or widened, integer saturation from 16-bit halves, z read from bits 15-0 of the second VGPR;
    • every refusal by name.
  • tests/test_rdna2_exec_format.py: test_typed_buffer_instructions_count_in_coverage is back, as the review asked. It now requires all 32 typed-buffer names to run in the interpreter (14 32-bit and 18 d16), so the test fails if a d16 form stops executing.
  • tests/test_rdna2_hlsl_format_d16.py (8 tests): interpreter vs GPU, byte for byte. Float special values and random bits through 32/32x4/16x4 FLOAT; UNORM/SNORM/SCALED/INT 8, 10 and 16-bit formats with the midpoint fields injected; DST_SEL and bounds; MTBUF with an INVALID V#; partial EXEC on loads (v8-v11 refilled before each load so kept halves are compared); stores with partial words (stride 1 and 2); wave64.
  • Failure case: on main the new interpreter tests fail (52 of 54; the module does not exist), and the restored test_typed_buffer_instructions_count_in_coverage fails because 18 names are not executable. I also mutated the HLSL: dropping ties-to-even fails 2 GPU tests, zeroing the kept half fails 7, and decoding UNORM/SNORM through the float32 again fails test_normalized_scaled_and_integer_formats_match[formats0] (16-bit UNORM/SNORM; the GPU data holds the four separating values).
  • Test data is built in the tests; no external data.
  • Removed: the three _d16 cases from #150's refusal test (they now run).

Checklist

  • The PR covers a single reviewable behaviour.
  • A test fails without this change and passes with it.
  • The commands and results of each check are given above.
  • An unimplemented function returns an error (E_NOTIMPL), never a fake success.
  • README: the same change in all 9 languages (test_readme_sync.py checks it).
  • No game, console or SDK file, no key, no dump, no download link.
  • Findings drawn from a title: none.
  • Code taken from another project: none.

AI assistance: written with Claude Code (Claude Opus 5.5), reviewed and run on our hardware (RTX, WARP, Intel UHD).

🤖 Generated with Claude Code

**@⁠KainanP** on GitHub · 2026-11-25 19:39 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/230) `KainanP:feat/buffer-format-d16` → `main` · +816 −54 · 17 files · 1 commits · merged 2026-11-26 00:15 UTC Supersedes #223 (closed by the maintainer for conflicts; now rebased onto main e921268) Only the README lines conflicted; numbers recomputed. The float32 → float16 narrowing here keeps NaN payloads (buffer conversion, #150), so it stays separate from the f16 ALU helpers of #218, which give the canonical NaN. ## Change The 18 d16 typed buffer encodings that main still refused now run in the reference interpreter and translate to HLSL: `buffer_load_format_d16_{x,xy,xyz,xyzw,hi_x}`, `buffer_store_format_d16_{x,xy,xyz,xyzw,hi_x}`, `tbuffer_load_format_d16_{x,xy,xyz,xyzw}`, `tbuffer_store_format_d16_{x,xy,xyz,xyzw}` (the full list of `_format_d16` names in `MNEMONICS` where `rdna2_exec.executable` was false). The PR builds on the 32-bit typed formats of #150 and reuses its format tables, DST_SEL handling, bounds and conversions. Interpreter coverage, recounted on the tree merged with main `e921268`: **1,208 → 1,226 of 1,490 encodings** (`rdna2_exec.coverage()`), 81% → 82% in all 9 READMEs; the test count stays `1400+` (1,481 collected). #232 moves the same coverage line from the same base (1,208), and neither PR has merged yet, so the figures stay as they are. Whichever PR lands second will get the combined figure recomputed. ### Rules and sources AMD, "RDNA 2" Instruction Set Architecture, November 2020 (archived copy from `docs/research/rdna2-sources.md`, SHA-256 `22aec03f…4795`, printed page numbers): | Rule | Source | | --- | --- | | RDNA 2 is packed d16: component i goes in VGPR `VDATA + i/2`, low half first (xyzw uses 2 VGPRs) | §8.1.2 p. 56 ("BUFFER_LOAD_FORMAT_D16_XYZW writes two VGPRs"), §8.1.4 p. 59 ("a pair of data are stored in each 32-bit VGPR (LSBs first, then MSBs)"); LLVM 20.1.8: `FeatureUnpackedD16VMem` is set only for GFX8 (`AMDGPU.td`), and the packed `TBUFFER_LOAD_FORMAT_D16_XY` uses `VGPR_32` (`BUFInstructions.td`) | | `_d16_x` writes bits 15-0, `_d16_hi_x` bits 31-16, and the other half is kept | §12.14 p. 215 / p. 211 pseudo-code `D0[15:0] = MEM[ADDR]` / `D0[31:16] = MEM[ADDR]`; §8.1.6 p. 64; AMD RDNA 2 XML: "store the result into the low/high 16 bits of a 32-bit vector register" | | A d16 load converts the 32-bit result of the matching non-d16 load to 16 bits | §8.1.4 p. 59: "data returned from the texture unit is converted to 16 bits … Control over int vs. float is controlled by FORMAT"; §8.1.3 p. 58: integer formats come back as integers of the storage type | | Stores: the texture unit converts each 16-bit half to the memory format | §8.1.4 p. 59; XML: "Convert 16 bits of data from the low/high 16 bits of a 32-bit vector input register" | Applied conversions: - **Loads.** UINT/SINT formats of 16 bits or less give the low 16 bits of the zero- or sign-extended field. **UNORM and SNORM round the exact quotient c / (2^n − 1) (SNORM: c / (2^(n−1) − 1), with −2^(n−1) giving −1.0) once to float16**, to nearest even, float16 subnormals kept. **32-bit FLOAT formats narrow toward zero**: finite values past the range give ±65504, float16 subnormals are kept, and a NaN keeps its sign and its top 10 payload bits without being quieted (payload 1 if those bits are all zero, `0x7F800001` → `0x7C01`). A 16-bit FLOAT field comes back unchanged. USCALED and SSCALED go float32 (the exact integer) → float16 to nearest even, overflow to infinity. - **Stores.** Each half is widened to the value the non-d16 store takes: UINT is zero-extended, SINT sign-extended, float16 → float32 is exact for 32-bit FLOAT formats (NaN payload shifted left by 13, as #150 widens 16_FLOAT), and a 16-bit FLOAT field is copied. The value then goes through #150's saturation (UINT to 2^n−1, SINT to the field's range). - **DST_SEL = 1** gives 1.0 (`0x3C00`) for float, normalized and scaled formats and the integer 1 otherwise, #150's value narrowed like any other component. ### UNORM/SNORM and FLOAT narrowing: assumed, measurement requested The ISA only says "data returned from the texture unit is converted to 16 bits" (§8.1.4, p. 59). No public source says how the data is rounded, so both rules are labelled **assumed** in the code, and akimfomin/PortBridge#85 asks for the decisive words. Only four 16-bit values separate one rounding of the exact quotient from two: 16_UNORM `0xFFAF` → `0x3BFD` and `0xFFEF` → `0x3BFF`, 16_SNORM `0x7FF7` → `0x3BFF` and `0x8009` → `0xBBFF`. Narrowing the float32 instead gives `0x3BFE`, `0x3C00`, `0x3C00` and `0xBC00`. The other widths give the same half under both roundings, and a test checks this. Since the review, 32-bit FLOAT formats narrow toward zero (65504 past the range, NaN payload 1 when its top 10 bits are zero). The SPIR-V path `third_party/leonida/rdna2spirv.py` already narrows them this way, so both translators of AnyXboxX now agree. The previous version of this PR rounded to nearest with infinity past the range and refused that NaN. Both choices are still assumptions until PortBridge#85 answers. ### Assumptions (not measured, stated in `emu/rdna2_buffer_d16.py`) 1. UNORM/SNORM rounded once, and 32-bit FLOAT narrowed toward zero (above; PortBridge#85). 2. SCALED → float16 to nearest even, overflow to infinity; 16_FLOAT fields unchanged, NaNs included (PortBridge#85, section C). 3. **The high half of the second VGPR of `_d16_xyz`** is kept, like the high half of `_d16_x`. The ISA only gives pseudo-code for `_x` and `_hi_x`. ### Refused by name (no fake success) - d16 **loads** of 32-bit integer formats (`32_UINT`, `32_32_SINT`, …): whether 32 → 16 bits truncates or clamps is not documented. - d16 **stores** to UNORM/SNORM/SCALED formats. They stay refused, as in #150. The HLSL follows the module's existing convention: what the interpreter refuses at run time (a MUBUF format read from the V#) reads zeros there. ### HLSL `BufHalfRatio` rounds the exact quotient by integer long division (the remainder stays below the 16-bit denominator), and `BufHalfFromFloat` (to nearest even, or toward zero for FLOAT formats) uses integer operations only, with no `double` and no `f32tof16` (Intel UHD has no FP64, and `f32tof16` rounding is driver-defined). `BufNarrow` and `BufWiden` sit on top of #150's `BufDecode` and `BufEncode`. `BufField` now copies a 16-bit FLOAT field, a path #150 could not reach. Only the halves a load fills are written. ## Verification Branch rebased on main `e921268` (head `2d2a7a7`). Tests were run on the same tree rebased on `9a06443`; `e921268` only adds launcher/docs changes. ``` python -m pytest (RTX 4060, default) → 1463 passed, 17 skipped python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools → All checks passed! ANYXBOXX_GPU=warp python -m pytest tests/test_rdna2_exec_format_d16.py tests/test_rdna2_hlsl_format_d16.py tests/test_rdna2_hlsl_format.py tests/test_rdna2_exec_format.py → 98 passed ANYXBOXX_GPU=Intel python -m pytest (same files) → 98 passed (Intel UHD, no FP64) ``` ## Oracle and test data - `tests/test_rdna2_exec_format_d16.py` (hand-computed values): - float32 → float16 both ways (to nearest even and toward zero): ties, overflow (65520 → inf / 65504), subnormals (2^-25 → 0, 1.5×2^-24 → 2^-23 / 2^-24), NaN payloads including `0x7F800001` → `0x7C01`, −0.0 and float32 subnormals; 32_FLOAT through the instruction gives the toward-zero half; - as independent oracles, Python's binary16 rounding (`struct` format `e`) for nearest even, and the largest float16 not above |x| for toward zero, each over 20,000 random float32 values and the subnormal range; - the four values that separate one rounding from two pinned through the instruction (assumed, PortBridge#85), and every UNORM/SNORM field of widths 2, 4, 5, 6, 8, 10, 11 and 16 against an exact-fraction oracle (`fractions.Fraction`, nearest float16 by exact distance), which also checks that only two UNORM16 and two SNORM16 values differ from narrowing the float32; - scaled (2049 → 2048, 65535 → inf), integer extension (8_SINT 0x80 → 0xFF80), 16-bit FLOAT pass-through; - packing of x/xy/xyz/xyzw/hi_x with the untouched halves kept, partial EXEC, DST_SEL 0/1 and out-of-range reads, MTBUF format and the INVALID V#; - stores: float16 copied or widened, integer saturation from 16-bit halves, z read from bits 15-0 of the second VGPR; - every refusal by name. - `tests/test_rdna2_exec_format.py`: `test_typed_buffer_instructions_count_in_coverage` is back, as the review asked. It now requires all 32 typed-buffer names to run in the interpreter (14 32-bit and 18 d16), so the test fails if a d16 form stops executing. - `tests/test_rdna2_hlsl_format_d16.py` (8 tests): interpreter vs GPU, byte for byte. Float special values and random bits through 32/32x4/16x4 FLOAT; UNORM/SNORM/SCALED/INT 8, 10 and 16-bit formats with the midpoint fields injected; DST_SEL and bounds; MTBUF with an INVALID V#; partial EXEC on loads (v8-v11 refilled before each load so kept halves are compared); stores with partial words (stride 1 and 2); wave64. - Failure case: on main the new interpreter tests fail (52 of 54; the module does not exist), and the restored `test_typed_buffer_instructions_count_in_coverage` fails because 18 names are not executable. I also mutated the HLSL: dropping ties-to-even fails 2 GPU tests, zeroing the kept half fails 7, and decoding UNORM/SNORM through the float32 again fails `test_normalized_scaled_and_integer_formats_match[formats0]` (16-bit UNORM/SNORM; the GPU data holds the four separating values). - Test data is built in the tests; no external data. - Removed: the three `_d16` cases from #150's refusal test (they now run). ## Checklist - [x] The PR covers a single reviewable behaviour. - [x] A test fails without this change and passes with it. - [x] The commands and results of each check are given above. - [x] An unimplemented function returns an error (`E_NOTIMPL`), never a fake success. - [x] README: the same change in all 9 languages (`test_readme_sync.py` checks it). - [x] No game, console or SDK file, no key, no dump, no download link. - [x] Findings drawn from a title: none. - [x] Code taken from another project: none. AI assistance: written with Claude Code (Claude Opus 5.5), reviewed and run on our hardware (RTX, WARP, Intel UHD). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The 18 encodings buffer_load/store_format_d16_{x,xy,xyz,xyzw,hi_x} and
tbuffer_load/store_format_d16_{x,xy,xyz,xyzw} now run in the reference
interpreter and translate to HLSL, on top of the 32-bit typed formats of #150.

- Packing (RDNA 2 is packed d16): component i goes to VGPR VDATA + i/2, low
  half first; _d16_x and the third component of _d16_xyz write bits 15-0,
  _d16_hi_x bits 31-16, and the other half is kept. ISA section 8.1.2 (p. 56),
  8.1.4 (p. 59), 8.1.6 (p. 64), 12.14 (p. 211, 215: "D0[15:0] = MEM[ADDR]",
  "D0[31:16] = MEM[ADDR]"); AMD RDNA 2 XML ("low/high 16 bits of a 32-bit
  vector register"); LLVM 20.1.8 FeatureUnpackedD16VMem only on GFX8.
- Loads (section 8.1.4: "data returned from the texture unit is converted to
  16 bits"): integer formats of 16 bits or less keep the low 16 bits. UNORM
  and SNORM round the exact quotient c / (2^n - 1) once to float16, nearest
  even, subnormals kept (16_UNORM 0xFFAF -> 0x3BFD, 0xFFEF -> 0x3BFF,
  16_SNORM 0x7FF7 -> 0x3BFF, 0x8009 -> 0xBBFF, where narrowing the float32
  would be one ulp above). 32-bit float formats narrow toward zero, finite
  values past the range giving 65504, a NaN keeping its sign and top 10
  payload bits (payload 1 if those are zero). No public source covers
  either rule (the ISA only says the data "is converted to 16 bits"), so
  both are assumed and asked in akimfomin/PortBridge#85. SCALED values go float32 ->
  float16 to nearest even, overflow to infinity (assumed). 32-bit integer
  formats are refused by name (truncation or clamping is not documented).
- Stores widen each half to the value the non-d16 store takes (UINT
  zero-extended, SINT sign-extended, float16 -> float32 exact, 16-bit FLOAT
  copied), then reuse #150's saturation. UNORM/SNORM/SCALED stores stay
  refused.
- HLSL uses integer operations only for the float16 conversions, the exact
  quotient by long division (no double: Intel UHD has no FP64).

Interpreter coverage 1,208 -> 1,226 of 1,490 encodings (README 81% -> 82%);
test count still 1400+. New tests in tests/test_rdna2_exec_format_d16.py
(hand-computed values, an exact-fraction oracle for every 2- to 16-bit
normalized field, Python's binary16 rounding and a toward-zero oracle for
the float narrowing) and tests/test_rdna2_hlsl_format_d16.py (byte-for-byte
GPU parity in wave32 and wave64). The coverage test of
tests/test_rdna2_exec_format.py now requires the 18 d16 forms too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:38:53 +00:00
github manually merged commit 2d2a7a7dc5 into gh-pr/230/base 2026-11-26 05:38:55 +00:00
Author
Owner

@⁠KainanP on GitHub · 2026-11-25 19:45 UTC · original

Rebased again onto main 4f2cf5c after #226 merged (README now 1,156/1,490, 78%); full suite 1376/1376/1374 passed on RTX/WARP/Intel.

AI use: Claude Code (Claude Opus 5.5).

**@⁠KainanP** on GitHub · 2026-11-25 19:45 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/230#issuecomment-7172732876) Rebased again onto main 4f2cf5c after #226 merged (README now 1,156/1,490, 78%); full suite 1376/1376/1374 passed on RTX/WARP/Intel. _AI use: Claude Code (Claude Opus 5.5)._
Author
Owner

@⁠LooperSalty on GitHub · 2026-11-25 21:03 UTC · original

Thanks for the d16 forms.

  1. The PR removes test_typed_buffer_instructions_count_in_coverage from tests/test_rdna2_exec_format.py instead of updating it. It was the only check that the typed buffer forms run in the interpreter. Please restore it with the d16 forms included, so a d16 form that stops executing fails a test.
  2. The docstrings cite measurements from the Leonida project (ubiquitarianism/leonida, docs/design.md and docs/shader_validation.md at 9f9a7c5f). That repository was taken down on 2026-11-24 after a DMCA notice, and rule 2 of AGENTS.md only allows public sources (AMD's RDNA 2 ISA, LLVM's tests, Microsoft Learn, compatibly licensed code) and measurements from our own runs. Please remove these Leonida citations and, where a behaviour still needs a source, cite the AMD ISA section or an LLVM test instead (or re-measure it with our own tooling and say how it was obtained).
  3. #232 also moves the RDNA 2 encodings line from the same base (1,138); whichever lands second will need the combined figure recomputed.
**@⁠LooperSalty** on GitHub · 2026-11-25 21:03 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/230#issuecomment-7174542911) Thanks for the d16 forms. 1. The PR removes `test_typed_buffer_instructions_count_in_coverage` from `tests/test_rdna2_exec_format.py` instead of updating it. It was the only check that the typed buffer forms run in the interpreter. Please restore it with the d16 forms included, so a d16 form that stops executing fails a test. 2. The docstrings cite measurements from the Leonida project (ubiquitarianism/leonida, docs/design.md and docs/shader_validation.md at 9f9a7c5f). That repository was taken down on 2026-11-24 after a DMCA notice, and rule 2 of AGENTS.md only allows public sources (AMD's RDNA 2 ISA, LLVM's tests, Microsoft Learn, compatibly licensed code) and measurements from our own runs. Please remove these Leonida citations and, where a behaviour still needs a source, cite the AMD ISA section or an LLVM test instead (or re-measure it with our own tooling and say how it was obtained). 3. #232 also moves the RDNA 2 encodings line from the same base (1,138); whichever lands second will need the combined figure recomputed.
Author
Owner

@⁠LooperSalty on GitHub · 2026-11-25 21:45 UTC · original

Follow-up after the review: (1) test_typed_buffer_instructions_count_in_coverage is still deleted (main tests/test_rdna2_exec_format.py:174); please restore it with its assertion updated for the d16 forms. (2) rdna2_buffer_d16.py:29-32 adds a new Leonida measurement citation ("Measured on an RX 6700 ... ubiquitarianism/leonida docs/shader_validation.md"); please remove it and mark unmeasured behaviour as assumed, or cite the AMD ISA. (3) Please rebase on main and recount the README RDNA 2 line with rdna2_exec.coverage() on the merged tree.

**@⁠LooperSalty** on GitHub · 2026-11-25 21:45 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/230#issuecomment-7175502274) Follow-up after the review: (1) `test_typed_buffer_instructions_count_in_coverage` is still deleted (main `tests/test_rdna2_exec_format.py:174`); please restore it with its assertion updated for the d16 forms. (2) `rdna2_buffer_d16.py:29-32` adds a new Leonida measurement citation ("Measured on an RX 6700 ... ubiquitarianism/leonida docs/shader_validation.md"); please remove it and mark unmeasured behaviour as assumed, or cite the AMD ISA. (3) Please rebase on main and recount the README RDNA 2 line with `rdna2_exec.coverage()` on the merged tree.
Author
Owner

@⁠KainanP on GitHub · 2026-11-25 22:54 UTC · original

Thanks. Updated and rebased on main e921268 (one commit, 2d2a7a7):

  1. test_typed_buffer_instructions_count_in_coverage is back in tests/test_rdna2_exec_format.py. It now requires all 32 typed-buffer names to run in the interpreter (14 32-bit and 18 d16), so a d16 form that stops executing fails it.
  2. No Leonida citation is left in the code, tests, commit message or description. No public source says how d16 conversion rounds (the ISA only says "converted to 16 bits", §8.1.4). So the UNORM/SNORM rule (exact quotient rounded once) is labelled assumed, and its four deciding values (16_UNORM 0xFFAF/0xFFEF, 16_SNORM 0x7FF7/0x8009) are pinned in an "assumed" test. The measurement request is akimfomin/PortBridge#85. One rule also changed in this pass: 32-bit FLOAT formats now narrow toward zero (65504 past the range, NaN payload 1 when its top bits are zero) instead of to nearest with infinity, matching what our SPIR-V path already does. That rule is also labelled assumed, in the same request.
  3. Rebased on main and recounted with rdna2_exec.coverage() on the merged tree: 1,208 → 1,226 / 1,490 (82%) in the 9 READMEs. The test count stays 1400+ (1,481). #232 is still open, so this figure does not include it. Whichever PR lands second will be recomputed.

Checks: full suite on the RTX 4060 (1463 passed, 17 skipped); d16 and format files on WARP (98 passed) and Intel UHD (98 passed); ruff clean.

AI use: Claude Code (Claude Opus 5.5).

**@⁠KainanP** on GitHub · 2026-11-25 22:54 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/230#issuecomment-7176922573) Thanks. Updated and rebased on main `e921268` (one commit, `2d2a7a7`): 1. `test_typed_buffer_instructions_count_in_coverage` is back in `tests/test_rdna2_exec_format.py`. It now requires all 32 typed-buffer names to run in the interpreter (14 32-bit and 18 d16), so a d16 form that stops executing fails it. 2. No Leonida citation is left in the code, tests, commit message or description. No public source says how d16 conversion rounds (the ISA only says "converted to 16 bits", §8.1.4). So the UNORM/SNORM rule (exact quotient rounded once) is labelled **assumed**, and its four deciding values (16_UNORM `0xFFAF`/`0xFFEF`, 16_SNORM `0x7FF7`/`0x8009`) are pinned in an "assumed" test. The measurement request is akimfomin/PortBridge#85. One rule also changed in this pass: 32-bit FLOAT formats now narrow toward zero (65504 past the range, NaN payload 1 when its top bits are zero) instead of to nearest with infinity, matching what our SPIR-V path already does. That rule is also labelled assumed, in the same request. 3. Rebased on main and recounted with `rdna2_exec.coverage()` on the merged tree: **1,208 → 1,226 / 1,490 (82%)** in the 9 READMEs. The test count stays 1400+ (1,481). #232 is still open, so this figure does not include it. Whichever PR lands second will be recomputed. Checks: full suite on the RTX 4060 (1463 passed, 17 skipped); d16 and format files on WARP (98 passed) and Intel UHD (98 passed); ruff clean. _AI use: Claude Code (Claude Opus 5.5)._
This discussion has been locked. Commenting is limited to contributors.
No description provided.