WIP: fix(vk): float adds native on Lunar Lake iGPUs from driver 101.8991 #1793
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
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
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1793
Loading…
Reference in a new issue
No description provided.
Delete branch "twisted89/Longshot:fix/vk-lnl-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 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
RX_VK_NATIVE_FADD=0still keeps the loop everywhere.RX_VK_NATIVE_FADD=0brings 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=0brings main's loop backSteps: 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 forestWhat 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.policy_rule::native_fadd_listed()ingpu/vk/device_policy.htakes 0x64A0 from 101.8991;native_fadd_wanted()'s comment ingpu/vk/vk_main.cppnames the run, and the log linevk: float atomic add on storage buffers:names Lunar Lake.RX_VK_NATIVE_FADDrow ingpu/vk/switches.defand indocs/development.md.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 andRX_VK_NATIVE_FADD=0the loop; the 140V's old "the loop" case is gone);tests/test_device_policy.pyhas 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=1000First 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, ... fpswindows with 900 or more draws a frame (the forest in view), the median per run; device losses fromlongshot_log.txtHow to reproduce: this PR's diff (the same as 84edc183's, measured over main
9ea65c7b) built withRX_MARCH=lunarlake(on another PC), and the v3.0.0 release; runs 1 to 4 in that order,RX_VK_NATIVE_FADDset inlongshot_env.txtBaseline: no build of main @
9ea65c7bran 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 withRX_VK_NATIVE_FADD=0, which is main's choice on Lunar Lake with this PR's code otherwise (the diff changes only the list).84edc183(run 3)84edc183(run 4)499dbfd0, frame 1895, on entering the forestRun 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.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):Measured over main
9ea65c7b; the PR is now on621dae50. 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_FADDchanges on Arc 140V with Intel's Windows driver 101.8991 or later; no switch is added.RX_VK_NATIVE_FADDTesting
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, andRX_VK_NATIVE_FADD=0, which also lost the device once) and not with this PR. Game-free:tests/test_native_float_atomic_add.pyandtests/test_device_policy.pyfail 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, asrun_all.pyskips the float-add check on Windows).miseis not installed on this PC, so the suite ran aspython -I -B tests/run_all.py --strict, the task's own command: 721 passed, 95 failed, 50 skipped (Windows,RX_CPMset to the Builder's CPM cache for the Vulkan headers). The same 95 fail on main @a433db32on this PC, the same way: none is new here (rebased on621dae50, 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
missingnx2/test_mesh_first_types.pytests/test_audio_output_devices.pytests/test_audio_output_errors.pytests/test_audio_wave_buffer_release.pytests/test_auto_handheld.pytests/test_bug_report_defaults.pytests/test_capture_read_once.pytests/test_capture_readback_visibility.pytests/test_compute_gate.pytests/test_coverage_run.pytests/test_crash_dialog.pytests/test_crt_options.pytests/test_damage_debug_menu.pytests/test_dead_targets_sweep.pytests/test_dev_packs.pytests/test_display_startup_failure.pytests/test_dlss_feature_size.pytests/test_draw_stream_visibility.pytests/test_exclusive_marks.pytests/test_failed_compile_keeps_objects.pytests/test_fastfp_fma.pytests/test_fma_soft.pytests/test_fpx_sticky.pytests/test_fs_path_utf8.pytests/test_fsr_image_retirement.pytests/test_fsr_uniform_ownership.pytests/test_fullscreen_monitor_platform.pytests/test_game_font.pytests/test_guest_imported.pytests/test_hd_rumble.pytests/test_high_fps_fixes.pytests/test_hos_ab.pytests/test_host_alloc_wait.pytests/test_host_guest_writes.pytests/test_hud_layout_row.pytests/test_image_view_retry.pytests/test_job_queue.pytests/test_libc_hooks.pytests/test_linux_audio_output.pytests/test_linux_preflight.pytests/test_linux_pressure.pytests/test_lower_depbar.pytests/test_lower_lds_after_sts.pytests/test_lower_register_markers.pytests/test_microphone_test_gain.pytests/test_missing_nup.pytests/test_mods_list.pytests/test_monitor_friendly_names.pytests/test_native_suatom.pytests/test_native_zstd.pytests/test_nvn_null_pool.pytests/test_nvn_tex_builder_guard.pytests/test_oot_state_tap.pytests/test_pads_after_menu.pytests/test_parallel_init_order.pytests/test_pending_guest_import.pytests/test_pipeline_cache_file.pytests/test_pipeline_play_cache.pytests/test_precompile_compute_guard.pytests/test_prepare_cache_save.pytests/test_prepare_stall.pytests/test_present_source_crop.pytests/test_present_thread.pytests/test_profiling_mode.pytests/test_program_answer_domains.pytests/test_psychov35_fsr3_fg.pytests/test_readback_timeout_source.pytests/test_recorder_sync.pytests/test_release.pytests/test_replay_write_order.pytests/test_rumble_mapping.pytests/test_rumble_refresh.pytests/test_sampler_admission.pytests/test_sampler_stack_walk.pytests/test_sdiv_overflow.pytests/test_sdl_monitor_names.pytests/test_shader_module_guard.pytests/test_shadow_slot.pytests/test_slow_frames.pytests/test_song_note_cue.pytests/test_spawn_emit.pytests/test_split_giants.pytests/test_staging_burst.pytests/test_system_header_cache.pytests/test_target_pool_cap.pytests/test_tested_configurations.pytests/test_texel_buffer_ownership.pytests/test_thinlto_tls.pytests/test_upscaler_rows.pytests/test_vbytes.pytests/test_vcore_escape.pytests/test_vfpx_elem.pytests/test_vk_occlusion_queries.pytests/test_walk_key.pytests/test_work_lock.pyNot tested: a build of main @
9ea65c7bitself 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:
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=0inlongshot_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.binand 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
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why.
in Risks.
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
Possibly related, for context:
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
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).46a0cf387ef00098ec22Rebased 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).@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.
@twisted89 only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.Description: the Linux build is asked of the Test Farm (comment above) and listed under Must be tested.
@fix
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.
@fix
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.