Lower v_cvt_pk_u8_f32 in the startup gfx2hlsl translator #2094

Merged
Ybucaille merged 6 commits from upstream-pr/2101 into main 2026-11-25 06:06:01 +00:00
Ybucaille commented 2026-11-25 00:21:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T00:21:27Z.


Lower v_cvt_pk_u8_f32 in tools/startup/gfx2hlsl.py (item K of #2023).

What it does

v_cvt_pk_u8_f32 D, S0, S1, S2 (VOP3A opcode 350) inserts a byte into S2:

D = (S2 & ~(0xff << 8 * S1[1:0])) | ((flt32_to_uint8(S0) & 0xff) << 8 * S1[1:0])

The RDNA 1.0 and RDNA 2 ISA guides do not define flt32_to_uint8: rounding, bounds, NaN and negative results are not stated. I did not find a source for them that I could cite, so this PR does what tools/compute_store_aot.py already does for the same opcode (#1546, #1592): it holds only where every reading agrees, an S0 that is +0.0 or an integer in [1, 255].

  • A constant S0 outside that set (0.5, -1.0, 256.0, NaN, -0.0) is refused.
  • A register S0 cannot be checked statically, so the program must keep it inside the set. The HLSL clamp only keeps the conversion defined; it is not a claim about the hardware.
  • Modifiers (clamp, omod, neg, abs), a wrong operand count and a non-VGPR destination are refused.
  • S1 and S2 may be registers or constants; only S1[1:0] is used.

I did not add rounding at x.5 or clamping below 0 and above 255 to the fixture, because the reference would be a guess. If a maintainer can point to the hardware behavior, that is a follow-up.

Test

tests/startup_gfx2hlsl_cvt_pk_u8_check.py, source-built (no retail bytes), on the shared startup_gfx2hlsl_lane_alu.py runner:

  • all four byte selectors, with S1 bits above [1:0] set, S2 words of four distinct bytes, S0 from 0.0 to 255.0;
  • negative controls: a lowering that loses S2 (also drawn), and a wrong byte position, both detected;
  • the check fails when the shift in the translator is mutated;
  • refusals listed above; llvm-mc reassembly of the pixel bodies.

Wired in CMakeLists.txt (controls, warp, hardware) and .github/workflows/windows.yml.

Verified here (Linux)

The new check (no arguments and binary with llvm-mc), every tests/startup_gfx2hlsl_*_check.py, tests/startup_translator_check.py, tests/docs_links_check.py and git diff --check. The D3D12/WARP draw does not run on Linux, so the draw mode is untested; the CTest entries need a Windows run.

Refs #2023 (item K)

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6594210858 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-25T00:21:27Z. --- Lower `v_cvt_pk_u8_f32` in `tools/startup/gfx2hlsl.py` (item K of #2023). ## What it does `v_cvt_pk_u8_f32 D, S0, S1, S2` (VOP3A opcode 350) inserts a byte into S2: D = (S2 & ~(0xff << 8 * S1[1:0])) | ((flt32_to_uint8(S0) & 0xff) << 8 * S1[1:0]) The RDNA 1.0 and RDNA 2 ISA guides do not define `flt32_to_uint8`: rounding, bounds, NaN and negative results are not stated. I did not find a source for them that I could cite, so this PR does what `tools/compute_store_aot.py` already does for the same opcode (#1546, #1592): it holds only where every reading agrees, an S0 that is +0.0 or an integer in [1, 255]. - A constant S0 outside that set (0.5, -1.0, 256.0, NaN, -0.0) is refused. - A register S0 cannot be checked statically, so the program must keep it inside the set. The HLSL `clamp` only keeps the conversion defined; it is not a claim about the hardware. - Modifiers (clamp, omod, neg, abs), a wrong operand count and a non-VGPR destination are refused. - S1 and S2 may be registers or constants; only S1[1:0] is used. I did not add rounding at x.5 or clamping below 0 and above 255 to the fixture, because the reference would be a guess. If a maintainer can point to the hardware behavior, that is a follow-up. ## Test `tests/startup_gfx2hlsl_cvt_pk_u8_check.py`, source-built (no retail bytes), on the shared `startup_gfx2hlsl_lane_alu.py` runner: - all four byte selectors, with S1 bits above [1:0] set, S2 words of four distinct bytes, S0 from 0.0 to 255.0; - negative controls: a lowering that loses S2 (also drawn), and a wrong byte position, both detected; - the check fails when the shift in the translator is mutated; - refusals listed above; `llvm-mc` reassembly of the pixel bodies. Wired in `CMakeLists.txt` (controls, warp, hardware) and `.github/workflows/windows.yml`. ## Verified here (Linux) The new check (no arguments and `binary` with llvm-mc), every `tests/startup_gfx2hlsl_*_check.py`, `tests/startup_translator_check.py`, `tests/docs_links_check.py` and `git diff --check`. The D3D12/WARP draw does not run on Linux, so the `draw` mode is untested; the CTest entries need a Windows run. Refs #2023 (item K) AI-assisted.
R0Y00 commented 2026-11-25 01:01:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T00:54:51Z.

Review: CHANGES_REQUESTED


The four in-domain draws and both mutations passed on WARP and RTX 4060 Laptop. The generic startup path still accepts an arbitrary register for S0 and clamps it, with no proof or explicit profile contract that it contains only +0.0 or integers 1..255. A computed fraction, NaN or negative value can now silently select an invented byte. Please restrict the default path to proven in-domain words, or add an explicitly selected fixture/profile contract with a rejection for unproven operands in ordinary translation. Keep the four selector checks and the dropped-S2 control.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6049890159 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#pullrequestreview-6049890159). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T00:54:51Z. **Review:** CHANGES_REQUESTED --- The four in-domain draws and both mutations passed on WARP and RTX 4060 Laptop. The generic startup path still accepts an arbitrary register for S0 and clamps it, with no proof or explicit profile contract that it contains only +0.0 or integers 1..255. A computed fraction, NaN or negative value can now silently select an invented byte. Please restrict the default path to proven in-domain words, or add an explicitly selected fixture/profile contract with a rejection for unproven operands in ordinary translation. Keep the four selector checks and the dropped-S2 control.
ChazY11 commented 2026-11-25 01:02:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T00:29:56Z.


Six mutations: four caught, two survivors — and one of them I expect to change the drawn word, so I would like your read before I claim anything

Baseline on this branch, both paths run here (Windows 11 build 26300.9974, DXC 10.0.26100.0):

python -B tests/startup_gfx2hlsl_cvt_pk_u8_check.py                          exit 0
python -B tests/startup_gfx2hlsl_cvt_pk_u8_check.py draw <dxc> <offscreen_check> warp   exit 0
warp: 2 draws matched, 1 mutated draws read their mutated words
mutation in op_v_cvt_pk_u8_f32 controls draw (warp)
shift pinned to 0u (ignore S1) caught —
rest high bits no longer preserved ((rest & ~(0xff<<s)) | → (rest |) caught —
the constant-range refusal removed caught —
len(ops) != 4 → != 3 caught —
clamp(F(x), 0.0, 255.0) → 0.0, 256.0 survived —
the insert mask & 0xffu → & 0x1ffu survived survived

The clamp survivor is fine, and here is why I am not calling it a gap

Under this lowering's stated contract the source is +0.0 or an integer in 1..255, and outside that the ISA's flt32_to_uint8 is undefined. Clamping
at 256 instead of 255 can only differ for inputs in (255, 256], which the contract excludes. So it is an equivalent mutant relative to the
precondition
— but the constant is a documented choice, and a one-line text assertion ('0.0, 255.0' in text) would pin it for free. Your call.

The mask survivor is the one I would like explained

((rest & ~(0xffu << s)) | ((x & 0xffu) << s)) → ... ((x & 0x1ffu) << s). For your own first draw vector:

s0=0x437f0000 (255.0)  s1=0  rest=0x55aa33cc   expected 0x55aa33ff

correct: clear the low byte of rest → 0x55aa3300, insert 0xff → 0x55aa33ff
mutant: clear nine bits → 0x55aa3200, insert 0xff → 0x55aa32ff

Different word, and bit 8 of rest (0x33cc → LSB of 0x33 is 1) is exactly the bit the wider mask eats. Yet the draw stayed green when I applied
it. I checked that the mutant reaches the emitted text — the assignment becomes

v5 = ((0x55aa33ccu & ~(0xffu << ((0x00000000u & 3u) << 3u))) | ((uint(clamp(F(0x437f0000u), 0.0, 255.0)) & 0x1ffu) << ((0x00000000u & 3u) << 3u)));

so one of three things is true, and I could not settle which in the time I had:

  1. my hand computation above is wrong (then the survivor is equivalent and I have learned something);
  2. check_draw compiles the good shader from a translation that is not the live one after the mutation — translate() builds hlsl_ps() at call time,
    so I would expect it to be live, which is why this is a question rather than a claim;
  3. the drawn comparison tolerates it for a reason I have not seen.

If it is (2), then the draw half is not a control against lowering mutations at all, which would matter beyond this PR. If it is (1), ignore me.

The thing this PR gets right that I want to write down

Refusing a constant S0 outside {+0.0} ∪ [1,255] is the correct shape of answer for an instruction whose own guide leaves the conversion undefined:
the translator states the precondition it needs instead of guessing a rounding rule. That is the same call I made in #2092 for class16, and it is
much easier to defend in review than a plausible-looking round().

AI-assisted; the six mutations, both check modes and the HLSL dump above were run locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148571213 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#issuecomment-7148571213). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-25T00:29:56Z. --- ## Six mutations: four caught, two survivors — and one of them I expect to change the drawn word, so I would like your read before I claim anything Baseline on this branch, both paths run here (Windows 11 build 26300.9974, DXC 10.0.26100.0): ```text python -B tests/startup_gfx2hlsl_cvt_pk_u8_check.py exit 0 python -B tests/startup_gfx2hlsl_cvt_pk_u8_check.py draw <dxc> <offscreen_check> warp exit 0 warp: 2 draws matched, 1 mutated draws read their mutated words ``` | mutation in `op_v_cvt_pk_u8_f32` | controls | draw (warp) | |---|---|---| | `shift` pinned to `0u` (ignore S1) | **caught** | — | | `rest` high bits no longer preserved (`(rest & ~(0xff<<s)) \|` → `(rest \|`) | **caught** | — | | the constant-range refusal removed | **caught** | — | | `len(ops) != 4` → `!= 3` | **caught** | — | | `clamp(F(x), 0.0, 255.0)` → `0.0, 256.0` | survived | — | | the insert mask `& 0xffu` → `& 0x1ffu` | survived | **survived** | ### The clamp survivor is fine, and here is why I am not calling it a gap Under this lowering's stated contract the source is `+0.0` or an integer in `1..255`, and outside that the ISA's `flt32_to_uint8` is undefined. Clamping at 256 instead of 255 can only differ for inputs in `(255, 256]`, which the contract excludes. So it is an equivalent mutant *relative to the precondition* — but the constant is a documented choice, and a one-line text assertion (`'0.0, 255.0' in text`) would pin it for free. Your call. ### The mask survivor is the one I would like explained `((rest & ~(0xffu << s)) | ((x & 0xffu) << s))` → `... ((x & 0x1ffu) << s)`. For your own first draw vector: ```text s0=0x437f0000 (255.0) s1=0 rest=0x55aa33cc expected 0x55aa33ff ``` correct: clear the low byte of `rest` → `0x55aa3300`, insert `0xff` → `0x55aa33ff` mutant: clear **nine** bits → `0x55aa3200`, insert `0xff` → `0x55aa32ff` Different word, and bit 8 of `rest` (`0x33cc` → LSB of `0x33` is 1) is exactly the bit the wider mask eats. Yet the draw stayed green when I applied it. I checked that the mutant reaches the emitted text — the assignment becomes ```hlsl v5 = ((0x55aa33ccu & ~(0xffu << ((0x00000000u & 3u) << 3u))) | ((uint(clamp(F(0x437f0000u), 0.0, 255.0)) & 0x1ffu) << ((0x00000000u & 3u) << 3u))); ``` so one of three things is true, and I could not settle which in the time I had: 1. my hand computation above is wrong (then the survivor is equivalent and I have learned something); 2. `check_draw` compiles the `good` shader from a translation that is not the live one after the mutation — `translate()` builds `hlsl_ps()` at call time, so I would expect it to be live, which is why this is a question rather than a claim; 3. the drawn comparison tolerates it for a reason I have not seen. If it is (2), then the draw half is not a control against lowering mutations at all, which would matter beyond this PR. If it is (1), ignore me. ## The thing this PR gets right that I want to write down Refusing a constant `S0` outside `{+0.0} ∪ [1,255]` is the correct shape of answer for an instruction whose own guide leaves the conversion undefined: the translator states the precondition it needs instead of guessing a rounding rule. That is the same call I made in #2092 for `class16`, and it is much easier to defend in review than a plausible-looking `round()`. AI-assisted; the six mutations, both check modes and the HLSL dump above were run locally.
ChazY11 commented 2026-11-25 01:02:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T00:30:43Z.


Narrowing my own question: the mutant does reach the compiled pixel shader

I said I could not tell whether the draw half compiles the live lowering. That part is now settled, and it makes the survivor more interesting rather than
less:

unmutated  lane 12: ((v8 & ~(0xffu << ((v4 & 3u) << 3u))) | ((uint(clamp(F(v0), 0.0, 255.0)) & 0xffu) << ((v4 & 3u) << 3u)))
mutated    lane 12: ((v8 & ~(0xffu << ((v4 & 3u) << 3u))) | ((uint(clamp(F(v0), 0.0, 255.0)) & 0x1ffu) << ((v4 & 3u) << 3u)))
contains 0x1ffu: False -> True

So translate() is live, the mutant lands in the good shader's text, and the draw still reported 2 draws matched. Whatever is responsible is therefore
downstream of the translation — in compile_hlsl, in the renderer's comparison, or in my hand computation of the expected word.

For your convenience, the case I computed by hand from your own first draw set:

s0=0x437f0000 (255.0)   s1=0   rest=0x55aa33cc
correct: rest & ~0xff | (255 << 0)              = 0x55aa3300 | 0xff = 0x55aa33ff
mutant:  rest & ~0x1ff | (255 & 0x1ff) << 0     = 0x55aa3200 | 0xff = 0x55aa32ff

If that arithmetic is right, the mutated shader cannot produce the word want demands, and the draw should have failed — so one of the two runs I did
(controls, then draw, same mutant, same session) did something I have not accounted for. If it is wrong, then the mask mutant is equivalent and my
survivor report is noise; I would rather you tell me which than have me guess in public.

I am not claiming your draw half is unfaithful — I am saying I could not explain the result with the evidence I have, and the next reviewer should not
have to rediscover that.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148583950 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#issuecomment-7148583950). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-25T00:30:43Z. --- ## Narrowing my own question: the mutant does reach the compiled pixel shader I said I could not tell whether the draw half compiles the live lowering. That part is now settled, and it makes the survivor more interesting rather than less: ```text unmutated lane 12: ((v8 & ~(0xffu << ((v4 & 3u) << 3u))) | ((uint(clamp(F(v0), 0.0, 255.0)) & 0xffu) << ((v4 & 3u) << 3u))) mutated lane 12: ((v8 & ~(0xffu << ((v4 & 3u) << 3u))) | ((uint(clamp(F(v0), 0.0, 255.0)) & 0x1ffu) << ((v4 & 3u) << 3u))) contains 0x1ffu: False -> True ``` So `translate()` is live, the mutant lands in the `good` shader's text, and the draw still reported `2 draws matched`. Whatever is responsible is therefore downstream of the translation — in `compile_hlsl`, in the renderer's comparison, or in my hand computation of the expected word. For your convenience, the case I computed by hand from your own first draw set: ```text s0=0x437f0000 (255.0) s1=0 rest=0x55aa33cc correct: rest & ~0xff | (255 << 0) = 0x55aa3300 | 0xff = 0x55aa33ff mutant: rest & ~0x1ff | (255 & 0x1ff) << 0 = 0x55aa3200 | 0xff = 0x55aa32ff ``` If that arithmetic is right, the mutated shader cannot produce the word `want` demands, and the draw should have failed — so one of the two runs I did (controls, then draw, same mutant, same session) did something I have not accounted for. If it is wrong, then the mask mutant is equivalent and my survivor report is noise; I would rather you tell me which than have me guess in public. I am not claiming your draw half is unfaithful — I am saying I could not explain the result with the evidence I have, and the next reviewer should not have to rediscover that. AI-assisted.
ChazY11 commented 2026-11-25 01:02:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T00:31:33Z.


Correction: the mask survivor is an equivalent mutant, and my hand computation was wrong

I have to withdraw the question in my previous comment. I mutated only the insert side:

((v8 & ~(0xffu << ((v4 & 3u) << 3u))) | ((uint(clamp(F(v0), 0.0, 255.0)) & 0x1ffu) << ((v4 & 3u) << 3u)))
                                                    ^^^^^^ this changed
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ clear side untouched

The clear mask is still ~(0xffu << s), so bit 8 of rest is preserved either way, and the inserted value comes from
uint(clamp(F(x), 0.0, 255.0)), which is at most 255 — so & 0x1ffu and & 0xffu select exactly the same bits. The word is identical:

rest & ~0xff            = 0x55aa3300
(255 & 0x1ff) << 0      = 0xff
result                  = 0x55aa33ff   (same as the correct lowering)

In my previous comment I wrote rest & ~0x1ff for "mutant" — that is not what the mutant does. The mutant never touches the clear side. So the draw
matching was correct, your draw half is faithful, and the survivor is equivalent: nothing to fix, and no question for you to answer.

Three things I got out of this, for the record rather than for this PR:

  1. an "equivalent mutant survivor" is a claim about the code, not about the test, and mine rested on an arithmetic step I did not re-read against the
    text I had just printed in the same comment;
  2. the mask/clear pair is a place where a one-character mutation looks like it changes the field width and does not — worth knowing if you ever want a
    real gap there, the mutation has to widen the clear mask (~(0x1ffu << s)), which would then be caught by the draw;
  3. I should have run that mutation to completion (mutating the clear side as well) before posting the question, instead of posting a question I could have
    answered with one more edit.

Sorry for the noise. The rest of the review stands: four of six mutations caught, and the clamp constant is the only thing I would still pin (with a text
assertion, since it is equivalent under the stated precondition).

AI-assisted; the mutant text above is from the run I posted, re-read.

Verified the follow-through before posting the correction

I said the mutation that would be a real gap is widening the clear mask, so I ran it:

((rest & ~(0x1ffu << s)) | ((x & 0xffu) << s))     clear side widened

controls: AssertionError: translated text reads 00000000 00000000 11223344   exit 1
draw:     exit 1

Both halves catch it, which is what a faithful pair of controls should do — and it is further evidence that my earlier survivor was equivalent rather
than missed. The clear-side mutation is the one to use if anyone wants a maintained control here.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148597184 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#issuecomment-7148597184). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-25T00:31:33Z. --- ## Correction: the mask survivor is an equivalent mutant, and my hand computation was wrong I have to withdraw the question in my previous comment. I mutated only the **insert** side: ```hlsl ((v8 & ~(0xffu << ((v4 & 3u) << 3u))) | ((uint(clamp(F(v0), 0.0, 255.0)) & 0x1ffu) << ((v4 & 3u) << 3u))) ^^^^^^ this changed ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ clear side untouched ``` The clear mask is still `~(0xffu << s)`, so bit 8 of `rest` is **preserved** either way, and the inserted value comes from `uint(clamp(F(x), 0.0, 255.0))`, which is at most 255 — so `& 0x1ffu` and `& 0xffu` select exactly the same bits. The word is identical: ```text rest & ~0xff = 0x55aa3300 (255 & 0x1ff) << 0 = 0xff result = 0x55aa33ff (same as the correct lowering) ``` In my previous comment I wrote `rest & ~0x1ff` for "mutant" — that is not what the mutant does. The mutant never touches the clear side. So the draw matching was correct, your draw half is faithful, and the survivor is equivalent: nothing to fix, and no question for you to answer. Three things I got out of this, for the record rather than for this PR: 1. an "equivalent mutant survivor" is a claim about the *code*, not about the test, and mine rested on an arithmetic step I did not re-read against the text I had just printed in the same comment; 2. the mask/clear pair is a place where a one-character mutation looks like it changes the field width and does not — worth knowing if you ever want a real gap there, the mutation has to widen the **clear** mask (`~(0x1ffu << s)`), which would then be caught by the draw; 3. I should have run that mutation to completion (mutating the clear side as well) before posting the question, instead of posting a question I could have answered with one more edit. Sorry for the noise. The rest of the review stands: four of six mutations caught, and the clamp constant is the only thing I would still pin (with a text assertion, since it is equivalent under the stated precondition). AI-assisted; the mutant text above is from the run I posted, re-read. ## Verified the follow-through before posting the correction I said the mutation that *would* be a real gap is widening the **clear** mask, so I ran it: ```text ((rest & ~(0x1ffu << s)) | ((x & 0xffu) << s)) clear side widened controls: AssertionError: translated text reads 00000000 00000000 11223344 exit 1 draw: exit 1 ``` Both halves catch it, which is what a faithful pair of controls should do — and it is further evidence that my earlier survivor was equivalent rather than missed. The clear-side mutation is the one to use if anyone wants a maintained control here.
Its3rr0rsWRLD commented 2026-11-25 01:02:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Its3rr0rsWRLD on 2026-11-25T00:39:37Z.


Windows run of the requested draws for #2101, tested at head 2d67fe41930379043235b98b2b6e0799ebf05f27.

Environment

  • Windows 11 26H2, build 26300.9974
  • Hardware adapter: NVIDIA GeForce RTX 4070 Ti, driver 32.0.16.1088
  • WARP: Microsoft Basic Render Driver, d3d10warp.dll 10.0.26100.9818
  • dev preset, MSVC; built only offscreen_check and the tests' dependencies

Command

ctest --preset dev --no-tests=error -R "^startup_(gfx2hlsl_interp_f16|gfx2hlsl_bit_alu|vertex_fetch_formats|gfx2hlsl_cvt_pk_u8)_(controls|warp|hardware)$" --output-on-failure

Results: 9/9 passed (the interp_f16 family is not in this branch)

Test Result
startup_gfx2hlsl_cvt_pk_u8_controls pass
startup_gfx2hlsl_cvt_pk_u8_warp pass
startup_gfx2hlsl_cvt_pk_u8_hardware pass
startup_vertex_fetch_formats_controls pass
startup_vertex_fetch_formats_warp pass
startup_vertex_fetch_formats_hardware pass
startup_gfx2hlsl_bit_alu_controls pass
startup_gfx2hlsl_bit_alu_warp pass
startup_gfx2hlsl_bit_alu_hardware pass

Run by Claude (AI-assisted).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148742912 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#issuecomment-7148742912). Originally posted by [Its3rr0rsWRLD](https://github.com/Its3rr0rsWRLD) on 2026-11-25T00:39:37Z. --- Windows run of the requested draws for #2101, tested at head `2d67fe41930379043235b98b2b6e0799ebf05f27`. **Environment** - Windows 11 26H2, build 26300.9974 - Hardware adapter: NVIDIA GeForce RTX 4070 Ti, driver 32.0.16.1088 - WARP: Microsoft Basic Render Driver, d3d10warp.dll 10.0.26100.9818 - `dev` preset, MSVC; built only `offscreen_check` and the tests' dependencies **Command** ``` ctest --preset dev --no-tests=error -R "^startup_(gfx2hlsl_interp_f16|gfx2hlsl_bit_alu|vertex_fetch_formats|gfx2hlsl_cvt_pk_u8)_(controls|warp|hardware)$" --output-on-failure ``` **Results: 9/9 passed** (the `interp_f16` family is not in this branch) | Test | Result | |---|---| | `startup_gfx2hlsl_cvt_pk_u8_controls` | pass | | `startup_gfx2hlsl_cvt_pk_u8_warp` | pass | | `startup_gfx2hlsl_cvt_pk_u8_hardware` | pass | | `startup_vertex_fetch_formats_controls` | pass | | `startup_vertex_fetch_formats_warp` | pass | | `startup_vertex_fetch_formats_hardware` | pass | | `startup_gfx2hlsl_bit_alu_controls` | pass | | `startup_gfx2hlsl_bit_alu_warp` | pass | | `startup_gfx2hlsl_bit_alu_hardware` | pass | Run by Claude (AI-assisted).
tedin7 commented 2026-11-25 02:01:45 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:41:06Z.

Review: COMMENTED


Review of head 1afe5a69e748b408b7f38c84b0879abe85cd2d41. No blocking findings.

Summary: v_cvt_pk_u8_f32 is lowered only where S0 is +0.0 or an integer in 1..255. Constants are checked at translation. Registers must be proven by an unmodified v_cvt_f32_ubyte0..3 in straight-line, full-exec code, or the caller must select pk_u8_s0_contract. The merge expression matches the ISA text. Title and body are neutral and the CI jobs pass.

Checked

  • Every VGPR write goes through set_v (rg for other emitters found none), so discarding the proof there covers all later writes, including loads and multi-register results.
  • v_cvt_f32_ubyte* yields exactly float(0..255), so the proof is sound. It is skipped with modifiers, with branches, or when exec is not the entry mask.
  • The contract is off by default and is recorded in the pipeline notes when used.
  • The pipeline kwargs in startup_gfx2hlsl_lane_alu.py are optional, so other families are unchanged.
  • The CMake and windows.yml entries sit next to the sibling cvt_alu entries.

Commands run locally on Linux (output summarised)

  • python3 -B tests/startup_gfx2hlsl_cvt_pk_u8_check.py -> all ok, rc=0 (translation controls only; no GPU draw was run locally).
  • python3 -B tests/startup_gfx2hlsl_cvt_alu_check.py -> all ok, rc=0 (shared runner is unaffected).
  • python3 tests/docs_links_check.py -> 18 files, 393 links OK.
  • python3 tests/bidi_controls_check.py -> OK.
  • git diff --check origin/main...HEAD -> clean.
  • Mutation 1: removed the byte_float_v discard in set_v -> the "float multiply is refused" control fails.
  • Mutation 2: widened the constant bound from 255 to 256 -> "refused forms stay refused" fails.
  • Mutation 3: dropped the has_branches guard -> "no proof in a program with branches" fails.
  • All three mutations were reverted with git checkout -- ..

P1: none.

P2: none.

Nits

  • docs/experiments.md is a long single paragraph. Splitting out the "proven register" rule would make it easier to read.
  • getattr(self, 'byte_float_v', set()).discard(n) runs on every set_v. Initialising the set in __init__ would be simpler. This is not blocking.

Not run: Windows WARP/hardware draw (x2w_pipe.py win2025). This is a re-run of the CI Windows job, which passed on this head. A maintainer who wants a local GPU readback should run startup_gfx2hlsl_cvt_pk_u8_warp.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6050298078 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#pullrequestreview-6050298078). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:41:06Z. **Review:** COMMENTED --- Review of head `1afe5a69e748b408b7f38c84b0879abe85cd2d41`. No blocking findings. **Summary:** `v_cvt_pk_u8_f32` is lowered only where S0 is +0.0 or an integer in 1..255. Constants are checked at translation. Registers must be proven by an unmodified `v_cvt_f32_ubyte0..3` in straight-line, full-exec code, or the caller must select `pk_u8_s0_contract`. The merge expression matches the ISA text. Title and body are neutral and the CI jobs pass. **Checked** - Every VGPR write goes through `set_v` (`rg` for other emitters found none), so discarding the proof there covers all later writes, including loads and multi-register results. - `v_cvt_f32_ubyte*` yields exactly float(0..255), so the proof is sound. It is skipped with modifiers, with branches, or when exec is not the entry mask. - The contract is off by default and is recorded in the pipeline notes when used. - The `pipeline` kwargs in `startup_gfx2hlsl_lane_alu.py` are optional, so other families are unchanged. - The CMake and `windows.yml` entries sit next to the sibling `cvt_alu` entries. **Commands run locally on Linux (output summarised)** - `python3 -B tests/startup_gfx2hlsl_cvt_pk_u8_check.py` -> all ok, rc=0 (translation controls only; no GPU draw was run locally). - `python3 -B tests/startup_gfx2hlsl_cvt_alu_check.py` -> all ok, rc=0 (shared runner is unaffected). - `python3 tests/docs_links_check.py` -> 18 files, 393 links OK. - `python3 tests/bidi_controls_check.py` -> OK. - `git diff --check origin/main...HEAD` -> clean. - Mutation 1: removed the `byte_float_v` discard in `set_v` -> the "float multiply is refused" control fails. - Mutation 2: widened the constant bound from 255 to 256 -> "refused forms stay refused" fails. - Mutation 3: dropped the `has_branches` guard -> "no proof in a program with branches" fails. - All three mutations were reverted with `git checkout -- .`. **P1:** none. **P2:** none. **Nits** - `docs/experiments.md` is a long single paragraph. Splitting out the "proven register" rule would make it easier to read. - `getattr(self, 'byte_float_v', set()).discard(n)` runs on every `set_v`. Initialising the set in `__init__` would be simpler. This is not blocking. **Not run:** Windows WARP/hardware draw (`x2w_pipe.py win2025`). This is a re-run of the CI Windows job, which passed on this head. A maintainer who wants a local GPU readback should run `startup_gfx2hlsl_cvt_pk_u8_warp`. AI-assisted; commands listed were executed locally.
Ybucaille commented 2026-11-25 02:02:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T01:07:33Z.


Thanks for the review. Addressed in 1afe5a69.

Default path: proven S0 only. In ordinary translation, a register S0 is now accepted only when its value is proven to be +0.0 or an integer in 1..255:

  • a constant in that set (unchanged);
  • a VGPR written by v_cvt_f32_ubyte0..3 (e32 or e64, without modifiers) in straight-line code under the entry EXEC, and not written since. The proof is dropped on any later write of the register.

Anything else is refused with v_cvt_pk_u8_f32 source vN is not proven to be +0.0 or an integer in 1..255. That covers a computed value (v_mul_f32 after the conversion, for example), a plain v_mov_b32 copy, v_cvt_f32_u32, a conversion with clamp or mul:2, an SGPR, and any of these after a branch or under a partial EXEC.

Explicit contract for the fixture. Pipeline(..., pk_u8_s0_contract=True) states that unproven S0 registers hold only those values. Only then are they accepted, still with the clamp, and the pipeline records the assumption in its notes, so it is written to the manifest. Ordinary translation (load_request, request_refusals) never sets it. The draws select it through the fixture family, so their HLSL is unchanged.

Kept: the four selector checks and the dropped-S2 control are unchanged. In the accepted list, the register S0 forms became constants, because they now need the contract. Each of them is covered again in the new contract controls.

New controls: an unproven S0 is refused without the contract (three spellings, exact message), and the same words are accepted with it, with the note. ubyte0..3 are accepted without the contract, in e32 and e64. Each refused form above has its own control. Each new control fails on the previous code, on a version where the contract is always on, on a version where the proof survives a later write, and on a version where the proof accepts modifiers.

Linux: the check (with binary /usr/bin/llvm-mc; the words are unchanged), all startup_gfx2hlsl_*_check.py, startup_translator_check.py and docs_links_check.py pass. git diff --check is clean. The draws were not rerun: the fixture HLSL is the same, only the way the contract is selected changed. A Windows rerun of startup_gfx2hlsl_cvt_pk_u8_(controls|warp|hardware) would confirm it.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149231223 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#issuecomment-7149231223). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-25T01:07:33Z. --- Thanks for the review. Addressed in 1afe5a69. **Default path: proven S0 only.** In ordinary translation, a register S0 is now accepted only when its value is proven to be +0.0 or an integer in 1..255: - a constant in that set (unchanged); - a VGPR written by `v_cvt_f32_ubyte0..3` (e32 or e64, without modifiers) in straight-line code under the entry EXEC, and not written since. The proof is dropped on any later write of the register. Anything else is refused with `v_cvt_pk_u8_f32 source vN is not proven to be +0.0 or an integer in 1..255`. That covers a computed value (`v_mul_f32` after the conversion, for example), a plain `v_mov_b32` copy, `v_cvt_f32_u32`, a conversion with `clamp` or `mul:2`, an SGPR, and any of these after a branch or under a partial EXEC. **Explicit contract for the fixture.** `Pipeline(..., pk_u8_s0_contract=True)` states that unproven S0 registers hold only those values. Only then are they accepted, still with the clamp, and the pipeline records the assumption in its notes, so it is written to the manifest. Ordinary translation (`load_request`, `request_refusals`) never sets it. The draws select it through the fixture family, so their HLSL is unchanged. **Kept:** the four selector checks and the dropped-S2 control are unchanged. In the `accepted` list, the register S0 forms became constants, because they now need the contract. Each of them is covered again in the new contract controls. **New controls:** an unproven S0 is refused without the contract (three spellings, exact message), and the same words are accepted with it, with the note. `ubyte0..3` are accepted without the contract, in e32 and e64. Each refused form above has its own control. Each new control fails on the previous code, on a version where the contract is always on, on a version where the proof survives a later write, and on a version where the proof accepts modifiers. Linux: the check (with `binary /usr/bin/llvm-mc`; the words are unchanged), all `startup_gfx2hlsl_*_check.py`, `startup_translator_check.py` and `docs_links_check.py` pass. `git diff --check` is clean. The draws were not rerun: the fixture HLSL is the same, only the way the contract is selected changed. A Windows rerun of `startup_gfx2hlsl_cvt_pk_u8_(controls|warp|hardware)` would confirm it. AI-assisted.
denn0x commented 2026-11-25 02:02:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-25T01:07:44Z.


Thanks. One concern about the register path.

In a private executable's pixel programs (decode only, aggregate counts):

  • 212 instructions are v_cvt_pk_u8_f32;
  • in 208 of them, S0 comes straight from a v_mul_f32 right before it, with no rounding instruction in between. That looks like the usual x * 255.0 pack to unorm8.

So the precondition in the comment ("the program must keep it inside the set") does not hold for these programs: S0 is generally not an integer.

  • If the hardware rounds to nearest, truncating with uint(clamp(...)) gives a byte one lower for about half the inputs.
  • If the hardware truncates, the lowering is right, but then that needs a citation. The guides leave flt32_to_uint8 undefined, as you note.

Two options:

  1. Refuse a register S0 unless it is proven integral (for example, produced by v_rndne_f32 / v_floor_f32 / v_cvt_f32_u32). That keeps the PR exact for what it can prove.
  2. Find the rounding: a hardware readback on any RDNA 2 adapter (the op is the same), or how Mesa/LLVM use the instruction for pack_unorm_4x8. If the compiler relies on it without an explicit round, that is strong evidence that the hardware rounds.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149234155 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#issuecomment-7149234155). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-25T01:07:44Z. --- Thanks. One concern about the register path. In a private executable's pixel programs (decode only, aggregate counts): - 212 instructions are `v_cvt_pk_u8_f32`; - in 208 of them, S0 comes straight from a `v_mul_f32` right before it, with no rounding instruction in between. That looks like the usual `x * 255.0` pack to unorm8. So the precondition in the comment ("the program must keep it inside the set") does not hold for these programs: S0 is generally not an integer. - If the hardware rounds to nearest, truncating with `uint(clamp(...))` gives a byte one lower for about half the inputs. - If the hardware truncates, the lowering is right, but then that needs a citation. The guides leave `flt32_to_uint8` undefined, as you note. Two options: 1. Refuse a register S0 unless it is proven integral (for example, produced by `v_rndne_f32` / `v_floor_f32` / `v_cvt_f32_u32`). That keeps the PR exact for what it can prove. 2. Find the rounding: a hardware readback on any RDNA 2 adapter (the op is the same), or how Mesa/LLVM use the instruction for `pack_unorm_4x8`. If the compiler relies on it without an explicit round, that is strong evidence that the hardware rounds.
Ybucaille commented 2026-11-25 02:02:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T01:15:19Z.


Thanks, @denn0x. Our comments crossed: 1afe5a69 (pushed a few seconds before yours) is your option 1, slightly stricter. A register S0 is accepted without the explicit fixture contract only when it comes straight from v_cvt_f32_ubyte0..3. v_rndne_f32 / v_floor_f32 / v_cvt_f32_u32 prove an integer but not the range: a negative value or one above 255 would still reach the clamp, and the clamp is exactly the undefined part. So the 208 v_mul_f32 → v_cvt_pk_u8_f32 sequences from your scan are refused in ordinary translation.

On option 2, the only measurement I found is second-hand and not on RDNA. shadPS4 #5194 (https://github.com/shadps4-emu/shadPS4/pull/5194, merged 2026-10-01) reports a hardware test on PS4 (GCN). Its findings:

  • round half to even: 1.5 → 2, 2.5 → 2, 127.5 → 128, 254.5 → 254;
  • saturation to 0..255: 256 and +inf → 255, negative values and -inf → 0;
  • NaN → 0;
  • byte select by S1 & 3.

The PR does not describe the test protocol. Nothing else I checked defines the conversion. LLVM has no semantics comment, no constant folding and no pattern for int_amdgcn_cvt_pk_u8_f32. Mesa ACO only emits it to write exact 8-bit constants on GFX10+, never for pack_unorm_4x8, so it says nothing about rounding.

If that holds on RDNA, the truncating uint(clamp(...)) would indeed be one too low for about half of the x * 255.0 inputs, as you say. So I'd keep this PR to the proven domain and lower the general form (round half to even, saturate, NaN → 0) in a follow-up, once there is an RDNA readback of the cases above. Anyone with an RDNA 2 adapter who can run a raw gfx10 compute shader would settle it.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149361504 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#issuecomment-7149361504). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-25T01:15:19Z. --- Thanks, @denn0x. Our comments crossed: 1afe5a69 (pushed a few seconds before yours) is your option 1, slightly stricter. A register S0 is accepted without the explicit fixture contract only when it comes straight from `v_cvt_f32_ubyte0..3`. `v_rndne_f32` / `v_floor_f32` / `v_cvt_f32_u32` prove an integer but not the range: a negative value or one above 255 would still reach the clamp, and the clamp is exactly the undefined part. So the 208 `v_mul_f32` → `v_cvt_pk_u8_f32` sequences from your scan are refused in ordinary translation. On option 2, the only measurement I found is second-hand and not on RDNA. shadPS4 #5194 (https://github.com/shadps4-emu/shadPS4/pull/5194, merged 2026-10-01) reports a hardware test on PS4 (GCN). Its findings: - round half to even: 1.5 → 2, 2.5 → 2, 127.5 → 128, 254.5 → 254; - saturation to 0..255: 256 and +inf → 255, negative values and -inf → 0; - NaN → 0; - byte select by `S1 & 3`. The PR does not describe the test protocol. Nothing else I checked defines the conversion. LLVM has no semantics comment, no constant folding and no pattern for `int_amdgcn_cvt_pk_u8_f32`. Mesa ACO only emits it to write exact 8-bit constants on GFX10+, never for `pack_unorm_4x8`, so it says nothing about rounding. If that holds on RDNA, the truncating `uint(clamp(...))` would indeed be one too low for about half of the `x * 255.0` inputs, as you say. So I'd keep this PR to the proven domain and lower the general form (round half to even, saturate, NaN → 0) in a follow-up, once there is an RDNA readback of the cases above. Anyone with an RDNA 2 adapter who can run a raw gfx10 compute shader would settle it. AI-assisted.
rasptum commented 2026-11-25 02:02:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-25T01:40:34Z.


### Independent Windows rerun at 1afe5a69

Measured on a physical machine, not CI. The PR head 1afe5a69e748b408b7f38c84b0879abe85cd2d41 was merged into origin/main 4c1b27dd first, so the tree under test is merge commit c6583bb0 (merge was clean).

Command

ctest --preset dev --no-tests=error -R "^startup_(gfx2hlsl_cvt_pk_u8|gfx2hlsl_interp_f16)_(controls|warp|hardware)$" --output-on-failure

Result: 3/3 passed, 0 failed, no skips

Test Result Time
startup_gfx2hlsl_cvt_pk_u8_controls Passed 0.20 s
startup_gfx2hlsl_cvt_pk_u8_warp Passed 0.85 s
startup_gfx2hlsl_cvt_pk_u8_hardware Passed 2.70 s

Environment, copied from the draw runs themselves:

WARP:

backend=warp debug_layer=enabled
adapter=Microsoft Basic Render Driver vendor=1414 device=008c
driver=10.0.19041.5794

Hardware:

backend=hardware debug_layer=enabled
adapter=NVIDIA GeForce RTX 3060 vendor=10de device=2503
driver=32.0.15.9636

Host: Windows 10 Pro 22H2, build 19045.6466; MSVC x64 Debug (dev preset); DXC 1.7.2308.16 (Windows SDK 10.0.26100.0).

Notes

  • The debug layer was available and enabled on both adapters, and the test reported no debug-layer errors. No capability skip: every leg returned 0, so this is a pass and not a skip.
  • --no-tests=error matched exactly the three expected names. The interp_f16 half of the filter belongs to a different branch and is not registered here, so it selected nothing extra.
  • Not covered by this run: the /O2 (release) configuration. The workflow skips build-and-test-release on pull requests (if: github.event_name != 'pull_request'), so nothing has exercised this change at /O2 yet.
  • What this establishes: the new v_cvt_pk_u8_f32 lowering and its drawn pixel output agree with the fixture's expected words on WARP and on the RTX 3060 at this head. It says nothing about any other form or about title startup.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149825365 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#issuecomment-7149825365). Originally posted by [rasptum](https://github.com/rasptum) on 2026-11-25T01:40:34Z. --- ### Independent Windows rerun at `1afe5a69` Measured on a physical machine, not CI. The PR head `1afe5a69e748b408b7f38c84b0879abe85cd2d41` was merged into `origin/main` `4c1b27dd` first, so the tree under test is merge commit `c6583bb0` (merge was clean). **Command** ``` ctest --preset dev --no-tests=error -R "^startup_(gfx2hlsl_cvt_pk_u8|gfx2hlsl_interp_f16)_(controls|warp|hardware)$" --output-on-failure ``` **Result: 3/3 passed, 0 failed, no skips** | Test | Result | Time | | --- | --- | --- | | `startup_gfx2hlsl_cvt_pk_u8_controls` | Passed | 0.20 s | | `startup_gfx2hlsl_cvt_pk_u8_warp` | Passed | 0.85 s | | `startup_gfx2hlsl_cvt_pk_u8_hardware` | Passed | 2.70 s | **Environment**, copied from the draw runs themselves: WARP: ``` backend=warp debug_layer=enabled adapter=Microsoft Basic Render Driver vendor=1414 device=008c driver=10.0.19041.5794 ``` Hardware: ``` backend=hardware debug_layer=enabled adapter=NVIDIA GeForce RTX 3060 vendor=10de device=2503 driver=32.0.15.9636 ``` Host: Windows 10 Pro 22H2, build 19045.6466; MSVC x64 Debug (`dev` preset); DXC 1.7.2308.16 (Windows SDK 10.0.26100.0). **Notes** - The debug layer was available and enabled on both adapters, and the test reported no debug-layer errors. No capability skip: every leg returned 0, so this is a pass and not a skip. - `--no-tests=error` matched exactly the three expected names. The `interp_f16` half of the filter belongs to a different branch and is not registered here, so it selected nothing extra. - Not covered by this run: the `/O2` (release) configuration. The workflow skips `build-and-test-release` on pull requests (`if: github.event_name != 'pull_request'`), so nothing has exercised this change at `/O2` yet. - What this establishes: the new `v_cvt_pk_u8_f32` lowering and its drawn pixel output agree with the fixture's expected words on WARP and on the RTX 3060 at this head. It says nothing about any other form or about title startup.
Ybucaille commented 2026-11-25 02:02:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T01:46:05Z.


Thanks @rasptum for the RTX 3060 / WARP run, and @tedin7 for the review and the mutations.

Nits:

  • The docs one is done in 73769831: the proven-register rule now has its own paragraph.
  • I kept getattr(self, 'byte_float_v', ...) as is. Several checks build bare Stage objects (Stage.__new__, or the Probe helpers in startup_gfx2hlsl_*_check.py) that skip both __init__ and translate(). They then call set_v or the op handlers directly. Initialising the set in __init__ or translate() and reading it directly broke 14 of those checks with AttributeError. The guard follows the existing uniform_v pattern for the same reason.

That commit only changes docs/experiments.md, so the draws above still apply.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149932955 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#issuecomment-7149932955). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-25T01:46:05Z. --- Thanks @rasptum for the RTX 3060 / WARP run, and @tedin7 for the review and the mutations. Nits: - The docs one is done in 73769831: the proven-register rule now has its own paragraph. - I kept `getattr(self, 'byte_float_v', ...)` as is. Several checks build bare `Stage` objects (`Stage.__new__`, or the `Probe` helpers in `startup_gfx2hlsl_*_check.py`) that skip both `__init__` and `translate()`. They then call `set_v` or the op handlers directly. Initialising the set in `__init__` or `translate()` and reading it directly broke 14 of those checks with `AttributeError`. The guard follows the existing `uniform_v` pattern for the same reason. That commit only changes `docs/experiments.md`, so the draws above still apply. AI-assisted.
tedin7 commented 2026-11-25 03:00:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:53:24Z.

Review: COMMENTED


Review of head 73769831d758cf260248bfee694549dbe54480e0 (comment only, no approval).

Verdict: logic looks sound; one blocker, the branch conflicts with main.

Findings

  • P1: GitHub reports mergeable: CONFLICTING. git merge-tree --write-tree origin/main HEAD reports a content conflict in tools/startup/gfx2hlsl.py (windows.yml, CMakeLists.txt and docs/experiments.md auto-merge). Please rebase and re-run the checks below.
  • P2: none.
  • Nit: getattr(self, 'byte_float_v', set()).discard(n) in set_v allocates a throwaway set on every register write when the attribute is absent. Initialising byte_float_v in the Stage constructor would remove the getattr/setdefault indirection in both places.

What I checked

  • The constant S0 gate (+0.0 or an integer in 1..255) matches what tools/compute_store_aot.py accepts for the same opcode, and the PR text states the undefined flt32_to_uint8 behaviour honestly.
  • A register S0 is accepted only when it was written by v_cvt_f32_ubyte0..3 with no modifier, with straight-line code and full exec, and with no write since. Every write goes through set_v, which clears the proof, including the fma_mix path. Otherwise it is refused unless the fixture-only pk_u8_s0_contract is selected, and that choice is recorded in the pipeline notes.
  • The byte insert formula matches the ISA text: mask 0xff << 8*S1[1:0], merge into S2.
  • CI on this head: Linux checks, gfx1013 fixtures and Windows build all pass. The /O2 job and the coverage chart job were skipped. I did not run the Windows WARP job (win2025), because the PR's own Windows CI job passed and the draw test is in that job.

Commands run locally

  • python3 tests/startup_gfx2hlsl_cvt_pk_u8_check.py -> v_cvt_pk_u8_f32: 8 draw sets: ok, mutation changes draw set 0: ok
  • python3 tests/startup_gfx2hlsl_lane_alu.py -> accepted forms translate: ok, refused forms stay refused: ok, Self-test passed.
  • python3 tests/docs_links_check.py -> Checked 18 Markdown files and 393 links.
  • python3 tests/bidi_controls_check.py -> no bidirectional controls.
  • git diff --check origin/main...HEAD -> clean
  • Mutation 1: forced the proof check to always fail (src[1] not in byte_float_v replaced by False). The tests failed with unproven S0 refused without the contract, so the mutation was killed.
  • Mutation 2: removed the proof-clearing discard in set_v. The tests failed with a float multiply is refused without the contract, so the mutation was killed.
  • Both mutations were reverted with git checkout -- ..

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6051143321 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#pullrequestreview-6051143321). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T02:53:24Z. **Review:** COMMENTED --- Review of head `73769831d758cf260248bfee694549dbe54480e0` (comment only, no approval). **Verdict: logic looks sound; one blocker, the branch conflicts with main.** Findings - P1: GitHub reports `mergeable: CONFLICTING`. `git merge-tree --write-tree origin/main HEAD` reports a content conflict in `tools/startup/gfx2hlsl.py` (windows.yml, CMakeLists.txt and docs/experiments.md auto-merge). Please rebase and re-run the checks below. - P2: none. - Nit: `getattr(self, 'byte_float_v', set()).discard(n)` in `set_v` allocates a throwaway set on every register write when the attribute is absent. Initialising `byte_float_v` in the Stage constructor would remove the `getattr`/`setdefault` indirection in both places. What I checked - The constant S0 gate (+0.0 or an integer in 1..255) matches what `tools/compute_store_aot.py` accepts for the same opcode, and the PR text states the undefined `flt32_to_uint8` behaviour honestly. - A register S0 is accepted only when it was written by `v_cvt_f32_ubyte0..3` with no modifier, with straight-line code and full exec, and with no write since. Every write goes through `set_v`, which clears the proof, including the fma_mix path. Otherwise it is refused unless the fixture-only `pk_u8_s0_contract` is selected, and that choice is recorded in the pipeline notes. - The byte insert formula matches the ISA text: mask `0xff << 8*S1[1:0]`, merge into S2. - CI on this head: Linux checks, gfx1013 fixtures and Windows build all pass. The /O2 job and the coverage chart job were skipped. I did not run the Windows WARP job (`win2025`), because the PR's own Windows CI job passed and the draw test is in that job. Commands run locally - `python3 tests/startup_gfx2hlsl_cvt_pk_u8_check.py` -> `v_cvt_pk_u8_f32: 8 draw sets: ok`, `mutation changes draw set 0: ok` - `python3 tests/startup_gfx2hlsl_lane_alu.py` -> `accepted forms translate: ok`, `refused forms stay refused: ok`, `Self-test passed.` - `python3 tests/docs_links_check.py` -> `Checked 18 Markdown files and 393 links.` - `python3 tests/bidi_controls_check.py` -> `no bidirectional controls.` - `git diff --check origin/main...HEAD` -> clean - Mutation 1: forced the proof check to always fail (`src[1] not in byte_float_v` replaced by `False`). The tests failed with `unproven S0 refused without the contract`, so the mutation was killed. - Mutation 2: removed the proof-clearing discard in `set_v`. The tests failed with `a float multiply is refused without the contract`, so the mutation was killed. - Both mutations were reverted with `git checkout -- .`. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 05:04:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T04:09:03Z.

Review: COMMENTED


Re-review of head 2487e8f8888c5f78acf8c06c183856b32aa85bf9 (comment only, no approval).

Verdict: the earlier P1 (merge conflict with main) is resolved. No blocking findings.

Earlier P1 check

  • GitHub now reports mergeable: MERGEABLE.
  • git merge-tree --write-tree origin/main HEAD returns a clean tree, with no conflict in tools/startup/gfx2hlsl.py.
  • The head is a merge of main into the branch. The diff against main is 6 files, +246/-6, the same scope as before.

CI on this head: Linux checks, gfx1013 fixtures and Windows build pass. The /O2 job and the coverage chart job were skipped.

Commands run locally on Linux (output summarised)

  • python3 -B tests/startup_gfx2hlsl_cvt_pk_u8_check.py -> all ok, rc=0
  • python3 -B tests/startup_gfx2hlsl_cvt_alu_check.py -> all ok, rc=0
  • python3 tests/docs_links_check.py -> 18 files, 405 links OK
  • python3 tests/bidi_controls_check.py -> OK
  • git diff --check origin/main...HEAD -> clean
  • Mutation: widened the constant bound from 255 to 256 in tools/startup/gfx2hlsl.py. The new check fails. The change was reverted with git checkout -- ..

P1: none.

P2: none.

Nits (unchanged, not blocking)

  • getattr(self, 'byte_float_v', set()).discard(n) in set_v allocates a set on every write. Initialising byte_float_v in the constructor would remove the getattr/setdefault indirection.

Not run: a Windows WARP/hardware draw. The CI Windows job passed on this head. A maintainer who wants a local GPU readback should run startup_gfx2hlsl_cvt_pk_u8_warp.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6051730876 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#pullrequestreview-6051730876). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T04:09:03Z. **Review:** COMMENTED --- Re-review of head `2487e8f8888c5f78acf8c06c183856b32aa85bf9` (comment only, no approval). **Verdict: the earlier P1 (merge conflict with main) is resolved. No blocking findings.** **Earlier P1 check** - GitHub now reports `mergeable: MERGEABLE`. - `git merge-tree --write-tree origin/main HEAD` returns a clean tree, with no conflict in `tools/startup/gfx2hlsl.py`. - The head is a merge of main into the branch. The diff against main is 6 files, +246/-6, the same scope as before. **CI on this head:** Linux checks, gfx1013 fixtures and Windows build pass. The /O2 job and the coverage chart job were skipped. **Commands run locally on Linux (output summarised)** - `python3 -B tests/startup_gfx2hlsl_cvt_pk_u8_check.py` -> all ok, rc=0 - `python3 -B tests/startup_gfx2hlsl_cvt_alu_check.py` -> all ok, rc=0 - `python3 tests/docs_links_check.py` -> 18 files, 405 links OK - `python3 tests/bidi_controls_check.py` -> OK - `git diff --check origin/main...HEAD` -> clean - Mutation: widened the constant bound from 255 to 256 in `tools/startup/gfx2hlsl.py`. The new check fails. The change was reverted with `git checkout -- .`. **P1:** none. **P2:** none. **Nits (unchanged, not blocking)** - `getattr(self, 'byte_float_v', set()).discard(n)` in `set_v` allocates a set on every write. Initialising `byte_float_v` in the constructor would remove the `getattr`/`setdefault` indirection. **Not run:** a Windows WARP/hardware draw. The CI Windows job passed on this head. A maintainer who wants a local GPU readback should run `startup_gfx2hlsl_cvt_pk_u8_warp`. AI-assisted; commands listed were executed locally.
Ybucaille commented 2026-11-25 05:04:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T04:04:55Z.


Merged main (4b9490ac) into the branch; new head 2487e8f8, mergeable again. One conflict in tools/startup/gfx2hlsl.py: Pipeline.__init__ now takes both ps_attr_map (from main) and pk_u8_s0_contract. The three PR commits are unchanged.

Re-run locally on the new head: startup_gfx2hlsl_cvt_pk_u8_check.py, startup_gfx2hlsl_lane_alu.py, startup_translator_check.py, docs_links_check.py, bidi_controls_check.py, plus all 41 tests/startup_gfx2hlsl_*_check.py (including the ones main just added): all exit 0. git diff --check origin/main...HEAD is clean.

On the byte_float_v nit: kept the getattr, since the bare Stage objects in the checks skip __init__ (see my earlier comment).

@tedin7, since you offered: could you run the Windows draws on 2487e8f8 when your server is free?

ctest --preset dev --no-tests=error -R "^startup_gfx2hlsl_cvt_pk_u8_(controls|warp|hardware)$" --output-on-failure

The /O2 (release) configuration is still untested for this change.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7152511162 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#issuecomment-7152511162). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-25T04:04:55Z. --- Merged `main` (`4b9490ac`) into the branch; new head `2487e8f8`, mergeable again. One conflict in `tools/startup/gfx2hlsl.py`: `Pipeline.__init__` now takes both `ps_attr_map` (from `main`) and `pk_u8_s0_contract`. The three PR commits are unchanged. Re-run locally on the new head: `startup_gfx2hlsl_cvt_pk_u8_check.py`, `startup_gfx2hlsl_lane_alu.py`, `startup_translator_check.py`, `docs_links_check.py`, `bidi_controls_check.py`, plus all 41 `tests/startup_gfx2hlsl_*_check.py` (including the ones `main` just added): all exit 0. `git diff --check origin/main...HEAD` is clean. On the `byte_float_v` nit: kept the `getattr`, since the bare `Stage` objects in the checks skip `__init__` (see my earlier comment). @tedin7, since you offered: could you run the Windows draws on `2487e8f8` when your server is free? ``` ctest --preset dev --no-tests=error -R "^startup_gfx2hlsl_cvt_pk_u8_(controls|warp|hardware)$" --output-on-failure ``` The `/O2` (release) configuration is still untested for this change.
tedin7 commented 2026-11-25 06:01:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T05:20:41Z.

Review: COMMENTED


Re-review of head 77b36dddbf6b69b67eaba4816311fe9ec840fa00 (a merge of main only; the PR's own diff is unchanged in substance since the previous reviewed head).

Scope: v_cvt_pk_u8_f32 lowering in tools/startup/gfx2hlsl.py, new tests/startup_gfx2hlsl_cvt_pk_u8_check.py, lane_alu fixture hook (pipeline kwargs), CMake and workflow wiring.

Commands executed locally in a clean worktree of this head:

  • git diff --stat origin/main...HEAD: 6 files, +246/-6.
  • python3 -B tests/startup_gfx2hlsl_cvt_pk_u8_check.py: four lanes translated ok; 8 draw sets ok; mutation changes draw set 0 ok.
  • python3 -B tests/startup_gfx2hlsl_lane_alu.py: accepted forms translate ok; refused forms stay refused ok.
  • python3 tests/docs_links_check.py: 18 files, 407 links, ok.
  • python3 tests/bidi_controls_check.py: 1489 files, no bidi controls.
  • git diff --check origin/main...HEAD: clean.
  • Mutation 1: disabled the constant-source domain refusal (if False). The refused-forms check fails, so it is killed.
  • Mutation 2: changed the byte-select mask & 3u to & 7u. The translated-text check fails, so it is killed.
  • Worktree is clean after git checkout -- ..
  • gh pr checks: Linux checks, gfx1013 fixtures and Windows build/test are green. The /O2 job and the chart publish were skipped. The PR is mergeable.
  • I did not run the Windows VM myself. The draw tests (WARP and hardware) are covered by the PR's own Windows CI job.

Findings:

  • P1: none.
  • P2: none.
  • Nit: byte_float_v is read through getattr(self, ..., ()) and created through __dict__.setdefault. A normal attribute set in __init__ would be simpler and would not hide a typo. Optional.
  • Nit: set_v discards the proof, but any future path that writes self.v[...] without set_v would keep a stale proof. Today I found no such path. A short comment at the proof site would help.

Semantics: the formula D = (S2 & ~(0xff << 8*S1[1:0])) | ((cvt(S0) & 0xff) << 8*S1[1:0]) matches the ISA text. Leaving the undefined flt32_to_uint8 cases out by requiring S0 to be +0.0 or an integer in 1..255 is conservative, and the proof/contract split is clear. Titles and text are neutral and clean-room.

Verdict: no blocking issues from this review.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052237546 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#pullrequestreview-6052237546). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T05:20:41Z. **Review:** COMMENTED --- Re-review of head `77b36dddbf6b69b67eaba4816311fe9ec840fa00` (a merge of main only; the PR's own diff is unchanged in substance since the previous reviewed head). Scope: `v_cvt_pk_u8_f32` lowering in `tools/startup/gfx2hlsl.py`, new `tests/startup_gfx2hlsl_cvt_pk_u8_check.py`, `lane_alu` fixture hook (`pipeline` kwargs), CMake and workflow wiring. Commands executed locally in a clean worktree of this head: - `git diff --stat origin/main...HEAD`: 6 files, +246/-6. - `python3 -B tests/startup_gfx2hlsl_cvt_pk_u8_check.py`: four lanes translated ok; 8 draw sets ok; mutation changes draw set 0 ok. - `python3 -B tests/startup_gfx2hlsl_lane_alu.py`: accepted forms translate ok; refused forms stay refused ok. - `python3 tests/docs_links_check.py`: 18 files, 407 links, ok. - `python3 tests/bidi_controls_check.py`: 1489 files, no bidi controls. - `git diff --check origin/main...HEAD`: clean. - Mutation 1: disabled the constant-source domain refusal (`if False`). The refused-forms check fails, so it is killed. - Mutation 2: changed the byte-select mask `& 3u` to `& 7u`. The translated-text check fails, so it is killed. - Worktree is clean after `git checkout -- .`. - `gh pr checks`: Linux checks, gfx1013 fixtures and Windows build/test are green. The /O2 job and the chart publish were skipped. The PR is mergeable. - I did not run the Windows VM myself. The draw tests (WARP and hardware) are covered by the PR's own Windows CI job. Findings: - P1: none. - P2: none. - Nit: `byte_float_v` is read through `getattr(self, ..., ())` and created through `__dict__.setdefault`. A normal attribute set in `__init__` would be simpler and would not hide a typo. Optional. - Nit: `set_v` discards the proof, but any future path that writes `self.v[...]` without `set_v` would keep a stale proof. Today I found no such path. A short comment at the proof site would help. Semantics: the formula `D = (S2 & ~(0xff << 8*S1[1:0])) | ((cvt(S0) & 0xff) << 8*S1[1:0])` matches the ISA text. Leaving the undefined `flt32_to_uint8` cases out by requiring S0 to be +0.0 or an integer in 1..255 is conservative, and the proof/contract split is clear. Titles and text are neutral and clean-room. Verdict: no blocking issues from this review. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 06:01:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T05:59:28Z.

Review: COMMENTED


Re-review of head e556be5e11 (changes since 77b36ddd: byte_float_v becomes a class default, set_v and the proof/lookup sites no longer use getattr/__dict__.setdefault).

Verdict: no P1, no P2.

What I checked

  • git diff --stat origin/main...HEAD: 6 files, gfx2hlsl.py + one new check + lane_alu hook + CMake/CI/docs. Title is neutral, PR is MERGEABLE.
  • CI on this head: Linux Python checks, gfx1013 fixtures and Windows build/test all pass (the /O2 and chart jobs are skipped).
  • The only VGPR write path in the emitter is set_v (single emit('v%d = ...') at gfx2hlsl.py:630), and set_v is where the proof is dropped. The new comment at the proof site states this contract. Good.
  • The class default () is falsy, so set_v skips the discard until the first proof creates a per-instance set. No shared mutable state between stages.
  • The proof is only granted with no modifiers, known exec and no branches. A constant S0 outside +0.0 / 1..255 is refused. Any other register needs the explicit pk_u8_s0_contract, and that choice is recorded in pipe.notes.
  • The formula matches the ISA text quoted in the comment: D = (S2 & ~(0xff << 8*S1[1:0])) | ((cvt(S0) & 0xff) << 8*S1[1:0]).

Commands run locally on the head

  • python3 -B tests/startup_gfx2hlsl_cvt_pk_u8_check.py: all steps ok (four lanes translated, 8 draw sets, mutation changes draw set 0, accepted/refused forms).
  • python3 -B tests/startup_gfx2hlsl_lane_alu.py: Self-test passed.
  • python3 tests/docs_links_check.py: 18 files, 407 links ok.
  • python3 tests/bidi_controls_check.py: no bidirectional controls.
  • git diff --check origin/main...HEAD: clean.

Mutations (each reverted with git checkout -- .)

  1. set_v no longer discards the proof: killed (AssertionError: a float multiply is refused without the contract).
  2. Select mask & 3u changed to & 1u: killed (translated text reads 42fe0000 12345676 01fe7f80).

Windows: I did not run the Win2025 pipeline. The WARP/hardware draw tests are registered in CMake and the Windows CI job passed on this head.

Nits (non-blocking)

  • nit: byte_float_v is typed as a tuple at class level but becomes a set on first use. A one-word comment would make the switch explicit.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052576283 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#pullrequestreview-6052576283). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T05:59:28Z. **Review:** COMMENTED --- Re-review of head e556be5e11ac0e7bd987214914ee6ad55d6a87da (changes since 77b36ddd: `byte_float_v` becomes a class default, `set_v` and the proof/lookup sites no longer use `getattr`/`__dict__.setdefault`). **Verdict: no P1, no P2.** What I checked - `git diff --stat origin/main...HEAD`: 6 files, gfx2hlsl.py + one new check + lane_alu hook + CMake/CI/docs. Title is neutral, PR is MERGEABLE. - CI on this head: Linux Python checks, gfx1013 fixtures and Windows build/test all pass (the /O2 and chart jobs are skipped). - The only VGPR write path in the emitter is `set_v` (single `emit('v%d = ...')` at gfx2hlsl.py:630), and `set_v` is where the proof is dropped. The new comment at the proof site states this contract. Good. - The class default `()` is falsy, so `set_v` skips the discard until the first proof creates a per-instance `set`. No shared mutable state between stages. - The proof is only granted with no modifiers, known exec and no branches. A constant S0 outside +0.0 / 1..255 is refused. Any other register needs the explicit `pk_u8_s0_contract`, and that choice is recorded in `pipe.notes`. - The formula matches the ISA text quoted in the comment: `D = (S2 & ~(0xff << 8*S1[1:0])) | ((cvt(S0) & 0xff) << 8*S1[1:0])`. Commands run locally on the head - `python3 -B tests/startup_gfx2hlsl_cvt_pk_u8_check.py`: all steps ok (four lanes translated, 8 draw sets, mutation changes draw set 0, accepted/refused forms). - `python3 -B tests/startup_gfx2hlsl_lane_alu.py`: Self-test passed. - `python3 tests/docs_links_check.py`: 18 files, 407 links ok. - `python3 tests/bidi_controls_check.py`: no bidirectional controls. - `git diff --check origin/main...HEAD`: clean. Mutations (each reverted with `git checkout -- .`) 1. `set_v` no longer discards the proof: killed (`AssertionError: a float multiply is refused without the contract`). 2. Select mask `& 3u` changed to `& 1u`: killed (`translated text reads 42fe0000 12345676 01fe7f80`). Windows: I did not run the Win2025 pipeline. The WARP/hardware draw tests are registered in CMake and the Windows CI job passed on this head. Nits (non-blocking) - nit: `byte_float_v` is typed as a tuple at class level but becomes a `set` on first use. A one-word comment would make the switch explicit. AI-assisted; commands listed were executed locally.
Ybucaille commented 2026-11-25 06:01:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T05:16:38Z.


Merged main again (13 new commits, conflicts in set_v, the v_cvt_f32_* path with the new low16_only operands, and Pipeline.__init__ with srv_formats; both sides kept). New head 77b36ddd, mergeable; all tests/startup_gfx2hlsl_*_check.py and startup_translator_check.py pass locally. @tedin7, please use 77b36ddd rather than 2487e8f8 for the Windows draws.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7153615445 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#issuecomment-7153615445). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-25T05:16:38Z. --- Merged `main` again (13 new commits, conflicts in `set_v`, the `v_cvt_f32_*` path with the new `low16_only` operands, and `Pipeline.__init__` with `srv_formats`; both sides kept). New head `77b36ddd`, mergeable; all `tests/startup_gfx2hlsl_*_check.py` and `startup_translator_check.py` pass locally. @tedin7, please use `77b36ddd` rather than `2487e8f8` for the Windows draws.
Ybucaille commented 2026-11-25 06:01:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T05:54:56Z.


Thanks @tedin7. Both nits done in e556be5e: byte_float_v now has an immutable class default () replaced by a set on the first proof (same pattern as low16_only_v), so the getattr / __dict__.setdefault indirection is gone and probes without __init__ still work. The proof site now says that every VGPR write must go through set_v, which drops the proof. Mutation tried: skipping the drop in set_v makes startup_gfx2hlsl_cvt_pk_u8_check.py fail. All startup_gfx2hlsl_* checks pass locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154260296 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#issuecomment-7154260296). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-25T05:54:56Z. --- Thanks @tedin7. Both nits done in e556be5e: `byte_float_v` now has an immutable class default `()` replaced by a set on the first proof (same pattern as `low16_only_v`), so the `getattr` / `__dict__.setdefault` indirection is gone and probes without `__init__` still work. The proof site now says that every VGPR write must go through `set_v`, which drops the proof. Mutation tried: skipping the drop in `set_v` makes `startup_gfx2hlsl_cvt_pk_u8_check.py` fail. All `startup_gfx2hlsl_*` checks pass locally.
upstream-sync closed this pull request 2026-11-25 07:00:53 +00:00
R0Y00 commented 2026-11-25 07:00:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T06:05:52Z.

Review: APPROVED


The original S0 finding is resolved. Ordinary translation refuses an unproven value, and an explicitly selected profile records its input contract. All four byte selectors and the lost-S2 mutation verified independently on WARP and RTX 4060 Laptop.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052629041 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#pullrequestreview-6052629041). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T06:05:52Z. **Review:** APPROVED --- The original S0 finding is resolved. Ordinary translation refuses an unproven value, and an explicitly selected profile records its input contract. All four byte selectors and the lost-S2 mutation verified independently on WARP and RTX 4060 Laptop.
legacy-code-archaeologist commented 2026-11-25 07:01:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-25T06:05:47Z.


Ran head e556be5e on three adapters. All pass. Windows 11 build 26100, debug layer unavailable, FXC and DXC from SDK 10.0.26100.0.

Test Adapter Driver Result
startup_gfx2hlsl_cvt_pk_u8_controls n/a n/a pass
startup_gfx2hlsl_cvt_pk_u8_warp Microsoft Basic Render Driver 10.0.26100.8972 pass
startup_gfx2hlsl_cvt_pk_u8_hardware (XBOX2WINDOWS_ADAPTER=Quadro) NVIDIA Quadro M1000M (Maxwell) 32.0.15.7371 pass
startup_gfx2hlsl_cvt_pk_u8_hardware (XBOX2WINDOWS_ADAPTER=Intel) Intel HD Graphics 530 (Gen9) 31.0.101.2111 pass

Every run printed the same 5 ok lines, and the FXC and DXC mutations each failed as expected, for example fxc v_cvt_pk_u8_f32 mutation: fails as expected, reads 00000000,00000100,007f0000,ff000000.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154436347 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2101#issuecomment-7154436347). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-25T06:05:47Z. --- Ran head `e556be5e` on three adapters. All pass. Windows 11 build 26100, debug layer unavailable, FXC and DXC from SDK 10.0.26100.0. | Test | Adapter | Driver | Result | |---|---|---|---| | `startup_gfx2hlsl_cvt_pk_u8_controls` | n/a | n/a | pass | | `startup_gfx2hlsl_cvt_pk_u8_warp` | Microsoft Basic Render Driver | 10.0.26100.8972 | pass | | `startup_gfx2hlsl_cvt_pk_u8_hardware` (`XBOX2WINDOWS_ADAPTER=Quadro`) | NVIDIA Quadro M1000M (Maxwell) | 32.0.15.7371 | pass | | `startup_gfx2hlsl_cvt_pk_u8_hardware` (`XBOX2WINDOWS_ADAPTER=Intel`) | Intel HD Graphics 530 (Gen9) | 31.0.101.2111 | pass | Every run printed the same 5 ok lines, and the FXC and DXC mutations each failed as expected, for example `fxc v_cvt_pk_u8_f32 mutation: fails as expected, reads 00000000,00000100,007f0000,ff000000`. _AI-assisted._
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2094
No description provided.