Repository navigation
Description
Call for contributors: AnyKyty architecture v2 — "what the GPU writes, the GPU reads"
AnyKyty already runs most of our test games well, but GPU-driven titles such as our bench title (a native PS5 title on an in-house engine) are stuck around 12–13 fps on a strong PC (Ryzen 9 7950X3D + RTX 4080 SUPER, 4K). After a lot of measurement, our conclusion is that this is not something more tuning will fix: it is an architecture problem, and it will get worse as more games move to GPU-driven rendering (UE5-style engines, compute-generated draw data).
We measured where the time goes, wrote two throwaway proofs of concept, and drafted a step-by-step plan. We are looking for people who want to take one or more steps of this plan. Everything below is measured unless marked estimate.
1. Diagnosis (six games, same build, same PC)
| Game | fps | draws + dispatches / frame | Execute thread µs per op | write faults / frame | buffer uploads / frame |
|---|---|---|---|---|---|
| Our GPU-driven bench title | 11.6 | 3 789 + 2 616 | 9.85 | 1 933 | 46 MiB |
| A PS4-era open-world title | 139 | 3 096 + 66 | 1.74 | 37 | 0.2 MiB |
| a UE4 title | 71 | 4 242 + 78 | 2.47 | 11 | 0.7 MiB |
| a Unity title | 150 | 992 + 73 | 3.81 | 52 | 1.0 MiB |
| a second UE4 title | 93 | 506 + 17 | 4.62 | 6 | 0.2 MiB |
| a second Unity title | 209 | 812 + 61 | 3.21 | 14 | 0.2 MiB |
Five of six games are above 60 fps and are held by the GPU or by the game itself. The bench title has three walls stacked at 45–75 ms per frame: our Execute thread (~61 ms CPU), the GPU (45 ms, real busy time), and the game's own threads (write faults and waits). Each isolated fix only revealed the next wall, which is why individual optimisations gave 5–15 %.
Three root causes, present in all six games:
- The CPU redoes, per draw, what the console does at execution time. On PS5 the shader loads its own descriptors (T#, V#, S#) and tables from memory. We read, resolve, specialise, revalidate and record them on four CPU threads: 5.6–11.6 µs per operation on five games, 20.4 µs on the bench title. The measured floor for a Vulkan operation is 0.06–0.21 µs. The pathological case is data written by the GPU: the bench title builds its draw tables with compute shaders, so every CPU read of a word written in the current tick forces us to wait for the whole GPU queue to drain (once per frame, 5–21 ms).
- Guest memory exists in two copies kept coherent by page faults. Harmless when one thread writes a little (6–52 faults per frame). Explosive when eleven game threads write: one fault costs ~5 µs alone and ~71–77 µs under contention.
- Shader translation costs GPU time. The GPU runs a frame from the bench title in 45 ms where we estimate ~13–15 ms native (estimate). Biggest finding so far: PS5 scalar loads (
S_LOAD_DWORD, one per wave) translated into per-invocation storage-buffer loads. Making them uniform made one full-screen pass ×22 faster and the whole frame's GPU time −15 % (landed in AnyKyty).
2. What was already tried and ruled out (please don't redo these)
- Reusing recorded command buffers / diff-decoding PM4: between two real frames, 0 % of draws are byte-identical (games re-allocate per-frame memory).
VK_EXT_device_generated_commands(tested on a Unity title): only 23 % of draws eligible because descriptor sets were rebuilt by the CPU per draw; with resolution already this cheap, there is nothing left for DGC to remove, and each cut costs ~16 µs of GPU.- Guest memory imported as host memory for the GPU (
VK_EXT_external_memory_host): GPU +57 % in our POC. Reads across PCIe are paid on every access. - Moving the CPU resolution earlier / to more threads: the resolver thread was only 36 % busy; the cost is in proving that an early read is still valid, not in the resolution itself.
userfaultfd+PAGEMAP_SCANinstead of faults: 1.5 ms per 4 GiB scan, ~93 ms per frame at 60 syncs. Linux-only as well.
3. Target architecture
Pillar 1 — "What the GPU writes, the GPU reads." The recompiler already classifies every load of a shader (control word, flattened word, descriptor). If the address chain stays in CPU-written memory, keep today's ahead-of-time resolution. If a word is written by the GPU (or reached through a pointer read from a GPU-written page), the shader reads it itself from a contiguous VRAM mirror of guest memory: first data words, then V# (a buffer becomes a mirror address), then T#/S# (image-heap index found through a GPU-side table). No GPU-written value ever becomes part of a module key, a specialisation or a revalidation. Second slice: once all resources are data, a draw no longer needs the resolver at all ("thin chain": decode, pipeline lookup, push constants, draw).
| Today (the bench title) | Target | |
|---|---|---|
| GPU drains caused by Execute | ~1 per frame, 8–12 ms | 0 by construction |
| Execute time tied to GPU-written words | up to 37 ms / frame | ~0 |
| Execute per operation | 9.85 µs | ≤ 2 µs (2.25 µs measured in-game on draws that already take a table path) |
| Modules per guest program | 1.37 (up to 95) | 1 |
Driver needs: Vulkan 1.2/1.3 core features (bufferDeviceAddress, non-uniform descriptor indexing, shaderInt64, storage images without format) and sparse buffers for the contiguous mirror. VK_EXT_descriptor_buffer is not required. Fallback is per shader: today's path.
Pillar 2 — "One mirror, writes that mark themselves." One sparse VRAM buffer mirrors GPU-visible guest memory (address = base + guest address). CPU writes stop faulting: at the first fault of a write site, the instruction is replaced by a jump to a trampoline that writes through the always-writable second view and marks a card table. Sync points scan the cards and upload dirty pages in stream order. Our own libSceAgc marks its pages at the source. The fault stays as the fallback, so unseen sites still work.
| Today (the bench title) | Measured target | |
|---|---|---|
| Game write faults | 1 933–2 301 per frame, ~77 µs each | 99.3 % come from patchable sites |
| Thread time in faults | ~136 ms per frame (all threads) | 163 → 0.15 ms in a calibrated bench |
| Scan at sync points | re-protection 6–28 ms per frame | card scan 0.9 ms per frame at 587 syncs |
This is the only fault-free tracking that works on both Linux and Windows. It does not move today's wall (removing 44 % of faults gave 0 fps on the bench title while Execute is the wall); it becomes the wall once Execute is light.
Pillar 3 — GPU translation cost. No proven factor yet. Leads: generalise the scalar-load rule (everything uniform per wave becomes a per-operation constant), fewer cuts and barriers (the bench title: 2 872 barriers per frame), native wave64 on RADV (NVIDIA only has 32-wide subgroups; splitting wave64 gave −5 % GPU there).
4. Proofs of concept (code on branch poc/architecture-v2)
POC 1 — who resolves descriptors, CPU or GPU (poc/gpuresolve/). Bench calibrated on a frame from the bench title: 3 800 draws + 2 600 dispatches, 180 passes, 8 textures + 4 buffers + 24 table words per operation, tables in a GPU-side guest-memory mirror. Six arms render the same image to the byte.
- CPU: 0.056 µs per draw when the GPU resolves (0.21 µs/op on the draw+dispatch mix, 1.35 ms per frame) vs 9.85 µs/op in Execute in-game today.
- GPU, draws: resolution in the shader is free (−4 to −10 %).
- GPU, small serial dispatches: +6 % with a contiguous mirror, +28 % with a page table → contiguous wins.
- One resolution pass per render pass: +2–3 ms/frame → rejected. Per-draw blocks in host memory over PCIe: +57 % GPU → rejected.
- Same image and ≤ 2 % GPU cost on RADV (AMD iGPU).
- Key insight: resolving on the CPU is nearly free in itself (+0.04 µs/op). Our 10 µs/op is the machinery that proves an early read is still valid (read log, revalidation, specialisation, faults, drains). A GPU reading at execution time needs none of it.
POC 2 — self-marking writes vs faults (poc/selfmark/). Bench calibrated on the bench title's fault profile (11 threads, 2 300 pages per frame):
- mprotect + SIGSEGV: 163 ms of thread time per frame (~71 µs per fault), plus 6 ms of re-protection;
- self-marking writes through a second view: +0.15 ms per frame, 0.9 ms with 587 sync points;
- a first-fault site patcher (Zydis-based,
patch.cpp) on real write sites: 99.3 % of faults covered, 0 failures, +0.98 ns per patched write, 5 µs to patch a site. Half of the sites are shorter than 5 bytes and need the neighbouring instruction relocated: the relinker can prove at conversion time that no jump lands there.
Not measured yet: the fps these pillars give in-game. Estimate only: pillars 1 and 2 could bring the bench title down to its GPU wall (~45 ms/frame). Going further needs pillar 3.
5. Plan — pick a step
Each step is shippable on its own, universal (nothing per game), and proven by an in-session A/B (KYTY_AB) on the bench title plus a non-regression run on other games. Days are worker-days, estimated.
| # | Step | Days | Risk | Proof / stop gate |
|---|---|---|---|---|
| E0 | Emit the 20 most expensive programs from the bench title with their GPU-written words read from the mirror (SRT root as a dynamic-offset uniform buffer); compare registers/size (nvstats) and time by compute replay |
2 | low | Stop gate: more than +10 % GPU → change the emission form before E2 |
| E1 | Our libSceAgc marks its own pages instead of faulting |
1 | low | write-fault counter |
| E2 | GPU-written words and V# read by the shader, compute first (indirect args, GPU-formed V#, image tables, indirect descriptor tables, refused flattened words) | 6–9 | medium–high | A/B on the bench title; stop if no gain beyond the error |
| E3 | CPU pre-records: no execution-time revalidation for loads left to the GPU; resolver only prefetches | 3–5 | medium | A/B on the bench title, [kyty-resolve] counters |
| E4 | Thin chain: draws/dispatches whose resources are all data skip the resolver | 6–10 | medium | A/B on the bench title + two other games |
| E5 | Images as data: T#/S# → image-heap index via a GPU-side table; miss → fallback texture + miss ring; format/swizzle carried by the view | 8–12 | high | one module per program |
| E6 | First-fault site patcher + card tables (new concurrent code in Rust), safe zones and trampoline section from the relinker | 8–12 | medium | fault count per frame; stop at sites ≥ 5 bytes if any wrong image or crash |
| E7 | Contiguous mirror replaces the buffer-cache buffers (Rust spec + differential replay, like our tracker model) | 10–15 | high | Execute buffer-cache and mprotect time |
| E8 | Command-processor copies at their stream position, labels published at real GPU completion for GPU-written pages | 5–8 | medium | existing ordering tests + A/B |
| G | GPU track, offline proof first: per-operation constants for everything wave-uniform; fewer cuts; native wave64 on RADV | 2–3 per proof | — | nvstats, real GPU time |
Order: E0 and E1 now; E2 then E3 (the bench title's measured wall); E4; E6 in parallel from E1; E5; E7 with E8. Total 50–75 worker-days.
6. How to help
- Comment here with the step you want to take so we don't duplicate work. Branch off
AnyKyty, one step per PR. - Measure, don't estimate. Every PR needs an A/B inside one game session (
KYTY_ABtoggles a temporary switch per phase); the switch is removed once the A/B decides. - GPU time: measure real busy time (segment-level timestamps). Per-command timestamps serialise the GPU and doubled the bench title's GPU time in our own measurements (113 ms instead of 54).
- New concurrent/critical code goes in Rust; the recompiler stays C++. No comments in code, please (project convention).
- Especially welcome: people with AMD GPUs (pillar 3 and RADV checks), Windows testers (pillar 2's second view and vectored-exception fallback), and anyone with SPIR-V / Vulkan shader-compiler experience (E0, E2, E5, G).
- Testing a game and posting logs with fps,
[kyty-*]counters and frame times also helps a lot: we need more GPU-driven titles besides our bench title to validate the pillars.
Thanks to everyone already testing and sending PRs. This is a big one, and it is the path to running the new generation of PS5 games well.
Activity
Raghav314 commentedon Nov 21, 2026
I'm taking E1: our libSceAgc will mark the command-buffer pages it writes itself, instead of taking a write fault on them. The hook is already there:
AllocateinlibSceAgc/Command/src/Packet.cppcallsAgcDriverPrepareCommandWritewith the exact range before writing, and on the Kyty side that function does nothing yet. The fault stays as the fallback, so a write that races an upload still works.Before the change I'll check how many of the write faults actually come from libSceAgc's own stores and how many from code the game inlines (the downward embedded data is written by the game, not by libSceAgc). Each fault gets classified by its faulting address. On Astro Bot's hub, about a quarter of the guest write faults land in command-buffer segments; GTA V in game opens about 10k 64 KiB blocks per second. The PR will show the write-fault counter and an in-session A/B (
KYTY_AB) on those two games.Branch:
perf/kyty-agc-self-markoffAnyKyty.Raghav314 commentedon Nov 21, 2026
E1 update: I measured where the guest write faults come from before building anything. A temporary diagnostic classifies each write fault by the module that contains the faulting instruction, on the current AnyKyty build with an RTX 4090. Counts are per 10 s; handler time is our fault handler only, without the kernel's signal delivery.
Our libSceAgc's own stores already fault only about once per 64 KiB command block, since those blocks open as a whole on the first fault. Most command-segment faults come from the game's memcpy into the segment, which libSceAgc can't mark. In GTA V, most of the game-code faults land in a block that also holds a page the GPU wrote (about 40k), or in a buffer of the cache (about 38k). Both take the single-page path.
So on these two games E1 would remove at most 0.5 % of the faults. We'll also run the same diagnostic on Ghost of Yōtei and come back here with its numbers, then build E1 only if libSceAgc's share there is worth it.
simnJS commentedon Nov 21, 2026
@Raghav314 thanks a lot, measuring before building is exactly the right call.
We already have the Ghost of Yōtei split (same idea: each write fault classified by the module holding the faulting instruction, bpftrace on the game process, current AnyKyty, RTX 4080 SUPER, 4K):
That is ~2 300 write faults per frame, coming from only 639 distinct instructions (6 sites make 50 %, 59 make 90 %, 248 make 99 %), all plain stores (
mov,vmovups,vmovntdq…).So your numbers and ours agree: E1 alone is small (0.5 % on your two games, ~7 % on Yōtei). It is still worth it as a cheap first step on Yōtei-like titles, but the real lever is E6 (patch the faulting store site on its first fault so it marks its page itself): it covers the game code and the libc
memcpytoo. In the POC (poc/selfmark/patch.cpponpoc/architecture-v2), 310 of Yōtei's 318 hot sites were patched and verified (99.3 % of its faults), 0 failures, +0.98 ns per patched store.If you want to fold E1 into E6, or take E6 directly, that would be great. Either way, please post the Yōtei-like numbers you get and keep the
KYTY_ABA/B in one session. One caution from our measurements: removing faults alone did not move Yōtei's fps last night, because its current wall is the Execute thread (see pillar 1). The fault work pays off once that wall moves, and on weaker CPUs.Celegans12 commentedon Nov 21, 2026
I'd like to take E0, and then E2 if E0 passes its gate. We're on Windows with an RTX 3080 Laptop + i9-11900H, running Yōtei 1.008 at our Teshio Ridge save, where your slope test puts Execute at 0.6-0.7 frame-ms per thread-ms (#55). So the effect of E2/E3 should show up directly in frames here, and we can measure it with the same session A/B.
My plan for E0: take the 20 most expensive Yōtei compute programs (by our per-shader GPU timer; the cloth solver
0x53f2b6c8a752875aand the particle passes lead it), emit each with its GPU-written words read from the mirror, with the SRT root as a dynamic-offset uniform buffer as in your table, and compare against today's module by register count, code size and GPU time in a compute replay. Then I'll stop at your +10 % gate before touching E2. I'll start frompoc/architecture-v2(397cc6cd632) for the emission side and branch offAnyKytyfor the step itself, one step per PR.A note on our measurements so far: the GPU numbers I posted today came from a timestamp around every draw and dispatch, which you've found serialises the GPU. They're fine for comparing two heads, but not as absolute GPU time. For E0 I'll use segment-level timestamps and the replay times, as you suggest.
Two questions before I start. Is there an existing replay harness for single compute programs that you'd want E0 to use, so the numbers line up with yours? And do you already have the list of which loads of those programs count as GPU-written in your classification, or should E0 derive it from the recompiler's load classes on our captured state?
AI-assisted: yes
simnJS commentedon Nov 21, 2026
@Celegans12 thank you! For transparency: we've already started E0 on our side (Linux, RTX 4080 SUPER, Ghost of Yōtei 02.002, the 20 most expensive programs, both emission forms, register and code size from
nvstatsplus real GPU time). The result is expected within a few hours; we'll publish the numbers and the tool on thepoc/branch so you can replay it.Your measurement on Windows and Ampere (RTX 3080 Laptop) stays very useful as a second point: another driver, another GPU generation. You can run it with our tool as soon as it's published, or with your own.
E2 is yours if you want it, once E0 passes its gate (less than +10 % GPU). We won't start it on our side.
On your two questions: the harness for E0 will be the tool we publish with it (the existing
kyty_compute_pipeline_replayfrom #133 only replays pipeline creation and doesn't dispatch, so it can't give GPU time). And the list of loads we treat as GPU-written for those programs will be part of that publication, so you won't need to derive it separately.Celegans12 commentedon Nov 21, 2026
@simnJS thanks, E2 it is, after your E0 gate. While E0 runs I mapped where GPU-written words still turn into CPU state on the current head, so E2 can start as soon as the gate passes. A few things came out of that where I'd like your direction before writing code.
At our Teshio save the resolve thread refuses about 38k dispatches per 10 s: two thirds because the walk hits a GPU-written word, the rest because the program uses the image heap (that part is E5). The GPU-written words that still reach the CPU are the ones something exact depends on: a word used as the address of the next walk level (
FlatWordsReadOnCpu), V# fields that end up in the module key (ResourceSpecialization), indirect dispatch args, indirect descriptor key tables, and image tables. My first slice would be a counter that splits the refused loads by what they feed, so the order of the rest follows the measured size.sparseAddressSpaceSizeandmaxBufferSizeare 1 TiB, so a literal "base + guest address" mirror of the whole guest GPU range doesn't fit here; it would have to cover the mapped windows only. AnyKyty already has the 16 KiB page table read through BDA (bda_load_u32), which sees GPU writes in stream order. Should E2 start on that page table and move to the contiguous mirror with E7, and could your E0 run also time the page-table form, since POC 1 put it at +28 % against +6 % on small dispatches?Our machine has the rest of what the plan lists (BDA, shaderInt64, non-uniform indexing, sparse buffers, storage images without format, pipeline statistics). I'll run your E0 tool here as soon as it's on the branch.
AI-assisted: yes
simnJS commentedon Nov 21, 2026
@Celegans12 great mapping, thanks. Answers:
Mirror form: start E2 on the existing BDA page table. A literal "base + guest address" mirror of the whole range doesn't fit a 1 TiB sparse space, so the contiguous mirror (E7) would only cover the mapped windows anyway. E2 on the 16 KiB page table keeps the stream-order visibility of GPU writes we already have; moving to the contiguous mirror becomes an E7 change behind the same shader-side load. Our E0 run will now time the page-table form too (alongside the contiguous mirror), on the 20 real programs, so the +28 % vs +6 % from the POC gets checked on real shaders.
V# formed by the GPU: read-only buffers first. Reads through a GPU-formed V# need nothing from the tracker. Writes through one would need GPU writes tracked at sync points instead of at GC; that belongs with E7/E8. If a program writes through such a V#, keep today's path for it in E2.
Chased words: per-dispatch flag in push data. One module per program is a goal of the plan (Yōtei sits at 1.37 modules per program, up to 95), so we'd rather not add variants per set of chased words. If E0 or your A/B shows the branch costs something measurable on a real program, we can revisit for that program only.
Load classes: yes. Our E0 now splits the GPU-written loads exactly as you listed: address-only words, V# fields feeding the module key, indirect args, indirect descriptor key tables, image tables, with count and cost per class. Please use those classes. The tool goes on a
poc/branch with the results.Your first slice (a counter splitting refused loads by what they feed) sounds right as the start of E2. Thanks for taking it on.
simnJS commentedon Nov 21, 2026
@Celegans12 E0 is done: E2 is a go, and it's yours. Tool and code on
poc/e0-gpu-reads(6fb1dbdfbd). Everything below is GPU time only, measured as ratios against today's emission, on a rented RTX 4090 (driver 615.71); E0 says nothing about fps, since it moves no CPU work.What was measured
spirv-val. Registers on NVIDIA unchanged in sum, code −2 %.Result
Your question on the page table
bda_load_u32/get_bda_pointerat every access: +89 % / +74 %, up to ×6.5 on one program.Recommended form for E2
ResourceSpecializationkey).Your question on classes:
kyty_e0_emitwrites them per program (classesin itsinfo.txt): data words, address-only words (FlatWordsReadOnCpu), V#, T#, S#, indirect descriptor key tables and image tables, each with the share read from GPU-written memory. So you can use ours. In the captured programs, the GPU-written V# is the most frequent class and costs nothing; address-only words in GPU-written memory are rare (the pointer usually sits in CPU-written memory and points into GPU-written memory). Indirect args weren't covered (the captures only took direct dispatches);[kyty-resolve]counters in game would size them at the start of E2.Limits: 6 of the top 20 without a usable time (still under the gate at the worst measured ratio), one capture per program, a rented GPU rather than our PC's, bench times that differ from the game (only ratios count), indirect buffers and image tables left to the CPU (E5), and the in-game capture patch isn't on the branch, so without it
emit.shfalls back to synthetic inputs.poc/e0/has the replay steps (build.sh,emit.sh,bench.sh,summary.py); the bench is standard C++20 and Vulkan but hasn't been compiled on Windows yet.Your questions 2 and 3 (GPU-formed V# and the tracker; chased words) are E2 design calls; we'll answer them separately.
Celegans12 commentedon Nov 21, 2026
@simnJS thanks, that's a clear go, and the selective form plus "V# by mirror address for every buffer" is a nicer starting point than I expected, since the V# part is a gain on its own and takes those fields out of the key. I'll build E2 in that order: V# by mirror address first, then shader-read words for chains through GPU-written memory, with the root as a uniform buffer and chain words shared rather than re-read.
On the page table, I'll go with the simple inline lookup from the start and re-measure it here. I'll also compile your
poc/e0bench on Windows and run it on the 3080 Laptop as the second data point, before writing E2 code, so we know whether Ampere and the Windows driver agree with your 4090 ratios.Also thanks for folding the label deferral in, and for the cloth fix. Both will be in our next Yōtei build, and I'll post the laptop numbers when it's measured.
AI-assisted: yes
simnJS commentedon Nov 21, 2026
@Celegans12 for coordination: we're taking step G, generalising the rule from the 4K pass so that the PS5's scalar loads are translated into uniform loads instead of one load per invocation, offline first, without touching the SRT root or the V# that E2 covers.
Celegans12 commentedon Nov 21, 2026
@simnJS first E2 measurement, before any E2 code: a counter that classifies every resolution Execute has to do because of a GPU-written word, by your classes, on our Yōtei build at Teshio (your head of this afternoon plus our commits, RTX 3080 Laptop). It changes the picture a bit, so I wanted you to see it before I go further.
Per frame, those resolutions cost Execute about 5.4 ms for dispatches and 0.6 ms for draws. Almost all of it is V#: 98 % of the dispatch refusals and all of the draw ones. Indirect args are 0.6 ms, T#/S# 0.2 ms, and address-only words and key tables are practically zero. The catch is that one compute program carries 4.5 ms of the 5.4: about 280 dispatches per frame of the program under the game's "Proxy Set Cull" marker (our hash
0x3e9ec76bb9964bff), with about 385k V# loads per 10 s. Its GPU-formed V# are written through, so under the rule from your answer (written-through V# keep today's path in E2) it stays on the CPU, and the first slice covers only about 1-1.5 ms per frame here.So I'll still build the read-only V# slice first as agreed, but the big item on this title is a write through a GPU-formed V#. I'm looking at whether that program's writes can be bounded per dispatch from the V# itself (the range num_records × stride describes), so the tracker could mark it GPU-written at submit instead of learning it at GC. If that holds, it would be exact to include V#s whose written range is fully described by the V#. Would that be acceptable in E2, or do you want those to wait for E7/E8?
Details
One 10 s window, 93 frames, counter on (
KYTY_E2_STATS=1), 92.8 presents per 10 s in that leg.By class (first blocking class, refusals per 10 s, ms per frame): dispatches: vsharp_key 26,284 (4.58 ms), indirect_args 465 (0.61), T#/S# 170 (0.21); draws: vsharp_key 9,439 over 60 programs (0.62). Address-only 1, key tables 0.
Top dispatch programs by Execute cost:
0x3e9ec76bb9964bff4.50 ms per frame (25,316 refusals per 10 s, 384,652 V# loads), then four indirect-args programs at 0.10-0.31 ms each,0xe7a45b7d19e249fa0.23 ms (V# + T#/S#).AI-assisted: yes
simnJS commentedon Nov 21, 2026
@Celegans12 great measurement, and it does change the picture: one program at 4.5 ms of Execute per frame is the biggest single item we've seen.
On including written-through GPU-formed V#s in E2: yes, but not by marking the range at submit from the V#. At submit, the V# is a GPU-written word of the current tick: reading it on the CPU to get
baseandnum_records × strideis exactly the drain E2 exists to remove. It would only be exact if we waited for it, and guessing it from the previous frame is the kind of speculation that just cost us #170.What we'd accept in E2, as a second slice after the read-only one, with its own A/B:
Before building it, please measure the cost of that marking offline on
0x3e9ec76bb9964bffwith the E0 tool (poc/e0, same method: captured inputs, batch timestamps, outputs identical). If the atomics cost more than they save, we'll keep that program on today's path and move the write side to E7/E8.Order stays: read-only V# slice first (your 1-1.5 ms), then this.
simnJS commentedon Nov 21, 2026
@Celegans12 a coordination note on step G, so our branches don't collide with your E2.
What G touches
IR::Bindings: a new field,flattened_srt_uniform_index(serialised).DefineDescriptors: a uniform index for buffers read byS_BUFFER_LOADand never written, plus a uniform view of the flattened table for words at a constant index below 4096.EmitReadConst,EmitReadConstBuffer,EmitReadCallWord.RenderExecutor::RebindBuffers, which fills that view.What G leaves alone
S_LOADby address (2,202 loads over 287 Ghost of Yōtei modules) andS_BUFFER_LOADon indirect buffers (5,514 loads over 74 modules). Those are the chain words that E2 moves to the mirror.Please say if you see an overlap with your E2 branch.
Celegans12 commentedon Nov 21, 2026
@simnJS thanks for laying it out. There is one real overlap and a few nearby edit sites, and I think a clean split is easy.
The overlap is buffers read only by
S_BUFFER_LOADwhose V# the CPU knows (root user data or SRT words). My first E2 slice, as written so far, puts every read-only, untyped buffer with a word-described V# on the mirror address, and that includes those constant-only ones, which are exactly the buffers G wants as a uniform buffer. I'd split it this way:S_BUFFER_LOADwhose V# the CPU knows: they stay bound and get your uniform index.buffer_load*), by mirror address.In my slice that's a single change (skip constant-only buffers when choosing what to mirror), and I'll make it now unless you'd rather draw the line differently.
The other contact points are mechanical: E2 adds a serialised field to
IR::Bindingsnext to yourflattened_srt_uniform_index(same field list), gives mirrored buffers no descriptor index inDefineDescriptors(the same loop where you add the uniform index), and adds one loop inRebindBuffersafter the bound buffers to fill the mirror slots, separate from your table view. I don't touchEmitReadConst,EmitReadConstBufferorEmitReadCallWord; the mirror path goes through the storage-buffer access helpers instead. So I'd suggest G lands first and I rebase E2 onto it.AI-assisted: yes
68 remaining items
teepean commentedon Nov 25, 2026
I'd like to take E5 (images as data), unless it has already started on your side. @Celegans12 left the E7.5/E3/E5 side to you on 11-22, so if you'd rather keep E5, say so and I'll take something else.
Setup: Linux, Ryzen 9 9950X, RTX 3090 (NVIDIA 615.78.08), Ghost of Yōtei at 1080p, ~19-20 fps at full detail on an AnyKyty-based tree (
7de61e3451plus local measurement switches).What we measured on Yōtei that bears on E5 (10 s windows, per frame):
Plan, measuring first:
KYTY_ABA/B on Yōtei plus a non-regression game, and the deleted lines counted.Two questions:
feat/e7-5(the mirror) or onAnyKyty?AI-assisted: yes
teepean commentedon Nov 25, 2026
E5 step 1, the census. Measured on Yōtei, nothing built yet.
Setup: same as above, plus a game-side detail-scale patch, so this is ~1,520 draws/frame at 25.9 fps. At full detail the image-heap numbers scale about with draw count; the full-detail figures are in my previous comment. Our image-heap census counter is printed every 10 s; per-frame values are averages.
Heap state (stable across windows):
Churn per frame:
So the tables are rebuilt every frame but point almost only at descriptors the heap already knows.
Execute cost of image-heap programs (refused ahead, resolved at execute):
Total ~7.9 ms/frame of Execute. The heap work itself (acquire, rebind, commit, lists) is only ~1.3 ms of that; the rest is the full execute-side resolution that heap programs force.
Design sketch for discussion (no code until you're OK with the direction):
Deletes: per-view slot buffers and their uploads, table probing and refresh, page watching of heap tables,
ImageHeapPredictions, and the image-heap refusal of ahead resolution.Gate before E5 proper, like E0: emit the top heap programs with the hash lookup and time them in a replay. Stop if more than +10 % GPU, then do the
KYTY_ABin game.Questions:
feat/e7-5or onAnyKyty?AI-assisted: yes
teepean commentedon Nov 25, 2026
E5 gate, first answer to my own hash question: the per-load hash fails, by a wide margin.
Bench: a synthetic Vulkan compute micro-bench on an RTX 3090 (NVIDIA 615.78.08).
Hash vs slot:
The slot buffer stays within 3–15 % of the floor in the uniform cases.
Why:
Revised E5 direction: keep a slot buffer indexed by table position, and change who fills it.
Still deleted: CPU probing and refresh, page watching of heap tables,
ImageHeapPredictions, and the image-heap refusal of ahead resolution. The slot buffers stay, but become GPU-written.Next:
KYTY_ABswitch.Open question for you: does the GPU fill pass conflict with your E3 plans (resolve preloads, no revalidation at execute)? It seems complementary, since it removes the reason heap programs are refused, but I'd rather check before building it.
AI-assisted: yes
teepean commentedon Nov 25, 2026
E5 follow-up: the slot form's GPU side checks out.
The shader body doesn't change.
KYTY_AHEAD_IMAGE_HEAPon (five Yōtei runs: plain,KYTY_AHEAD_HEAP_SHAPE,KYTY_AHEAD_HEAP_ROOTS, 10 s windows), predicted vs executed views always loggedreplays: ... other kinds 0. Only slot contents changed, never the kinds.The fill pass
At Yōtei's ~4k changed T# per frame, that's ~8 µs/frame with one pass per frame, and ~36 µs even for a full refill.
The caveat is pass count, not pass size. Kyty refreshes heap tables 485 times per frame today. One pass per refresh would add ~3 ms of serial GPU time, so the fill has to be batched: one pass per submit, or per sync that actually changed table pages. The miss ring is read back at the next sync, so a miss shows the fallback for one frame (~2 per frame measured).
Status:
KYTY_AB. I'll hold it until you've said whether E5 is mine and which base you want (AnyKytyorfeat/e7-5).AI-assisted: yes
teepean commentedon Nov 25, 2026
E5 CPU-side ceiling on Yōtei: Execute's image-heap cost nearly disappears, but fps moves only +2.7 % at this scene.
What the ceiling does. A local hack on top of
7de61e3451, not a PR. It uses f474daa's predictions (restored locally), changed in two ways:{slot_count, address}triple in the flattened SRT instead of resolving again. Slot contents never matter to the CPU; this is what a GPU-filled slot buffer allows.Execute still fills slots on the CPU (refresh/probe), so the fill pass isn't in it yet.
Results. Same scene and settings, scale-0.15 detail patch, ~1,520 draws/frame, 3 alternating pairs:
Ceiling counters per frame:
The result is +0.7 fps (+2.7 %), 3/3 pairs positive.
For comparison, two earlier variants:
Both are below control, which matches #170: missed predictions cost more than they save.
Why so little fps for ~7 ms of Execute:
So each Execute cut moves time into those waits instead of off the frame; we saw the same with other Execute-only cuts. At full detail (~3,100 draws), where Execute is ~50 ms/frame, the share should be larger; I haven't measured it there yet.
Heap-index census of the translated programs (offline, by a colleague, from our dumps; last-write tracing, hand-checked on 2 programs):
s_buffer_load_dwordx8of the T# at table + id × stride, then sample, then loop.What this means for E5:
The fps return depends on what else bounds the frame, though. Here that is the main-thread wait chain, not Execute.
Next on my side: check the image with patched slots (screenshots), then the same A/B at full detail. If those hold, a clean version on
AnyKyty: GPU fill pass, shape-less kind prediction, no CPU slot probing, behind aKYTY_ABswitch.AI-assisted: yes
teepean commentedon Nov 25, 2026
The same E5 CPU-side ceiling at full detail (no detail-scale patch, ~3,100 draws/frame). Same scene and settings, alternating runs.
That is +0.2 fps (~+1 %) for ~10.7 ms/frame less Execute work.
At the reduced-detail scene it was −7.3 ms for +0.7 fps. So at both detail levels the ceiling removes almost all of Execute's image-heap cost, and fps barely moves.
On this title and machine, Execute's total isn't what paces the frame. The game's main thread spends ~17 ms of a ~37 ms frame (reduced detail) waiting on three things:
Cutting Execute work that isn't on those ops' path just moves the time into those waits. We're now measuring the frame's critical path, from each wait back to the op, queue and thread that releases it, before deciding where E5-style work actually pays.
So for E5 itself:
Side note for anyone running Yōtei at full detail on NVIDIA: two of six runs here hung the GPU on the loading screen (Xid 109, CTX SWITCH TIMEOUT), one in each arm, so it isn't E5. I haven't found the cause yet.
AI-assisted: yes
simnJS commentedon Nov 26, 2026
Status update on our side of v2 (E7.5, the guest-memory mirror), plus what we learned this week.
E7.5 T1–T3
mirror_base + address, and misses go through the residency map. The code is done. Its first measurement was +40 % GPU time, all of it in compute. The cause was a serial chain on every device-address access: six metadata words, then the residency word, then a device-scope atomic on the usage word, and only then the data. The fix reads the metadata in one block, reads residency and usage with plain loads, and keeps the atomic on the rare miss path. A cross-model review then found a race in the first version of that fix (a stale plain read of the usage word could skip marking a block that was still in use). The usage bit is now set by an unconditional atomic OR whose result is never read.Two NVIDIA 595 compiler crashes worth knowing about
libnvidia-gpucompsegfaults on anOpGroupNonUniformShufflethat reads the first lane inside a waterfall loop (V_READFIRSTLANEcompared against itself, then a ballot). The fix emitsV_READFIRSTLANEas a subgroup reduction instead (fix(kyty): read the first lane with a subgroup reduction instead of a shuffle). It is in review for AnyKyty.+0xa3465b) shows up on Blackwell (RTX 50 series) only, while warming the bench title's cache. We don't know yet whether the T3 shader form triggers it. A control run (head only) on a 50-series card is next.Where this points
simnJS commentedon Nov 26, 2026
Sorry for the silence these last two days. Several of you were waiting on an answer from us, so here they are.
@teepean, E5 (images as data): yes, it's yours. Nobody had started it on our side. Your measurements answer most of the design questions already:
KYTY_ABshowing Execute ms per frame and GPU busy (it must not cost GPU), plus a second title where Execute is the wall. @mrfelek's profile below is exactly that kind of title.@Celegans12, E2 slice 2 gate: go with the gate off (conservative marks). Your verify legs are exact (1.55 M views matched, no miss, conflict or demotion), the arms are level on fps and GPU, and Execute saves 1.9 ms per frame on the dispatch side, which is the whole point of slice 2. The strict gate costs 4.6 % for a guarantee the verify leg shows we don't need. Keep the strict gate only as a debug check, not a second runtime mode. For the PR: rebase on
feat/e7-5-t3once the T3 gate passes (status in my comment just above), and keep the deletion ledger (the record-time V# reads and the CPU binding and marking of formed views).@mrfelek, thanks for both. The opposite-profile title (Execute as the wall through op count, ~11,600 ops per frame at ~3.6 µs, almost no GPU-written reads) is exactly what E4 needs next to our GPU-bound bench title. Your
perfbreakdown (ExecutePreparedDraw46 %,PrepareGraphicsBindings20 %) goes into the E4 plan. And yes, please run the strict gate againstKYTY_E2_FORMED_GATE=0for Celegans12 on the 3080 Ti and the 780M with validation on: the RADV numbers are the ones nobody else has.@relativespace2K, sorry, that
usagebenchpointer went nowhere: it stayed local and we dropped it. The E7.5 numbers it was meant to give came from the in-game runs instead. What would help now is thefeat/e7-5mirror shim tests (kyty_shim_mirror_shadow,kyty_shim_mirror_windows) on the RX 6800 XT under Windows, once T3 is pushed. I'll ping you here when it is.simnJS commentedon Nov 26, 2026
A small change to what I wrote above: we'd like to land the whole v2 batch in one go, so we'll do the integration work on our side tonight, with your designs and data. Your branches and measurements are the basis, and the credit stays yours:
feat/e2-slice2(23a914f22c) onto the T3 stack as it is, with your commits and your authorship, and making the gate-off form the only runtime mode. Please look over the result when it's up. If you have anything newer locally, push it and we'll take it instead.We'll post the branches here, along with the T3 gate result.
simnJS commentedon Nov 26, 2026
The T3 gate result, as promised above.
The first T3 gate run failed. On an RTX 4080-class card with the same driver as our reference PC, the T3 form compiles fine, but it stops the GPU while our bench title loads, in its cloth solver compute shaders (
the GPU has not reached tick N in 10 s … the GPU stopped). The head doesn't stop there any more. The summaries before the stop count reads of mirror blocks that are not bound yet, so the lead is a dispatch that reaches a block by device address before the block is resident. GPU time and fps could not be measured on that run, because of the stop.T3 is now fixed outside the title: no dispatch reads an unbound block, the mirror tests pass, and the replays reproduce the reference images. The in-title gate is running again on Vast.
What it means for E2 slice 2 and E5: both are rebased onto the T3 stack on our side (@Celegans12's commits with their authorship, and @teepean's slot form with the GPU fill pass, credited to the design). They wait for T3. We'll post the branches here once the gate passes, so you don't review something that still moves.
@teepean, about the Xid 109 on the loading screen at full detail: that is very likely the same solver hang. If it happens on the current
AnyKyty, the linecompute shaders of the unfinished tick …that followsthe GPU stoppednames the shaders; please post it here.teepean commentedon Nov 26, 2026
Thanks. On the Xid 109s: the one I still have a log for was in the world, not on the loading screen. It was 00:42 local, on the scale-0.15 exe, on our
7de61e3451-based tree with local switches. It logged:The kernel logged Xid 109, CTX SWITCH TIMEOUT. The two loading-screen hangs at full detail (21:20 and 21:30) were overwritten by later runs, sorry. I'll post the line from the next one, on a build that records the shaders.
AI-assisted: yes
Celegans12 commentedon Nov 26, 2026
@mrfelek thanks for the offer, and sorry it took me three days to answer.
The gate only matters for dispatches that form a V# on the GPU, which means the V# words were written by the GPU but the CPU walk still knows their address. On Yōtei that's almost all Proxy Set Cull, about 280 dispatches a frame. In a title without that pattern, both modes run today's path, and the A/B would only show that nothing regresses. Before spending a whole session on it, I'd do a short run with
KYTY_E2_GPU_FORMED=1and look at the[kyty-e2f]line. If "gpu-formed dispatches" stays near 0, the title can't tell the two modes apart. ASTRO BOT will probably come out like that, given how few of its ahead reads touch GPU writes. A GPU-driven title is more likely to show something, for example one of the UE5 titles from the game tests (#222).For a title that does form views:
KYTY_E2_GPU_FORMED=1 KYTY_E2_VIEWLOG_VERIFY=1, once withKYTY_E2_FORMED_GATE=0and once without it. Check the matched/missing/extra view counts and the misses, conflicts and demotions on the[kyty-e2f]line, plus anyVUID-lines.KYTY_E2_GPU_FORMED=1 KYTY_AB=40:KYTY_E2_FORMED_GATE KYTY_AB_SETTLE=8for about 600 s. On our laptop the strict gate cost a GPU drain of about 4.7 ms once a frame, which is the number worth checking on other GPUs.One timing note: simnJS is rebasing slice 2 onto the T3 stack with gate-off as the only mode. So the run that helps most is probably the strict-against-gate-off check on
23a914f22cdnow, and later the integrated branch once it's posted, to see that it still verifies on the 3080 Ti and the 780M.AI-assisted: yes
Celegans12 commentedon Nov 26, 2026
@simnJS thanks, and no worries about the silence. We were away for a few days ourselves while our usage limits reset. Nothing newer on our side, so
23a914f22cdis the one to take. When the T3 stack with slice 2 is up, I'll review it and run it on Yōtei on the 3080 Laptop: a verify leg withKYTY_E2_VIEWLOG_VERIFY=1and an in-run A/B. It'd also give you a second NVIDIA card for the cloth-solver stop.One heads-up for when our numbers come in: we rebuilt our setup after a disk cleanup and are now on Yōtei 01.512.000 instead of 1.008. Expect a fresh baseline from us, not a straight comparison with the earlier numbers.
AI-assisted: yes
mrfelek commentedon Nov 26, 2026
@Celegans12 @simnJS I ran the check from Celegans12's comment first, on
23a914f22cd(feat/e2-slice2), RTX 3080 Ti 12 GB, NVIDIA 615.71.09, Linux, headless.KYTY_E2_GPU_FORMED=1, one run per scene. Both titles are UE5.So neither scene can tell the strict gate from gate-off, and I didn't run the verify and
KYTY_ABlegs there.The scene that could show something, Star Wars' Jakku race, doesn't run on this branch on the 3080 Ti. All four tries stop as the race loads, 10-30 s after the start, while
AnyKyty7de61e3451(no mirror) runs the same race through:KYTY_E2_VSHARP_MIRROR=1 KYTY_E2_GPU_FORMED=1:[kyty-mirror] could not allocate 32 MiB for the mirror: ErrorOutOfDeviceMemory(guestMirror.cpp:508);KYTY_E2_GPU_FORMED=1only, and once more with full E2:the GPU has not reached tick ... in 10 s, thenNot implemented (result != vk::Result::eSuccess)at masterSemaphore.cpp:111. No Xid in the kernel log.Just before it stops, the mirror has 1.9-2.1 GiB of 64 KiB blocks bound (56-68 chunks of 32 MiB), on top of what the game itself uses on a 12 GB card. So I think the mirror's bound memory runs the card out of device memory in the race. Is there a cap on how much the mirror may bind, or a way to run slice 2 without the mirror for the gate check? Otherwise I'll wait for the integrated branch.
(The
VA Space alloc failedlines in the kernel log at start are the mirror probe's own room checks, so I left them out.)AI-assisted.
Celegans12 commentedon Nov 26, 2026
@mrfelek thanks, that settles it for those two scenes: with 0 formed dispatches, neither one can tell the two modes apart, so skipping the verify and A/B legs was the right call.
Slice 2 can't run without the mirror, I'm afraid. A formed view reads the V# words and the buffer through
mirror_base+ address, so the mirror is what the slice is built on. As far as I knowfeat/e7-5at T1 has no setting that caps the blocks it binds. That 1.9-2.1 GiB of bound 64 KiB blocks on top of the game is the T1 mirror's own residency, not something slice 2 adds. T2/T3 change how blocks are bound and evicted, so the Jakku race OOM on a 12 GB card is probably worth checking on the integrated branch rather than on this one. @simnJS, this might be a useful data point for the T3 gate: a UE5 race on a 12 GB card that runs onAnyKytybut runs out of device memory with the T1 mirror. I'd wait for the integrated branch and run the race there.AI-assisted: yes