pixel_aot: lower v_min3_f32, v_max3_f32 and v_med3_f32 #168
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/169"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T17:54:28Z.
Change
tools/pixel_aot.pynow accepts the three-operand float minimum, maximum and median instructions (v_min3_f32,v_max3_f32,v_med3_f32) in the existing arithmetic path. They are emitted as nested HLSLmin/max; the median ismax(min(a, b), min(max(a, b), c)). Operand modifiers (-,|x|) andclampgo through the same handling as the other VOP3 arithmetic. Other data types (_i32,_u32,_f16) and wrong operand counts are still rejected.tests/pixel_aot_check.pyadds athree_way()fixture that loads four constants and writes:|constant|, green and the clamped red.Every result is one of its inputs, so the CPU reference (
three_way_case) is exact in binary32 before the round-toward-zero half export. The draw uses two constant sets,(0.25, 0.75, 0.375, 0.5)and(0.625, 0.125, -0.3125, 0.5); the second reverses the clamp bounds and makes the|s46|modifier matter.docs/experiments.md#offline-pixel-shader-recompilationlists the new instructions, the HLSL form and the unmeasured NaN behaviour, and describes the new draw and its negative controls.Verification
python3 -B tests/pixel_aot_check.py binary /usr/lib/llvm-18/bin/llvm-mc /usr/lib/llvm-18/bin/llvm-objcopy /usr/lib/llvm-18/lib/libLLVM.so.18.1passes. The fixture is assembled for gfx1013, wrapped in a synthetic record, extracted, disassembled and lowered, and the result must equal lowering the source text.tools/pixel_aot.pyfrommainfails withValueError: Unsupported instruction 20: v_med3_f32 v15, s47, v13, v12.min,maxandsorted(...)[1]; the expected HLSL lines are present; an_i32,_u32or_f16variant and a two-operandv_med3_f32are rejected; the newerexp mrt0,spelling gives identical output.|s46|modifier, 64 texels differ under the second set; with the red median replaced byv_min3_f32, 64 texels differ under both sets. The draw test uses the second set for both negative controls.ctest --preset dev --no-tests=error -R '^pixel_aot_' -Vate2f31cb(rebased on maind311159, beside #202's signed-export draw and #258's truncation draw; earlier runs at 0aaa488, 0f4a150 and 862628f gave the same result) on Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100, DXC 1.9.2602.17:pixel_aot_hardwarepassed on an NVIDIA GeForce RTX 5080 (driver 32.0.16.1692) andpixel_aot_warpon the Microsoft Basic Render Driver, every draw withpixels=4096 channels=16384 max_absolute_error=0. The D3D12 debug layer was not available. The fullctest --preset dev --no-tests=errorpassed 86/86, withbvh_wave64_hardware,bvh_wave64_warpandwave_shuffle_warpskipped.Evidence and follow-up
v_med3_f32andv_min3/max3_f32have their own NaN and IEEE-mode rules; the HLSL lowering may differ for NaN operands and for the sign of zero when+0and-0compare equal. The fixture avoids signed zeros.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T18:16:09Z.
GitHub reports a conflict on
0aaa4880. Please reconcile the three-operand entries and shader fixture lists with the arithmetic, move and predicate cases now on main. Run the LLVM round trip andpixel_aot_warpon the reconciled branch before marking ready.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T18:23:54Z.
0f4a1508retains the earlier arithmetic and predicate fixtures and the Windows check passed. GitHub now reports a conflict after #202 landed. Please keep the signedhalf_rtzcorrection and signed-export draw from #202 alongside the new three-way draw and its negative controls, and rerun the shared pixel suite.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T18:23:17Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
0f4a150ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T19:46:03Z.
Rebased on main
7233cec(862628f). The conflict was intests/pixel_aot_check.py: the form-coveragelowerwrapper from main is kept (the test now also importsALUfor the three-operand template check), and the draw step keeps #202's signedhalf_rtzexport draw and then runs the three-way draw with both constant sets and its two negative controls. The three-operand ALU entries and fixture lists sit beside the arithmetic, move, predicate and signed-export cases from main.On Windows 11 26200.9974 (MSVC 14.44.35207, SDK 10.0.26100, DXC 1.9.2602.17):
ctest --preset dev --no-tests=error -R '^pixel_aot_' -Vpassed 2/2,pixel_aot_hardwareon the RTX 5080 (driver 32.0.16.1692) andpixel_aot_warpon WARP, every draw withmax_absolute_error=0. The full suite passed 121/121. This machine has no gfx1013 LLVM, so the LLVM round trip is covered by the CI "Assemble and translate gfx1013 fixtures" job on this head.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T19:59:42Z.
The rebase preserves the signed-export draw and resolves the previous conflict. One acceptance gap remains in the shared arithmetic branch: a
min3,max3ormed3writing an outstanding image sample destination can overwrite its tracked register beforevmcnt(0). Please reject that write while the sample is pending and add a control proving the same destination is writable after the wait.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T20:28:10Z.
#273 has supplied the shared pending-destination guard and pre/post-wait controls requested above. The remaining conflicts on
862628faredocs/experiments.mdandtests/pixel_aot_check.py. Please preserve the three-way extrema controls alongside the landed pending-write and single-word-load cases.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T21:27:41Z.
At
e2f31cb, the merge conflicts are intests/pixel_aot_check.pyandtools/pixel_aot.py. Please retain main'sceilentry and draw alongside the three-way extrema.