WIP: fix(vk): float adds native on Lunar Lake iGPUs from driver 101.8991 #1793

Draft
twisted89 wants to merge 3 commits from twisted89/Longshot:fix/vk-lnl-native-fadd into main
First-time contributor

Type: fix · Risk: low · Tested on: Windows 11, Intel Arc 140V (Lunar Lake iGPU), driver 101.8991 · Needs: a Linux build (Test Farm)

TL;DR

On Intel's Lunar Lake laptops (Arc 140V and its family), Kokiri Forest is covered by a thick milky white haze, and the GPU can be lost on entering it: the game's shaders add floats with a retry loop that gives up and drops adds, the same fault #816 fixed on Panther Lake. This PR enables the GPU's own float add by default on the tested Arc 140V (PCI ID 0x64A0) when the Vulkan feature is available, as on the listed recent Intel GPUs. On an Arc 140V the haze is gone (the picture as an Arc B580 shows it), the device was not lost; a new check fails on main and passes here.

Breakdown

  • Who it helps: players on Intel Lunar Lake laptops (Core Ultra 200V, Arc 130V/140V) with Intel's Windows driver.
  • What was wrong: the GPU's own float add was turned on only for the Intel GPU families it had been run on, and Lunar Lake was not one of them, so it kept the loop that loses adds when many threads add to one value.
  • What changes: Intel's Windows driver on Arc 140V (PCI device 0x64A0) from driver 101.8991 now gets the native float add by default.
  • What does not change: every other GPU and driver; Mesa's Intel driver; older Lunar Lake drivers; RX_VK_NATIVE_FADD=0 still keeps the loop everywhere.
  • How it was checked: two game-free checks (they fail on main, pass here); on an Arc 140V with 101.8991, the v3.0.0 release and this build with the loop forced against this build's native add at the same spot: the haze in every loop run and a device loss in one, a clear picture and no loss with the native add; a play session through Kokiri Forest and Inside the Deku Tree with no crash.
  • What is still open: other Lunar Lake GPUs (0x6420, 0x64B0) and other drivers not run; one native run in the A/B (and the play session).
  • Risk: low; a Lunar Lake driver whose native float add is wrong would show it in the scene's exposure (too dark or too bright); RX_VK_NATIVE_FADD=0 brings the loop back.

Why

The shaders' float adds to storage buffers run as a compare-exchange loop unless the GPU's own atomic add is turned on, and that loop gives up after 1024 attempts and loses the add. On Panther Lake that lost part of the exposure's light sums and covered Kokiri Forest in a white haze (#618, fixed by #816), and on the Arc B-series the same sums lost the device (#444, #606). #816 turned on the native add for Meteor Lake, Arrow Lake, Panther Lake and Battlemage, the families it had been run on, and named Lunar Lake as not tried. Lunar Lake has the same fault: on an Arc 140V the forest is behind a milky white veil with the loop, and the loop lost the device at the same program as #606 (499dbfd0, the sky's light sums).

The tracker was searched (Lunar, 140V, NATIVE_FADD, float add): no issue or other PR for Lunar Lake.

See #816
See #618

How to reproduce

Seen on: Windows 11 build 26300, Intel Arc 140V (Lunar Lake iGPU, 0x64A0), driver 32.0.101.8991, Core Ultra 7 258V, 32 GB
Settings and switches: defaults (Auto (this PC) preset); on this PR's build, RX_VK_NATIVE_FADD=0 brings main's loop back
Steps: load a save in Kokiri Forest and walk the path to the Great Deku Tree
Expected: the forest with its light mist and the fireflies, full contrast and colour (as on an Arc B580)
Actual: the whole picture behind a near-white veil (v3.0.0, and this build with RX_VK_NATIVE_FADD=0); in one run with the loop the device was lost on entering the forest

What changed

Arc 140V joins the Intel GPUs that get the native float add by default, from the driver it was run on. The list is written once, in device_policy.h; everything else is the comments, the log line and the docs that name the families.

  • vk: policy_rule::native_fadd_listed() in gpu/vk/device_policy.h takes 0x64A0 from 101.8991; native_fadd_wanted()'s comment in gpu/vk/vk_main.cpp names the run, and the log line vk: float atomic add on storage buffers: names Lunar Lake.
  • switches: the RX_VK_NATIVE_FADD row in gpu/vk/switches.def and in docs/development.md.
  • tests: tests/test_native_float_atomic_add.py's table has seven Lunar Lake cases (the 140V at 101.8991 native and other 0x64xx devices using the loop; an older driver, Meteor Lake and Panther Lake at 8991, Mesa's driver and RX_VK_NATIVE_FADD=0 the loop; the 140V's old "the loop" case is gone); tests/test_device_policy.py has the rule's edge at 101.8991 and 101.8990.

Measurements

Verdict: fixed. With the loop, the forest is behind a white haze in every run (screen linear mean 0.82-0.83) and the device was lost once on entering it; with the native add the picture is as bright as an Arc B580's at a forest spot (0.207 against #816's 0.199) and the device was not lost. These runs do not establish a performance comparison.

