upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/buffer_formats.md
diff options
context:
space:
mode:
authorAlxcBTW <187763517+AlxcBTW@users.noreply.github.com>2026-11-22 16:58:26 +0100
committerAlxcBTW <187763517+AlxcBTW@users.noreply.github.com>2026-11-22 16:58:26 +0100
commita93da2c18534d064472a5d045e875466a4018e64 (patch)
tree03bdaeae8f5c84b29ae72d3f3ffb1b21d3979865 /docs/buffer_formats.md
parent357945f4554b0efee116238c507607e8cfe3a208 (diff)
buffer_format_fuzz: distinct y and w in the store probe; count the (x, w) routing apart
store_inputs() gave y and w the same value for two-component formats, so run_stores could not tell the translator's (x, y) from the Radeon 880M's (x, w) for buffer_store_format_*; the zero mismatches did not validate the second component. The probe now uses a different value in every register and also runs _xy stores. The hardware model routes a two-component buffer_store_format_* to (x, w) (_xy: (x, 0)); tbuffer_store_format_* takes (x, y) like the translator. Those stores are counted as known-difference elements, outside the validated count: 1,330,469 validated elements, 0 mismatches, plus 26,523 known-difference elements. The translator is unchanged (RDNA2 unmeasured); the difference is pinned as an expectedFailure in test_buffer_formats_all.py. docs/buffer_formats.md and the design.md row say so. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/buffer_formats.md')
-rw-r--r--docs/buffer_formats.md146
1 files changed, 75 insertions, 71 deletions
diff --git a/docs/buffer_formats.md b/docs/buffer_formats.md
index f73f6afca..77f51e063 100644
--- a/docs/buffer_formats.md
+++ b/docs/buffer_formats.md
@@ -67,82 +67,84 @@ whole 16 bytes compared, so a byte written outside the element shows up.
67| **USCALED / SSCALED** | **converted as UNORM / SNORM**: storing 200.0 into 8_USCALED writes 255, storing 0.5 into 8_SSCALED writes 64. The SCALED formats are for loads; a store does not undo the "not divided" | 67| **USCALED / SSCALED** | **converted as UNORM / SNORM**: storing 200.0 into 8_USCALED writes 255, storing 0.5 into 8_SSCALED writes 64. The SCALED formats are for loads; a store does not undo the "not divided" |
68| 16_FLOAT, 10_11_11 / 11_11_10 FLOAT | **round toward zero** (not nearest): 0.49999997 gives `0x37FF`, not `0x3800`. A value too large for the format gives the **largest finite** value, not infinity: 65520.0 and 1e30 give `0x7BFF` for halves; only a real +infinity stores infinity. Denormals are produced. The unsigned floats store 0 for every negative number, −0 and −infinity | 68| 16_FLOAT, 10_11_11 / 11_11_10 FLOAT | **round toward zero** (not nearest): 0.49999997 gives `0x37FF`, not `0x3800`. A value too large for the format gives the **largest finite** value, not infinity: 65520.0 and 1e30 give `0x7BFF` for halves; only a real +infinity stores infinity. Denormals are produced. The unsigned floats store 0 for every negative number, −0 and −infinity |
69| NaN into a float format | stays a NaN: the sign (halves only) and the top mantissa bits of the payload, or 1 when those are all zero (`0x7F800001` gives `0x7C01`) | 69| NaN into a float format | stays a NaN: the sign (halves only) and the top mantissa bits of the payload, or 1 when those are all zero (`0x7F800001` gives `0x7C01`) |
70| a format with two components | **the 880M stores (x, w) for `buffer_store_format_xyzw`, not (x, y)**: `8_8_UINT` of (0x11, 0x22, 0x33, 0x44) writes 0x11, 0x44; `buffer_store_format_xy` into it writes 0x11 and 0. 1-, 3- and 4-component formats take x, xyz and xyzw. The translator writes (x, y); RDNA2 has not been measured (see below) | 70| a format with two components | **`buffer_store_format_*` on the 880M takes channels (x, w), not (x, y)**: `8_8_UINT` of (0x11, 0x22, 0x33, 0x44) writes 0x11, 0x44, and `buffer_store_format_xy` into it writes 0x11 and 0. **`tbuffer_store_format_*` takes (x, y)**, like the translator. 1-, 3- and 4-component formats take x, xyz and xyzw (`_xy` into them: x, y, then 0). The translator writes (x, y) for both. **KNOWN DIFFERENCE, not in the validated count; the target RDNA2 behaviour is unresolved until it is measured** |
71 71
72`DST_SEL` also reorders a store's channels on the 880M in a way that is not a plain swizzle (`xzwy` stores `zxyw`); only 72`DST_SEL` also reorders a store's channels on the 880M in a way that is not a plain swizzle (`xzwy` stores `zxyw`); only
73the identity and the B/R swap (`zyxw`, the 8_8_8_8 and 2_10_10_10 UNORM case the translator already handles) are modelled. 73the identity and the B/R swap (`zyxw`, the 8_8_8_8 and 2_10_10_10 UNORM case the translator already handles) are modelled.
74 74
75## What the 880M ran 75## What the 880M ran
76 76
77`python -I tools/buffer_format_fuzz.py --oracle hw --budget 200 --seed 7` on a Radeon 880M (gfx1150), 1,264,744 elements, 77`python -I tools/buffer_format_fuzz.py --oracle hw --budget 40 --seed 7` on a Radeon 880M (gfx1150): **1,330,469 validated
780 mismatches. `--negative-control` shows the harness is not vacuous (a kernel whose V# names another format differs on 78elements, 0 mismatches**, plus **26,523 known-difference elements** that are counted apart (below). Stores run as `_xyzw` and
79as `_xy`, with a different value in every register (an earlier version of the probe gave y and w the same value for
80two-component formats, which hid the difference). `--negative-control` shows the harness is not vacuous (a kernel whose V# names another format differs on
79all but one or two elements of five formats). `--self-test` checks the model without a GPU. 81all but one or two elements of five formats). `--self-test` checks the model without a GPU.
80 82
81| Code | Format | Translator | V# loads | tbuffer loads | V# stores | tbuffer stores | 83| Code | Format | Translator | V# loads | tbuffer loads | V# stores (xyzw and xy) | tbuffer stores (xyzw and xy) | known difference |
82|---|---|---|---|---|---|---| 84|---|---|---|---|---|---|---|---|
83| 1 | `8_UNORM` | before | 658 | 658 | 1,512 | 1,512 | 85| 1 | `8_UNORM` | before | 338 | 338 | 3,024 | 3,024 | 0 |
84| 2 | `8_SNORM` | before | 658 | 658 | 1,512 | 1,512 | 86| 2 | `8_SNORM` | before | 338 | 338 | 3,024 | 3,024 | 0 |
85| 3 | `8_USCALED` | added | 658 | 658 | 932 | 932 | 87| 3 | `8_USCALED` | added | 338 | 338 | 1,864 | 1,864 | 0 |
86| 4 | `8_SSCALED` | added | 658 | 658 | 932 | 932 | 88| 4 | `8_SSCALED` | added | 338 | 338 | 1,864 | 1,864 | 0 |
87| 5 | `8_UINT` | added | 658 | 658 | 844 | 844 | 89| 5 | `8_UINT` | added | 338 | 338 | 1,688 | 1,688 | 0 |
88| 6 | `8_SINT` | added | 658 | 658 | 844 | 844 | 90| 6 | `8_SINT` | added | 338 | 338 | 1,688 | 1,688 | 0 |
89| 7 | `16_UNORM` | before | 926 | 926 | 1,512 | 1,512 | 91| 7 | `16_UNORM` | before | 606 | 606 | 3,024 | 3,024 | 0 |
90| 8 | `16_SNORM` | before | 926 | 926 | 1,512 | 1,512 | 92| 8 | `16_SNORM` | before | 606 | 606 | 3,024 | 3,024 | 0 |
91| 9 | `16_USCALED` | added | 926 | 926 | 932 | 932 | 93| 9 | `16_USCALED` | added | 606 | 606 | 1,864 | 1,864 | 0 |
92| 10 | `16_SSCALED` | added | 926 | 926 | 932 | 932 | 94| 10 | `16_SSCALED` | added | 606 | 606 | 1,864 | 1,864 | 0 |
93| 11 | `16_UINT` | added | 926 | 926 | 844 | 844 | 95| 11 | `16_UINT` | added | 606 | 606 | 1,688 | 1,688 | 0 |
94| 12 | `16_SINT` | added | 926 | 926 | 844 | 844 | 96| 12 | `16_SINT` | added | 606 | 606 | 1,688 | 1,688 | 0 |
95| 13 | `16_FLOAT` | before | 65,938 | 65,938 | 932 | 932 | 97| 13 | `16_FLOAT` | before | 65,618 | 65,618 | 1,864 | 1,864 | 0 |
96| 14 | `8_8_UNORM` | before | 914 | 914 | 1,512 | 1,512 | 98| 14 | `8_8_UNORM` | before | 594 | 594 | 1,247 | 3,024 | 1,777 |
97| 15 | `8_8_SNORM` | before | 914 | 914 | 1,512 | 1,512 | 99| 15 | `8_8_SNORM` | before | 594 | 594 | 499 | 3,024 | 2,525 |
98| 16 | `8_8_USCALED` | added | 914 | 914 | 932 | 932 | 100| 16 | `8_8_USCALED` | added | 594 | 594 | 834 | 1,864 | 1,030 |
99| 17 | `8_8_SSCALED` | added | 914 | 914 | 932 | 932 | 101| 17 | `8_8_SSCALED` | added | 594 | 594 | 414 | 1,864 | 1,450 |
100| 18 | `8_8_UINT` | added | 914 | 914 | 844 | 844 | 102| 18 | `8_8_UINT` | added | 594 | 594 | 592 | 1,688 | 1,096 |
101| 19 | `8_8_SINT` | added | 914 | 914 | 844 | 844 | 103| 19 | `8_8_SINT` | added | 594 | 594 | 248 | 1,688 | 1,440 |
102| 20 | `32_UINT` | before | 677 | 677 | 844 | 844 | 104| 20 | `32_UINT` | before | 357 | 357 | 1,688 | 1,688 | 0 |
103| 21 | `32_SINT` | before | 677 | 677 | 844 | 844 | 105| 21 | `32_SINT` | before | 357 | 357 | 1,688 | 1,688 | 0 |
104| 22 | `32_FLOAT` | before | 677 | 677 | 932 | 932 | 106| 22 | `32_FLOAT` | before | 357 | 357 | 1,864 | 1,864 | 0 |
105| 23 | `16_16_UNORM` | before | 1,450 | 1,450 | 1,512 | 1,512 | 107| 23 | `16_16_UNORM` | before | 1,130 | 1,130 | 941 | 3,024 | 2,083 |
106| 24 | `16_16_SNORM` | before | 1,450 | 1,450 | 1,512 | 1,512 | 108| 24 | `16_16_SNORM` | before | 1,130 | 1,130 | 400 | 3,024 | 2,624 |
107| 25 | `16_16_USCALED` | added | 1,450 | 1,450 | 932 | 932 | 109| 25 | `16_16_USCALED` | added | 1,130 | 1,130 | 724 | 1,864 | 1,140 |
108| 26 | `16_16_SSCALED` | added | 1,450 | 1,450 | 932 | 932 | 110| 26 | `16_16_SSCALED` | added | 1,130 | 1,130 | 382 | 1,864 | 1,482 |
109| 27 | `16_16_UINT` | before | 1,450 | 1,450 | 844 | 844 | 111| 27 | `16_16_UINT` | before | 1,130 | 1,130 | 350 | 1,688 | 1,338 |
110| 28 | `16_16_SINT` | added | 1,450 | 1,450 | 844 | 844 | 112| 28 | `16_16_SINT` | added | 1,130 | 1,130 | 88 | 1,688 | 1,600 |
111| 29 | `16_16_FLOAT` | before | 131,474 | 131,474 | 932 | 932 | 113| 29 | `16_16_FLOAT` | before | 131,154 | 131,154 | 74 | 1,864 | 1,790 |
112| 36 | `10_11_11_FLOAT` | added | 5,522 | 5,522 | 932 | 932 | 114| 36 | `10_11_11_FLOAT` | added | 5,202 | 5,202 | 1,864 | 1,864 | 0 |
113| 43 | `11_11_10_FLOAT` | added | 5,522 | 5,522 | 932 | 932 | 115| 43 | `11_11_10_FLOAT` | added | 5,202 | 5,202 | 1,864 | 1,864 | 0 |
114| 44 | `10_10_10_2_UNORM` | before | 3,478 | 3,478 | 1,612 | 1,612 | 116| 44 | `10_10_10_2_UNORM` | before | 3,158 | 3,158 | 3,224 | 3,224 | 0 |
115| 45 | `10_10_10_2_SNORM` | added | 3,478 | 3,478 | 1,612 | 1,612 | 117| 45 | `10_10_10_2_SNORM` | added | 3,158 | 3,158 | 3,224 | 3,224 | 0 |
116| 48 | `10_10_10_2_UINT` | added | 3,478 | 3,478 | 844 | 844 | 118| 48 | `10_10_10_2_UINT` | added | 3,158 | 3,158 | 1,688 | 1,688 | 0 |
117| 49 | `10_10_10_2_SINT` | added | 3,478 | 3,478 | 844 | 844 | 119| 49 | `10_10_10_2_SINT` | added | 3,158 | 3,158 | 1,688 | 1,688 | 0 |
118| 50 | `2_10_10_10_UNORM` | before | 3,478 | 3,478 | 1,612 | 1,612 | 120| 50 | `2_10_10_10_UNORM` | before | 3,158 | 3,158 | 3,224 | 3,224 | 0 |
119| 51 | `2_10_10_10_SNORM` | added | 3,478 | 3,478 | 1,612 | 1,612 | 121| 51 | `2_10_10_10_SNORM` | added | 3,158 | 3,158 | 3,224 | 3,224 | 0 |
120| 52 | `2_10_10_10_USCALED` | added | 3,478 | 3,478 | 932 | 932 | 122| 52 | `2_10_10_10_USCALED` | added | 3,158 | 3,158 | 1,864 | 1,864 | 0 |
121| 53 | `2_10_10_10_SSCALED` | added | 3,478 | 3,478 | 932 | 932 | 123| 53 | `2_10_10_10_SSCALED` | added | 3,158 | 3,158 | 1,864 | 1,864 | 0 |
122| 54 | `2_10_10_10_UINT` | added | 3,478 | 3,478 | 844 | 844 | 124| 54 | `2_10_10_10_UINT` | added | 3,158 | 3,158 | 1,688 | 1,688 | 0 |
123| 55 | `2_10_10_10_SINT` | added | 3,478 | 3,478 | 844 | 844 | 125| 55 | `2_10_10_10_SINT` | added | 3,158 | 3,158 | 1,688 | 1,688 | 0 |
124| 56 | `8_8_8_8_UNORM` | before | 1,426 | 1,426 | 1,512 | 1,512 | 126| 56 | `8_8_8_8_UNORM` | before | 1,106 | 1,106 | 3,024 | 3,024 | 0 |
125| 57 | `8_8_8_8_SNORM` | before | 1,426 | 1,426 | 1,512 | 1,512 | 127| 57 | `8_8_8_8_SNORM` | before | 1,106 | 1,106 | 3,024 | 3,024 | 0 |
126| 58 | `8_8_8_8_USCALED` | added | 1,426 | 1,426 | 932 | 932 | 128| 58 | `8_8_8_8_USCALED` | added | 1,106 | 1,106 | 1,864 | 1,864 | 0 |
127| 59 | `8_8_8_8_SSCALED` | added | 1,426 | 1,426 | 932 | 932 | 129| 59 | `8_8_8_8_SSCALED` | added | 1,106 | 1,106 | 1,864 | 1,864 | 0 |
128| 60 | `8_8_8_8_UINT` | before | 1,426 | 1,426 | 844 | 844 | 130| 60 | `8_8_8_8_UINT` | before | 1,106 | 1,106 | 1,688 | 1,688 | 0 |
129| 61 | `8_8_8_8_SINT` | added | 1,426 | 1,426 | 844 | 844 | 131| 61 | `8_8_8_8_SINT` | added | 1,106 | 1,106 | 1,688 | 1,688 | 0 |
130| 62 | `32_32_UINT` | before | 952 | 952 | 844 | 844 | 132| 62 | `32_32_UINT` | before | 632 | 632 | 36 | 1,688 | 1,652 |
131| 63 | `32_32_SINT` | before | 952 | 952 | 844 | 844 | 133| 63 | `32_32_SINT` | before | 632 | 632 | 50 | 1,688 | 1,638 |
132| 64 | `32_32_FLOAT` | before | 952 | 952 | 932 | 932 | 134| 64 | `32_32_FLOAT` | before | 632 | 632 | 6 | 1,864 | 1,858 |
133| 65 | `16_16_16_16_UNORM` | before | 2,498 | 2,498 | 1,512 | 1,512 | 135| 65 | `16_16_16_16_UNORM` | before | 2,178 | 2,178 | 3,024 | 3,024 | 0 |
134| 66 | `16_16_16_16_SNORM` | before | 2,498 | 2,498 | 1,512 | 1,512 | 136| 66 | `16_16_16_16_SNORM` | before | 2,178 | 2,178 | 3,024 | 3,024 | 0 |
135| 67 | `16_16_16_16_USCALED` | added | 2,498 | 2,498 | 932 | 932 | 137| 67 | `16_16_16_16_USCALED` | added | 2,178 | 2,178 | 1,864 | 1,864 | 0 |
136| 68 | `16_16_16_16_SSCALED` | added | 2,498 | 2,498 | 932 | 932 | 138| 68 | `16_16_16_16_SSCALED` | added | 2,178 | 2,178 | 1,864 | 1,864 | 0 |
137| 69 | `16_16_16_16_UINT` | before | 2,498 | 2,498 | 844 | 844 | 139| 69 | `16_16_16_16_UINT` | before | 2,178 | 2,178 | 1,688 | 1,688 | 0 |
138| 70 | `16_16_16_16_SINT` | added | 2,498 | 2,498 | 844 | 844 | 140| 70 | `16_16_16_16_SINT` | added | 2,178 | 2,178 | 1,688 | 1,688 | 0 |
139| 71 | `16_16_16_16_FLOAT` | before | 262,546 | 262,546 | 932 | 932 | 141| 71 | `16_16_16_16_FLOAT` | before | 262,226 | 262,226 | 1,864 | 1,864 | 0 |
140| 72 | `32_32_32_UINT` | before | 1,227 | 1,227 | 844 | 844 | 142| 72 | `32_32_32_UINT` | before | 907 | 907 | 1,688 | 1,688 | 0 |
141| 73 | `32_32_32_SINT` | before | 1,227 | 1,227 | 844 | 844 | 143| 73 | `32_32_32_SINT` | before | 907 | 907 | 1,688 | 1,688 | 0 |
142| 74 | `32_32_32_FLOAT` | before | 1,227 | 1,227 | 932 | 932 | 144| 74 | `32_32_32_FLOAT` | before | 907 | 907 | 1,864 | 1,864 | 0 |
143| 75 | `32_32_32_32_UINT` | before | 1,502 | 1,502 | 844 | 844 | 145| 75 | `32_32_32_32_UINT` | before | 1,182 | 1,182 | 1,688 | 1,688 | 0 |
144| 76 | `32_32_32_32_SINT` | before | 1,502 | 1,502 | 844 | 844 | 146| 76 | `32_32_32_32_SINT` | before | 1,182 | 1,182 | 1,688 | 1,688 | 0 |
145| 77 | `32_32_32_32_FLOAT` | before | 1,502 | 1,502 | 932 | 932 | 147| 77 | `32_32_32_32_FLOAT` | before | 1,182 | 1,182 | 1,864 | 1,864 | 0 |
146 148
147"before" means the format was in `Gen.FORMATS` before this change. (Codes 5, 6, 11, 12, 18, 19, 28, 61 and 70, the narrow UINT and SINT ones, were added to main's table by a parallel change, measured on gfx1036, while this branch was open; they are marked "added" here because the 880M run covers them too and the table entries are identical.) Codes 30..35, 37..42 (no GFX11 form), 46 and 47 (GFX11 149"before" means the format was in `Gen.FORMATS` before this change. (Codes 5, 6, 11, 12, 18, 19, 28, 61 and 70, the narrow UINT and SINT ones, were added to main's table by a parallel change, measured on gfx1036, while this branch was open; they are marked "added" here because the 880M run covers them too and the table entries are identical.) Codes 30..35, 37..42 (no GFX11 form), 46 and 47 (GFX11
148has no SCALED 10_10_10_2) are not in the table. 150has no SCALED 10_10_10_2) are not in the table.
@@ -151,7 +153,7 @@ has no SCALED 10_10_10_2) are not in the table.
151 153
152Decode of every format that was already in `Gen.FORMATS` matches the 880M word for word (the 32 old codes are in the 154Decode of every format that was already in `Gen.FORMATS` matches the 880M word for word (the 32 old codes are in the
153table above). **Differences found in the older stores, left as they are** (an existing format stays byte-identical in this 155table above). **Differences found in the older stores, left as they are** (an existing format stays byte-identical in this
154change; the first two are pinned by an `expectedFailure` in `tests/semantic/test_buffer_formats_all.py`, which starts to 156change; the three are pinned by an `expectedFailure` in `tests/semantic/test_buffer_formats_all.py`, which starts to
155fail when someone fixes them): 157fail when someone fixes them):
156 158
1571. **16_FLOAT, 16_16_FLOAT and 16_16_16_16_FLOAT stores round to nearest even and overflow to infinity** (`Gen.f16_bits` 1591. **16_FLOAT, 16_16_FLOAT and 16_16_16_16_FLOAT stores round to nearest even and overflow to infinity** (`Gen.f16_bits`
@@ -163,8 +165,10 @@ fail when someone fixes them):
163 one-component formats and between 1 and 13 of 200 for the others (8_8_8_8_UNORM 9, 16_16_UNORM 7, 16_16_16_16_UNORM 12, 165 one-component formats and between 1 and 13 of 200 for the others (8_8_8_8_UNORM 9, 16_16_UNORM 7, 16_16_16_16_UNORM 12,
164 10_10_10_2_UNORM 13, 2_10_10_10_UNORM 11). The new formats store with an exact integer product 166 10_10_10_2_UNORM 13, 2_10_10_10_UNORM 11). The new formats store with an exact integer product
165 (`Gen.norm_encode_exact`). 167 (`Gen.norm_encode_exact`).
1663. **A two-component format stored with `xyzw`** takes (x, y) in the translator and (x, w) on the 880M (table above). 1683. **A two-component format stored with `buffer_store_format_xyzw` or `_xy`** takes (x, y) in the translator and (x, w) on the 880M
167 The RDNA2 xy/xyz measurements in `cs_fmt_xy_xyz.asm` do not cover it. Unresolved: it needs an RDNA2 card. 169 (26,523 elements in the run above, the last column of the table; `tbuffer_store_format_*` agrees with the translator).
170 The RDNA2 xy/xyz measurements in `cs_fmt_xy_xyz.asm` do not cover it. **Unresolved: the translator is unchanged until an RDNA2
171 card shows which is right.** It is pinned as an `expectedFailure` too, and excluded from the validated count.
168 172
169## Not measured 173## Not measured
170 174