shader: improve v_log_f32 accuracy near unity (NEW-58) #2160

Open
github-bot wants to merge 4 commits from github-bot/gh-2160 into main AGit
Owner

@⁠TheGrayOrange on GitHub · 2026-11-25 06:41 UTC · original
TheGrayOrange:task/new-58-log-accuracy-submission → main · +519 −0 · 2 files · 4 commits · open

Direct3D Log allows an absolute error of "2^-21" on inputs in "[0.5, 2]". RDNA2 documents 1-ULP accuracy and exact positive zero at unity for "V_LOG_F32". On the original lowering, "0x3f7fffff" produced "0xb24b4000" on RTX 4070 Ti SUPER and "0xb3e00000" on WARP, versus rounded reference "0xb3b8aa3c". Both host results meet the Direct3D bound. "Direct3D Log" (https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/log--sm4---asm-) · "AMD RDNA2 ISA, p. 141" (https://docs.amd.com/api/khub/documents/Etwpu9gFfl7d9q0QZ~Og/content#page=149)

The correction now covers "|x − 1| ≤ 1/8". It splits the linear term so the leading product is exact, then evaluates the remaining degree-eight Taylor terms in two grouped Horner chains. The conservative bound is below 0.859 true reference-binade ULP for this band, under the specified binary32 arithmetic ordering, permitting local multiply-add contraction but not reassociation. Outside it, the lowering preserves DXIL Log, including the existing accuracy gap. Of 66 sampled fallback inputs, errors reached 8.928844 ULP on NVIDIA and 3.648209 ULP on WARP.

The permanent regression generates runtime operands and computes its expected bounds from an independent binary64 atanh reference. It keeps the unrounded 1-ULP check and removes the generated table and standalone tool. The CPU model swept all 3,145,729 in-band encodings with representative contraction schedules. Device execution was sampled. Both adapters passed 260 permanent inputs plus exact positive zero at unity. Earlier equivalent-shader verification covered 244 additional in-band inputs on each adapter and preserved sampled fallback and modifier behavior. The maximum sampled in-band error was 0.605534 ULP on both adapters, and SDK DXIL validation passed.

Synthetic execution cost

On RTX 4070 Ti SUPER, matched native D3D12 timings put the grouped correction about 17% below degree nine for long dependency chains and 3% below for long throughput batches. Short throughput differences were inconclusive. The old-band long throughput medians were 19.456 µs for original, 55.296 µs for published degree five and 70.656 µs for degree nine in the earlier run. A separate matched run measured 70.656 µs for degree nine and 68.608 µs for grouped degree eight. The correction still adds execution cost, including for fallback inputs. This is synthetic workload evidence from one physical NVIDIA GPU. Native machine-code measurements, physical RDNA2 verification and game-data validation were outside the scope.

Validation

On base "940d32f", normal Windows workspace tests went from 695/5/10 to 696/5/10 and all-feature tests went from 700/5/10 to 701/5/10 (passed/failed/ignored). The same five existing failures affect descriptor capacity, dynamic slot allocation, unbound buffer reads, structured-buffer stride and NaN-coordinate gathers. Warning-denied workspace Clippy passed in both modes, as did full and staged asset policy. The formatter reports the existing base differences.

A merge preview against newer upstream "13f91ca" completed without conflicts. The merged tree has not yet been built or tested. Upstream CI has yet to validate this revision.

Developed with Strata/Qwen3.8 assistance and independently verified and integrated with Codex under human supervision. "Community claim NEW-58" (#1633)

**@⁠TheGrayOrange** on GitHub · 2026-11-25 06:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/2160) `TheGrayOrange:task/new-58-log-accuracy-submission` → `main` · +519 −0 · 2 files · 4 commits · open Direct3D Log allows an absolute error of "2^-21" on inputs in "[0.5, 2]". RDNA2 documents 1-ULP accuracy and exact positive zero at unity for "V_LOG_F32". On the original lowering, "0x3f7fffff" produced "0xb24b4000" on RTX 4070 Ti SUPER and "0xb3e00000" on WARP, versus rounded reference "0xb3b8aa3c". Both host results meet the Direct3D bound. "[Direct3D Log](https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/log--sm4---asm-)" (https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/log--sm4---asm-) · "[AMD RDNA2 ISA, p. 141](https://docs.amd.com/api/khub/documents/Et~wpu9g~Ffl7d9q0QZ~Og/content#page=149)" (https://docs.amd.com/api/khub/documents/Et~wpu9g~Ffl7d9q0QZ~Og/content#page=149) The correction now covers "|x − 1| ≤ 1/8". It splits the linear term so the leading product is exact, then evaluates the remaining degree-eight Taylor terms in two grouped Horner chains. The conservative bound is below 0.859 true reference-binade ULP for this band, under the specified binary32 arithmetic ordering, permitting local multiply-add contraction but not reassociation. Outside it, the lowering preserves DXIL Log, including the existing accuracy gap. Of 66 sampled fallback inputs, errors reached 8.928844 ULP on NVIDIA and 3.648209 ULP on WARP. The permanent regression generates runtime operands and computes its expected bounds from an independent binary64 atanh reference. It keeps the unrounded 1-ULP check and removes the generated table and standalone tool. The CPU model swept all 3,145,729 in-band encodings with representative contraction schedules. Device execution was sampled. Both adapters passed 260 permanent inputs plus exact positive zero at unity. Earlier equivalent-shader verification covered 244 additional in-band inputs on each adapter and preserved sampled fallback and modifier behavior. The maximum sampled in-band error was 0.605534 ULP on both adapters, and SDK DXIL validation passed. Synthetic execution cost On RTX 4070 Ti SUPER, matched native D3D12 timings put the grouped correction about 17% below degree nine for long dependency chains and 3% below for long throughput batches. Short throughput differences were inconclusive. The old-band long throughput medians were 19.456 µs for original, 55.296 µs for published degree five and 70.656 µs for degree nine in the earlier run. A separate matched run measured 70.656 µs for degree nine and 68.608 µs for grouped degree eight. The correction still adds execution cost, including for fallback inputs. This is synthetic workload evidence from one physical NVIDIA GPU. Native machine-code measurements, physical RDNA2 verification and game-data validation were outside the scope. Validation On base "940d32f", normal Windows workspace tests went from 695/5/10 to 696/5/10 and all-feature tests went from 700/5/10 to 701/5/10 (passed/failed/ignored). The same five existing failures affect descriptor capacity, dynamic slot allocation, unbound buffer reads, structured-buffer stride and NaN-coordinate gathers. Warning-denied workspace Clippy passed in both modes, as did full and staged asset policy. The formatter reports the existing base differences. A merge preview against newer upstream "13f91ca" completed without conflicts. The merged tree has not yet been built or tested. Upstream CI has yet to validate this revision. Developed with Strata/Qwen3.8 assistance and independently verified and integrated with Codex under human supervision. "[Community claim NEW-58](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633)" (https://git.gtahub.st/github/Marvisak--VIctory/issues/1633)
For inputs within 2^-6 of one, evaluate log2(1+t) with a split
linear term and a degree-five series. Preserve DXIL Log outside
the interval.

Cover the guest 1-ULP bound with runtime synthetic inputs and
provide a standalone tool to regenerate the reference windows.

NEW-58
Widen the near-unity band to 1/8 and group the degree-eight terms into
parallel Horner chains around the exact split linear product.

Compute the regression reference at runtime and preserve the true 1-ULP
check. Remove the generated table and standalone tool.

NEW-58
Preserve the legacy-multiply regression and append the accepted
near-unity logarithm regression after it.

NEW-58
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:56:46 +00:00
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 07:41 UTC · original · edited 2026-11-25 22:58 UTC

Update (head 6001af3): I re-ran the same probe: the same 1,202 inputs, |x − 1| from 2^-7 to 1/8 on both sides of 1.0, step 2^-7/40, scored against a correctly rounded log2 in exact arithmetic. It ran on an RTX 3070 (driver 616.56, Windows 11 26100.9711) and on WARP.
At 6001af3 both backends returned the same bits for all 1,202 inputs: 0 above 1 ULP, max 1 ULP against the correctly rounded value (0.565 ULP against the unrounded one), and 27 inputs 1 ULP off the correctly rounded value.
v_log_f32_near_unity_meets_rdna2_one_ulp passes on both backends (worst in-band error 0.606 ULP; fallback probes past 1/8 up to 8.93 ULP on the 3070 and 3.65 ULP on WARP).
As a control, the same probe on main f3578e3 (no correction) matches the table below in the three bands above 2^-6 (RTX 3070: 154/37, 300/38, 590/19; WARP: 47/12, 42/5, 12/2, as >1 ULP count / max ULP). In the first band, 2^-7 to 2^-6, main has 82 of 82 inputs above 1 ULP on the RTX 3070 (max 117 ULP) and 36 of 82 on WARP (max 17); the table below shows that band on the PR's earlier head, not on main. (Edited: the first version said main reproduced the whole table.) This input set stops at 1/8, so it says nothing about the band edge from outside.


Data on how far the near-unity correction needs to reach. Your test at 636d222 passes on an RTX 3070 (Ampere, driver 616.56, Windows 11) and on WARP. I added a local probe to it, not pushed: 1,202 inputs from |x − 1| = 2^-7 to 1/8 on both sides of 1.0, each result compared with a correctly rounded log2 computed in exact arithmetic. The comparison reproduces your reference rows and the 0x3f7fffff case.

| |x − 1| | inputs | RTX 3070 > 1 ULP | RTX 3070 max | WARP > 1 ULP | WARP max |
|---|---|---|---|---|---|
| 2^-7 – 2^-6 (inside the series band) | 82 | 0 | 0 | 0 | 0 |
| 2^-6 – 2^-5 | 160 | 154 | 37 ULP | 47 | 12 ULP |
| 2^-5 – 2^-4 | 320 | 300 | 38 ULP | 42 | 5 ULP |
| 2^-4 – 2^-3 | 640 | 590 | 19 ULP | 12 | 2 ULP |

Worst cases on the 3070: 0x3f839333 → 0x3d22c82e (correctly rounded 0x3d22c809) and 0x3f855333 → 0x3d70dc12 (0x3d70dbec).

So inside the band the series meets the 1-ULP contract, but just outside it NVIDIA's Log is still tens of ULP off. RDNA2 isn't: boykopovar/AnyPS5#2880 measured gfx1036 with tools/hw-oracle within 1 ULP of correctly rounded on all 2,368 rows 1 ± 2^-k(1 + m/64) and on a dense sample over [0.875, 1.375]. It found the NVIDIA driver up to 29,121 ULP off there. AnyPS5's fix takes a series in d = x − 1 for |d| ≤ 1/8: eight terms with fused multiply-adds stayed within 2 ULP of the hardware on all 9,280 inputs in that band, six terms reached 9 ULP, and a 1/4 band needed eleven terms. Widening the band to 1/8, with more terms, would cover what this probe shows. I haven't measured past 1/8.

AI-assisted (Claude Code). Synthetic inputs only; the probe and the script that scores it are local.

**@⁠upipibi** on GitHub · 2026-11-25 07:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/2160#issuecomment-7156151244) · edited 2026-11-25 22:58 UTC **Update (head `6001af3`):** I re-ran the same probe: the same 1,202 inputs, |x − 1| from 2^-7 to 1/8 on both sides of 1.0, step 2^-7/40, scored against a correctly rounded `log2` in exact arithmetic. It ran on an RTX 3070 (driver 616.56, Windows 11 26100.9711) and on WARP. At `6001af3` both backends returned the same bits for all 1,202 inputs: 0 above 1 ULP, max 1 ULP against the correctly rounded value (0.565 ULP against the unrounded one), and 27 inputs 1 ULP off the correctly rounded value. `v_log_f32_near_unity_meets_rdna2_one_ulp` passes on both backends (worst in-band error 0.606 ULP; fallback probes past 1/8 up to 8.93 ULP on the 3070 and 3.65 ULP on WARP). As a control, the same probe on main `f3578e3` (no correction) matches the table below in the three bands above 2^-6 (RTX 3070: 154/37, 300/38, 590/19; WARP: 47/12, 42/5, 12/2, as >1 ULP count / max ULP). In the first band, 2^-7 to 2^-6, main has 82 of 82 inputs above 1 ULP on the RTX 3070 (max 117 ULP) and 36 of 82 on WARP (max 17); the table below shows that band on the PR's earlier head, not on main. (Edited: the first version said main reproduced the whole table.) This input set stops at 1/8, so it says nothing about the band edge from outside. --- Data on how far the near-unity correction needs to reach. Your test at `636d222` passes on an RTX 3070 (Ampere, driver 616.56, Windows 11) and on WARP. I added a local probe to it, not pushed: 1,202 inputs from |x − 1| = 2^-7 to 1/8 on both sides of 1.0, each result compared with a correctly rounded `log2` computed in exact arithmetic. The comparison reproduces your reference rows and the `0x3f7fffff` case. | |x − 1| | inputs | RTX 3070 > 1 ULP | RTX 3070 max | WARP > 1 ULP | WARP max | |---|---|---|---|---|---| | 2^-7 – 2^-6 (inside the series band) | 82 | 0 | 0 | 0 | 0 | | 2^-6 – 2^-5 | 160 | 154 | 37 ULP | 47 | 12 ULP | | 2^-5 – 2^-4 | 320 | 300 | 38 ULP | 42 | 5 ULP | | 2^-4 – 2^-3 | 640 | 590 | 19 ULP | 12 | 2 ULP | Worst cases on the 3070: `0x3f839333` → `0x3d22c82e` (correctly rounded `0x3d22c809`) and `0x3f855333` → `0x3d70dc12` (`0x3d70dbec`). So inside the band the series meets the 1-ULP contract, but just outside it NVIDIA's `Log` is still tens of ULP off. RDNA2 isn't: boykopovar/AnyPS5#2880 measured gfx1036 with `tools/hw-oracle` within 1 ULP of correctly rounded on all 2,368 rows 1 ± 2^-k(1 + m/64) and on a dense sample over [0.875, 1.375]. It found the NVIDIA driver up to 29,121 ULP off there. AnyPS5's fix takes a series in d = x − 1 for |d| ≤ 1/8: eight terms with fused multiply-adds stayed within 2 ULP of the hardware on all 9,280 inputs in that band, six terms reached 9 ULP, and a 1/4 band needed eleven terms. Widening the band to 1/8, with more terms, would cover what this probe shows. I haven't measured past 1/8. AI-assisted (Claude Code). Synthetic inputs only; the probe and the script that scores it are local.
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 08:04 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head 636d2222 onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

**@⁠sinan-cmyk** on GitHub · 2026-11-25 08:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2160#issuecomment-7156568961) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 636d2222 onto `main` 940d32f (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 23,918 with this PR. No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 11:24 UTC · original · edited 2026-11-26 01:21 UTC

Automated triage for the maintainers.

Merge candidate. The branch is rebased (ac40854) and merges cleanly. The earlier asks are met. The standalone generator and generated table are gone, so the diff touches only emit/lower.rs and emit/valu_tests.rs. Lower::log_f32 has a short comment. The band is widened to |x − 1| ≤ 1/8. The evidence is the RDNA2 ISA's V_LOG_F32 contract (1 ULP, exact +0 at 1.0). An independent RTX 3070 and WARP probe on 6001af3 found no in-band input more than 1 ULP off. Outside the band, and for NaN or infinity, the ordered OLE select keeps DXIL Log unchanged. The regression computes its reference at run time (atanh series in binary64), not from a table.

For the maintainers: every v_log_f32 now runs the series as well as DXIL Log, and the cost is measured only synthetically.

Nits: the test comments cite VIC-0018 and VIC-0005, which are not in this repo, so please drop them. The new arm _ if name == "v_log_f32" could be 23 => like its neighbours.

CI: not run. The workflow for this head is waiting for maintainer approval (action_required).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 11:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/2160#issuecomment-7161011484) · edited 2026-11-26 01:21 UTC <!-- victory-triage v1 head=ac40854b8850690a48b738aef8cdf62a89c55d27 verdict=merge-candidate at=2026-11-26T01:21:37Z --> Automated triage for the maintainers. **Merge candidate.** The branch is rebased (`ac40854`) and merges cleanly. The earlier asks are met. The standalone generator and generated table are gone, so the diff touches only `emit/lower.rs` and `emit/valu_tests.rs`. `Lower::log_f32` has a short comment. The band is widened to |x − 1| ≤ 1/8. The evidence is the RDNA2 ISA's `V_LOG_F32` contract (1 ULP, exact +0 at 1.0). An independent RTX 3070 and WARP probe on `6001af3` found no in-band input more than 1 ULP off. Outside the band, and for NaN or infinity, the ordered `OLE` select keeps DXIL `Log` unchanged. The regression computes its reference at run time (atanh series in binary64), not from a table. For the maintainers: every `v_log_f32` now runs the series as well as DXIL `Log`, and the cost is measured only synthetically. Nits: the test comments cite `VIC-0018` and `VIC-0005`, which are not in this repo, so please drop them. The new arm `_ if name == "v_log_f32"` could be `23 =>` like its neighbours. CI: not run. The workflow for this head is waiting for maintainer approval (`action_required`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠TheGrayOrange on GitHub · 2026-11-25 14:36 UTC · original

Received.

I'll simplify the regression by replacing the generated table and standalone reference generator with a compact runtime reference, subject to validating its accuracy. I'll also shorten the implementation comments.

The measurements outside the current correction interval are particularly helpful. I'll investigate extending the interval toward |x − 1| ≤ 1/8 while retaining the 1-ULP accuracy target, and measure the shader execution overhead against both main and the current PR.

I'll report the resulting accuracy coverage, remaining limitations, and performance measurements before updating the PR.

**@⁠TheGrayOrange** on GitHub · 2026-11-25 14:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/2160#issuecomment-7165547153) Received. I'll simplify the regression by replacing the generated table and standalone reference generator with a compact runtime reference, subject to validating its accuracy. I'll also shorten the implementation comments. The measurements outside the current correction interval are particularly helpful. I'll investigate extending the interval toward |x − 1| ≤ 1/8 while retaining the 1-ULP accuracy target, and measure the shader execution overhead against both main and the current PR. I'll report the resulting accuracy coverage, remaining limitations, and performance measurements before updating the PR.
Author
Owner

@⁠TheGrayOrange on GitHub · 2026-11-25 22:06 UTC · original

I've updated the PR to address the feedback.

The correction now covers an inclusive "|x − 1| ≤ 1/8" and uses a grouped degree-eight approximation with an exact leading product. The conservative error bound is below 0.859 ULP in that interval. Both reported RTX encodings now pass, and the permanent NVIDIA and WARP runs passed all 260 nonzero in-band inputs and exact positive zero at unity.

The regression now computes its independent binary64 reference at runtime and applies the 1-ULP bound against the unrounded reference. The standalone generator and generated table are gone, and the lowering comments have been shortened. DXIL Log remains the fallback, with sampled errors outside the new band reaching 8.93 ULP on the tested NVIDIA adapter.

I also measured the original lowering, published correction and wider correction, then investigated lower-cost alternatives. Matched native D3D12 timing on RTX 4070 Ti SUPER showed about 17% lower long dependency-chain time and 3% lower long throughput-batch time for the final grouped implementation compared with the intermediate degree-nine correction. Short throughput results were inconclusive. The correction still costs more than original Log and the previously published degree-five revision in the synthetic workloads.

The updated PR description includes the numerical results, performance measurements and remaining limitations. Local Windows validation reproduced the same five baseline failures in both workspace configurations. Upstream CI remains pending.

**@⁠TheGrayOrange** on GitHub · 2026-11-25 22:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2160#issuecomment-7175934683) I've updated the PR to address the feedback. The correction now covers an inclusive "|x − 1| ≤ 1/8" and uses a grouped degree-eight approximation with an exact leading product. The conservative error bound is below 0.859 ULP in that interval. Both reported RTX encodings now pass, and the permanent NVIDIA and WARP runs passed all 260 nonzero in-band inputs and exact positive zero at unity. The regression now computes its independent binary64 reference at runtime and applies the 1-ULP bound against the unrounded reference. The standalone generator and generated table are gone, and the lowering comments have been shortened. DXIL Log remains the fallback, with sampled errors outside the new band reaching 8.93 ULP on the tested NVIDIA adapter. I also measured the original lowering, published correction and wider correction, then investigated lower-cost alternatives. Matched native D3D12 timing on RTX 4070 Ti SUPER showed about 17% lower long dependency-chain time and 3% lower long throughput-batch time for the final grouped implementation compared with the intermediate degree-nine correction. Short throughput results were inconclusive. The correction still costs more than original Log and the previously published degree-five revision in the synthetic workloads. The updated PR description includes the numerical results, performance measurements and remaining limitations. Local Windows validation reproduced the same five baseline failures in both workspace configurations. Upstream CI remains pending.
Author
Owner

@⁠TheGrayOrange on GitHub · 2026-11-25 22:10 UTC · original

I've updated the PR to address the feedback.

The correction now covers an inclusive "|x − 1| ≤ 1/8" and uses a grouped degree-eight approximation with an exact leading product. The conservative error bound is below 0.859 ULP in that interval. Both reported RTX encodings now pass, and the permanent NVIDIA and WARP runs passed all 260 nonzero in-band inputs and exact positive zero at unity.

The regression now computes its independent binary64 reference at runtime and applies the 1-ULP bound against the unrounded reference. The standalone generator and generated table are gone, and the lowering comments have been shortened. DXIL Log remains the fallback, with sampled errors outside the new band reaching 8.93 ULP on the tested NVIDIA adapter.

I also measured the original lowering, published correction and wider correction, then investigated lower-cost alternatives. Matched native D3D12 timing on RTX 4070 Ti SUPER showed about 17% lower long dependency-chain time and 3% lower long throughput-batch time for the final grouped implementation compared with the intermediate degree-nine correction. Short throughput results were inconclusive. The correction still costs more than original Log and the previously published degree-five revision in the synthetic workloads.

The updated PR description includes the numerical results, performance measurements and remaining limitations. Local Windows validation reproduced the same five baseline failures in both workspace configurations. Upstream CI remains pending.

**@⁠TheGrayOrange** on GitHub · 2026-11-25 22:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/2160#issuecomment-7176030560) I've updated the PR to address the feedback. The correction now covers an inclusive "|x − 1| ≤ 1/8" and uses a grouped degree-eight approximation with an exact leading product. The conservative error bound is below 0.859 ULP in that interval. Both reported RTX encodings now pass, and the permanent NVIDIA and WARP runs passed all 260 nonzero in-band inputs and exact positive zero at unity. The regression now computes its independent binary64 reference at runtime and applies the 1-ULP bound against the unrounded reference. The standalone generator and generated table are gone, and the lowering comments have been shortened. DXIL Log remains the fallback, with sampled errors outside the new band reaching 8.93 ULP on the tested NVIDIA adapter. I also measured the original lowering, published correction and wider correction, then investigated lower-cost alternatives. Matched native D3D12 timing on RTX 4070 Ti SUPER showed about 17% lower long dependency-chain time and 3% lower long throughput-batch time for the final grouped implementation compared with the intermediate degree-nine correction. Short throughput results were inconclusive. The correction still costs more than original Log and the previously published degree-five revision in the synthetic workloads. The updated PR description includes the numerical results, performance measurements and remaining limitations. Local Windows validation reproduced the same five baseline failures in both workspace configurations. Upstream CI remains pending.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 23:20 UTC · original

I resolved the conflict in valu_tests.rs on an integration branch at 8739b74. Your exact 6001af3 is its first parent, with both authored commits preserved. The only conflict was the insertion point for your log test and the upstream legacy-multiply test. Both are included.

On app-local WARP SM 6.6 with DXIL validation, your same fixture reported 114 violations on 842b0cb and zero at 8739b74. The 260 in-band values had a worst error of 0.605534 ULP at the integrated head and unity returned exact positive zero. The legacy-multiply regression, the 36 VALU tests, strict shader Clippy and the asset policy also passed. The integration merges cleanly with 842b0cb; you can fast-forward your branch to it.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 23:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/2160#issuecomment-7177425807) I resolved the conflict in `valu_tests.rs` on an [integration branch](https://github.com/andrewpozdnakov7-jpg/VIctory/tree/codex2/merge-2160-current-main) at [`8739b74`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/8739b7408a9bf0b009698c353baf5e20326438a8). Your exact `6001af3` is its first parent, with both authored commits preserved. The only conflict was the insertion point for your log test and the upstream legacy-multiply test. Both are included. On app-local WARP SM 6.6 with DXIL validation, your same fixture reported 114 violations on `842b0cb` and zero at `8739b74`. The 260 in-band values had a worst error of 0.605534 ULP at the integrated head and unity returned exact positive zero. The legacy-multiply regression, the 36 VALU tests, strict shader Clippy and the asset policy also passed. The integration merges cleanly with `842b0cb`; you can fast-forward your branch to it.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 06:54 UTC · original · approved these changes

Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, cargo test -p victory-shader --locked.

144 passed / 0 failed / 2 ignored. v_log_f32 accuracy improved near unity (NEW-58) — log precision fix near 1.0; numerical-accuracy work, hardware validation still needed on Windows.

**@⁠catminou4** on GitHub · 2026-11-25 06:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2160#pullrequestreview-6053114947) · **approved these changes** Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, `cargo test -p victory-shader --locked`. 144 passed / 0 failed / 2 ignored. v_log_f32 accuracy improved near unity (NEW-58) — log precision fix near 1.0; numerical-accuracy work, hardware validation still needed on Windows.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 13:00 UTC · original

I ran the entire inclusive [0.875, 1.125] interval as translated v_log_f32 on WARP 1.0.22 with Agility 1.620.2 and SDK DXIL validation. The same synthetic shader consumed every binary32 encoding from a buffer and echoed the input beside its result. The comparison used binary64 ln_1p(x - 1) * log2(e) and the unrounded reference’s binary32 binade spacing.

Revision Inputs read back Above 1 ULP Worst error
Upstream 63bcca4 3,145,729 886,601 2,577,860.478 ULP at 0x3f7fffff
Exact ac40854 3,145,729 0 0.721567 ULP at 0x3f603a70
ac40854 combined with 63bcca4 3,145,729 0 0.721567 ULP at 0x3f603a70

Unity returned the exact positive-zero word. Both immediate out-of-band neighbors, ±0, +∞ and 2.0 match upstream bit for bit. This sweep measures WARP. The physical-adapter results are the samples already reported in the PR.

The opt-in test is 20dd20f, a test-only commit on your exact head. With SM 6.6 WARP and the SDK validator set up:

cargo test --locked -p victory-shader --lib emit::semantics_tests::log_f32_dense_warp_sweep -- --exact --ignored --nocapture --test-threads=1

If you reuse the probe, please retain its Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding it into another commit.

AI-assisted with Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 13:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2160#issuecomment-7192757008) I ran the entire inclusive `[0.875, 1.125]` interval as translated `v_log_f32` on WARP 1.0.22 with Agility 1.620.2 and SDK DXIL validation. The same synthetic shader consumed every binary32 encoding from a buffer and echoed the input beside its result. The comparison used binary64 `ln_1p(x - 1) * log2(e)` and the unrounded reference’s binary32 binade spacing. | Revision | Inputs read back | Above 1 ULP | Worst error | | --- | ---: | ---: | ---: | | Upstream `63bcca4` | 3,145,729 | 886,601 | 2,577,860.478 ULP at `0x3f7fffff` | | Exact `ac40854` | 3,145,729 | **0** | **0.721567 ULP** at `0x3f603a70` | | `ac40854` combined with `63bcca4` | 3,145,729 | **0** | **0.721567 ULP** at `0x3f603a70` | Unity returned the exact positive-zero word. Both immediate out-of-band neighbors, ±0, +∞ and 2.0 match upstream bit for bit. This sweep measures WARP. The physical-adapter results are the samples already reported in the PR. The opt-in test is [20dd20f](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/20dd20f38290456ab236607aaeb98b7ac71ba3f7), a test-only commit on your exact head. With SM 6.6 WARP and the SDK validator set up: ```text cargo test --locked -p victory-shader --lib emit::semantics_tests::log_f32_dense_warp_sweep -- --exact --ignored --nocapture --test-threads=1 ``` If you reuse the probe, please retain its Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding it into another commit. AI-assisted with Codex.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 15:26 UTC · original · approved these changes

The t = hi + lo split (emit/lower.rs:2168-2206) makes C1 * hi exact in binary32, the ordered <= 1/8 band (OLE) includes both endpoints while falling back to DXIL Log for out-of-band values, infinities, zeros, and NaNs, and 1.0 returns bit-exact +0.0 (0x0000_0000). Exhaustive modeling across all 3,145,729 in-band binary32 encodings stayed within 0.721567 ULP (0.677041 ULP under FMA contraction).

Non-blocking notes:

  • Merged onto origin/main (63bcca43), emit/lower.rs grows to 523,781 B (only 507 B under the 524,288 B policy cap) — worth keeping in mind before stacking other lower.rs PRs.
  • In valu_tests.rs:2642-2645, the comment says One 24th of a ULP while the code uses 2^-24 (2f64.powi(-24)), and gating the per-input VIC6 BITS/VIC6 FALLBACK prints behind an env var would keep default test output concise.

Local verification at ac40854b (and cleanly merged onto origin/main at ee4ef6e5): xtask policy (191 files ok), cargo clippy -p victory-shader --all-targets (default and --all-features, 0 warnings), SDK dxil.dll validation, emit::valu_tests on both RTX 5090 and WARP (36/36), and v_log_f32_near_unity_meets_rdna2_one_ulp (checked=278, in_band=260, violations=0, worst_in_band_ulp=0.605534 on both RTX 5090 and WARP) all passed. Approving.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 15:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2160#pullrequestreview-6076733730) · **approved these changes** The `t = hi + lo` split (`emit/lower.rs:2168-2206`) makes `C1 * hi` exact in binary32, the ordered `<= 1/8` band (`OLE`) includes both endpoints while falling back to DXIL `Log` for out-of-band values, infinities, zeros, and NaNs, and `1.0` returns bit-exact `+0.0` (`0x0000_0000`). Exhaustive modeling across all 3,145,729 in-band binary32 encodings stayed within `0.721567 ULP` (`0.677041 ULP` under FMA contraction). Non-blocking notes: - Merged onto `origin/main` (`63bcca43`), `emit/lower.rs` grows to **`523,781 B`** (only **507 B** under the `524,288 B` policy cap) — worth keeping in mind before stacking other `lower.rs` PRs. - In `valu_tests.rs:2642-2645`, the comment says `One 24th of a ULP` while the code uses `2^-24` (`2f64.powi(-24)`), and gating the per-input `VIC6 BITS`/`VIC6 FALLBACK` prints behind an env var would keep default test output concise. Local verification at `ac40854b` (and cleanly merged onto `origin/main` at `ee4ef6e5`): `xtask policy` (`191 files ok`), `cargo clippy -p victory-shader --all-targets` (`default` and `--all-features`, 0 warnings), SDK `dxil.dll` validation, `emit::valu_tests` on both RTX 5090 and WARP (`36/36`), and `v_log_f32_near_unity_meets_rdna2_one_ulp` (`checked=278`, `in_band=260`, `violations=0`, `worst_in_band_ulp=0.605534` on both RTX 5090 and WARP) all passed. Approving.
Author
Owner

@⁠TheGrayOrange on GitHub · 2026-11-26 19:36 UTC · original

Thank you @⁠andrewpozdnakov7-jpg @⁠fuzeofficlal for verification, particularly the exhaustive WARP execution sweep and RTX 5090 coverage. It's encouraging to see the numerical results reproduced across additional environments.

I'll address the remaining comment, opcode matching and diagnostic-output cleanup without changing the numerical implementation.

**@⁠TheGrayOrange** on GitHub · 2026-11-26 19:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/2160#issuecomment-7201769634) Thank you @⁠andrewpozdnakov7-jpg @⁠fuzeofficlal for verification, particularly the exhaustive WARP execution sweep and RTX 5090 coverage. It's encouraging to see the numerical results reproduced across additional environments. I'll address the remaining comment, opcode matching and diagnostic-output cleanup without changing the numerical implementation.
Author
Owner

@⁠TheGrayOrange on GitHub · 2026-11-26 19:49 UTC · original

Addressed the remaining cleanup feedback in 4f7f699:

  • Removed internal assignment references.
  • Changed the opcode dispatch to 23 =>.
  • Corrected the ULP guard comment.
  • Gated detailed per-input output behind VICTORY_LOG_F32_VERBOSE=1.
  • Confirmed compliance with the file-size limit.

The focused WARP regression passed in both output modes. All 342 results and both validated DXIL containers remain identical to the previous verification.

The numerical implementation is unchanged.

Again, thanks @⁠andrewpozdnakov7-jpg @⁠fuzeofficlal for the testing and review.

**@⁠TheGrayOrange** on GitHub · 2026-11-26 19:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/2160#issuecomment-7202005130) Addressed the remaining cleanup feedback in `4f7f699`: - Removed internal assignment references. - Changed the opcode dispatch to `23 =>`. - Corrected the ULP guard comment. - Gated detailed per-input output behind `VICTORY_LOG_F32_VERBOSE=1`. - Confirmed compliance with the file-size limit. The focused WARP regression passed in both output modes. All 342 results and both validated DXIL containers remain identical to the previous verification. The numerical implementation is unchanged. Again, thanks @⁠andrewpozdnakov7-jpg @⁠fuzeofficlal for the testing and review.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2160/head:github-bot/gh-2160'
git switch 'github-bot/gh-2160'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2160'
git switch 'github-bot/gh-2160'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2160'
git switch 'github-bot/gh-2160'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2160'
git switch 'main'
git merge --squash 'github-bot/gh-2160'
git switch 'main'
git merge --ff-only 'github-bot/gh-2160'
git switch 'main'
git merge 'github-bot/gh-2160'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2160
No description provided.