Hardware: Windows 11 build 26300, Intel Arc 140V (16GB) (Lunar Lake iGPU, 8086:64A0), driver 32.0.101.8991, Core Ultra 7 258V, 32 GB
Scene: Kokiri Forest (child), the path's end before the Great Deku Tree, standing still; picture 1920x1200, scene 1440x900; Auto (this PC) preset; one options file for every run (HOS_OPTIONS_FILE), HOS_FPS_MAX=1000
First and warm launch time to gameplay, cache-drop timing, and cache sizes with populated caches: not yet measured.
Method: screenshots (Win+Alt+PrtScn), the scene area's mean (5-70 % across, 5-75 % down, HUD left out) in linear light, as #816 measured it; fps from the log's vk: 120 presents, ... fps windows with 900 or more draws a frame (the forest in view), the median per run; device losses from longshot_log.txt
How to reproduce: this PR's diff (the same as 84edc183's, measured over main 9ea65c7b) built with RX_MARCH=lunarlake (on another PC), and the v3.0.0 release; runs 1 to 4 in that order, RX_VK_NATIVE_FADD set in longshot_env.txt
Baseline: no build of main @ 9ea65c7b ran on this laptop. The before columns are the v3.0.0 release (87cb36aa), which picks the loop on Lunar Lake as main does, and this PR's build with RX_VK_NATIVE_FADD=0, which is main's choice on Lunar Lake with this PR's code otherwise (the diff changes only the list).

Before: v3.0.0 @ 87cb36aa (runs 1, 2) Before, RX_VK_NATIVE_FADD=0: this PR @ 84edc183 (run 3) After: this PR @ 84edc183 (run 4)
Picture white haze, both runs white haze clear, as on an Arc B580
Device lost no, no yes: 499dbfd0, frame 1895, on entering the forest no
fps (median of the log's windows with 900+ draws) 10.0, 10.8 (median 10.4) none: the device was lost first 12.1
Screenshot Screen linear mean (R, G, B)
the loop, first shot 0.823 0.792 0.640
the loop, second shot 0.834 0.803 0.668
this PR, native add (run 4) 0.207 0.203 0.156
Arc B580 at Saria's spot (#816's reference) 0.199 0.191 0.156

Run 4 set RX_VK_NATIVE_FADD=1, which on this PR's build is the default on Lunar Lake (its log line names the switch instead of Lunar Lake; the play session below ran it unset). Which loop run each of the two loop screenshots came from was not kept.

Before: the loop (Arc 140V) After: this PR (Arc 140V)
Before: the loop on an Arc 140V, Kokiri Forest After: this PR on an Arc 140V, Kokiri Forest
v3.0.0:  vk: float atomic add on storage buffers: compare-exchange loop, by default only with NVIDIA's driver and Intel's Windows driver on Meteor Lake, Arrow Lake, Panther Lake and Battlemage (RX_VK_NATIVE_FADD=1: native where the GPU has it)
run 3:   vk: float atomic add on storage buffers: compare-exchange loop, RX_VK_NATIVE_FADD=0
run 3:   vk: device lost: 2 checkpoints (74357 markers set)
run 3:   vk:   stage 0x1: marker 73891 (dispatch of program 499dbfd0721d2858, frame 1895)
run 4:   vk: float atomic add on storage buffers: native (VK_EXT_shader_atomic_float), RX_VK_NATIVE_FADD=1
session: vk: float atomic add on storage buffers: native (VK_EXT_shader_atomic_float), Intel's Windows driver, Meteor Lake, Arrow Lake, Panther Lake, Lunar Lake or Battlemage
session: map: KokiriForest_Child (child) ... map: InsideTheDekuTree (child) ... display: window closed, exiting
fps windows (>= 900 draws): run 1: 7.9 9.9 8.1 10.0 10.0 10.0 | run 2: 10.8 10.1 9.9 11.2 11.7 | run 4: 11.4 10.4 12.1 12.3 12.1 (and one 3.8 while the forest loaded)

The play session (unset, the default): Kokiri Forest and Inside the Deku Tree, about 30-40 fps in the log's windows at ~900-1000 draws a frame (a different spot and options file from the A/B), no crash or device loss, clean exit.

Game-free checks, before (the tests alone over main) and after (this PR @ 84edc183):

Before: FAIL: RX_VK_NATIVE_FADD=[(unset)], driver 5, device 0x64a0, version 101.8991: the loop
Before: (long long)policy_rule::native_fadd_listed(VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS, 0x64A0, 101u << 14 | 8991u) is 0, expected 1
After:  switch: 54 cases: ... on Panther Lake from 101.9150 and on Lunar Lake from 101.8991; RX_VK_NATIVE_FADD by the switches' rule on any driver
After:  PASS: a float add is the GPU's own atomic where it has one, the loop elsewhere; the device and cache follow
After:  ok: 19 PCs, each of DevicePolicy's 69 fields as the rules have it; ...

