pixel_aot: non-packed binary16 VOP1/VOP2 ALU under the low-16-only contract (scope question) #833
Open
opened 2026-11-23 11:00:07 +00:00 by JB2WIN
·
17 comments
No Branch/Tag specified
main
codex/indirect-large-backed-views
codex/word3-preflight-check
codex/vertex-table-two-records
codex/live-index-alias
codex/copied-vertex-buffer-srv
codex/windows-stage-test-output
codex/preserve-live-srv-retirement
codex/share-render-target-tracking
codex/sgd5-negative-offset-fixture
coverage-dashboard
codex/mesh-loose-root
codex/mesh86-cache-padding
codex/xmem-scatter-preflight
codex/mesh-depth-ps
codex/indirect-dispatch-refresh
codex/compute-container-index
codex/startup-compute-formatted-load
codex/compute-indirect-producer
codex/compute-atomic-soffset
codex/mesh-dual-handoff
codex/startup-run-sh-watcher-control
codex/queue31-page-alias
codex/indexed-indirect-compute-root
codex/typed-buffer-view-metadata
codex/translated-indexed-address-alias
codex/fixed-mesh-create-result
codex/xmem-section-lease
codex/startup-slot86-mesh-cache
codex/restore-mesh-barrier-iteration
codex/translated-indirect-upload-index
codex/xapu-completion-opt-in
codex/translated-indexed-rect
codex/translated-indexed-indirect
codex/startup-mesh-lds-integration
codex/startup-console-ms24
codex/startup-slot57-mesh-request
codex/indirect-copy-provenance
codex/present-color-producer-trace
codex/compute-dispatch-binding-trace
codex/translated-indirect-table-buffers
codex/indirect-copy-provenance-base
codex/mix-half-literal-source
codex/translated-indirect-draw
codex/xmem-scatter-diagnostics
codex/slot148-recording-upload
codex/slot70-loading-art-verified
codex/command-list-upload-arena
codex/recover-failed-command-list
codex/startup-heap-timing-notes
codex/align-audio-input-timeline
codex/synthetic-depth-export-control
codex/startup-texture1d-on-windows
codex/1629-packed-position-fixture
codex/cpu-srv-refresh
codex/stream-root-srv-draw
codex/audio-mixer-timer
codex/startup-reload-published-shader
codex/priority-integrate-1284
codex/guest-sixteen-page-record
codex/aot-placed-dxr-batch
codex/guest-directory-selection
codex/gamesave-enumerate-read
codex/readme-archive-to-pixels
codex/pe-placed-view-draw
codex/archive-directory-gpu
codex/slot133-dxr-build
codex/materialize-placed-vertex-view
codex/dstorage-directory-offsets
codex/xg-nine-bc-copy
codex/xg-slot10-bc64-arrays
codex/dxr-guest-address-readback
codex/gpu-va-high-bits
codex/clarify-diagnostic-startup-scope
codex/xg-six-levels
codex/typed-derived-blend
codex/english-legal-text-progress
codex/address-bc-4ks
codex/dstorage-bounded-file-read
codex/wide-srv-offsets-menu
codex/startup-memory-srv
codex/bound-view-tail
codex/language-selector-readback
codex/setup-menu-progress
codex/cpu-plane-refresh
codex/startup-ubyte-vertex
codex/presenter-window-selection
codex/startup-uniform-buffer-lane
codex/intro-loop-timing
codex/static-clzero-loops
codex/document-rtx-intro
codex/startup-insertq
codex/nv12-startup-texture
codex/stream-stage-draw
codex/startup-null-uav-format
codex/startup-draw-capture
codex/shorten-windows-checks
codex/dstorage-rfc1950
codex/startup-dump-fence
codex/pr1135-review-base
codex/startup-stream-requests
codex/startup-chroma-view
codex/readme-graphics-pipeline-streams
codex/static-crt-free-tls
codex/arc-140t-rtx-5080-laptop-gpu-reports
codex/main-startup-progress-entry
codex/signed-dxil-catalogue
codex/reloc-free-preferred-base
codex/quad-dpp-bit-mask
codex/raw-srv-bounds
codex/rx9070-31044-hardware-report
codex/gpu-page-source-provenance
codex/runtime-placeholder-interior
codex/gpu-copy-queue-tile-order
codex/pe-pin-external-providers
codex/xmem-placeholder-reservations
codex/xmem-shared-physical-pages
codex/pe-package-startup
codex/xmem-tools-memory-query
codex/cpu-stack-output-import
codex/pe-load-security-cookie
codex/record-three-bvh-retests
codex/cpu-rbp-frame-anchor
codex/xmem-default-startup
codex/record-rtx-3050-ti-9597
codex/docs-readme-start-here
codex/check-compute-mad24-truncation
codex/docs-discord-community
codex/bound-rcx-branch-mutants
codex/rtx5060ti-bvh-62114
codex/837-neutral-readme-disclaimer
codex/record-rtx-3070-ti
codex/title-neutral-public-wording
codex/exe-shadow-frame-submissions
codex/exe-shadow-runtime-chain
codex/readme-polish
codex/gpu-coverage-nov23
codex/spirv-minlod
codex/shadow-shim-device
codex/exe-two-shadow-frames
codex/shim-dispatch-cleanup
codex/fix-spirv-cache-probe
codex/sampler-use
codex/ballot-bit-extract
codex/packed-fma-release
codex/cpu-packed-fma-o2
codex/publish-coverage-dashboard
codex/mesh-cbv-binding-order
codex/spirv-window-fixture
codex/ps-e32-float-uint
codex/ps-cbuffer-reads
codex/fixed-profile-rescan
codex/shim-compute-integration
codex/readme-visible-coverage
codex/readme-research-navigation
codex/integrate-pr-256
codex/indexed-mesh
codex/sampled-coverage
codex/first-ms
codex/dual-ps
codex/ps-attribute
codex/compute-first
codex/ps-export
codex/readme-research-status
codex/ps-layout
codex/blast-window
codex/chart-caption
codex/reviewer-roles
codex/blast-aot
codex/archive-program
codex/crc-stream-program
codex/exe-image-data-chain
codex/local-cpu-fixture-coverage
codex/exe-bound-frame-chain
codex/exe-mapped-comparison
codex/contribution-dependencies
codex/exe-entry-aot
codex/bink-frame-heap-integration
docs/hardware-seven-reports
codex/bink-custom-heap
codex/bink-heap-callers
codex/discussions-entry-points
codex/gpu-community-batch-64
codex/ffx-scratch-writers
codex/generic-project-documentation
codex/ffx-dispatch-rcas
codex/four-windows-gpu-reports
codex/title-neutral-project-wording
codex/community-coverage-provenance
codex/rcas-packed-texels
codex/community-gpu-retests
codex/community-build-and-gpu-reports
codex/ffx-provider-loop
codex/ffx-recurrent-views
codex/ffx-recurrent-resource
codex/amd-wave64-reports
codex/ffx-backend-slots
codex/upscaler-device-init
codex/ffx-context-lifecycle
codex/ffx-version-query
codex/ffx-provider-contract
codex/typed-object-callback
codex/cpu-ordinal-import
codex/chained-cpu-ranges
codex/cpu-import-call
codex/cpu-direct-call
codex/cpu-leaf-aot
codex/community-project-status
codex/script-state-path-replay
codex/script-state-evidence
codex/bc7-resident-tail
codex/bcpack-mip-tail
codex/bc7-texture-draw
codex/asset-ranges
codex/pixel-constants
codex/pixel-aot
codex/pre-exe-workloads
codex/root-signature-device-coverage
engineering/packed-bvh-leaves
engineering/bvh-build-and-update
engineering/intake-root-roundtrip
community/gpu-check-release
community/english-contributor-entry
gpu-check-v0.1.0
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#833
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 JB2WIN on 2026-11-23T11:00:07Z.
On current
main, a form-coverage run lists the non-packed binary16 ALU forms as uncovered:v_add_f16,v_sub_f16,v_subrev_f16,v_mul_f16,v_min_f16,v_max_f16,v_ldexp_f16,v_fmac_f16,v_fmaak_f16andv_fmamk_f16.v_rcp_f16,v_sqrt_f16,v_rsq_f16,v_log_f16,v_exp_f16,v_sin_f16,v_cos_f16,v_floor_f16,v_ceil_f16,v_trunc_f16,v_rndne_f16andv_fract_f16._e64spellings of the above.#732 now gives the 16-bit integer ops a low-16-only contract. A first slice of these forms could use the same contract:
v_cvt_f32_f16, the f16 compares and SDWAWORD_0.Before proposing a design I'd like to settle three points:
v_cvt_f32_f16plus SDWAWORD_0?v_fma_f16. @KomaGuy and @Holastor, would a plain VOP1/VOP2 slice get in your way, or should it wait for those PRs?HALF_ROUNDING?I'd start with the arithmetic VOP2 set (
add/sub/subrev/mul/min/max). Transcendental andldexpwould come later, if at all. AI-assisted (Claude Code).Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-23T11:05:50Z.
Thanks for checking in @JB2WIN!
A plain VOP1/VOP2 slice for binary16 arithmetic will not get in the way of #704:
Regarding your 3rd point (rounding modes): in #704, R0Y00 specifically requested rejecting non-default rounding modes (HALF_ROUNDING["0"] / RNE only, rejecting HALF_RTZ), so sticking to the default RNE mode for the first slice is definitely consistent with established practice in pixel_aot.
Feel free to proceed with the VOP2 arithmetic slice (dd/sub/subrev/mul/min/max)!
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T11:16:39Z.
A small plain, non-fused VOP2 slice can proceed independently of #419 and #704. Start with add/sub/subrev/mul under a validated binary16 mode: nearest-even with half denormals preserved. A numeric half-mode assumption needs the same entry provenance or tracked MODE write as the rest of the profile; refuse unsupported or unknown modes. Track the low half as defined, with the high half unknown. Start with audited
v_cvt_f32_f16and SDWAWORD_0consumers. Any added compare/chained consumer needs its own low-half validation; keep whole-word and high-half readers rejected. Keep min/max separate until the signed-zero and NaN rules are pinned. Use LLVM 15 round-trip and a lossless integer readback with halfway rounding, positive and negative subnormals, signed zero, and a wrong-rounding/high-half control. For any input class whose observable result is not established, require a proven supported value or independent native reference before extending the profile.Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-23T12:08:52Z.
Thanks, both. The design for the
add/sub/subrev/mulslice is drafted. Before I build it, two choices are yours.The arithmetic is
widen16of both low halves, oneprecisebinary32 operation, thennarrow16. That is exact for these ops: binary32mulof two halves is exact, and double rounding through binary32 is harmless foraddbecause 24 ≥ 2·11+2. I checked it exhaustively offline over all finite operand pairs foraddandmul, with 0 differences.require_proven_i32_f32_range: refuse any source not statically proven finite. That makes the slice much narrower.HALF_DENORM_ENTRY= preserve), with every MODE-changing instruction refused. Is that the provenance you mean, or do you want a trackedhwreg(HW_REG_MODE, 6, 2)write?Smaller choices, unless you object:
("half16", …)tag, separate from integerlow16, so the integer 16-bit readers can't consume it.v_cvt_f32_f16without modifiers, plus SDWAWORD_0(cvt and mov).clamp, omod and integer inline constants other than 0 are refused.v_add_f16_e64refusal neighbour becomesv_min_f16_e64.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T12:15:41Z.
Choose (b) for the first slice. Require both operands to be proven finite, including register copies with established provenance. Leave arbitrary runtime operands for the extension that establishes NaN and infinity behavior. Finite overflow is a separate case. If the slice accepts it, pin the signed result at both overflow boundaries with an independent reference and integer readback. Otherwise require a result within the supported range.
An explicit entry profile is sufficient for binary16 denormal preservation when the caller gets it from validated guest state. Keep the new forms unavailable when that entry state is unknown, and refuse MODE writes that might invalidate it. Tracking the denormal field can follow separately. The distinct half16 tag and the proposed audited readers fit the low-half rule. Please include a refusal for an unknown mode and for a dynamic operand lacking the finite proof. Keep the signed-zero and subnormal cases in the draw.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T14:09:01Z.
#854 landed the first slice: plain add, sub, subrev and mul on proven-finite low halves under the validated binary16 mode. WARP and RTX reads matched, including signed overflow, and the high-half consumption controls still refuse unsupported uses. This issue stays open for the remaining forms and arbitrary runtime operands.
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-23T14:53:40Z.
Thanks for landing #854. I'd like to take the next small slice under the same rules:
v_floor_f16,v_ceil_f16,v_trunc_f16andv_rndne_f16(VOP1 and_e64). LLVM 15.0.7VOP1Instructions.tdL449-452 maps them toffloor,fceil,ftruncandfrint.The plan:
widen16, then the binary32floor/ceil/trunc/round, thennarrow16. The rounded value of a finite half is itself a representable half, so the narrowing is exact.half16result read only by the audited readers.clamp, omod and modifiers.trunc(-0.5)), halfway cases forrndne(0.5, 1.5, 2.5 and -2.5), the largest finite values, subnormals and integers at 1024 and above. Mutations swap each op for another and drop the sign of a -0 result.v_fract_f16stays out because of its clamp near 1, and so domin/maxand the transcendentals. AI-assisted (Claude Code).Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T14:54:48Z.
Please go ahead with the four rounding operations under the same finite-input, explicit binary16 mode and low-half-only rules as #854. Keep the existing _e32 and _e64 modifier refusals. For RNDNE, verify ties-to-even with the emitted code. For signed zero, read back the raw half bits and preserve the input sign when a result rounds to zero. Include negative subnormals: FLOOR should give -1, while CEIL and TRUNC should give -0. The positive counterpart distinguishes CEIL from TRUNC. The existing consumer and half-width rejection controls still apply.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T15:44:15Z.
#881 merged at
b8646f5. The finite, low-half FLOOR, CEIL, TRUNC and RNDNE forms now have integer pixel readbacks and passed on WARP and RTX. All five mutations, including ties-away and lost negative zero, differed on both. The out-of-scope forms and arbitrary runtime inputs still need separate evidence, so this stays open.Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-23T15:53:05Z.
Thanks for landing #881. Here is a proposal for the next slice; I won't start it without your go-ahead.
The candidates are
v_cvt_f16_i16andv_cvt_f16_u16(VOP1 and_e64). LLVM 15.0.7VOP1Instructions.tdL432-433 maps them tosint_to_fpanduint_to_fp. The integer input class differs from the float slices:v_cvt_f16_i16: every i16 input (−32768…32767) converts to a finite binary16 under nearest-even. No NaN or inf can arise, and the largest magnitude, 32768, is representable. So a runtime source could be accepted, as long as it is a value the existing 16-bit integer contract already reads correctly: alow16result, or a register whose low 16 bits are read.v_cvt_f16_u16: inputs ≥ 65520 round to +inf. The source would therefore need a proof that its value is below 65520, and runtime values would be refused. The alternative is to pin the overflow at the boundary, but you set that up as a separate case.Either way the result would be a
half16low half for the audited readers.clampand omod are refused, under the explicit denormal entry profile. Integers above 2048 still round, so the draw would include halfway integers such as 2049 and 4099, ±32768, -0 versus +0 (the integer 0 gives +0), and the boundary 65519/65520 for u16.Would you accept runtime i16 sources for
v_cvt_f16_i16, or keep both conversions on proven-constant sources for now? AI-assisted (Claude Code).Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T16:04:05Z.
Please go ahead with runtime signed i16 through the existing audited low-16 integer reader. It must sign-extend bits 15:0, and the result stays a low-half-only binary16 value. All signed i16 inputs round to finite binary16 under the stated mode, so a constant proof is unnecessary. For u16, keep the current scope to statically proven values below 65520; reject an unproven runtime source and the overflow boundary. Keep modifiers refused.
For signed runtime cases, send distinct values through the same compiled shader and vary the high half independently. Include -32768, 32767, 2049 and its negative, and integer zero (expected +0). For unsigned constants, 65519 should round to 65504 and 65520 should be refused. Use raw-bit readback and a mutation that would catch a zero-extension or ties-away implementation.
Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-23T19:52:37Z.
Thanks for checking @JB2WIN! Neither #419 (DPP binary16 ops) nor #421 (DPP conversions) overlaps with plain VOP1/VOP2 binary16 forms — glad #881 landed and feel free to proceed with the next plain slice.
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-23T19:52:52Z.
Thanks for landing #921. Here is a proposal for the reverse direction. I'll wait for your go-ahead before starting it.
The forms are
v_cvt_i16_f16andv_cvt_u16_f16, plain and_e64. LLVM 15.0.7VOP1Instructions.tdL436-437 maps them tofp_to_sintandfp_to_uint(VOP_I16_F16_SPECIAL_OMOD), which truncate toward zero. Under the existing rules, the slice would be:low16integer value, readable through the audited 16-bit integer readers from #732. The bits are the low 16 bits of the truncated integer.clampand omod.Should this slice stay on proven in-range constants, or do you want a different first step for half→int? AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T20:01:38Z.
Please proceed with the finite, statically proven in-range slice. RDNA 2 §12.8, VOP1 entries 82 and 83, explicitly specifies truncation for both. Apply the range check to the truncated integer, then produce a low16 result and retain the existing high-half refusal. For boundary tests use exactly representable halves: 32752 and 32768 straddle the positive signed limit, and -32768 and its next lower half straddle the negative limit. 32767.5 is not representable as a half. Include -0.5 to unsigned zero, -1 refused for unsigned, 65504 for unsigned, nonfinite/unknown-source refusals, and an independent rounding mutation. Keep modifiers and output modifiers outside this slice. Use LLVM 15 assembly and exact integer readback for plain and e64.
AMD RDNA 2 ISA reference
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T00:35:07Z.
#1077 and #1084 cover the same finite, statically proven binary16-to-i16/u16 low-half conversion slice. @tedin7 and @romn4rch, please use #1077 as the integration point and bring any distinct boundary or mutation controls from #1084 over with attribution. One independent LLVM 15/WARP review of the combined candidate would help. Keep the whole-word/high-half rejection, exact signed and unsigned endpoints, and the controls for nonfinite and out-of-range inputs. The issue remains open while this slice is reviewed.
Imported from R0Y00/Xbox2Windows. Originally posted by romn4rch on 2026-11-24T00:53:04Z.
I compared #1084 with #1077 at
e7ab28bto find controls to bring over. Every boundary, refusal and mutation in #1084 already has a counterpart in #1077:0x77ff) and -32768 (0xf800) accepted; 32768 (0x7800) and -32800 (0xf801) refused0xb800) gives 0, 65504 (0x7bff) accepted, -1 (0xbc00) refused0x0001and0x8001Nothing needs to move. One behavioural difference: #1084 accepts both forms under round toward zero, treating the truncation as defined by the instruction, while #1077 refuses them like the other binary16 forms. I would keep #1077's refusal for this slice, because nothing here measures whether the MODE rounding field affects these conversions.
I'm closing #1084 in favour of #1077 and will run an independent LLVM 15 and WARP review of #1077.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:04:41Z.
Claiming v_fmac_f16_e32 and v_ldexp_f16_e32 in tools/pixel_aot.py (their disassembly is already in main). The v_cvt_i16/u16_f16 slice is #1077. Environment: Linux with LLVM 19 locally; I rely on the Ubuntu LLVM 15 job and the Windows WARP jobs for the rest. AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T03:17:36Z.
Please go ahead with the two literal-K forms. Keep the low-half definedness rules and the previously tested FMA profile. An LLVM 15 assemble/disassemble check should distinguish which operand receives K. For execution, use different values for both source operands and K, a rounding case that distinguishes a fused result from two operations, and a control that puts the literal in the wrong slot. Keep whole-word and high-half consumers refused where the upper half is unknown.