Skip to content

fix: plot data loader 2#1004

Merged
FrankD412 merged 4 commits into
mainfrom
fix-plot-data-loader-2
May 27, 2026
Merged

fix: plot data loader 2#1004
FrankD412 merged 4 commits into
mainfrom
fix-plot-data-loader-2

Conversation

@debermudez

@debermudez debermudez commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Per-variation aggregates now include resolved model names stamped into metadata
    • Data loader supports YAML v2 profiling phases and legacy loadgen formats for concurrency/request counts
  • Improvements

    • Plot exporters emit warnings listing specific missing data sources or metric columns and skip those plots
    • Aggregate-only runs can inherit model metadata when input config lacks it
  • Tests

    • Added tests for model resolution, YAML v2 vs legacy load handling, and exporter skip/warning behavior

Review Change Stack

@copy-pr-bot

copy-pr-bot Bot commented May 27, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

github-actions Bot commented May 27, 2026

Copy link
Copy Markdown

Try out this PR

Quick install:

pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@1dce25b38fce0117a1c2c5c3923a366e5cb03fe1

Recommended 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@1dce25b38fce0117a1c2c5c3923a366e5cb03fe1

Last updated for commit: 1dce25bBrowse code

@debermudez debermudez changed the title Fix plot data loader 2 May 27, 2026
@github-actions github-actions Bot added the fix label May 27, 2026
@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@debermudez, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 14 minutes and 46 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c703c447-97d7-41fe-b873-b80ce5d8fbda

📥 Commits

Reviewing files that changed from the base of the PR and between 0794980 and 1dce25b.

📒 Files selected for processing (1)
  • tests/unit/test_cli_runner_sweep_helpers.py

Walkthrough

This PR adds model name metadata stamping to per-variation aggregates, unifies multi-format configuration reading in the data loader with aggregate-only fallbacks, and replaces vague availability checks in PNG exporters with detailed diagnostic reporting of missing data columns and sources.

Changes

Config Metadata Resolution and Diagnostic Reporting