Measured over main 9ea65c7b; the PR is now on 621dae50. The numbers hold: this PR's diff is the same, and none of main's commits since touches the float-add choice, its translation or the passes that set the exposure (#1747 is NFC, #1792 dev_packs).

Build time and size: not affected (one condition in a header, comments and a log string). Memory: not affected. Time to gameplay and cache-drop timing and size for the first launch after the mode change and the following warm launch have not been measured.

Flags and settings

The default of RX_VK_NATIVE_FADD changes on Arc 140V with Intel's Windows driver 101.8991 or later; no switch is added.

Flag What it is Before this PR After this PR Effect Helps / doesn't help / untested Recommendation
RX_VK_NATIVE_FADD the shaders' float adds: 1 the GPU's own atomic, 0 the compare-exchange loop unset: the loop on Lunar Lake unset: native on Lunar Lake from 101.8991 float adds can no longer be lost on Lunar Lake helps on an Arc 140V, 101.8991: the haze gone, no device loss on by default for Lunar Lake

Testing

Tested: on an Arc 140V (8086:64A0), driver 101.8991, Core Ultra 7 258V, Windows 11 26300: the game built from this change over main 9ea65c7b (RX_MARCH=lunarlake, built on another PC). Kokiri Forest and Inside the Deku Tree played (the native add, no crash, no device loss, a clean exit); the A/B in Measurements shows the haze with the loop (v3.0.0, and RX_VK_NATIVE_FADD=0, which also lost the device once) and not with this PR. Game-free: tests/test_native_float_atomic_add.py and tests/test_device_policy.py fail with the tests alone over main and pass here (run by hand on Windows with g++ 13.2 and the Vulkan SDK 1.4.363's headers and spirv-val, as run_all.py skips the float-add check on Windows). mise is not installed on this PC, so the suite ran as python -I -B tests/run_all.py --strict, the task's own command: 721 passed, 95 failed, 50 skipped (Windows, RX_CPM set to the Builder's CPM cache for the Vulkan headers). The same 95 fail on main @ a433db32 on this PC, the same way: none is new here (rebased on 621dae50, one more, tests/test_oot_barrier.py, a thread stress check, failed once under the full run's load and passed 3 of 3 alone), and the float-add and device-policy checks pass. Most need clang/clang++ (not installed) or a gcc fixture build this PC's MinGW g++ 13.2 refuses.

The 95, failing on main too

  • missing
  • nx2/test_mesh_first_types.py
  • tests/test_audio_output_devices.py
  • tests/test_audio_output_errors.py
  • tests/test_audio_wave_buffer_release.py
  • tests/test_auto_handheld.py
  • tests/test_bug_report_defaults.py
  • tests/test_capture_read_once.py
  • tests/test_capture_readback_visibility.py
  • tests/test_compute_gate.py
  • tests/test_coverage_run.py
  • tests/test_crash_dialog.py
  • tests/test_crt_options.py
  • tests/test_damage_debug_menu.py
  • tests/test_dead_targets_sweep.py
  • tests/test_dev_packs.py
  • tests/test_display_startup_failure.py
  • tests/test_dlss_feature_size.py
  • tests/test_draw_stream_visibility.py
  • tests/test_exclusive_marks.py
  • tests/test_failed_compile_keeps_objects.py
  • tests/test_fastfp_fma.py
  • tests/test_fma_soft.py
  • tests/test_fpx_sticky.py
  • tests/test_fs_path_utf8.py
  • tests/test_fsr_image_retirement.py
  • tests/test_fsr_uniform_ownership.py
  • tests/test_fullscreen_monitor_platform.py
  • tests/test_game_font.py
  • tests/test_guest_imported.py
  • tests/test_hd_rumble.py
  • tests/test_high_fps_fixes.py
  • tests/test_hos_ab.py
  • tests/test_host_alloc_wait.py
  • tests/test_host_guest_writes.py
  • tests/test_hud_layout_row.py
  • tests/test_image_view_retry.py
  • tests/test_job_queue.py
  • tests/test_libc_hooks.py
  • tests/test_linux_audio_output.py
  • tests/test_linux_preflight.py
  • tests/test_linux_pressure.py
  • tests/test_lower_depbar.py
  • tests/test_lower_lds_after_sts.py
  • tests/test_lower_register_markers.py
  • tests/test_microphone_test_gain.py
  • tests/test_missing_nup.py
  • tests/test_mods_list.py
  • tests/test_monitor_friendly_names.py
  • tests/test_native_suatom.py
  • tests/test_native_zstd.py
  • tests/test_nvn_null_pool.py
  • tests/test_nvn_tex_builder_guard.py
  • tests/test_oot_state_tap.py
  • tests/test_pads_after_menu.py
  • tests/test_parallel_init_order.py
  • tests/test_pending_guest_import.py
  • tests/test_pipeline_cache_file.py
  • tests/test_pipeline_play_cache.py
  • tests/test_precompile_compute_guard.py
  • tests/test_prepare_cache_save.py
  • tests/test_prepare_stall.py
  • tests/test_present_source_crop.py
  • tests/test_present_thread.py
  • tests/test_profiling_mode.py
  • tests/test_program_answer_domains.py
  • tests/test_psychov35_fsr3_fg.py
  • tests/test_readback_timeout_source.py
  • tests/test_recorder_sync.py
  • tests/test_release.py
  • tests/test_replay_write_order.py
  • tests/test_rumble_mapping.py
  • tests/test_rumble_refresh.py
  • tests/test_sampler_admission.py
  • tests/test_sampler_stack_walk.py
  • tests/test_sdiv_overflow.py
  • tests/test_sdl_monitor_names.py
  • tests/test_shader_module_guard.py
  • tests/test_shadow_slot.py
  • tests/test_slow_frames.py
  • tests/test_song_note_cue.py
  • tests/test_spawn_emit.py
  • tests/test_split_giants.py
  • tests/test_staging_burst.py
  • tests/test_system_header_cache.py
  • tests/test_target_pool_cap.py
  • tests/test_tested_configurations.py
  • tests/test_texel_buffer_ownership.py
  • tests/test_thinlto_tls.py
  • tests/test_upscaler_rows.py
  • tests/test_vbytes.py
  • tests/test_vcore_escape.py
  • tests/test_vfpx_elem.py
  • tests/test_vk_occlusion_queries.py
  • tests/test_walk_key.py
  • tests/test_work_lock.py

Not tested: a build of main @ 9ea65c7b itself on the laptop (v3.0.0 and the switch stand in for it: Measurements' Baseline); the other Lunar Lake GPUs (0x6420, 0x64B0); drivers other than 101.8991; clang (not installed here); Linux (the rule is for Intel's Windows driver only).

Must be tested:

  • linux, any GPU: build this branch and start the game into Kokiri Forest, expecting a clean build and no crash or device loss. Compare the selected float-add mode and feature availability with main; the log wording may differ (Test Farm: @Beanstalk, asked in the comments).

Other Lunar Lake GPUs (Arc 130V, 0x64xx) and newer drivers would widen it; the Test Farm has no Lunar Lake tag.

Risks

What could break: a Lunar Lake driver whose native float add is wrong would put wrong sums into the exposure and other light sums (a too dark or too bright scene); only Arc 140V with Intel's Windows driver 101.8991 or later is affected.

Turning it off: RX_VK_NATIVE_FADD=0 in longshot_env.txt, or revert the commit.

Compatibility: on Arc 140V with Intel's Windows driver from 101.8991, the first start after updating translates every program again and rebuilds cache/longshot_vk_pipelines.bin and its play-cache files (the float add is in the translator's stamp). Time to gameplay and cache-drop timing and size on the first and following warm launch remain to be measured.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what
    can't be run by hand is in Testing's Not testable by hand, with why.
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and
    in Risks.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named).
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Screenshots of the same spot, captioned like the Measurements columns, for a change that shows on screen.
  • A file in docs/tested/ for each new measured run (format in docs/tested-configurations.md).
  • Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value.
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Docs updated.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: built with llvm-mingw and run on the Arc 140V. Linux: asked of the Test Farm; not built here.)

