perf: add wgpu timestamp phase queries - #815
Draft
aram-devdocs wants to merge 4 commits into
Draft
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
aram-devdocs
force-pushed
the
codex/issue-741-gpu-timestamp-queries
branch
from
July 8, 2026 19:57
e9a22d3 to
f04206f
Compare
aram-devdocs
force-pushed
the
codex/issue-741-gpu-timestamp-queries
branch
from
July 8, 2026 21:52
f04206f to
7c7c4ca
Compare
aram-devdocs
force-pushed
the
codex/issue-741-gpu-timestamp-queries
branch
from
July 8, 2026 23:58
7c7c4ca to
1512c9e
Compare
8 tasks
aram-devdocs
force-pushed
the
codex/issue-741-gpu-timestamp-queries
branch
from
July 9, 2026 17:45
1512c9e to
280e361
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Type: perf
Summary:
Add wgpu timestamp-query instrumentation for the shadow pass, main render pass, and GPU submission tail so Phase 0 can attribute GPU-side frame costs separately from CPU record-time counters.
Related Issues: Closes #741
Changes Made
Engine Core (
goud_engine/src/)wgpu_backend/timestamps.rsto own the QuerySet, resolve buffer, double-buffered readback slots, and GPU phase readback.timestamp_writeswhere supported, with encoder-write fallback for adapters that only support encoder timestamps.gpu_shadow,gpu_render, andgpu_submitintoframe_timing.FFI Layer (
goud_engine/src/ffi/)No changes.
SDKs (
sdks/)No changes.
Codegen Pipeline (
codegen/)No changes.
Documentation
No changes.
Architectural Compliance
unsafeblocksTesting
cargo checkcargo fmt --all -- --checkcargo clippy -- -D warningsGOUD_SKIP_NATIVE_SMOKE=1 cargo testcargo test --test spec eng2_p0_01_query_set_populates_and_resolves_on_wgpu_backend -- --nocapturecargo test -p goud-engine-core --lib libs::graphics::backend::wgpu_backend::timestamps -- --nocapture./codegen.shLocal note: plain
cargo testreachestests/native_main_thread.rsand can fail on this macOS desktop when the native window cannot present a frame. The test has a documentedGOUD_SKIP_NATIVE_SMOKE=1opt-out, which was used for the full-suite run above.Code Quality
todo!()orunimplemented!()in production code#[allow(unused)]without a justification commentResult, notunwrap()/expect()in library codeBreaking Changes
None.
Version Bump
Bump type: none
Justification: Internal instrumentation only.
Security
unsafeblocksPerformance
Adds GPU-backed counters for
gpu_shadow,gpu_render, andgpu_submit.gpu_submitmeasures the GPU-side submission tail that wgpu can timestamp, not the CPUqueue.submit()call.Evidence blocker: on this host (
macOS 26.5.1, Apple M3 Pro,wgpu 29.0.1, Metal), timestamp QuerySets resolve all zeros. This matches upstream wgpu issue gfx-rs/wgpu#9414 for the macOS 26 / Metal 4 counter-sample regression. The spec now quarantines only that exact zero-counter platform case; non-broken backends must produce non-zero raw slots and non-zero phase durations.Real-GPU S1 capture with non-zero
gpu_shadow,gpu_render, andgpu_submitremains pending before this draft can be marked ready.Reviewer Notes
This PR remains draft. It wires and hardens the instrumentation path, but the ENG2 issue should not close until the S1 evidence gate is attached from a backend where timestamp QuerySets resolve correctly.