WIP: fix(vk): keep TLS initialization coherent under COFF ThinLTO #755
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 @ 14e165a
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
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!755
Loading…
Reference in a new issue
No description provided.
Delete branch "siantm/Longshot:fix/coff-thinlto-tls"
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 Pro 26300, LLVM-MinGW 23.1.5, game-free · Needs: recorder-sync completion, full suite and Linux verification
Why
Windows COFF ThinLTO can fail to link the profiler and recorder's inline thread-local initialization routines. This fixes ownership and initialization without enabling ThinLTO or claiming an FPS improvement.
How to reproduce
Seen on: Windows 11 Pro 26300, LLVM-MinGW Clang 23.1.5 and lld.
Settings and switches: C++20 O2; native and
-flto=thin, static runtime.Steps: run
python -I -B tests/test_thinlto_tls.py --cxx x86_64-w64-mingw32-clang++ --source-ref 9e6f231d, then the same command without--source-refon this branch.Expected: both consumers link and preserve cross-TU identity, per-thread separation and queued cleanup.
Actual: main's native arm succeeds; ThinLTO fails on initialization symbols for
mkwvk::prof_tandmkwvk::rec::t_arena.What changed
Constant-initialize profiler POD TLS and give the recorder arena function-local thread-local ownership. Migrate every arena consumer and preserve destruction-time draining.
gpu/vk/vk_internal.h,gpu/vk/vk_recorder.h: focused production fix from local 073ed616.tests/test_thinlto_tls.py: compile real profiler/recorder consumers across translation units, with a baseline adapter.Measurements
Verdict: main fails during ThinLTO linking; the patched native and ThinLTO consumers pass.
Hardware: Windows 11 Pro 26300, Intel Core i7-9700, 31.8 GiB usable RAM; Python 3.14.7, LLVM-MinGW 23.1.5; no GPU used.
Method: the same authored cross-TU consumer against main and the prepared implementation.
9e6f231d484daadbcdObserved patched output:
PASS: native/ThinLTO production cross-TU TLS identity, thread isolation and Enc exit drain. Profiler sampling/exact-mode checks pass, as do recorder own/idle's 22 switch cases and deliberately broken variants. The checks ran on the source snapshot committed as484daadbcdbefore browser submission.Flags and settings
None. Production optimization defaults do not change; this does not enable the broader local ThinLTO experiment.
Testing
Tested: baseline/branch TLS comparison, profiler sampling/exact mode, recorder own/idle; run record accepted by the actual catalogue renderer.
Not tested: full game/renderer build, native Linux, full suite. The enclosing command timed out at 300 seconds while the larger
test_recorder_sync.pydriver was running; that driver is not reported as passed. The catalogue unit driver also has a Windows CRLF-vs-LF fixture failure.Must be tested: complete recorder-sync and full suite on Windows; native Linux TLS/recorder checks before readiness, by hand or Test Farm. Investigate any timeout rather than treating it as success.
Risks
What could break: per-thread lifetime, initialization or destruction ordering.
Turning it off: revert this commit; no new toggle.
Compatibility: no save/settings/cache-format, renderer ABI or compiler-default changes.
Checklist
Everyone
fix(vk): keep TLS initialization coherent under COFF ThinLTO.9e6f231d.When it applies
Assisted-by: OpenAI Codex.484daadbcd4150b1f2e9View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.