🤖 Generated with Claude Code

**Type:** fix · **Risk:** low · **Tested on:** Windows 11, Intel Arc 140V (Lunar Lake iGPU), driver 101.8991 · **Needs:** a Linux build (Test Farm) ## TL;DR On Intel's Lunar Lake laptops (Arc 140V and its family), Kokiri Forest is covered by a thick milky white haze, and the GPU can be lost on entering it: the game's shaders add floats with a retry loop that gives up and drops adds, the same fault #816 fixed on Panther Lake. This PR enables the GPU's own float add by default on the tested Arc 140V (PCI ID 0x64A0) when the Vulkan feature is available, as on the listed recent Intel GPUs. On an Arc 140V the haze is gone (the picture as an Arc B580 shows it), the device was not lost; a new check fails on main and passes here. ## Breakdown - **Who it helps:** players on Intel Lunar Lake laptops (Core Ultra 200V, Arc 130V/140V) with Intel's Windows driver. - **What was wrong:** the GPU's own float add was turned on only for the Intel GPU families it had been run on, and Lunar Lake was not one of them, so it kept the loop that loses adds when many threads add to one value. - **What changes:** Intel's Windows driver on Arc 140V (PCI device 0x64A0) from driver 101.8991 now gets the native float add by default. - **What does not change:** every other GPU and driver; Mesa's Intel driver; older Lunar Lake drivers; `RX_VK_NATIVE_FADD=0` still keeps the loop everywhere. - **How it was checked:** two game-free checks (they fail on main, pass here); on an Arc 140V with 101.8991, the v3.0.0 release and this build with the loop forced against this build's native add at the same spot: the haze in every loop run and a device loss in one, a clear picture and no loss with the native add; a play session through Kokiri Forest and Inside the Deku Tree with no crash. - **What is still open:** other Lunar Lake GPUs (0x6420, 0x64B0) and other drivers not run; one native run in the A/B (and the play session). - **Risk:** low; a Lunar Lake driver whose native float add is wrong would show it in the scene's exposure (too dark or too bright); `RX_VK_NATIVE_FADD=0` brings the loop back. ## Why The shaders' float adds to storage buffers run as a compare-exchange loop unless the GPU's own atomic add is turned on, and that loop gives up after 1024 attempts and loses the add. On Panther Lake that lost part of the exposure's light sums and covered Kokiri Forest in a white haze (#618, fixed by #816), and on the Arc B-series the same sums lost the device (#444, #606). #816 turned on the native add for Meteor Lake, Arrow Lake, Panther Lake and Battlemage, the families it had been run on, and named Lunar Lake as not tried. Lunar Lake has the same fault: on an Arc 140V the forest is behind a milky white veil with the loop, and the loop lost the device at the same program as #606 (`499dbfd0`, the sky's light sums). The tracker was searched (Lunar, 140V, NATIVE_FADD, float add): no issue or other PR for Lunar Lake. See #816 See #618 ## How to reproduce **Seen on:** Windows 11 build 26300, Intel Arc 140V (Lunar Lake iGPU, 0x64A0), driver 32.0.101.8991, Core Ultra 7 258V, 32 GB **Settings and switches:** defaults (Auto (this PC) preset); on this PR's build, `RX_VK_NATIVE_FADD=0` brings main's loop back **Steps:** load a save in Kokiri Forest and walk the path to the Great Deku Tree **Expected:** the forest with its light mist and the fireflies, full contrast and colour (as on an Arc B580) **Actual:** the whole picture behind a near-white veil (v3.0.0, and this build with `RX_VK_NATIVE_FADD=0`); in one run with the loop the device was lost on entering the forest ## What changed Arc 140V joins the Intel GPUs that get the native float add by default, from the driver it was run on. The list is written once, in `device_policy.h`; everything else is the comments, the log line and the docs that name the families. - vk: `policy_rule::native_fadd_listed()` in `gpu/vk/device_policy.h` takes 0x64A0 from 101.8991; `native_fadd_wanted()`'s comment in `gpu/vk/vk_main.cpp` names the run, and the log line `vk: float atomic add on storage buffers:` names Lunar Lake. - switches: the `RX_VK_NATIVE_FADD` row in `gpu/vk/switches.def` and in `docs/development.md`. - tests: `tests/test_native_float_atomic_add.py`'s table has seven Lunar Lake cases (the 140V at 101.8991 native and other 0x64xx devices using the loop; an older driver, Meteor Lake and Panther Lake at 8991, Mesa's driver and `RX_VK_NATIVE_FADD=0` the loop; the 140V's old "the loop" case is gone); `tests/test_device_policy.py` has the rule's edge at 101.8991 and 101.8990. ## Measurements **Verdict:** fixed. With the loop, the forest is behind a white haze in every run (screen linear mean 0.82-0.83) and the device was lost once on entering it; with the native add the picture is as bright as an Arc B580's at a forest spot (0.207 against #816's 0.199) and the device was not lost. These runs do not establish a performance comparison. Hardware: Windows 11 build 26300, Intel Arc 140V (16GB) (Lunar Lake iGPU, 8086:64A0), driver 32.0.101.8991, Core Ultra 7 258V, 32 GB Scene: Kokiri Forest (child), the path's end before the Great Deku Tree, standing still; picture 1920x1200, scene 1440x900; Auto (this PC) preset; one options file for every run (`HOS_OPTIONS_FILE`), `HOS_FPS_MAX=1000` First and warm launch time to gameplay, cache-drop timing, and cache sizes with populated caches: not yet measured. Method: screenshots (Win+Alt+PrtScn), the scene area's mean (5-70 % across, 5-75 % down, HUD left out) in linear light, as #816 measured it; fps from the log's `vk: 120 presents, ... fps` windows with 900 or more draws a frame (the forest in view), the median per run; device losses from `longshot_log.txt` How to reproduce: this PR's diff (the same as 84edc183's, measured over main 9ea65c7b) built with `RX_MARCH=lunarlake` (on another PC), and the v3.0.0 release; runs 1 to 4 in that order, `RX_VK_NATIVE_FADD` set in `longshot_env.txt` Baseline: no build of main @ 9ea65c7b ran on this laptop. The before columns are the v3.0.0 release (87cb36aa), which picks the loop on Lunar Lake as main does, and this PR's build with `RX_VK_NATIVE_FADD=0`, which is main's choice on Lunar Lake with this PR's code otherwise (the diff changes only the list). | | Before: v3.0.0 @ 87cb36aa (runs 1, 2) | Before, RX_VK_NATIVE_FADD=0: this PR @ 84edc183 (run 3) | After: this PR @ 84edc183 (run 4) | |---|---|---|---| | Picture | white haze, both runs | white haze | clear, as on an Arc B580 | | Device lost | no, no | yes: `499dbfd0`, frame 1895, on entering the forest | no | | fps (median of the log's windows with 900+ draws) | 10.0, 10.8 (median 10.4) | none: the device was lost first | 12.1 | | Screenshot | Screen linear mean (R, G, B) | |---|---| | the loop, first shot | 0.823 0.792 0.640 | | the loop, second shot | 0.834 0.803 0.668 | | **this PR, native add (run 4)** | **0.207 0.203 0.156** | | Arc B580 at Saria's spot (#816's reference) | 0.199 0.191 0.156 | Run 4 set `RX_VK_NATIVE_FADD=1`, which on this PR's build is the default on Lunar Lake (its log line names the switch instead of Lunar Lake; the play session below ran it unset). Which loop run each of the two loop screenshots came from was not kept. | Before: the loop (Arc 140V) | After: this PR (Arc 140V) | |---|---| | ![Before: the loop on an Arc 140V, Kokiri Forest](https://git.magicbean.dev/attachments/a58df5d4-7ace-49bf-927c-22f7cedaa955) | ![After: this PR on an Arc 140V, Kokiri Forest](https://git.magicbean.dev/attachments/6d6e3a15-89fc-4ebc-b659-550f5a0a663d) | ``` v3.0.0: vk: float atomic add on storage buffers: compare-exchange loop, by default only with NVIDIA's driver and Intel's Windows driver on Meteor Lake, Arrow Lake, Panther Lake and Battlemage (RX_VK_NATIVE_FADD=1: native where the GPU has it) run 3: vk: float atomic add on storage buffers: compare-exchange loop, RX_VK_NATIVE_FADD=0 run 3: vk: device lost: 2 checkpoints (74357 markers set) run 3: vk: stage 0x1: marker 73891 (dispatch of program 499dbfd0721d2858, frame 1895) run 4: vk: float atomic add on storage buffers: native (VK_EXT_shader_atomic_float), RX_VK_NATIVE_FADD=1 session: vk: float atomic add on storage buffers: native (VK_EXT_shader_atomic_float), Intel's Windows driver, Meteor Lake, Arrow Lake, Panther Lake, Lunar Lake or Battlemage session: map: KokiriForest_Child (child) ... map: InsideTheDekuTree (child) ... display: window closed, exiting fps windows (>= 900 draws): run 1: 7.9 9.9 8.1 10.0 10.0 10.0 | run 2: 10.8 10.1 9.9 11.2 11.7 | run 4: 11.4 10.4 12.1 12.3 12.1 (and one 3.8 while the forest loaded) ``` The play session (unset, the default): Kokiri Forest and Inside the Deku Tree, about 30-40 fps in the log's windows at ~900-1000 draws a frame (a different spot and options file from the A/B), no crash or device loss, clean exit. Game-free checks, before (the tests alone over main) and after (this PR @ 84edc183): ``` Before: FAIL: RX_VK_NATIVE_FADD=[(unset)], driver 5, device 0x64a0, version 101.8991: the loop Before: (long long)policy_rule::native_fadd_listed(VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS, 0x64A0, 101u << 14 | 8991u) is 0, expected 1 After: switch: 54 cases: ... on Panther Lake from 101.9150 and on Lunar Lake from 101.8991; RX_VK_NATIVE_FADD by the switches' rule on any driver After: PASS: a float add is the GPU's own atomic where it has one, the loop elsewhere; the device and cache follow After: ok: 19 PCs, each of DevicePolicy's 69 fields as the rules have it; ... ``` Measured over main 9ea65c7b; the PR is now on 621dae50. The numbers hold: this PR's diff is the same, and none of main's commits since touches the float-add choice, its translation or the passes that set the exposure (#1747 is NFC, #1792 dev_packs). Build time and size: not affected (one condition in a header, comments and a log string). Memory: not affected. Time to gameplay and cache-drop timing and size for the first launch after the mode change and the following warm launch have not been measured. ### Flags and settings The default of `RX_VK_NATIVE_FADD` changes on Arc 140V with Intel's Windows driver 101.8991 or later; no switch is added. | Flag | What it is | Before this PR | After this PR | Effect | Helps / doesn't help / untested | Recommendation | |---|---|---|---|---|---|---| | `RX_VK_NATIVE_FADD` | the shaders' float adds: 1 the GPU's own atomic, 0 the compare-exchange loop | unset: the loop on Lunar Lake | unset: native on Lunar Lake from 101.8991 | float adds can no longer be lost on Lunar Lake | helps on an Arc 140V, 101.8991: the haze gone, no device loss | on by default for Lunar Lake | ## Testing **Tested:** on an Arc 140V (8086:64A0), driver 101.8991, Core Ultra 7 258V, Windows 11 26300: the game built from this change over main 9ea65c7b (`RX_MARCH=lunarlake`, built on another PC). Kokiri Forest and Inside the Deku Tree played (the native add, no crash, no device loss, a clean exit); the A/B in Measurements shows the haze with the loop (v3.0.0, and `RX_VK_NATIVE_FADD=0`, which also lost the device once) and not with this PR. Game-free: `tests/test_native_float_atomic_add.py` and `tests/test_device_policy.py` fail with the tests alone over main and pass here (run by hand on Windows with g++ 13.2 and the Vulkan SDK 1.4.363's headers and spirv-val, as `run_all.py` skips the float-add check on Windows). `mise` is not installed on this PC, so the suite ran as `python -I -B tests/run_all.py --strict`, the task's own command: 721 passed, 95 failed, 50 skipped (Windows, `RX_CPM` set to the Builder's CPM cache for the Vulkan headers). The same 95 fail on main @ a433db32 on this PC, the same way: none is new here (rebased on 621dae50, one more, `tests/test_oot_barrier.py`, a thread stress check, failed once under the full run's load and passed 3 of 3 alone), and the float-add and device-policy checks pass. Most need clang/clang++ (not installed) or a gcc fixture build this PC's MinGW g++ 13.2 refuses. <details><summary>The 95, failing on main too</summary> - `missing` - `nx2/test_mesh_first_types.py` - `tests/test_audio_output_devices.py` - `tests/test_audio_output_errors.py` - `tests/test_audio_wave_buffer_release.py` - `tests/test_auto_handheld.py` - `tests/test_bug_report_defaults.py` - `tests/test_capture_read_once.py` - `tests/test_capture_readback_visibility.py` - `tests/test_compute_gate.py` - `tests/test_coverage_run.py` - `tests/test_crash_dialog.py` - `tests/test_crt_options.py` - `tests/test_damage_debug_menu.py` - `tests/test_dead_targets_sweep.py` - `tests/test_dev_packs.py` - `tests/test_display_startup_failure.py` - `tests/test_dlss_feature_size.py` - `tests/test_draw_stream_visibility.py` - `tests/test_exclusive_marks.py` - `tests/test_failed_compile_keeps_objects.py` - `tests/test_fastfp_fma.py` - `tests/test_fma_soft.py` - `tests/test_fpx_sticky.py` - `tests/test_fs_path_utf8.py` - `tests/test_fsr_image_retirement.py` - `tests/test_fsr_uniform_ownership.py` - `tests/test_fullscreen_monitor_platform.py` - `tests/test_game_font.py` - `tests/test_guest_imported.py` - `tests/test_hd_rumble.py` - `tests/test_high_fps_fixes.py` - `tests/test_hos_ab.py` - `tests/test_host_alloc_wait.py` - `tests/test_host_guest_writes.py` - `tests/test_hud_layout_row.py` - `tests/test_image_view_retry.py` - `tests/test_job_queue.py` - `tests/test_libc_hooks.py` - `tests/test_linux_audio_output.py` - `tests/test_linux_preflight.py` - `tests/test_linux_pressure.py` - `tests/test_lower_depbar.py` - `tests/test_lower_lds_after_sts.py` - `tests/test_lower_register_markers.py` - `tests/test_microphone_test_gain.py` - `tests/test_missing_nup.py` - `tests/test_mods_list.py` - `tests/test_monitor_friendly_names.py` - `tests/test_native_suatom.py` - `tests/test_native_zstd.py` - `tests/test_nvn_null_pool.py` - `tests/test_nvn_tex_builder_guard.py` - `tests/test_oot_state_tap.py` - `tests/test_pads_after_menu.py` - `tests/test_parallel_init_order.py` - `tests/test_pending_guest_import.py` - `tests/test_pipeline_cache_file.py` - `tests/test_pipeline_play_cache.py` - `tests/test_precompile_compute_guard.py` - `tests/test_prepare_cache_save.py` - `tests/test_prepare_stall.py` - `tests/test_present_source_crop.py` - `tests/test_present_thread.py` - `tests/test_profiling_mode.py` - `tests/test_program_answer_domains.py` - `tests/test_psychov35_fsr3_fg.py` - `tests/test_readback_timeout_source.py` - `tests/test_recorder_sync.py` - `tests/test_release.py` - `tests/test_replay_write_order.py` - `tests/test_rumble_mapping.py` - `tests/test_rumble_refresh.py` - `tests/test_sampler_admission.py` - `tests/test_sampler_stack_walk.py` - `tests/test_sdiv_overflow.py` - `tests/test_sdl_monitor_names.py` - `tests/test_shader_module_guard.py` - `tests/test_shadow_slot.py` - `tests/test_slow_frames.py` - `tests/test_song_note_cue.py` - `tests/test_spawn_emit.py` - `tests/test_split_giants.py` - `tests/test_staging_burst.py` - `tests/test_system_header_cache.py` - `tests/test_target_pool_cap.py` - `tests/test_tested_configurations.py` - `tests/test_texel_buffer_ownership.py` - `tests/test_thinlto_tls.py` - `tests/test_upscaler_rows.py` - `tests/test_vbytes.py` - `tests/test_vcore_escape.py` - `tests/test_vfpx_elem.py` - `tests/test_vk_occlusion_queries.py` - `tests/test_walk_key.py` - `tests/test_work_lock.py` </details> **Not tested:** a build of main @ 9ea65c7b itself on the laptop (v3.0.0 and the switch stand in for it: Measurements' Baseline); the other Lunar Lake GPUs (0x6420, 0x64B0); drivers other than 101.8991; clang (not installed here); Linux (the rule is for Intel's Windows driver only). **Must be tested:** - linux, any GPU: build this branch and start the game into Kokiri Forest, expecting a clean build and no crash or device loss. Compare the selected float-add mode and feature availability with main; the log wording may differ (Test Farm: @Beanstalk, asked in the comments). Other Lunar Lake GPUs (Arc 130V, 0x64xx) and newer drivers would widen it; the Test Farm has no Lunar Lake tag. ## Risks **What could break:** a Lunar Lake driver whose native float add is wrong would put wrong sums into the exposure and other light sums (a too dark or too bright scene); only Arc 140V with Intel's Windows driver 101.8991 or later is affected. **Turning it off:** `RX_VK_NATIVE_FADD=0` in `longshot_env.txt`, or revert the commit. **Compatibility:** on Arc 140V with Intel's Windows driver from 101.8991, the first start after updating translates every program again and rebuilds `cache/longshot_vk_pipelines.bin` and its play-cache files (the float add is in the translator's stamp). Time to gameplay and cache-drop timing and size on the first and following warm launch remain to be measured. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Screenshots of the same spot, captioned like the Measurements columns, for a change that shows on screen. - [x] A file in `docs/tested/` for each new measured run (format in `docs/tested-configurations.md`). - [x] Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value. - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [x] Docs updated. - [ ] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: built with llvm-mingw and run on the Arc 140V. Linux: asked of the Test Farm; not built here.) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The float-add checks now expect Intel's Windows driver on the Lunar Lake
iGPUs (PCI device 0x64xx) from 101.8991 to get the GPU's own float add,
as the Arc 140V (0x64A0) ran it in the game; an older driver, Mesa's
driver and RX_VK_NATIVE_FADD=0 keep the compare-exchange loop. Fails on
main: Lunar Lake keeps the loop there.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(vk): float adds native on Lunar Lake iGPUs from driver 101.8991
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
628ff1ec26
Intel's Windows driver on the Lunar Lake iGPUs (PCI device 0x64xx) now
gets the GPU's own float add on storage buffers (OpAtomicFAddEXT) by
default from driver 101.8991, as Meteor Lake, Arrow Lake, Panther Lake
and Battlemage already do (PR 816 for Panther Lake). Before, these GPUs
ran the compare-exchange loop, which gives up after 1024 attempts and
loses that add. Run on an Arc 140V (0x64A0) with 101.8991 in Kokiri
Forest and Inside the Deku Tree: native adds, no crash or device loss.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member

