Extract shared realtime timing helpers#387
Conversation
Greptile SummaryThis PR extracts OmniDreams-specific realtime timing types and helpers into a new canonical module at
Confidence Score: 5/5Safe to merge; the refactoring is a clean extract with no logic changes to existing production paths. All production behaviour is preserved: the global e2e profiling accumulators are replaced by an equivalent InputToPresentProfileWindow object, the trace-event dependency chain in emit_video_model_timing_ranges uses explicit is not None guards fixing the zero-valued-ID corruption from prior review threads, and VideoModelTimings gains only optional fields with defaults keeping all existing constructors valid. The compatibility shim correctly re-exports every previously public symbol. No correctness regressions were found. The new canonical module at flashdreams/serving/realtime/timing.py could benefit from an all declaration to match the shim and make the public API explicit, but this does not affect correctness. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph before["Before (all in omnidreams)"]
OT["omnidreams.interactive_drive\n.runtime.timing\n(full implementation)"]
OTypes["omnidreams.interactive_drive\n.types\n(VideoModelTimings here)"]
Loop1["runtime/loop.py\n(manual global accumulators)"]
Pipeline1["chunk_pipeline.py\n(inline trace ranges)"]
App1["app.py / cli.py"]
OT --> Loop1
OT --> Pipeline1
OT --> App1
OTypes --> Pipeline1
end
subgraph after["After (shared canonical module)"]
FT["flashdreams.serving.realtime\n.timing\n(canonical module)"]
Shim["omnidreams.interactive_drive\n.runtime.timing\n(re-export shim)"]
Loop2["runtime/loop.py\n(InputToPresentProfileWindow)"]
Pipeline2["chunk_pipeline.py\n(emit_video_model_timing_ranges)"]
App2["app.py / cli.py"]
FT --> Shim
FT --> Loop2
FT --> Pipeline2
FT --> App2
Shim -. "backwards-compat" .-> Loop2
end
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
subgraph before["Before (all in omnidreams)"]
OT["omnidreams.interactive_drive\n.runtime.timing\n(full implementation)"]
OTypes["omnidreams.interactive_drive\n.types\n(VideoModelTimings here)"]
Loop1["runtime/loop.py\n(manual global accumulators)"]
Pipeline1["chunk_pipeline.py\n(inline trace ranges)"]
App1["app.py / cli.py"]
OT --> Loop1
OT --> Pipeline1
OT --> App1
OTypes --> Pipeline1
end
subgraph after["After (shared canonical module)"]
FT["flashdreams.serving.realtime\n.timing\n(canonical module)"]
Shim["omnidreams.interactive_drive\n.runtime.timing\n(re-export shim)"]
Loop2["runtime/loop.py\n(InputToPresentProfileWindow)"]
Pipeline2["chunk_pipeline.py\n(emit_video_model_timing_ranges)"]
App2["app.py / cli.py"]
FT --> Shim
FT --> Loop2
FT --> Pipeline2
FT --> App2
Shim -. "backwards-compat" .-> Loop2
end
Reviews (4): Last reviewed commit: "Add coverage for ChunkHistory iterator c..." | Re-trigger Greptile |
|
I think we might need to revisit this profiling logic later. Currently only the omnidream-interactive demo uses this logic. Technically other interactive demo can re-use it, but the interface is not very clear. |
Yeah I imagine @ArielG-NV may want to update our timing metrics as part of his benchmark work this week, so this one may go through a bunch of updates. |
Move the OmniDreams realtime timing records, trace context, video-model stage tracing, and input-to-present profile window into flashdreams.serving.realtime.timing. Add shared duration and rolling summary helpers, optional decode/cache stage timings, and migrate the OmniDreams interactive demo and tests to consume the shared module while keeping the old import path as a compatibility shim.
Preserve zero-valued trace event IDs when wiring optional cache and decode stage dependencies, update the ChunkHistory iterator annotation, and remove a dead profile-window count guard. Add regression coverage for trace sinks that return event ID 0 for optional timing stages.
Add a realtime timing test that verifies ChunkHistory.__iter__ returns an Iterator and yields appended chunks in order, making the iterator contract from the review feedback explicit in test coverage.
e3507a8 to
a562201
Compare
|
I am unsure on if I would want to use the current tooling here for timing or to eventually replace it all. Unlikely I use it in its current state though. Eventually, either we will add to what we have or replace it so that any timing metrics we collect give us an annotated nvtx timeline for agentic development and profiling sanity reasons. We can still merge the changes though with/without the existing code - if I won't use it, it will just be code I strip out naturally when I propose the benchmark/regression-test changes. |
Extract shared realtime timing helpers
Move the OmniDreams realtime timing records, trace context, video-model
stage tracing, and input-to-present profile window into
flashdreams.serving.realtime.timing. Add shared duration and rolling
summary helpers, optional decode/cache stage timings, and migrate the
OmniDreams interactive demo and tests to consume the shared module while
keeping the old import path as a compatibility shim.