WIP: fix(vk): float adds native on Panther Lake iGPUs, where the loop lost the exposure's adds #816
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8015c9a
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!816
Loading…
Reference in a new issue
No description provided.
Delete branch "ertomas/Longshot:fix/vk-ptl-native-fadd"
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?
Type: fix · Risk: low · Tested on: Windows 11, Intel Arc B390 (Panther Lake iGPU), driver 101.9150 · Needs: a Linux build of the renderer (Test Farm)
Why
On Intel's Panther Lake laptops (the Arc B390 iGPU), Kokiri Forest is covered by a steady, milky near-white haze that washes out the trees, the houses, the ground and the characters. The game measures how bright the scene is to set its exposure, and on these GPUs that measurement lost part of its sums, so the game exposed the picture about 8 times too bright. An Arc B580 at the same spot shows only the forest's light mist.
The same sums are the program the GPU was lost in on this PC a few minutes into play (#606), and #444 made the same change on the Arc B-series for that program: with this change, the device was not lost in 40 minutes of play here.
Fixes #618
See #606
How to reproduce
Seen on: Windows 11 Insider 26220, Intel Arc B390 (Panther Lake iGPU, PCI 0xB080, no VRAM mirror), driver 32.0.101.9150, Core Ultra X7 358H, 32 GB
Settings and switches: defaults (Auto (this PC) preset);
RX_VK_NO_INTEL_SERIAL=1for the shader preparation onlySteps: load a save in Kokiri Forest, stand by Link's house next to Saria, or walk the path towards the Deku Tree
Expected: the forest with its light mist and sun shafts, full contrast and colour (as on an Arc B580)
Actual: the whole picture behind a near-white veil, steady, on every build of main tried (
f647a072,fbd42024,414f56e2, and #189, #443, #459)What changed
The shaders' float adds to storage buffers are now the GPU's own atomic (
OpAtomicFAddEXT) by default on Intel's Windows driver for Panther Lake iGPUs (PCI device 0xB0xx) from driver 101.9150, as they already are on Meteor Lake, Arrow Lake and Battlemage. Before, these GPUs ran the compare-exchange loop, which gives up after 1024 attempts and loses that add.native_fadd_wanted()ingpu/vk/vk_main.cpptakes 0xB0xx from 101.9150; the log linevk: float atomic add on storage buffers:names Panther Lake.tests/test_native_float_atomic_add.py's table has six Panther Lake cases: the B390 at 101.9150 and another 0xB0xx device native; an older driver, Meteor Lake at 9150, Mesa's driver andRX_VK_NATIVE_FADD=0the loop. It fails on main (device 0xb080, version 101.9150: the loop) and passes here.RX_VK_NATIVE_FADDrow indocs/development.md; the runs indocs/tested/2026-11-14-igpu-haze-ertomas-run01.mdanddocs/tested/2026-11-15-igpu-haze-ertomas-run02.md.How it was found (frame dumps,
RX_VK_DUMP, on this PC):RX_VK_MIRROR=1,RX_VK_UB_SNAPSHOT=0(=1is this PC's default),RX_VK_SPLIT_UBFLUSH=1,RX_VK_READBACK_LATE=newest,RX_VK_CHUNK=0. So it is not stale or half-written memory without a VRAM mirror.ab368194) passes the picture through faithfully: the TAAU stand-in's output equals the tonemap's, and the last copy's sRGB encode is the game's own (NVN_FORMAT_RGBA8_SRGB). The tonemap's linear output had a mean of 0.71, against about 0.19 in a B580 screenshot of the same spot.RX_VK_NATIVE_FADD=1, every write to the scene target was about 8x darker from the first one on (the sky,489438d7: mean 20.7 → 2.59; after the fog pass1a7482c0: 0.78 → 0.11): the game's pre-exposure. The frame's float adds include499dbfd0, one workgroup summing a 256x256 sky texture (#444's "sky's light sums"): one workgroup adding into a few words is the case where the loop runs out of attempts.Measurements
Verdict: fixed. In four interleaved runs at Saria's spot (main, this PR, main, this PR), the screen with this PR is as bright as on an Arc B580 (linear mean 0.205 against 0.199), where main is about 4x brighter (0.778); the two runs of each side agree within 0.003. No device loss in about 40 minutes of play with native adds; one with the loop in about 20 minutes of short runs, at
499dbfd0.Hardware: Windows 11 Insider 26220, Intel Arc B390 (Panther Lake iGPU, 0xB080, no VRAM mirror), driver 32.0.101.9150, Core Ultra X7 358H, 32 GB
Scene: Kokiri Forest, child, by Link's house next to Saria, daytime; Auto (this PC) preset, the game's upscaler (the TAAU stand-in on this card)
Method: screenshots (Win+Alt+PrtScn), mean of the scene area (5-70 % across, 5-75 % down, HUD left out) in linear light; the scene target's mean from the frame dump's log lines (
RX_VK_DUMP); device losses fromlongshot_log.txtHow to reproduce:
scripts/dev_packs.pyruntimes: main53f96d78(its own renderer pack) and this PR over53f96d78(its renderer pack), no switch, run alternately; the frame dumps from runtimes over main414f56e2, one withRX_VK_NATIVE_FADD=1Interleaved A/B, screen linear mean (R, G, B), Saria's spot, in the order run:
53f96d7853f96d78Arc B580 at the same spot (screenshot from #459): 0.199 0.191 0.156.
Measured over main
53f96d78; the PR is now onbbe6fdf2. The numbers still hold: this PR's diff is the same, and none of main's commits since touches the float-add choice, the float-add translation or the passes that set the exposure (git diff 53f96d78 bbe6fdf2has no change tonative_fadd_wanted,OpAtomicFAddEXTor the compare-exchange loop).Where the brightness comes from (frame dumps, runtimes over main
414f56e2):414f56e2RX_VK_NATIVE_FADD=1: main @414f56e21a7482c0, meanab368194, meanDevice lost: with the loop, once (
499dbfd0) in about 20 minutes of short runs on main414f56e2; with native adds, none in 37 minutes (this change over414f56e2) plus the A/B runs.Screenshots of the same spot are in the first comment: the four A/B runs, the Deku Tree path, and the B580 reference.
Flags and settings
The default of
RX_VK_NATIVE_FADDchanges on Panther Lake iGPUs; no switch is added.RX_VK_NATIVE_FADD(unset)RX_VK_NATIVE_FADD=0gives the loop backTesting
Tested:
53f96d78(the same diff as here; the PR is now on mainbbe6fdf2), Windows 11 Insider 26220, Arc B390 (0xB080), driver 101.9150: four interleaved runs at Saria's spot against main53f96d78(main, this PR, main, this PR): the haze in both main runs, gone in both runs of this PR; the logs show the loop on main and native adds by the new default here; no device loss.414f56e2and no switch: the haze is gone, the picture as on a B580; 37 minutes of play, no device loss, a clean close. The log line confirms native adds by the new default.RX_VK_NATIVE_FADD=1on main414f56e2: the same picture, so the native add alone is what changes it.tests/test_native_float_atomic_add.pyrun directly with clang (llvm-mingw) and the Vulkan SDK'sspirv-val: fails on main, passes here (48 cases), and main's own version of the check passes on this rule.run_allskips it on Windows (it needsspirv-val).python -I -B tests/run_all.pyon Windows, this PR @f121f6bdover mainbbe6fdf2: 552 passed, 18 failed, 36 skipped (Windows, 16 at once). None of the 18 reads this change, and each fails the same way on mainbbe6fdf2when run alone (test_tested_configurations is a CRLF/LF mismatch on Windows; test_vk_occlusion_queries doesn't find its C++ compiler on Windows): test_appimage_player_build, test_cpp_preflight, test_crash_dialog, test_env_on, test_lift_cleanup_error, test_linux_preflight, test_make_game_cache, test_make_game_prepare, test_missing_nup, test_oot_state_tap, test_options_budget_once, test_portable_builder_home, test_portable_builder_startup, test_readback_late, test_tested_configurations, test_vk_occlusion_queries, test_vk_pgo, test_walk_key.Not tested:
Must be tested:
@Beanstalk linux, build the renderer): the renderer builds; no change in play is expected, since the rule only changes Intel's Windows driver.Risks
What could break: on a Panther Lake iGPU, a driver whose native float add misbehaves; it was run on 101.9150 only.
0xB0xxis taken as Panther Lake's range, as0x7Dxxis for Meteor Lake and Arrow Lake.Turning it off:
RX_VK_NATIVE_FADD=0inlongshot_env.txt, or revert the commit.Compatibility: on Panther Lake iGPUs, the first start after updating translates the shaders and prepares the pipelines again (the program cache's stamp holds the float-add choice): one long start, about 24 minutes here with compiles side by side. Nothing changes on other GPUs, saves or the options file; no vk ABI change.
Issues
Fixes #618
See #606
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.docs/tested/for each new measured run (format indocs/tested-configurations.md).mainand passing here.tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
Screenshots, Windows 11, Arc B390 (Panther Lake iGPU, 0xB080), driver 101.9150, Kokiri Forest, the Auto (this PC) preset.
By Link's house, next to Saria
Four interleaved runs, in the order played:
The path towards the Deku Tree (the same area; the camera is not at exactly the same place)
Rebased on main
aa95d35fbefore opening; the description says why the A/B numbers from53f96d78still hold, and run_all was run again on the rebase (the same 18 Windows failures as on main).@Beanstalk linux, build the renderer: the build succeeds; no change in play expected (the rule only changes Intel's Windows driver)
@ertomas only members of
BigBeanscan start the farm.One of them can approve this request by reacting 👍 to it.This request was foree76848, and the PR has changed since (f121f6b), so a 👍 no longer approves it. Comment@Beanstalkagain to ask for the new commit.ee768482f1f121f6bd5bRebased onto
main@bbe6fdf2: no conflicts. No tests were run here; the test boxes stay yours.Description updated for HumanBean's rebase onto main
bbe6fdf2(f121f6bd): run_all run again there (552 passed; the 18 failures fail the same way on mainbbe6fdf2alone), the fix's own check passes, and none of main's commits since the A/B touches the float-add rule.@Beanstalk linux, build the renderer: the build succeeds; no change in play expected (the rule only changes Intel's Windows driver)
@ertomas only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.