Possibly related, for context:

  • PR #191 fix(vk): Intel's Windows driver no longer loses the device on float adds to storage buffers: they are the GPU's own atomic — Earlier Intel float-add default implementation; this adds another supported GPU family
Possibly related, for context: - PR #191 fix(vk): Intel's Windows driver no longer loses the device on float adds to storage buffers: they are the GPU's own atomic — Earlier Intel float-add default implementation; this adds another supported GPU family
Author
First-time contributor

Tested in game: Arc 140V (driver 101.8991), Core Ultra 7 258V, Windows 11 26300, built with RX_MARCH=lunarlake: Kokiri Forest and Inside the Deku Tree play at ~36 fps; the log shows float atomic add native on Lunar Lake; no crash or device loss, clean exit

Tested in game: Arc 140V (driver 101.8991), Core Ultra 7 258V, Windows 11 26300, built with RX_MARCH=lunarlake: Kokiri Forest and Inside the Deku Tree play at ~36 fps; the log shows float atomic add native on Lunar Lake; no crash or device loss, clean exit
docs(tested): native float add on an Arc 140V (Lunar Lake) in Kokiri Forest
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 18s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
46a0cf387e
Two runs on an Arc 140V with driver 101.8991: a play session through
Kokiri Forest and Inside the Deku Tree, and the A/B of the loop (v3.0.0,
and RX_VK_NATIVE_FADD=0) against the native add at the path to the
Great Deku Tree.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

