Shaders: lower RDNA2 lighting multiply in DXIL #2938
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2938
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2938"
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?
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 00:55 UTC · original
andrewpozdnakov7-jpg:codex2/mullit-f32→main· +236 −0 · 3 files · 1 commits · openWhat changed
The DXIL lowerer now handles VOP3 opcode 0x150 in the default f32 mode used by VIctory. A positive, ordered third operand enables the multiplication. The right operand's negative maximum-finite, negative infinity or NaN encoding returns negative maximum-finite. The result then follows the measured priority of the legacy zero and left NaN rules.
The product's underflow check uses a scaled multiply so the decision at the smallest normal can be made after rounding to 24 significant bits. The lowering applies source abs/neg and output scale/clamp while preserving the relevant NaN payload and zero bits. The behavior comes from public physical RDNA2 reports. Operand rules and source modifiers, flushed inputs, product rounding, output modifiers.
Validation
63bcca43fails with Unsupported for v_mullit_f32. At this head it passes DXIL validation and D3D12 WARP SM 6.6 UAV readback for every case.AI-assisted.
@fuzeofficlal on GitHub · 2026-11-26 01:08 UTC · original
Code review and RTX 5090 + WARP + DXIL verification at head
20352211afebmerged cleanly ontomain(63bcca43c6a0;emit/lower.rs=520,643B, only+80B thanks to splittingemit/lower/lighting_mul.rs):crates/victory-shader/src/emit/lower/lighting_mul.rs):abs/negbitwise (And !SIGN/Xor SIGN, lines 35-40) avoids quieting sNaNs prematurely.invalid_rhs(rhs_nan || rhs >= NEGATIVE_MAX) returns-f32::MAX(0xff7f_ffff) ahead ofeither_zero(|lhs| < MIN_NORMAL || |rhs| < MIN_NORMAL -> +0.0), so0.0 * -Infand0.0 * qNaNproduce-f32::MAXwhile0.0 * +Inf/0.0 * NaN_lhsproduce+0.0.2^64(0x5f80_0000, lines 80-111) avoids host tininess/FTZ discrepancies around2^-126, andomod(scale_lighting_result) runs before unsigned-clampingclamp([0, 1.0], negatives/NaNs ->+0.0).dxil.dll10.0.26100.0,VICTORY_D3D12_DEBUG=1, Rust 1.98.1):cargo xtask policy:192 files ok;cargo clippy(default +--all-features): 0 warningsmullit lighting emit::tests emit::lower::tests: 51/51 passed on both RTX 5090 and WARP (includingv_mullit_f32_applies_lighting_rules).Clean submodule split and thorough special-value handling; LGTM.
@Marvisak on GitHub · 2026-11-26 04:27 UTC · original
Automated triage for the maintainers.
Merge candidate. Adds a DXIL lowering for
v_mullit_f32(VOP3 0x150) inemit/lower/lighting_mul.rs, dispatched fromLower::valu. The main special case (S1 is -MAX_FLOAT, -INF or NaN, or S2 is not positive or is NaN, gives -MAX_FLOAT) matches the RDNA2 ISA guide; the gate's interaction with denormal flushing, abs/neg handling that keeps sNaN payloads, omod before clamp and the scaled-product tininess handling read correctly, and the test uses the cited measurements as expected values. Please cite the RDNA2 ISA guide in the doc comment next to the links for the finer rules. Merging this and #2942 leaves a trivialmodline conflict inemit/lower.rs.CI: passing.
Generated by Claude Code
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.