WIP: fix(host): native zstd keeps the virtual core during stream decodes (load freezes on an Arc iGPU) #1632
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1632
Loading…
Reference in a new issue
No description provided.
Delete branch "Guep/Longshot:fix/zstd-keep-core"
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: medium · Tested on: Windows 11, Arc 155H iGPU (Intel) · Needs: Windows on another iGPU, a run with #1553
TL;DR
On an Intel Arc 155H laptop, main often froze at loading screens for 20 seconds to 5 minutes: 7 runs of 10 on a fixed route. Each freeze followed the native zstd stream decode giving up its virtual core and waiting to get it back. Keeping the core during that decode (
HOS_NATIVE_ZSTD=2) froze in none of 3 runs, and earlier tours on an RTX 4070 SUPER showed loading screens no longer with it. This PR makes keeping the core the default;HOS_NATIVE_ZSTD=1gives it up as before.Breakdown
HOS_NATIVE_ZSTD=2did).HOS_NATIVE_ZSTD_FRAMES),HOS_NATIVE_ZSTD=0.Why
Since #1402 made the native stream decode the default with its core given up meanwhile, main froze at loads on this PC in 7 runs of 10: the game reads no controller for 20 s to 5 min, always at the same place (
hid: the game read no controller for N s (lr 0x83489670)). WithHOS_NATIVE_ZSTD=0 HOS_NATIVE_ZSTD_FRAMES=0it froze in none of 3, and withHOS_NATIVE_ZSTD=2(on the host, the core kept) in none of 3: the give-up and take-back are what make the freezes frequent here. The same log line is in reports from other players: See #1424, See #1365. A rare freeze at the same place also happened once on v3.0.0-rc.7 (before #1402), so this is not the only cause.How to reproduce
Seen on: Windows 11 Pro, Arc 155H iGPU (0x7D55), driver 101.9175, Core Ultra 7 155H, 32 GB
Settings and switches: the game's upscaler 50%, FSR 3.1 FG 2x;
RX_VK_EQ_BIAS=0; native zstd at its defaultSteps: a scripted route by teleport: Kokiri Forest, Hyrule Field, Market, Kakariko, Death Mountain Trail (about 18 minutes)
Expected: each area loads within seconds
Actual: in most runs one load hangs for 20 s to 5 min; the log shows
hid: the game read no controllerwith lr 0x83489670What changed
The default of
HOS_NATIVE_ZSTD(unset or empty) is now 2: the stream decode runs on the host's libzstd and keeps its virtual core.HOS_NATIVE_ZSTD=1still gives it up around each call.zs_mode()inhost/hos_zstd.c(the default 2; 1 only when asked), and its comment.tests/test_native_zstd.pyexpects the core kept when the switch is unset or empty.docs/development.mdandgpu/vk/switches.defdescribe the new default.Measurements
Verdict: freezes at loads 7 of 10 runs with the core given up, 0 of 3 with it kept, on main
c7db6c02/257c5491.Hardware: Windows 11 Pro, Arc 155H iGPU, driver 101.9175, Core Ultra 7 155H, 32 GB
Scene: the five-area route above; the game's upscaler 50%, FSR 3.1 FG 2x
Method: a run counts as frozen when longshot_log.txt has
hid: the game read no controller for N swith N over 20; runs interleaved over one nightHow to reproduce: the route with
HOS_NATIVE_ZSTDunset, then=2c7db6c02/257c5491, native zstd default (=1)HOS_NATIVE_ZSTD=0,HOS_NATIVE_ZSTD_FRAMES=0HOS_NATIVE_ZSTD=2(this PR's default), main @c7db6c02The RTX 4070 SUPER tours in
docs/tested/2026-11-17-native-zstd-default-*(keep vs give up) show the same loading-screen time either way.Flags and settings
HOS_NATIVE_ZSTD's default changes from 1 to 2.HOS_NATIVE_ZSTDTesting
Tested: Windows 11, Arc 155H: the route in the game with
HOS_NATIVE_ZSTD=2on mainc7db6c02, 3 runs, no freeze (this PR makes that the default; the build of this exact commit was not run in the game).tests/test_native_zstd.pypasses.Not tested: this commit's own build in the game, and a build with #1553 (it reworked virtual-core wakeups after these runs and may change the picture): a run on the nightly with #1553 is under way on this PC and its result will be posted here. Linux and other GPUs.
Must be tested:
the game read no controller forover 20 s in longshot_log.txt) (Test Farm: @Beanstalk windows intel, a teleport tour, look for the hid line)docs/tested/2026-11-17-native-zstd-default-*'s method)Risks
What could break: loads could be slightly slower where other game threads needed the core the decode now keeps.
Turning it off:
HOS_NATIVE_ZSTD=1(the previous default).Compatibility: nothing changes (no cache, save or option change).
Issues
See #1424
See #1365
Checklist
Everyone
type(scope): description) of the status line's type.HOS_NATIVE_ZSTD=2); this commit's build not yet.main.python -I -B tests/run_all.pypasses (the 39 tests that fail on this PC (Windows, no Vulkan headers or spirv-val here) fail on mainc507b98ctoo; none new).third_party/untouched.When it applies
Assisted-by:/Co-Authored-By:trailers.tests/that reads changed source updated in this PR, not weakened.Tested in game: Windows 11, Intel Arc 155H iGPU (0x7D55), driver 101.9175: a five-area teleport route (Kokiri, Hyrule Field, Market, Kakariko, Death Mountain Trail) on main
c7db6c02with HOS_NATIVE_ZSTD=2, the default this PR sets: 3 runs, no load hung (no 'the game read no controller' over 20 s); with the previous default main hung at a load in 7 runs of 10. This commit's own build not yet run in the game.Possibly related, for context:
Thanks. I read #539 and its log: it looks like a different problem.
zstd:line, so the native stream decode this PR changes was not running there.hid: the game read no controller for N s (lr 0x83489670)line, which every freeze here has, as do #1424 and #1365.What it shares is virtual-core starvation before the end (
vcores: ... longest 1926.3 mson several threads), the same family as #1553 works on, but not this decode's give-up and take-back. So I'm leaving #539 out of this PR's Issues.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.