shader: lower compute v_ldexp_f32 #1911
Open
henriazz10 wants to merge 2 commits from
upstream-pr/1918 into main
pull from: upstream-pr/1918
merge into: R0Y00:main
R0Y00:main
R0Y00:codex/indirect-large-backed-views
R0Y00:codex/word3-preflight-check
R0Y00:codex/vertex-table-two-records
R0Y00:codex/live-index-alias
R0Y00:codex/copied-vertex-buffer-srv
R0Y00:codex/windows-stage-test-output
R0Y00:codex/preserve-live-srv-retirement
R0Y00:codex/share-render-target-tracking
R0Y00:codex/sgd5-negative-offset-fixture
R0Y00:coverage-dashboard
R0Y00:codex/mesh-loose-root
R0Y00:codex/mesh86-cache-padding
R0Y00:codex/xmem-scatter-preflight
R0Y00:codex/mesh-depth-ps
R0Y00:codex/indirect-dispatch-refresh
R0Y00:codex/compute-container-index
R0Y00:codex/startup-compute-formatted-load
R0Y00:codex/compute-indirect-producer
R0Y00:codex/compute-atomic-soffset
R0Y00:codex/mesh-dual-handoff
R0Y00:codex/startup-run-sh-watcher-control
R0Y00:codex/queue31-page-alias
R0Y00:codex/indexed-indirect-compute-root
R0Y00:codex/typed-buffer-view-metadata
R0Y00:codex/translated-indexed-address-alias
R0Y00:codex/fixed-mesh-create-result
R0Y00:codex/xmem-section-lease
R0Y00:codex/startup-slot86-mesh-cache
R0Y00:codex/restore-mesh-barrier-iteration
R0Y00:codex/translated-indirect-upload-index
R0Y00:codex/xapu-completion-opt-in
R0Y00:codex/translated-indexed-rect
R0Y00:codex/translated-indexed-indirect
R0Y00:codex/startup-mesh-lds-integration
R0Y00:codex/startup-console-ms24
R0Y00:codex/startup-slot57-mesh-request
R0Y00:codex/indirect-copy-provenance
R0Y00:codex/present-color-producer-trace
R0Y00:codex/compute-dispatch-binding-trace
R0Y00:codex/translated-indirect-table-buffers
R0Y00:codex/indirect-copy-provenance-base
R0Y00:codex/mix-half-literal-source
R0Y00:codex/translated-indirect-draw
R0Y00:codex/xmem-scatter-diagnostics
R0Y00:codex/slot148-recording-upload
R0Y00:codex/slot70-loading-art-verified
R0Y00:codex/command-list-upload-arena
R0Y00:codex/recover-failed-command-list
R0Y00:codex/startup-heap-timing-notes
R0Y00:codex/align-audio-input-timeline
R0Y00:codex/synthetic-depth-export-control
R0Y00:codex/startup-texture1d-on-windows
R0Y00:codex/1629-packed-position-fixture
R0Y00:codex/cpu-srv-refresh
R0Y00:codex/stream-root-srv-draw
R0Y00:codex/audio-mixer-timer
R0Y00:codex/startup-reload-published-shader
R0Y00:codex/priority-integrate-1284
R0Y00:codex/guest-sixteen-page-record
R0Y00:codex/aot-placed-dxr-batch
R0Y00:codex/guest-directory-selection
R0Y00:codex/gamesave-enumerate-read
R0Y00:codex/readme-archive-to-pixels
R0Y00:codex/pe-placed-view-draw
R0Y00:codex/archive-directory-gpu
R0Y00:codex/slot133-dxr-build
R0Y00:codex/materialize-placed-vertex-view
R0Y00:codex/dstorage-directory-offsets
R0Y00:codex/xg-nine-bc-copy
R0Y00:codex/xg-slot10-bc64-arrays
R0Y00:codex/dxr-guest-address-readback
R0Y00:codex/gpu-va-high-bits
R0Y00:codex/clarify-diagnostic-startup-scope
R0Y00:codex/xg-six-levels
R0Y00:codex/typed-derived-blend
R0Y00:codex/english-legal-text-progress
R0Y00:codex/address-bc-4ks
R0Y00:codex/dstorage-bounded-file-read
R0Y00:codex/wide-srv-offsets-menu
R0Y00:codex/startup-memory-srv
R0Y00:codex/bound-view-tail
R0Y00:codex/language-selector-readback
R0Y00:codex/setup-menu-progress
R0Y00:codex/cpu-plane-refresh
R0Y00:codex/startup-ubyte-vertex
R0Y00:codex/presenter-window-selection
R0Y00:codex/startup-uniform-buffer-lane
R0Y00:codex/intro-loop-timing
R0Y00:codex/static-clzero-loops
R0Y00:codex/document-rtx-intro
R0Y00:codex/startup-insertq
R0Y00:codex/nv12-startup-texture
R0Y00:codex/stream-stage-draw
R0Y00:codex/startup-null-uav-format
R0Y00:codex/startup-draw-capture
R0Y00:codex/shorten-windows-checks
R0Y00:codex/dstorage-rfc1950
R0Y00:codex/startup-dump-fence
R0Y00:codex/pr1135-review-base
R0Y00:codex/startup-stream-requests
R0Y00:codex/startup-chroma-view
R0Y00:codex/readme-graphics-pipeline-streams
R0Y00:codex/static-crt-free-tls
R0Y00:codex/arc-140t-rtx-5080-laptop-gpu-reports
R0Y00:codex/main-startup-progress-entry
R0Y00:codex/signed-dxil-catalogue
R0Y00:codex/reloc-free-preferred-base
R0Y00:codex/quad-dpp-bit-mask
R0Y00:codex/raw-srv-bounds
R0Y00:codex/rx9070-31044-hardware-report
R0Y00:codex/gpu-page-source-provenance
R0Y00:codex/runtime-placeholder-interior
R0Y00:codex/gpu-copy-queue-tile-order
R0Y00:codex/pe-pin-external-providers
R0Y00:codex/xmem-placeholder-reservations
R0Y00:codex/xmem-shared-physical-pages
R0Y00:codex/pe-package-startup
R0Y00:codex/xmem-tools-memory-query
R0Y00:codex/cpu-stack-output-import
R0Y00:codex/pe-load-security-cookie
R0Y00:codex/record-three-bvh-retests
R0Y00:codex/cpu-rbp-frame-anchor
R0Y00:codex/xmem-default-startup
R0Y00:codex/record-rtx-3050-ti-9597
R0Y00:codex/docs-readme-start-here
R0Y00:codex/check-compute-mad24-truncation
R0Y00:codex/docs-discord-community
R0Y00:codex/bound-rcx-branch-mutants
R0Y00:codex/rtx5060ti-bvh-62114
R0Y00:codex/837-neutral-readme-disclaimer
R0Y00:codex/record-rtx-3070-ti
R0Y00:codex/title-neutral-public-wording
R0Y00:codex/exe-shadow-frame-submissions
R0Y00:codex/exe-shadow-runtime-chain
R0Y00:codex/readme-polish
R0Y00:codex/gpu-coverage-nov23
R0Y00:codex/spirv-minlod
R0Y00:codex/shadow-shim-device
R0Y00:codex/exe-two-shadow-frames
R0Y00:codex/shim-dispatch-cleanup
R0Y00:codex/fix-spirv-cache-probe
R0Y00:codex/sampler-use
R0Y00:codex/ballot-bit-extract
R0Y00:codex/packed-fma-release
R0Y00:codex/cpu-packed-fma-o2
R0Y00:codex/publish-coverage-dashboard
R0Y00:codex/mesh-cbv-binding-order
R0Y00:codex/spirv-window-fixture
R0Y00:codex/ps-e32-float-uint
R0Y00:codex/ps-cbuffer-reads
R0Y00:codex/fixed-profile-rescan
R0Y00:codex/shim-compute-integration
R0Y00:codex/readme-visible-coverage
R0Y00:codex/readme-research-navigation
R0Y00:codex/integrate-pr-256
R0Y00:codex/indexed-mesh
R0Y00:codex/sampled-coverage
R0Y00:codex/first-ms
R0Y00:codex/dual-ps
R0Y00:codex/ps-attribute
R0Y00:codex/compute-first
R0Y00:codex/ps-export
R0Y00:codex/readme-research-status
R0Y00:codex/ps-layout
R0Y00:codex/blast-window
R0Y00:codex/chart-caption
R0Y00:codex/reviewer-roles
R0Y00:codex/blast-aot
R0Y00:codex/archive-program
R0Y00:codex/crc-stream-program
R0Y00:codex/exe-image-data-chain
R0Y00:codex/local-cpu-fixture-coverage
R0Y00:codex/exe-bound-frame-chain
R0Y00:codex/exe-mapped-comparison
R0Y00:codex/contribution-dependencies
R0Y00:codex/exe-entry-aot
R0Y00:codex/bink-frame-heap-integration
R0Y00:docs/hardware-seven-reports
R0Y00:codex/bink-custom-heap
R0Y00:codex/bink-heap-callers
R0Y00:codex/discussions-entry-points
R0Y00:codex/gpu-community-batch-64
R0Y00:codex/ffx-scratch-writers
R0Y00:codex/generic-project-documentation
R0Y00:codex/ffx-dispatch-rcas
R0Y00:codex/four-windows-gpu-reports
R0Y00:codex/title-neutral-project-wording
R0Y00:codex/community-coverage-provenance
R0Y00:codex/rcas-packed-texels
R0Y00:codex/community-gpu-retests
R0Y00:codex/community-build-and-gpu-reports
R0Y00:codex/ffx-provider-loop
R0Y00:codex/ffx-recurrent-views
R0Y00:codex/ffx-recurrent-resource
R0Y00:codex/amd-wave64-reports
R0Y00:codex/ffx-backend-slots
R0Y00:codex/upscaler-device-init
R0Y00:codex/ffx-context-lifecycle
R0Y00:codex/ffx-version-query
R0Y00:codex/ffx-provider-contract
R0Y00:codex/typed-object-callback
R0Y00:codex/cpu-ordinal-import
R0Y00:codex/chained-cpu-ranges
R0Y00:codex/cpu-import-call
R0Y00:codex/cpu-direct-call
R0Y00:codex/cpu-leaf-aot
R0Y00:codex/community-project-status
R0Y00:codex/script-state-path-replay
R0Y00:codex/script-state-evidence
R0Y00:codex/bc7-resident-tail
R0Y00:codex/bcpack-mip-tail
R0Y00:codex/bc7-texture-draw
R0Y00:codex/asset-ranges
R0Y00:codex/pixel-constants
R0Y00:codex/pixel-aot
R0Y00:codex/pre-exe-workloads
R0Y00:codex/root-signature-device-coverage
R0Y00:engineering/packed-bvh-leaves
R0Y00:engineering/bvh-build-and-update
R0Y00:engineering/intake-root-roundtrip
R0Y00:community/gpu-check-release
R0Y00:community/english-contributor-entry
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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!1911
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1918"
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 henriazz10 on 2026-11-24T21:09:08Z.
Change
Refs #721. This is item 4 (
v_ldexp_f32) claimed in https://github.com/R0Y00/Xbox2Windows/issues/721#issuecomment-7143412663. It touches onlytools/compute_store_aot.py,tests/compute_store_check.py,CMakeLists.txtanddocs/experiments.md.v_ldexp_f32 vD, S0, S1(VOP3A opcode0x362, RDNA2D.f32 = ldexp(S0.f32, S1.i32) = S0.f32 * (2 ** S1.i32)) lowers tof32_ldexp(S0, S1), emitted inF32_HELPERSonly when used:S0uses the existingfloat_wordprofile (VGPR, known SGPR, inline float constant,0, or finite normal 32-bit literal; NaN, infinity and denormal constants are refused withUnverified float operand, while runtime words from memory or integer ALU may carry any bit pattern).S1is any knownalu_word(VGPR, known SGPR, integer inline constant, or 32-bit literal).f32_ldexpoperates onuintbit patterns: preserves+/-0and+/-Inf, quietssNaNand preservesqNaNpayloads, normalizes denormalS0inputs viafirstbithigh, clamps the signedS1exponent delta to[-512, 512]to preventintwraparound, overflows to+/-Inf, and rounds subnormal results to nearest-even. Denormal inputs and results assume binary32 denormals are enabled (IEEE mode); with flush-to-zero inMODE(FP_DENORM), console hardware would flush them, which is not modelled andMODEis not read by the translator.v_ldexp_f32_e64),clamp,omod(mul:2),-and|...|modifiers onS0orS1, register ranges (v[10:11]), and a float literal inS1(1.0);S0(v40,s30,s12), non-finite/denormal constantS0(0x7fc00000,0xff800000,0x00000001,-1,5,1.5, and scalar moves_mov_b32 s5, 0x00400000), andvDabovev255(v256) withUnverified float operand;S1(v40,s30,s12,0x100000000) withUnverified ALU operand;ALU_EXPRESSION_LIMIT(ALU expression too large).Mode gate (after review).
v_ldexp_f32is lowered only under the new caller statementf32_mode="ieee-rne-denorm"(--f32-mode ieee-rne-denorm): binary32 round-to-nearest-even with denormals preserved. With no statement it is refused withv_ldexp_f32 requires a declared f32 mode, and any other mode, including flush-to-zero, is refused withUnsupported f32 mode. Other operations keep their default. A no-profile refusal and an FTZ-mode refusal are translation controls. Non-folded per-lane inputs at word 1 (a denormal input) and word 20 (a normal input underflowing to denormal) separate preserved denormals from FTZ: an FTZ reference model and a recompiled-HLSL FTZ mutation must both mismatch, and do.Verification
Commit
b5e1fa8f(gate) one2bb9920, rebased onto246a875d. The draws,controls()and the LLVM 15 round trip were re-run onb5e1fa8f. Windows 11, DXC 10.0.26100.0, Python 3.12, D3D12 debug layer enabled.offscreen_checkwas built fromorigin/main; this PR does not change it.groups=1 compared_words=320 mismatches=0,debug_errors=0 debug_warnings=0groups=1 compared_words=320 mismatches=0,debug_errors=0 debug_warnings=0Other checks:
controls(): exit 0.docs_links_check.py: exit 0 (Checked 18 Markdown files and 376 links.).bidi_controls_check.py: exit 0 (Checked 1330 tracked source, script and build/CI files: no bidirectional controls.).git diff --check HEAD~1: exit 0.LLVM 15 round trip in Docker (
x2w-llvm15):binary_exit=0.ldexp_f32_binary()decodes the assembled fixture back to the samev_ldexp_f32lines and requires the identical lowered HLSL.Negative control. With
tools/compute_store_aot.pyfromorigin/main,ldexp_f32_controls()fails withValueError: Unsupported compute instruction: v_ldexp_f32 v4, v10, v11.Evidence
The fixture
LDEXP_F32is source-built in LLVM 15 spelling and runs one 64-thread group storing 4 words per thread (stride=16, 256 words stored, 64 sentinel words untouched). Each thread computes fourv_ldexp_f32results covering:v4): normal[1.5, 2.0)with sign and tie bits scaled by(tid.x - 20) * 10(underflow to+/-0, subnormal rounding, normal-range scaling, overflow to+/-Inf).v5): denormal inputs((tid.x & 1) << 31) | ((tid.x + 1) << 16)scaled by SGPRs4 = -3.v6):+/-0.0,+/-Inf,+/-qNaNand+/-sNaNwith payloads and large exponents0x7fffffff/0x80000000.v7): subnormal tie-to-even boundary(0x00800000 | (tid.x & 1))scaled across-26..-23and up to0x7fffffff(testingclamp(delta, -512, 512)againstint32wraparound).All 320 words are compared against an independent bit-level Python model (
ldexp_f32_word). The denormal, NaN and infinity draw cases check the helper against its own model on desktop, not against console hardware.ldexp_f32_controls()checksf32_ldexpemission, theStore4lowering, accepted source combinations (inline float,0, hex literal, SGPR, negative inline int, positive literal), and all rejection conditions.sNaNnot quieted: word 42;clamp(asint(b), -512, 512)narrowed to[-100, 100];return sign | q;replaced byreturn sign;;(a | 0x00400000u)replaced bya;if (exp == 0u) {replaced byif (false) {.Checklist
docs/experiments.md).AI-assisted. Gemini 4 Hydrogen (Antigravity CLI) wrote the change and ran the checks; Claude Code reviewed it.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T21:13:49Z.
Review: COMMENTED
Review of head
b36c718a27a9d9abd7b2c75015eb40f3c272cb2e(shader: lower compute v_ldexp_f32; CMakeLists.txt, docs/experiments.md, tests/compute_store_check.py, tools/compute_store_aot.py). No merge from my side yet: the branch conflicts with current main.Blocker: merge conflict.
git merge-tree --write-tree --name-only origin/main HEADreports a content conflict intests/compute_store_check.py(CMakeLists.txt, docs/experiments.md and tools/compute_store_aot.py auto-merge). Please rebase or merge main and keep both sides. GitHub shows mergeable UNKNOWN andgh pr checksreports no checks on the branch, so there is no CI result for this head either. I did not run Win2025: it would have to be redone after the rebase.Read of the diff (no P1/P2 in the logic as written).
compute_store_aot_ldexp_f32_<adapter>test registration (timeout 45).f32_ldexpkeeps +/-0 and +/-Inf, quiets sNaN, normalizes denormal inputs (shift = 23 - firstbithigh(mant), e = 1 - shift), clamps the signed S1 delta to [-512, 512], overflows to +/-Inf at e >= 255, and rounds subnormal results to nearest even (zero below e < -23). I checked these against the independent word model in the test and found no mismatch.Commands run locally on this head:
git diff --check origin/main...HEAD: rc=0python3 tests/docs_links_check.py: rc=0 (18 files, 382 links)python3 tests/bidi_controls_check.py: rc=0 (1343 files)python3 tests/compute_store_check.pywith no mode: the controls section (which includesldexp_f32_controls) passes; the script then stops on the missing mode argument, as expected. Thebinaryanddraw-ldexp_f32modes need the assembler and DXC, which this Linux node does not have.Mutations in tools/compute_store_aot.py (each reverted with
git checkout -- ., tree clean after):f32_ldexp(...)call: controls FAIL (AssertionError, rc=1). Killed.s0 is Nonerejection: controls FAIL (expected "Unverified float operand" rejection, got TypeError, rc=1). Killed.draw-ldexp_f32GPU test executes. That test carries its own mutation set for the clamp, flush, sNaN and denormal cases; it needs a Windows run after the rebase.After the rebase: a Win2025 Debug and Release run of
draw-ldexp_f32and the CI Windows job are still needed before a merge. This is a review comment, not an approval.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T21:26:18Z.
Review: CHANGES_REQUESTED
The new helper assumes binary32 round-to-nearest-even with denormals preserved. The PR documents that assumption, but lower() currently accepts ldexp whenever the register forms match; a shader with unknown or flush-to-zero mode silently takes the preserved-denormal path. Please gate this new lowering on an explicit, verified f32 profile for the supplied fixture or a mode proved from the input. Keep the existing default for unrelated operations, and refuse this op when its required mode is unknown or unsupported. Add a no-profile refusal and a non-folded preserve/FTZ discriminator. Continue to distinguish the emitted helper's NaN payload behavior from independently verified native behavior.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T21:31:16Z.
Review: COMMENTED
Review of head
226e0d5984439ffa1658431a12cd18c5bc8e1a2d(shader: lower compute v_ldexp_f32; CMakeLists.txt, docs/experiments.md, tests/compute_store_check.py, tools/compute_store_aot.py). No P1, no P2. My earlier comment was onb36c718a; this head is the same change rebased onto current main, and the merge conflict I reported is gone.Scope.
git diff origin/main...HEAD: 4 files, +284 lines, 0 deleted. CMakeLists.txt only adds thecompute_store_aot_ldexp_f32_<adapter>registration (timeout 45). The rest is the lowering, the HLSL helper, the independent word model and the check.git merge-tree --write-tree origin/main HEADmerges cleanly. GitHub: mergeable, state CLEAN.Semantics (RDNA2 V_LDEXP_F32, S0.f32 * 2^S1.i32). The helper keeps +/-0 and +/-Inf, quiets sNaN, normalizes denormal inputs, clamps the signed S1 delta to [-512, 512] so the exponent cannot wrap, overflows to +/-Inf at e >= 255, rounds subnormal results to nearest even and returns signed zero below e < -23. It matches the independent model in the test. The lowering refuses _e64, clamp/mul modifiers, abs/neg, register ranges, a float literal in S1, a non-finite or denormal constant S0 and unknown or pending operands. Documented limit: denormal handling assumes IEEE mode and does not model a MODE flush.
Commands run locally on this head:
git diff --check origin/main...HEAD: rc=0python3 tests/docs_links_check.py: rc=0 (18 files, 385 links)python3 tests/bidi_controls_check.py: rc=0 (1346 files)python3 tests/compute_store_check.py(no mode): the controls section, includingldexp_f32_controls, passes.--preset dev100% passed; Release /O2--preset release100% passed.compute_store_aot_ldexp_f32_warppassed in both (5.31 s and 4.75 s).Mutations in tools/compute_store_aot.py (each reverted with
git checkout -- ., tree clean after):f32_ldexp(...)call: controls FAIL (AssertionError, rc=1). Killed.s0 is Nonerejection: controls FAIL (expected "Unverified float operand", got TypeError, rc=1). Killed.Helper-body changes (exponent clamp, flush of subnormals, sNaN quieting, denormal normalization) are killed by the
draw-ldexp_f32run, which compiles each mutated helper and requires the readback to differ. That run passed on the Windows 2025 node above.This is a review comment, not an approval.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T21:31:39Z.
Review: COMMENTED
Follow-up on head
226e0d5984439ffa1658431a12cd18c5bc8e1a2d: two things changed after my review above, so the "mergeable, CLEAN" line there no longer holds and I am not merging.git merge-tree --write-tree --name-only origin/main HEADnow reports content conflicts in CMakeLists.txt, docs/experiments.md and others; GitHub shows CONFLICTING.lower()does not read MODE, which is the same gap. It needs an answer before any merge.No receipt-based merge was run (safe-merge-check: BLOCK on G2 and G6).
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by henriazz10 on 2026-11-25T00:44:33Z.
Thanks. The lowering is now gated, as requested. New commit
b5e1fa8f(one2bb9920, rebased onto246a875d):The gate.
lower()takes a new caller statement,f32_mode(--f32-mode).v_ldexp_f32is lowered only underf32_mode="ieee-rne-denorm": binary32 round-to-nearest-even with denormals preserved, the mode that the helper models.f32_mode, the op is refused:v_ldexp_f32 requires a declared f32 mode."ieee-rne-ftz"):Unsupported f32 mode: ....f32_mode.Controls.
ldexp_f32_controls()adds:f32_moderemoved;Both check the message.
Non-folded preserve/FTZ discriminator. The fixture's inputs are per-lane words, read from memory and from lane-dependent values, not constants. Two of them separate preserved denormals from FTZ:
An FTZ reference model, which flushes denormal inputs and results to a signed zero, must mismatch and does, first at word 1. A recompiled-HLSL FTZ mutation must also mismatch on the device, and does. The draw asserts that words 1 and 20 differ between the two models.
NaN payloads. The docs keep that the helper's NaN quieting and payload behavior is the helper's own model, checked against an independent Python model on desktop adapters. It is not verified as native console behavior.
Results on
b5e1fa8f:draw-cvt-u32-f32anddraw-bfealso still pass on both adapters after the rebase.docs_links_check.pyandgit diff --checkare clean.AI-assisted. Gemini 4 Hydrogen (Antigravity CLI) wrote the change; Claude Code reviewed it, rebased it and ran the checks.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:44:05Z.
@henriazz10 could you rebase this branch onto current
mainand force-push?GitHub reports head
4de732c7as conflicting withmain, so it cannot be merged as is.Files that conflict with current
main(b1a644ae):CMakeLists.txttests/compute_store_check.pytools/compute_store_aot.pyCommands run locally:
Once it is rebased and CI is green it will be re-checked right away.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by henriazz10 on 2026-11-25T14:54:39Z.
Rebased onto current
mainand force-pushed: head4dc53965on14b5d514. GitHub now reports it as mergeable.The two earlier commits are squashed into one, because the conflicts covered the same regions of
CMakeLists.txt,tests/compute_store_check.pyandtools/compute_store_aot.py. The behavior is unchanged:v_ldexp_f32is accepted only withf32_mode="ieee-rne-denorm"(--f32-mode) and is refused otherwise. One addition:compute_store_aot_ldexp_f32_${adapter}now writes itsFORM_COVERAGE_RECORD(14 forms, includingv_ldexp_f32), like the other compute draws.Checks on the new head (Windows 11 build 26300, DXC 10.0.26100.0, NVIDIA GeForce RTX 5080 driver 32.0.16.1692):
draw-ldexp_f32on warp and on hardware: exit 0, mismatches=0, debug_errors=0;draw-mac-f32anddraw-vcmp-selecton warp: exit 0, because they share the edited regions;tests/compute_store_check.py binarywith LLVM 15:binary_exit=0;tests/form_coverage_check.pyandgit diff --check: clean.AI-assisted. Claude Code rebased it and ran the checks.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-26T07:12:47Z.
AMD RDNA 4 run on
89b9aa85:compute_store_aot_ldexp_f32passes on both backends; the neighbouringcompute_store_aot_*_hardwarefamily is 78/79.Not a code change; measurements only. A third adapter for this fixture: the evidence table above covers WARP and an RTX 5080.
Environment
10.0.26200.9974(25H2, UBR0x26f6); MSVC BuildTools toolset14.44.35207; CMake4.4.4.Windows Kits\10\bin\10.0.26100.0\x64\, reportingdxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17).AMD Radeon RX 9070 XT,vendor=1002 device=7550, driver32.0.32029.2010. Thewarpbackend reportsMicrosoft Basic Render Driver vendor=1414 device=008c, driver10.0.26100.9818.dev. Every mode line reportsdebug_layer=unavailable, so no API validation is involved.89b9aa85(89b9aa8530659a91ed947174eca5a7bbf1785093);git rev-parse HEADis the second line of each log. Noldexporf32_modeline differs between4dc53965(the head measured on the RTX 5080) and89b9aa85intests/compute_store_check.py,tools/compute_store_aot.pyandCMakeLists.txt; the head moved by a rebase ontomain.Commands
Observed
Two further direct
draw-ldexp_f32 … hardwareruns printed the same four lines and exited 0.ldexp_f32_controls()exited 0; that is the translation side only (accept/refuse messages), not the device.What
compared_words=320covers on this fixture: 256 words written by the 64 threads (four pertid.x) compared word for word againstldexp_f32_words(), plus the 64 guard words after them that must still read0xc5c5c5c5.320is the renderer'scapacityconstant, not a count of results.ldexp_f32_drawdoes not print the control outcomes; it raises unless each control misbehaves on the backend it was given. On this run the six altered references (no exponent clamp, FTZ model, flushed subnormals, sNaN not quieted, no denormal input normalisation, sentinel past the group) and the five recompiled-HLSL mutations (narrowed exponent clamp, FTZ, flushed subnormals, sNaN not quieted, no denormal input normalisation) therefore each exited 1 onhardware, withword=N expected=for a reference andCompute readback differsfor a mutation.Regression
Whole neighbouring family on the same adapter,
99% tests passed, 1 tests failed out of 79in 514.57 s:That entry's own word comparison passes; only its fused
mad()control is not separable on this adapter, which is the control tracked in #2730 (seen there on RDNA 1). It is not attributable to this PR: the change addsF32_HELPERS["ldexp"]and onelower()branch, and its only two removed lines are thelower()signature line and themain()call site (f32_mode), so theMAC_F32path and its fixture are untouched at this head.What this establishes, and what it does not
cs_6_0, executes, and its 256 produced words are bit-identical to the fixture's Python model, with the 64 guard words untouched.a/b,firstbithigh, an integerclamp,Store4of auint4into aRWByteAddressBuffer), and the fixture builds its inputs with integer ALU ops. Denormals are produced and rounded explicitly in integers, so neither the compiler's nor the driver's FTZ can change a word.f32_mode="ieee-rne-denorm"is required for the op to be lowered and does not change the emission.v_ldexp_f32itself. The shader is an integer emulation compared against this repository's own model of the instruction: the instruction is never executed and there is no console comparison. A miscompile or a driver bug in the helper would be caught here; a wrong model would not.Limits
One adapter and one driver; debug layer absent;
cs_6_0; a single 64-thread group; integer outputs only; the 320-word expectation comes from the PR's ownldexp_f32_wordmodel, not from an external oracle.AI-assisted; runs executed on the machine above.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T09:36:40Z.
This PR now conflicts with
main. Conflicting files:CMakeLists.txttools/compute_store_aot.pyCould you merge
maininto your branch (a merge commit, no force push needed) and resolve these? Thank you.AI-assisted; commands listed were executed locally. (
git merge-tree origin/main <head>)Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T01:41:36Z.
I merged
main86beae95into this branch as90b39c31(a merge commit, no rebase or force-push), as tedin7 asked. Two files conflicted:CMakeLists.txt:mainadded thecompute_store_aot_alu_bfm_{warp,hardware}tests at the place where this branch addscompute_store_aot_ldexp_f32_{warp,hardware}. I kept both blocks,main's first.tools/compute_store_aot.py:main'swave_sizetext (wave64 is now allowed with group-shared LDS), followed by this branch'sf32_modesentences.mainmoved thewave_sizecheck further down and widened it towave_size not in (None, 32) and not (wave_size == 64 and shared_lds). In the conflict I kept only this branch'sf32_modecheck, somain's laterwave_sizecheck is the one that applies.mainhas no otherv_ldexp_f32orf32_modecode, so the lowering itself is unchanged.git diff --check origin/main...HEADis clean.What I ran on
90b39c31. I did a full build indevandrelease, then ran every test thatcompute_store_aot.pyfeeds (-R '(compute_store|compute_alu|ldexp)', excludingstartup_audio_*):_warptests timed out under-j 8(compute_store_aot_mimg_load,_mimg_mip,_lds_arithmetic,_lds_qword); each passes on its own at-j 1._hardwaretests at-j 1: all pass in Debug and Release, includingcompute_store_aot_ldexp_f32_hardware.This is a merge only. I haven't re-reviewed the change; another reviewer will.
Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.28000.0 DXC; Python 3.12.10.
This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by akimfomin on 2026-11-28T02:03:26Z.
A reference input for the explicit float lowering is VIctory #3221's signed zero boundary. Try a negative finite operand scaling just below the smallest subnormal, alongside the smallest representable negative result and a positive-zero control. Record the raw output bits to make the sign and flush policy visible apart from ordinary numerical equality.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T02:22:58Z.
Review: APPROVED
Reviewed
90b39c31merged over currentmain50e4f763. The merge is clean (tree8086192f) andgit diff --cached --checkis clean.The
mainmerge in90b39c31. I checked it withgit show --remerge-diff 90b39c31:CMakeLists.txt: thecompute_store_aot_ldexp_f32_*registration now sits aftermain'scompute_store_aot_alu_bfm_*block. Neither block lost anything.tools/compute_store_aot.py: the docstring keepsmain's wave64 sentence and then adds thef32_modeone. In the argument checks, the branch's oldwave_size not in (None, 32)check was dropped.main's wider check,wave_size not in (None, 32) and not (wave_size == 64 and shared_lds), still applies further down (line 1259). That is the right outcome; keeping the old check would have refusedmain's wave64 LDS case again.R0Y00's changes request on
226e0d59. As far as I can see, all four points are addressed on this head:v_ldexp_f32lowers only with the caller statementf32_mode="ieee-rne-denorm". With no statement it refuses (v_ldexp_f32 requires a declared f32 mode). Any other value refuses withUnsupported f32 mode, both in the argument check and at the op. Unrelated ops keep their default.s_denorm_mode 0,s_round_mode 3,s_setreg_imm32_b32 hwreg(HW_REG_MODE, 4, 4), 0ors_setreg_b32 hwreg(HW_REG_MODE, 0, 8), s4toLDEXP_F32each refuses withUnsupported compute instruction.ieee-rne-ftzrefusals are both controls inldexp_f32_controls().ldexp_f32_drawasserts that, and the FTZ reference control fails at word 1.docs/experiments.mdnow says the NaN-payload, denormal and infinity cases check the helper against its own model on desktop, not native console behaviour.What I ran.
devandrelease/O2.ctest --test-dir out/build/<preset> --no-tests=error -j 4 -R '(compute_store|compute_alu|ldexp)' -E '(startup_audio|_hardware$)'runs 120 tests per preset.compute_store_aot_ldexp_f32_warp,native_ldexp_controls,startup_gfx2hlsl_ldexp_controlsandpixel_aot_f16_fmac_ldexp_warp._warptests timed out under-j 4:guard_read,lds_packedandlds_qwordindev,mimg_mipinrelease. Each passes when rerun alone at-j 1.compute_store_aot_ldexp_f32_hardwareat-j 1passes in both presets, with no skip.Mutants of
tools/compute_store_aot.py, each run againstldexp_f32_controls()andcompute_store_aot_ldexp_f32_warp, after an unmutated baseline that passes both:ieee-rne-ftze < -22e >= 255→e > 255Restored afterwards;
git diff --quietis clean.Non-blocking.
e == 255boundary isn't exercised. No lane reaches a biased exponent of exactly 255. Withe > 255, a result there is built assign | (255 << 23) | mant: NaN whenmant != 0, or Inf only by accident whenmant == 0. A lane withS0exponent 127 and a non-zero mantissa, withS1 = 128, would pin it.Unsupported f32 mode.Verdict: approve on
90b39c31. R0Y00's changes-requested review on226e0d59still needs R0Y00's own re-review, so I'm not merging.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10; wave32; debug layer off.
CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass on90b39c31.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T07:00:05Z.
Thanks for the gate work. On
90b39c31, R0Y00's four asks look addressed to me.v_ldexp_f32refuses withoutf32_mode="ieee-rne-denorm", and unrelated ops keep their default. The no-profile and FTZ refusals are controls, and words 1 and 20 separate preserve from FTZ. The docs keep the NaN-payload caveat. MODE writes inside the program are refused too (s_denorm_mode 0,s_round_mode 3and boths_setregforms →Unsupported compute instruction).ldexp_f32_controls()and the fullcontrols()pass on this head merged into mainbbf4687b.One test gap remains from my side: two boundaries of
f32_ldexparen't reached by any fixture word. I checked this with an int32 transliteration of the emitted helper, which matchesldexp_f32_words()on all 256 words. The draw compares words exactly, so a helper mutant that produces the same 256 words passes it.if (e >= 255)→if (e > 255)(pigalot's note 1): 0 fixture words change. With S0=0x3fffffff, S1=128, the mutant returns0x7fffffff(NaN) where the right result is0x7f800000.clamp(asint(b), -512, 512)→min(asint(b), 512)): 0 fixture words change. With S0=0x00000001, S1=0x80000000, the int wraps and the mutant returns0x7f800000where the right result is0x00000000. An upper-clamp-only mutant does change words 243 and 247, so only that side is pinned.Could you add a lane for each of those two inputs, expecting
0x7f800000and0x00000000? Adding both edits as recompiled-HLSL mutations inldexp_f32_drawwould also show they're caught.A small one while you're there: the comment above
F32_HELPERS["ldexp"]still says "the translator does not read MODE". It could mention that lowering now requiresf32_mode="ieee-rne-denorm".This comment was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-28T20:09:16Z.
Review: CHANGES_REQUESTED
Reviewed
90b39c31.Run on a release build of
mainf2972840with this PR and 17 other open PRs merged locally, Windows Sandbox, network off, vGPU:compute_store_aot_ldexp_f32_warp(WARP) andcompute_store_aot_ldexp_f32_hardware(NVIDIA GeForce RTX 5080) pass, with 320 words compared and 0 mismatches.Changing the subnormal tie rule
(q & 1u) != 0uto== 0u(tools/compute_store_aot.py:192) made both fail.In the wider run at
-j 6,compute_store_aot_lds_arithmetic_hardwareandcompute_store_aot_lds_qword_hardwarehit their 45 s timeout, while their_warpvariants passed. This PR'scompute_store_aot.pychange does not plausibly cause that:f32_ldexp(is in the body;f32_moderaises only when it is set to another value;v_ldexp_f32lines.So the HLSL of those two programs is unchanged. Parallel load is the likelier cause: in pigalot's Debug run, the
_warpvariants of_lds_arithmeticand_lds_qwordalso timed out under-j 8, and both passed alone. They were not rerun alone here.Already raised and not repeated here:
226e0d59is still open.90b39c31and listed thee >= 255->e > 255survivor and the unpinned argument-level mode check.e == 255and lower-clamp lanes and the comment fix.The last three have no author reply yet.
Test gap:
e == 0.w0givese = 127 + 10k,w1gives -9..-3,w2returns early, andw3gives -25..-10 or a ±512 clamp. Mutation:tools/compute_store_aot.py:184if (e <= 0) {->if (e < 0) {, which returnssign | mantwithout the implicit bit or rounding. Add a lane with S0 =0x3fc00000(1.5) and S1 =-127, expecting0x00600000(the mutant gives0x00400000). Add the same edit to the recompiled-HLSL mutations inldexp_f32_draw.Request changes for the test gap above.
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T12:55:32Z.
Status on
90b39c31against main77d1ba4d. Verdict: hold for the open change requests. The head hasn't changed since my 07:00 comment.git merge-tree --write-tree origin/main 90b39c31→ treebe0edeb5).compute_store_check.controls()andldexp_f32_controls()pass (controls ok,ldexp ok, exit 0; Linux, Python 3.13).tools/compute_store_aot.pyonly, an offline tool, so it doesn't touch the runtime or the default native launcher path.MUST
0x3fc00000, S1-127, expecting0x00600000, plus the matching recompiled-HLSL mutation) is open.226e0d59still needs R0Y00's re-review. The four points look addressed, as pigalot and I said earlier.SHOULD
0x3fffffffwith S1128expecting0x7f800000(thee >= 255edge), and S00x00000001with S10x80000000expecting0x00000000(the lower clamp). So is the comment aboveF32_HELPERS["ldexp"].AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T18:40:16Z.
Thank you for this work, @henriazz10. Since the branch conflicts with
main, I carried your commit into #3882 on currentmainand added thee == 0lane from my review; if you would rather continue here, say so and I will close mine.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.