A/B on the Arc 140V (driver 101.8991) at the path to the Great Deku Tree: with the loop (the v3.0.0 release twice, and this build with RX_VK_NATIVE_FADD=0) the forest is behind a white haze (screen linear mean 0.82-0.83) and one run lost the device at 499dbfd0 on entering; with the native add the picture is clear (0.207 0.203 0.156, as #816's B580 reference) and the device was not lost, at about 12 fps against 10-11. Measurements, How to reproduce, screenshots and Testing updated; two run files added under docs/tested/ (46a0cf38).

A/B on the Arc 140V (driver 101.8991) at the path to the Great Deku Tree: with the loop (the v3.0.0 release twice, and this build with RX_VK_NATIVE_FADD=0) the forest is behind a white haze (screen linear mean 0.82-0.83) and one run lost the device at 499dbfd0 on entering; with the native add the picture is clear (0.207 0.203 0.156, as #816's B580 reference) and the device was not lost, at about 12 fps against 10-11. Measurements, How to reproduce, screenshots and Testing updated; two run files added under docs/tested/ (46a0cf38).
twisted89 force-pushed fix/vk-lnl-native-fadd from 46a0cf387e
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 18s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to f00098ec22
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 6s
2026-11-19 22:03:33 +00:00
Compare
Author
First-time contributor

Rebased on main 621dae50 (#1792, dev_packs only): the float-add and device-policy checks pass, and the full suite fails only what main fails on this PC. Measurements' table now names the commits and shows each side's picture, device loss and fps; the Host code box is added (Windows built and run, Linux not built here).

Rebased on main 621dae50 (#1792, dev_packs only): the float-add and device-policy checks pass, and the full suite fails only what main fails on this PC. Measurements' table now names the commits and shows each side's picture, device loss and fps; the Host code box is added (Windows built and run, Linux not built here).
Author
First-time contributor

@Beanstalk linux, any GPU: build this branch and start the game into Kokiri Forest. Expect it to build with no new error or warning, and the log's line 'vk: float atomic add on storage buffers:' to read as on main for that GPU (the change only adds Intel's Windows driver on Lunar Lake, so nothing on Linux should differ); no crash or device loss in a minute or two in the forest.

@Beanstalk linux, any GPU: build this branch and start the game into Kokiri Forest. Expect it to build with no new error or warning, and the log's line 'vk: float atomic add on storage buffers:' to read as on main for that GPU (the change only adds Intel's Windows driver on Lunar Lake, so nothing on Linux should differ); no crash or device loss in a minute or two in the forest.
Member

@twisted89 only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@twisted89 only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
Author
First-time contributor

Description: the Linux build is asked of the Test Farm (comment above) and listed under Must be tested.

Description: the Linux build is asked of the Test Farm (comment above) and listed under Must be tested.
Owner
@fix
Member

There is nothing for an edit to fix on this pull request.


Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

There is nothing for an edit to fix on this pull request. --- <sub>Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
Owner
@fix
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 6s
This pull request has changes conflicting with the target branch.
  • docs/development.md
  • gpu/vk/vk_main.cpp
Some workflows are waiting to be reviewed.
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/vk-lnl-native-fadd:twisted89-fix/vk-lnl-native-fadd'
git switch 'twisted89-fix/vk-lnl-native-fadd'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
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
MagicBeanDev/Longshot!1793
No description provided.