Skip to content

Fix benchmark fairness, profiling attribution, and reportability semantics#11

Open
lullu57 wants to merge 9 commits into
yazdinip:mainfrom
lullu57:codex/fix-benchmark-review-findings
Open

Fix benchmark fairness, profiling attribution, and reportability semantics#11
lullu57 wants to merge 9 commits into
yazdinip:mainfrom
lullu57:codex/fix-benchmark-review-findings

Conversation

@lullu57

@lullu57 lullu57 commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes the benchmark and analysis issues identified in the review pass so the repo artifacts better match the paper-facing claims.

What changed

  • Counts benchmark and profiling budgets in actual measurement rows instead of config IDs.
  • Scopes wall-clock limits per strategy and records budget-exhausted rows explicitly.
  • Runs held-out evaluation in an alternating order across strategies to reduce time-order bias.
  • Catches benchmark failures across validation, warmup, and timed phases and classifies launch failures more defensibly.
  • Adds richer profiling failure states and audit metadata, requires defensible kernel attribution for reportable counter sets, and avoids silently choosing the wrong kernel row.
  • Makes standalone profiling prefer a valid candidate when one exists.
  • Tightens summary/reportability logic so budget-limited or artifact-incomplete runs do not look reportable.
  • Makes study comparison fail clearly when no runs or no study rows match, includes observed deltas in hypothesis evidence, and preserves opportunity provenance with weighted regret aggregation.
  • Adds regression tests for profiling compatibility, hypothesis semantics, opportunity aggregation, and reportability gating.

Verification

  • PYTHONPATH=src pytest -q
  • Result: 31 passed on March 23, 2026.

Linked issues

Fixes #2
Fixes #3
Fixes #4
Fixes #5
Fixes #6
Fixes #7
Fixes #8
Fixes #9
Fixes #10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8280b12e93

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

combined = pd.concat(rows, ignore_index=True)
combined["weighted_regret_sum"] = (
pd.to_numeric(combined.get("avg_regret_to_best_measured"), errors="coerce").fillna(0.0)
* pd.to_numeric(combined.get("regret_weight"), errors="coerce").fillna(0.0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Handle missing opportunity columns before aggregation

_aggregate_opportunities now assumes columns like regret_weight, kernel_ids, strategy_ids, etc. already exist, but historical opportunity_catalog.csv files (produced before this commit) do not contain them. In that case this line path fails (combined.get("regret_weight") becomes None and later aggregations reference missing columns), so compare_runs crashes when mixing older artifacts with new code instead of producing a study result.

Useful? React with 👍 / 👎.

Comment on lines +146 to +147
else:
selected = [sorted(calibration_shapes, key=lambda shape: shape.shape_id)[0]]
selected = [_representative_shape(calibration_shapes)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor FIRST_CALIBRATION when selecting profiling shapes

The default/fallback branch now picks a median “representative” shape, so ProfileSamplingMode.FIRST_CALIBRATION no longer selects the first calibration shape. Since this mode is the default policy, profiling inputs silently shift for many experiments, which changes selector/profile behavior and breaks comparability with prior runs that used the documented first-shape semantics.

Useful? React with 👍 / 👎.

Comment thread src/kernel_tuner/profiling/adapter.py Outdated
status = ProfileStatus.INVOCATION_FAILED
notes = completed.stderr.strip() or completed.stdout.strip() or "ncu invocation failed"
elif unsupported:
elif diagnostics.get("matched_row_count", 0) == 0:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Classify ambiguous kernel attribution as no-profile data

When _choose_kernel_row returns kernel_attribution_status like regex_ambiguous, matched_row_count can be non-zero while no attributable row exists. This branch only flags NO_PROFILE_DATA when matched_row_count == 0, so ambiguous attribution is misclassified as UNSUPPORTED_COUNTER later, which incorrectly feeds these rows into counter-availability accounting and distorts reportability decisions.

Useful? React with 👍 / 👎.

@lullu57

lullu57 commented Mar 28, 2026

Copy link
Copy Markdown
Contributor Author

Published the profiling reliability follow-up and the reportability semantics fix to this PR.

What changed:

  • fixed the original ncu executable not found failure by making source scripts/bootstrap_env.sh <venv> the canonical launch path so CUDA tool exports survive into the shell that launches ktune
  • resolved profiler tool lookup through CUDA_HOME/bin before falling back to PATH
  • added profiler failure attribution so artifacts distinguish tool absence, queried-metric gaps, invocation failures, kernel-attribution failures, and missing counter values
  • replaced the fragile default_calibration long-scoreboard counter with smsp__warp_issue_stalled_long_scoreboard_per_warp_active.pct
  • changed reportability semantics so matched-budget runs with budget-limited selector decisions remain reportable evidence when the rest of the reportability contract passes; the budget-limited condition is still surfaced explicitly in the summary notes
  • improved study-comparison diagnostics so an empty study match now reports which filters excluded candidate runs

Validation:

  • local test suite: 53 passed, 1 skipped
  • gpunode2 smoke rerun succeeded with accepted calibration counters: artifacts/gemm_smoke/run_20260328T182208Z_78c5f7dc
  • gpunode2 reportable reruns succeeded with accepted counter sets:
    • artifacts/gemm_reportable/run_20260328T182338Z_6e92e07c
    • artifacts/layernorm_reportable/run_20260328T182601Z_5351e70a
  • the remaining work is no longer profiler reliability; it is refreshing the run summaries under the new reportability rule and then running the minimum seed/repeat ladder for validation_phase

I am updating the cluster checkout next and starting that study-eligible ladder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment