Commit Graph
98 Commits
Author SHA1 Message Date
Valiantsin DzerakhandClaude Opus 5.5 84abfaaf2c Merge the replay of NVN submissions on a queued thread, with reads waiting for the newest writer instead of a drain, behind TOTK_REPLAY_ASYNC
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:22:35 +03:00
Valiantsin DzerakhandClaude Opus 5.5 0ecfe91063 Merge asynchronous preemption of virtual cores with priority inheritance and the SDK's preemption disable, after MacNativeGames PR #488, behind TOTK_ASYNC_PREEMPT (on by default)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:22:25 +03:00
Valiantsin DzerakhandClaude Opus 5.5 792cc378f5 Merge branch 'main' into task/replayq
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:20:17 +03:00
Valiantsin DzerakhandClaude Opus 5.5 b0fa74720f Finish the queue before a host capture only when the replay is asynchronous, so TOTK_REPLAY_ASYNC=0 keeps the old capture path
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:20:17 +03:00
Valiantsin DzerakhandClaude Opus 5.5 dd4b28b400 Merge main into task/preempt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:19:18 +03:00
Valiantsin DzerakhandClaude Opus 5.5 921a5df120 Merge the texture re-upload counters into the perf lines
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:16:22 +03:00
Valiantsin DzerakhandClaude Opus 5.5 a220b89459 Collect the open work in one list in docs/backlog.md, read the shared shader list's "*" texture kind as 2D, and record measurements from the other test machines
The backlog gets one "Open work" section: freezes, bugs (the Yunobo fade with its repro), machine items and paused
branches. prepare_shaders.py no longer stops on the "*" and "*_depth" texture kinds of the newer list revisions.
The playbook records the GTX 1050 Ti, RTX 3090 Ti and 8th-gen i7 numbers and how to get a perf log from those
machines; port-lessons gains the MacNativeGames virtual-core preemption row; totk.ini.example lists mouse_sens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:16:10 +03:00
Valiantsin DzerakhandClaude Opus 5.5 5eb60404a2 Describe the asynchronous preemption of virtual cores in docs/architecture.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:01:21 +03:00
Valiantsin DzerakhandClaude Opus 5.5 bc6294cf46 Wait for the newest recorded writer of the stale textures in a guest read instead of draining the replay queue
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 07:48:33 +03:00
Valiantsin DzerakhandClaude Opus 5.5 e523898280 Merge branch 'main' into task/replayq
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 07:45:15 +03:00
Valiantsin DzerakhandClaude Opus 5.5 8553b00c9b Drop the bisect modes 3 to 5 of TOTK_ASYNC_PREEMPT and log interrupts after the owner is resumed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 07:44:47 +03:00
Valiantsin DzerakhandClaude Opus 5.5 9ddbc7b49d Check the replay queue for room again after taking the core back, since another thread may have filled it meanwhile
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 07:44:43 +03:00
Valiantsin DzerakhandClaude Opus 5.5 9bf73a3646 Work in progress: guest threads give their virtual core up while they wait for the replay queue, not yet built or run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 00:05:14 +03:00
Valiantsin DzerakhandClaude Opus 5.5 8f9716527a Keep the interrupted code's flags in kern_ap_stub, take the whole integer context, log the first interrupts and add test modes 2 to 5 of TOTK_ASYNC_PREEMPT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 00:03:10 +03:00
Valiantsin DzerakhandClaude Opus 5.5 9fea5cc37b Credit MacNativeGames for the virtual-core preemption in THIRD_PARTY_NOTICES.md and the kernel.c header
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:49:11 +03:00
Valiantsin DzerakhandClaude Opus 5.5 c66ac84925 Preempt a virtual core owner in top-level game code from the waiting thread, with priority inheritance and the SDK's preemption disable, behind TOTK_ASYNC_PREEMPT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:37:11 +03:00
Valiantsin DzerakhandClaude Opus 5.5 aaff964318 Work in progress: queue texture releases behind the replay instead of draining it, not yet built or run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:36:07 +03:00
Valiantsin DzerakhandClaude Opus 5.5 06f4fe93aa Finish the queue before TOTK_SHOTS and --shot read the presented image, which the replay thread may not have rendered yet
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:31:09 +03:00
Valiantsin DzerakhandClaude Opus 5.5 469c2be1e7 Wait for the texture's newest writer instead of draining the replay queue in ReadTexels, with TOTK_REPLAY_CHECK comparing against a full drain
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:27:49 +03:00
Valiantsin DzerakhandClaude Opus 5.5 d52cdfc6ee Add TOTK_CORE_DIAG: classify every virtual core wait by what the owner was doing, and answer SVC 0x36
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:23:48 +03:00
Valiantsin DzerakhandClaude Opus 5.5 1c1b3cf073 Log the replay queue's run totals at game exit and accept replay_async in totk.ini
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 21:27:11 +03:00
Valiantsin DzerakhandClaude Opus 5.5 bbcc50ae47 Count texture re-uploads and the share that follows WriteTexels in the perf lines
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 21:20:48 +03:00
Valiantsin DzerakhandClaude Opus 5.5 f63db636d4 Merge stage library builds for waiting draws on idle workers and skipping draws into passes with a per-frame target, behind TOTK_PIPE_WAIT and TOTK_PIPE_SKIP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:42:55 +03:00
Valiantsin DzerakhandClaude Opus 5.5 14af7e7347 Replay NVN submissions on a queued replay thread behind TOTK_REPLAY_ASYNC, with drains for calls that read or free GPU state
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:24:39 +03:00
Valiantsin DzerakhandClaude Opus 5.5 dc3a0e906a Reserve one pipeline worker for waiting draws' libraries only at the default TOTK_PIPE_WAIT, so TOTK_PIPE_WAIT=draw restores the old scheduling
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:00:06 +03:00
Valiantsin DzerakhandClaude Opus 5.5 6ece59b33e Merge branch 'main' into task/pipewait
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:48:19 +03:00
Valiantsin DzerakhandClaude Opus 5.5 d161a8aefe Build a waiting draw's stage libraries on idle workers in parallel and skip draws into passes with a per-frame target, with TOTK_PIPE_WAIT and TOTK_PIPE_SKIP knobs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:48:19 +03:00
Valiantsin DzerakhandClaude Opus 5.5 b34ca6ea4a Merge ASTC decode in a compute shader with native ASTC upload where the device samples it, behind TOTK_ASTC
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:36:43 +03:00
Valiantsin DzerakhandClaude Opus 5.5 21cc2f2962 Merge the descriptor build skip for draws with repeated inputs and descriptor writes through update templates
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:34:21 +03:00
Valiantsin DzerakhandClaude Opus 5.5 291267e65d Decode ASTC a block per lane group through shared memory, in scratch chunks of at most 32 MiB of texels, and time the dispatches with TOTK_ASTC_TIME
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:28:00 +03:00
Valiantsin DzerakhandClaude Opus 5.5 00d7c6689f Write descriptor sets through update templates made with each set layout, with TOTK_DESC_TEMPLATE=0 keeping the write structs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:03:30 +03:00
Valiantsin DzerakhandClaude Opus 5.5 d36034b1ec Skip building a graphics draw's descriptor sets when its inputs equal the previous draw's in the command buffer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 17:42:54 +03:00
Valiantsin DzerakhandClaude Opus 5.5 0140dc1672 Merge the per-draw shader memo and push skip, the page-indexed pool resolve cache, region-only ReadTexels and WriteTexels, GOB-wide swizzle, the Intel legacy driver vertex-input fallback and all-thread profile chains
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 17:42:50 +03:00
Valiantsin DzerakhandClaude Opus 5.5 9a859dfb2c Decode ASTC textures with a compute shader in the upload batch, or upload them natively where the device samples ASTC, behind TOTK_ASTC
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 14:42:51 +03:00
Valiantsin DzerakhandClaude Opus 5.5 dc75826d71 Turn dynamic vertex input off on Intel's older Windows driver, which draws nothing with it
Intel's frozen driver for UHD 630 and Ice Lake (Vulkan 1.3.215 and older) leaves the picture black with
VK_EXT_vertex_input_dynamic_state (LAS Recomp 61fe44ff, its issues #8 and #357); the GTX 1050 Ti laptop has a
UHD 630. TOTK_VK_DYN_VERTEX=0/1 forces it. The fallback path, checked on the RX 9070 with validation: field picture
as with it, no new validation messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 14:17:54 +03:00
Valiantsin DzerakhandClaude Opus 5.5 476715e0c2 Swizzle a texture row a GOB at a time instead of computing the block-linear address of every 16 bytes
Within a row, consecutive GOB columns are one block apart and a GOB row's four 16-byte segments sit at fixed
offsets, so the address is computed once per row. Non-ASTC texture upload time in the monsters2 load frames falls
by 28-38% (90 to 65 ms at the world load). probe-vkmem compares it with its reference swizzle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 14:14:46 +03:00
Valiantsin DzerakhandClaude Opus 5.5 f178be9eb2 Copy only the region of a ReadTexels or WriteTexels call instead of swizzling the whole texture level
A guest WriteTexels of a small region deswizzled and reswizzled the whole level while its thread held a virtual core
and the texture lock: 80 ms preemption delays and 50-160 ms frames in the monsters2 replay (frames 765-790,
1225-1235), with the render thread waiting on the texture lock. nvn_texels_box copies the box alone; probe-vkmem
compares it with the whole-level path on random boxes of five block sizes, mip levels, array layers and 3D slices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 14:12:43 +03:00
Valiantsin DzerakhandClaude Opus 5.5 8a41e3a7ef Keep call chains of every thread in the sampling profile with TOTK_PROFILE_CHAINS=1
Render-thread chains could not show which guest thread held a virtual core during a stall; with every thread's
chains over a short frame range the running samples name it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 14:12:43 +03:00
Valiantsin DzerakhandClaude Opus 5.5 faa246df38 Cache resolved pools per thread by the page of the address instead of the last four, so resolving stays one compare
The replay resolves every vertex stream and buffer binding of each draw; four entries thrashed over the pools a
frame touches, and each miss took the pool lock and searched the index. vk_mem_resolve falls from 5.3-6.1% to
1.6% of the RX 9070 render thread, field replay from 9.2 to 8.9 ms. TOTK_RESOLVE_CHECK=1 compares every hit with
the locked lookup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 14:00:58 +03:00
Valiantsin DzerakhandClaude Opus 5.5 b7c59adcd9 Reuse the previous draw's shaders while its program, bound state and textures repeat, and skip pushes equal to the last one
About 65% of field draws repeat the previous draw's program, state and texture handles; shader_for falls from
10.8% to 6.4% of the RX 9070 render thread and field replay from 9.7 to 9.2 ms. answers_for looks up only the
slots whose handle changed. TOTK_SHADER_MEMO=check verifies both against full lookups; TOTK_BIND_STATS counts
repeats per draw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:40:37 +03:00
Valiantsin DzerakhandClaude Opus 5.5 7596212938 Merge the render-thread call chains in the sampling profile and the set-associative shader cache that stops per-frame SHA-256 of shader code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:04:57 +03:00
Valiantsin DzerakhandClaude Opus 5.5 bf41b9cfef Make the program-to-shader cache 4-way set-associative so conflict misses stop hashing whole shaders with SHA-256 every frame
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:02:21 +03:00
Valiantsin DzerakhandClaude Opus 5.5 2790f7d0e2 Keep render-thread call chains in the sampling profile and report inclusive time and driver callers from them
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 12:40:49 +03:00
Valiantsin DzerakhandClaude Opus 5.5 78957c71ce Merge the profile write on window close and guest exit, which skip atexit handlers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 12:02:52 +03:00
Valiantsin DzerakhandClaude Opus 5.5 5d7958cbb1 Write the sampling profile when the window closes or the game exits, which skip atexit handlers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 11:55:32 +03:00
Valiantsin DzerakhandClaude Opus 5.5 6b1d15534e Merge the device-local mirror of buffer-bound pools on discrete GPUs and the frozen idle regions that cut write-watch queries
On the GTX 1050 Ti the GPU time per frame in the world drops from 110-120 ms to 10-11 ms. TOTK_MEMORY=verify on the
same machine compared 4.45 million mirror pages over a 74-second run with 0 mismatches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 09:43:34 +03:00
Valiantsin DzerakhandClaude Opus 5.5 51567ac32a Freeze idle pool regions read-only so write-watch queries skip them
The mirror and the texture checks queried about 930 MiB of write-watched memory per frame (0.96 ms on the RX 9070
machine, about 3 ms on an 8th-gen i7), at about 1 us per MiB, and 770 MiB of it lay in 2 MiB regions nothing had
written for two seconds. In mirror mode a region left unwritten for TOTK_FREEZE_IDLE submissions (300; 0 turns it off)
and lying wholly in imported pools is now made read-only (memory.c mem_freeze), and the snapshot and change queries
skip it. The first write faults and a vectored handler thaws the region before the write retries; file reads into
guest memory, which the kernel would refuse on a read-only page, thaw their buffer first and log a refusal, as do pool
init and finalize, and commits, decommits and protection changes thaw under the same lock. A region stays thawed for
5 s after a file read. Field: 66 queries over 380 MiB, 0.56 ms per frame; 0.38 ms of it are the queries that find
writes. The perf line `mem: write-watch` gives queries, bytes, time, frozen MiB, freezes and thaws. The gfx-abi probe
covers freeze, thaw by a write and the hold after mem_thaw. TOTK_MEMORY, TOTK_MIRROR_GAP and TOTK_FREEZE_IDLE are known
settings now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 08:39:47 +03:00
Valiantsin DzerakhandClaude Opus 5.5 1fe552ae0a Mirror buffer-bound pools in device-local memory on discrete GPUs
Imported pools put vertices, indices, constants and storage buffers in system memory, so discrete GPUs read them over
PCIe on every draw. A pool now gets a device-local mirror on its first use as a vertex, index, uniform, storage or
indirect buffer; bindings, buffer copies, fills and uniform updates use it at the same offsets. The first access of a
submission syncs the pages written since (write-watch snapshots shared with the texture checks, plus
nvnMemoryPoolFlushMappedRange ranges) in a prologue command buffer before the part; what the GPU writes into a mirror
goes back to guest memory at the end of the submission. TOTK_MEMORY=import|mirror|verify overrides the device class;
verify compares sampled mirror pages with guest memory at the fence. The vkexec probe gains a mirror part.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 00:45:56 +03:00
Valiantsin DzerakhandClaude Opus 5.5 c8a7b889d2 Merge the perf-gated count of what a VRAM mirror of buffer-bound pools would upload, the device class line and the census at frame 600
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 00:22:32 +03:00
Valiantsin DzerakhandClaude Opus 5.5 b8ecf1d937 Document the mem: class and mem: dirty lines in the agent playbook
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 00:17:27 +03:00