Layer / File(s) Summary
Sweep variation model resolution
src/aiperf/cli_runner/_sweep_aggregate.py, tests/unit/test_cli_runner_sweep_helpers.py
New _resolve_model_name_for_variation helper maps variation keys to model names from plan configs. Per-variation aggregation export stamps resolved model names into aggregate_result.metadata["model"], with fallback when configs are missing. Tests validate single-config/multi-config matching and unmatched-label fallback.
Data loader config format abstraction
src/aiperf/plot/core/data_loader.py, tests/unit/plot/test_data_loader.py
New _extract_load_field helper reads concurrency and request_count from either YAML v2 input_config.phases (preferring profiling phase) or legacy input_config.loadgen with correct precedence. Metadata extraction uses the helper to resolve load characteristics. Tests cover v2 phase selection, v2 vs legacy precedence, legacy fallback, and null handling.
Data loader aggregate metadata fallback
src/aiperf/plot/core/data_loader.py, tests/unit/plot/test_data_loader.py
Extended metadata extraction with fallback: when model name cannot be resolved from input_config, pull it from aggregated["metadata"]["model"] for aggregate-only runs. Tests verify aggregate-only resolution and precedence of input_config model selection over aggregate metadata.
Single-run PNG exporter diagnostic reporting
src/aiperf/plot/exporters/png/single_run.py, tests/unit/plot/test_png_exporter.py
New _missing_data_sources helper returns deduplicated, sorted list of missing or empty RunData sources for a PlotSpec. Export replaces boolean availability check with concrete missing-source detection; logs detailed WARNING with missing source names and plot name, then skips generation. Tests verify helper output and warning emission.
Multi-run PNG exporter diagnostic reporting
src/aiperf/plot/exporters/png/multi_run.py, tests/unit/plot/test_png_exporter.py
New _missing_required_columns helper returns list of required metric columns absent from DataFrame, treating concurrency as always-available. Export replaces boolean availability check with concrete column-missing detection; logs detailed WARNING with missing column names and plot name, then skips generation. Tests verify helper output and warning emission.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Metadata flows through plan and run alike,
With models stamped and formats unified—no strife!
Where data sleeps or columns hide away,
We warn with detail: here's what's gone astray.
A rabbit's work to make diagnostics bright! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix: plot data loader 2' does not clearly communicate the main changes in this pull request. Revise the title to reflect the primary changes: consider 'fix: improve plot data loader with model name resolution and better missing data handling' or similar to better describe the substantial changes across multiple exporters and the data loader.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 90.91% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/aiperf/cli_runner/_sweep_aggregate.py`:
- Around line 456-458: The block resolving and setting the model should be
extracted from _export_one_variation_aggregate into a small helper to reduce
that function's length: create a function (e.g.,
_apply_resolved_model_to_aggregate or _set_resolved_model_for_variation) that
accepts (plan, key, aggregate_result), calls
_resolve_model_name_for_variation(plan, key), and if a value is returned sets
aggregate_result.metadata["model"] = resolved_model; then replace the three-line
block in _export_one_variation_aggregate with a single call to this new helper.

In `@tests/unit/test_cli_runner_sweep_helpers.py`:
- Around line 501-547: Rename the three test functions so their names follow the
test_<function>_<scenario>_<expected> convention and include the target function
name _resolve_model_name_for_variation; e.g., change
test_single_config_no_variations_returns_first_model to
test__resolve_model_name_for_variation_single_config_no_variations_returns_first_model,
change test_matches_variation_index_for_multi_config_plan to
test__resolve_model_name_for_variation_multi_config_matches_variation_index_returns_expected,
and change test_falls_back_to_first_config_when_label_unmatched to
test__resolve_model_name_for_variation_unmatched_label_falls_back_to_first_config
so they clearly reference _resolve_model_name_for_variation and the
scenario/expected outcome.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9f060782-3764-4744-a720-9723216501bc

📥 Commits

Reviewing files that changed from the base of the PR and between ce24a54 and afb4fff.

📒 Files selected for processing (7)
  • src/aiperf/cli_runner/_sweep_aggregate.py
  • src/aiperf/plot/core/data_loader.py
  • src/aiperf/plot/exporters/png/multi_run.py
  • src/aiperf/plot/exporters/png/single_run.py
  • tests/unit/plot/test_data_loader.py
  • tests/unit/plot/test_png_exporter.py
  • tests/unit/test_cli_runner_sweep_helpers.py
Comment thread src/aiperf/cli_runner/_sweep_aggregate.py Outdated
Comment thread tests/unit/test_cli_runner_sweep_helpers.py Outdated
The aggregate JSON written per sweep cell
(`profile_export_aiperf_aggregate.json`) carries no `input_config`
block, so the plot loader resolved `model = None` on those runs and the
legend rendered "Unknown" — even after the YAML-v2/legacy fallback
fix in #998, which only addresses the per-trial path.

Write side (`_sweep_aggregate._export_one_variation_aggregate`):
resolve the model from `plan.configs[variation.index].models.items[0]`,
matching by label against the variation key. Stamp the result onto
`aggregate_result.metadata["model"]` (alongside `variation_label`,
`variation_values`, `sweep_mode`) so the aggregate file becomes
self-describing. Fall back to `configs[0]` when the label is unmatched.

Read side (`DataLoader._extract_metadata`): after the input_config
lookup, if `model` is still None, pick it up from
`aggregated["metadata"]["model"]`. Per-trial artifacts still win when
both shapes are present.

Signed-off-by: Elias Bermudez <dbermudez@nvidia.com>
YAML v2 artifacts leave ``input_config.loadgen`` as ``null`` and attach
per-phase load characteristics (``concurrency``, ``requests``) to the
``input_config.phases[]`` entries instead. The plot loader still only
checked ``loadgen.concurrency`` / ``loadgen.request_count``, so v2
artifacts came back with ``RunMetadata.concurrency = None``. In
``MultiRunPNGExporter._runs_to_dataframe`` the ``or 1`` fallback
collapsed every row to ``concurrency = 1``, fusing every cell into a
single uncertainty point instead of one per swept value.

Same class of shape-mismatch as the model name fix in #998: add a small
helper that prefers the v2 ``phases[].{concurrency, requests}`` (read
from the ``profiling`` phase when present, else the first phase) and
falls back to the legacy ``loadgen.{concurrency, request_count}``.

Defensive: ``loadgen`` may be the literal ``null`` (None) in v2 JSON,
which would have crashed the prior ``"x" in config["loadgen"]`` form
if a future change stops eliding null fields at serialization time.

Signed-off-by: Elias Bermudez <dbermudez@nvidia.com>
Previously, when ``_can_generate_plot`` returned False because a
required metric column (multi-run) or data source (single-run) was
missing, the skip was logged at ``debug`` level with no mention of
what was missing. Users running with the default log level saw only
``Saved 0 plots`` and had no signal to diagnose. The TTFT-on-non-
streaming-run case in particular has been silently dropping all plots.

Refactor ``_can_generate_plot`` into ``_missing_required_columns``
(multi-run) and ``_missing_data_sources`` (single-run) so each
exporter can name the missing items in the skip message. The skip log
is now ``warning`` with the spec name, the offending columns/sources,
and a hint pointing at the most common cause.

Signed-off-by: Elias Bermudez <dbermudez@nvidia.com>
@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.46154% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/aiperf/cli_runner/_sweep_aggregate.py 66.66% 2 Missing and 3 partials ⚠️
src/aiperf/plot/core/data_loader.py 95.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@debermudez debermudez force-pushed the fix-plot-data-loader-2 branch from afb4fff to 0794980 Compare May 27, 2026 18:46
…vention

Per CLAUDE.md's ``test_<function>_<scenario>_<expected>`` rule, rename
the three ``TestResolveModelNameForVariation`` methods so each name
carries the target function (with leading double underscore to
preserve the helper's own leading underscore) plus the scenario and
expected outcome. No behavior change.

Signed-off-by: Elias Bermudez <dbermudez@nvidia.com>
@FrankD412 FrankD412 merged commit d797629 into main May 27, 2026
19 checks passed
@FrankD412 FrankD412 deleted the fix-plot-data-loader-2 branch May 27, 2026 19:17
saturley-hall pushed a commit that referenced this pull request May 27, 2026
…1005)

Signed-off-by: Elias Bermudez <dbermudez@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants