# Vulkan performance verification — 2026-10-13 Device: OnePlus 13, Adreno 830. Build: Android NDK 28.2.13676358, API 33, repository Android `-O1` build. Headless, audio disabled, existing game resources and `save.work`. Game content, shaders, caches and captures are excluded from Git. ## Observed results / 实测结果 The final binary ran under `timeout 90`. It produced a complete hero selection capture at frame 601, reached the frame 602 profile interval, received SIGTERM, drained GPU work, and exited through the timeout path (`rc=124`). Graceful shutdown took 0.043 seconds. No `STOP`, abort or crash occurred in this run. The final capture shows the camp, characters, fire, Chinese title/description and Create button without visible corruption. | 60-frame interval | Existing baseline log, frame 602 | Final build, frame 602 | |---|---:|---:| | Elapsed | 38,066.393 ms | 9,557.800 ms | | Pipeline creation | 11,268.754 ms | 0.000 ms | | Draws | 68,566 | 81,902 | | Actual Vulkan submissions | 240 (180 logged + 60 Present) | 240 | | Render pass begins | One per draw in the old implementation | 4,380 | | Graphics + compute pipeline hits / misses | Recreated each time | 82,382 / 0 | | Framebuffer cache hits | Uncached | 83,702 | Final steady hero selection intervals (frames 302 through 602) took 9.147–12.410 seconds per 60 frames, median 11.373 seconds, with about 81,800–82,000 draws per interval and zero pipeline creation time. The historical baseline and final run have different loading/animation timing and draw counts; this is a practical scene comparison, not a controlled benchmark with identical command traces. Sustained rendering remains roughly 5–6.5 FPS in this scene and still needs further CPU/upload/descriptor optimization. 最终版 90 秒无崩溃,角色选择第 601 帧正常,第 602 帧区间约 9.56 秒 / 60 帧。稳定区间约 9.15–12.41 秒 / 60 帧,pipeline 创建时间持续为零。旧日志约 38.07 秒 / 60 帧;两次运行的加载 / 动画时间及 draw 数不同,不作为严格同指令流 benchmark。 The disk cache successfully loaded 1,628,103 bytes at startup. An invalid 32-byte all-zero cache was rejected (`pipeline_cache_load bytes=0`) and the real-Vulkan regression still passed. ## Update: Redmi 25098RA98C (Adreno 710) — 2026-10-13 Changes: `BATCH_SLOTS` raised to 8; GPU timestamp queries report `gpu_ms` per interval; shader pack built with `SB_ALIGN=64` so storage buffers bind directly from `addr & -64` instead of being copied to aligned transient buffers; draw-time SSBO write detection now tests vkmeta flag bit 0 only. `DM_VK_PASSPROF=N` gives a per-pass GPU breakdown. | Hero selection, 60-frame interval | Before (`redmi1`, old pack) | After (`redmi8`–`redmi10`, `rt64` pack) | |---|---:|---:| | Elapsed | 18,230–34,909 ms | 7,080–7,164 ms | | Storage-buffer bind time | ~9,800 ms (up to 32,000 ms in later intervals) | ~400 ms | | Transient buffers created | 8,309 | 0 | | Render passes / pass breaks | 5,336 / 4,927 | 4,380 / 2,880 | | GPU time (`gpu_ms`) | not measured | ~5,060 ms (≈85 ms/frame) | | Draws | — | ~81,900 | The scene now runs at about 8.4 FPS on this device (60 frames in ~7.1 s) and is GPU-bound: GPU time alone caps it near 12 FPS. `PASSPROF` shows one 1600×900 forward+ lighting pass (pixel shader `5c1ca4e7c3e4657c`, 385 draws) takes ~44 ms of ~87 ms per frame; `spirv-opt -O` made no difference. The 60 FPS target applies to Adreno 830-class devices, which still need re-measuring with this build. 更新(Redmi,Adreno 710):批次槽位改为 8,新增 GPU 时间戳 `gpu_ms`,着色器包使用 `SB_ALIGN=64` 后存储缓冲区按 64 字节对齐直接绑定,不再拷贝。角色选择每 60 帧从 18–35 秒降到约 7.1 秒,临时缓冲区创建从 8,309 降为 0;当前为 GPU 瓶颈(约 85 ms/帧,其中一个前向+光照 pass 约 44 ms)。60 FPS 目标需在 Adreno 830 上复测。Logs: `dm/android/build/perf/redmi1.log`, `redmi8.log`–`redmi10.log`. Update (WaitEvent, Redmi): `WAIT_PROFILE` showed every CPU wait came from `OP_WAIT_EVENT` (~5.1 s per 60 frames, two per frame); the host committed and CPU-waited for all prior GPU work although NVN's WaitEvent is a GPU-side wait, so CPU and GPU ran serially. Events already satisfied by queued signals now record only a barrier (`event_queued=120 event_blocked=0`). 60 frames: 7.7 s → 5.03–5.05 s (≈11.9 FPS), submits 4 → 2 per frame; elapsed now equals `gpu_ms`, so the scene is purely GPU-bound. The remaining `sync` wait (~2.6 s / 60, `sync_lag_max=5`) is the game's own one-frame-ahead throttle. Frame 841 matches the baseline. `DM_VK_EVENT_SYNC=1` restores the old path. Logs: `redmi18.log` (before), `redmi19.log` (after). 更新(WaitEvent):`WAIT_PROFILE` 显示所有 CPU 等待都来自 `OP_WAIT_EVENT`(每 60 帧约 5.1 秒、每帧 2 次)——宿主把 GPU 侧等待实现成了“提交 + CPU 等待之前全部 GPU 工作”,导致 CPU 与 GPU 串行。现在事件若可由排队的 signal 满足,只录屏障。每 60 帧 7.7 秒 → 约 5.04 秒(≈11.9 FPS),提交从 4 次/帧降到 2 次/帧,耗时等于 `gpu_ms`,完全 GPU 瓶颈。 Combined with `DM_VK_VRS=2x2` (opt-in): 60 frames 4.37 s (≈13.7 FPS), `gpu_ms` ≈4,356, sync wait ~1.85 s / 60; edges stay sharp, textures slightly softer (frame 841 mean abs diff 3.8 vs no VRS). Log: `redmi20.log`. 叠加 `DM_VK_VRS=2x2`(需手动开启):每 60 帧 4.37 秒(≈13.7 FPS),仍为 GPU 瓶颈;边缘清晰,纹理略软。 ## Submission boundary / 提交边界 Deferred commits, reusable fence slots (eight since the update above) and completion publication are implemented. This game path still requires about four actual submissions per frame because explicit QueueFlush / CPU waits and Present end batches; after the WaitEvent change above it is two per frame. No draw creates a new fence or performs its own queue idle. Ordinary consecutive draws retain their render pass; feedback, storage writes and explicit barriers keep required boundaries. Thus the strict “one submit per frame” target has not been reached for this guest command stream. 已实现延迟提交与多槽 fence 轮转(上方更新后为八槽),但游戏的显式 Flush / 等待边界仍导致约 4 次真实提交 / 帧(WaitEvent 改动后为 2 次)。下一步若要继续减少次数,需要根据客体的实际同步消费点优化,不能直接删除这些边界。真实窗口的 WSI 同步优化仍待第四步验证。 ## Validation / 验证 - Android host builds and links with no compiler warnings. - Real Vulkan device regression: `VK_PERF_TEST_PASS` for full key equality after hash collision, immutable CPU input address reuse, GPU-authored input reuse, isolated writeback snapshots across submissions, timeout / fence checks, slot rotations past the ring size, events published while the guest only polls memory, descriptor pool growth past 8,192 sets, and capacity splitting without advancing the logical fence early. - Invalid disk cache fallback passes the same GPU regression. Final game startup confirms a non-empty compatible disk cache load. - Final game capture visually checked at frame 601. Headless shutdown drained in-flight work. - `python3 dm/ios/tools/dm_i18n.py --check`: passes, 301 entries. - `python3 dm/i18n/scan_literals.py`: fails on two existing unrelated strings in `dm/ios/tools/gen_romfs_overlay.py:200` and `dm/ios/tools/drop_light.py:65`; those files were not changed by this work. - Khronos validation could not be enabled on this retail device: the Android loader returned `VK_ERROR_LAYER_NOT_PRESENT`, and `/data/local/debug/vulkan` is not writable by shell. No validation-layer-clean claim is made. Android's loader discovery restrictions are described in [the Android Vulkan implementation documentation](https://source.android.com/docs/core/graphics/implement-vulkan). - Mac / iOS runtime, real-window WSI and AAudio were not exercised. The new QueueFlush declaration/call are guarded by `__ANDROID__`. Reproduction commands and environment variables are in [README.md](README.md) / [README.zh-CN.md](README.zh-CN.md). Local evidence lives in ignored `dm/android/build/perf/`: `baseline.log`, `final.log`, `gpu-tests.log`, `cache-test.log`, and `final-0601.ppm` / `.png`. The device retains the original `dmhost`; the tested binary is `dmhost-perf-final` under `/data/local/tmp/d2r`.