Repository navigation
fix(metrics): sync the timeslice index and warmup baseline fixes with upstream aiperf - #59
Draft
weireweire wants to merge 3 commits into
Draft
weireweire wants to merge 3 commits into
weireweire wants to merge 3 commits into
Conversation
…ice snapshot Root cause: export_results runs in a worker thread while ingestion can continue. _build_slice_ragged_index indexed record_bin, sized at the snapshot, with every current record index, so a ragged value appended for a later record raised IndexError and aborted the export. Fix: map record indices beyond the snapshot to no slice, as get_values_for_mask does, keeping value positions unchanged. Drop the redundant _compute_timeslice_bins docstring. Validation: new test appends ragged values for a record past the snapshot while the index is built; the timeslices match the export without them. Signed-off-by: weireweire <20922698+weireweire@users.noreply.github.com>
…ream Root cause: ai-dynamo#49 fixed the agentic warmup-start scrape in two places: it set phase_kind="warmup" on the synthesized agentic warmup, and it added a PhaseBaselineRequestMessage.phase fallback for boundaries without a kind. Upstream aiperf (ai-dynamo#1325) fixes it with phase_kind="warmup" alone. The fallback cannot trigger: validated PhaseConfigs always carry a kind, and the agentic warmup now sets one. Fix: keep phase_kind="warmup" and its test assertion; drop the phase fallback, the message field, the publisher wiring, their tests, and the added comments, so this code matches upstream. Validation: tests/unit/server_metrics and tests/unit/timing. Signed-off-by: weireweire <20922698+weireweire@users.noreply.github.com>
Try out this PRQuick install: pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@a75c9f3c83e8795a4d1bbbf0cf2ee05c4abbf182Recommended with virtual environment (using uv): uv venv --python 3.12 && source .venv/bin/activate
uv pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@a75c9f3c83e8795a4d1bbbf0cf2ee05c4abbf182Last updated for commit: |
…d of shared state Root cause: the slice index and the active slice were stored on the accumulator while the export's slice loop ran. export_results runs in a worker thread, and the realtime summarize runs on the event loop with no lock, so a summary that overlapped the slice loop gathered ragged values from the export's current slice instead of its own mask. Fix: build the index as a local in _compute_timeslices and pass each slice's value positions to _compute_results as an argument; the accumulator holds no per-computation state. Also trim the index: int32 slice ids and value positions, and slice bounds from bincount + cumsum instead of a sorted copy and two searchsorted passes. Validation: new test runs a phase-scoped summary in the middle of the slice loop; both the export and the summary match their standalone results. Existing index tests still match the per-slice mask path. Signed-off-by: weireweire <20922698+weireweire@users.noreply.github.com>
This branch has not been deployed
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.
Summary
Keep the AgentX copies of #58 and #49 identical to their upstream form in ai-dynamo/aiperf, so later upstream syncs apply cleanly. This PR tracks ai-dynamo#1592 and will be updated whenever that PR changes.
Changes
1. Timeslice ragged index: skip records ingested after the export snapshot (follow-up to #58)
Same commit as the review fix on ai-dynamo#1592.
export_resultsruns in a worker thread while ingestion can continue._build_slice_ragged_indexindexedrecord_bin(sized at the snapshot) with every current record index, so a ragged value appended for a later record raisedIndexErrorand aborted the export.get_values_for_maskalready does. Value positions are unchanged, so exported timeslices are unchanged._compute_timeslice_binsdocstring.2. Timeslice ragged index: no shared per-computation state (follow-up to #58)
Same commit as the second review fix on ai-dynamo#1592.
export_resultsruns in a worker thread and the realtimesummarizeruns on the event loop with no lock, so a summary that overlapped the slice loop gatheredinter_chunk_latencyfrom the export's current slice instead of its own mask._compute_timeslices, and each slice's value positions are passed to_compute_resultsas an argument. The_compute_timeslice_binssplit from perf(metrics): gather timeslice ragged values from a per-slice index #58 is undone; the slice loop is back to its original form plus that argument.bincount+cumsum. At 20 M values: 422 MB peak and 80 MB retained, down from 504 MB and 160 MB._summarize_for_export_context(..., include_timeslices=False)as AgentX's realtimesummarizedoes (perf: skip unused live metric computations #53); upstream has noinclude_timeslicesargument.3. Warmup baseline tagging: align #49 with upstream
Upstream fixes the same bug with
phase_kind="warmup"on the synthesized agentic warmup alone (ai-dynamo#1325). #49 also added aPhaseBaselineRequestMessage.phasefallback for boundaries without a kind. That fallback cannot trigger here: validatedPhaseConfigs always carry a kind, and the agentic warmup now sets one.phase_kind="warmup"and its test assertion.phasemessage field, the publisher wiring, the manager fallback, their tests, and the added comments. The scrape tagging is now identical to upstream:phase_kind == "warmup"-> warmup, otherwise profiling.Tests
test_summary_overlapping_timeslice_export_keeps_its_own_values: a phase-scoped summary run in the middle of the export's slice loop matches its standalone result, and so does the export. On the commit before this fix the summary'sinter_chunk_latencyhas 54 values (one warmup slice) instead of 6,849.test_ragged_values_ingested_after_snapshot_are_excluded: appends ragged values for a record past the snapshot while the index is built; timeslices match the export without them. It raisesIndexErrorwithout the fix.tests/unit/{post_processors,metrics,exporters,server_metrics,timing,records}: 3817 passed, 10 failed. The same 10 tests fail onmaster(test_completed_excludes_analyzer_metrics,test_auto_offset_affects_execution_durationx6,test_global_idle_cap_rechecks_after_barrier_defers_near_timer,test_offset_child_uses_shared_scheduler_for_idle_cap,test_produces_intermediate_values).ruff checkpasses on the changed files.