Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e6a7353
[None][feat] perf-optimize: optimize one half of a disaggregated depl…
hyukn Sep 3, 2026
96321c4
[None][feat] perf-optimize: drive the SOL tracks through ibc-bench
hyukn Sep 7, 2026
89f4b56
[None][fix] perf-optimize: read a CTX sweep's workload where it state…
hyukn Sep 7, 2026
ac179c1
[None][feat] perf-optimize: fix the disagg operating point before opt…
hyukn Sep 8, 2026
5225e5c
[None][fix] perf-optimize: rank ctx configurations, not repeats of one
hyukn Sep 8, 2026
9c43700
[None][feat] perf-optimize: reach the staged disagg path from the CLI
hyukn Sep 8, 2026
1e8ada0
[None][fix] perf-optimize: establish each disagg half on its own arte…
hyukn Sep 8, 2026
bb38054
[None][fix] perf-optimize: invoke the design skill instead of wrappin…
hyukn Sep 8, 2026
b84ac3b
[None][feat] perf-optimize: close the two breaks in the staged disagg…
hyukn Sep 8, 2026
cfd90d1
[None][fix] perf-optimize: delete what sweep_design never called
hyukn Sep 8, 2026
dfe840c
[None][feat] perf-optimize: cut the campaign's sweep from the design'…
hyukn Sep 9, 2026
010c727
[None][fix] perf-optimize: let a failed design agent say what stopped it
hyukn Sep 9, 2026
e0cea5e
[None][fix] perf-optimize: answer the design skill's gates in the ins…
hyukn Sep 10, 2026
07d5ef9
[None][fix] perf-optimize: read back where the design actually landed
hyukn Sep 10, 2026
71093dc
[None][fix] perf-optimize: resolve the design before paying for anoth…
hyukn Sep 10, 2026
98701c2
[None][fix] perf-optimize: a redirected design carries its sweep with it
hyukn Sep 10, 2026
0ab8f58
[None][fix] perf-optimize: give each disagg half its own point and sweep
hyukn Sep 10, 2026
58c07ef
[None][fix] perf-optimize: hand the campaign the sweep that was resolved
hyukn Sep 10, 2026
47213ac
[None][fix] perf-optimize: a campaign cut from a design needs its own…
hyukn Sep 10, 2026
bbeea54
[None][fix] perf-optimize: pass the checkout to the derivation, not j…
hyukn Sep 10, 2026
96dcab6
[None][fix] perf-optimize: seven ways the staged campaign described i…
hyukn Sep 23, 2026
faa1a89
[None][fix] perf-optimize: a half inherits where to run, not what to run
hyukn Sep 29, 2026
b563928
[None][test] perf-optimize: an ordinary campaign is handed no directive
hyukn Sep 29, 2026
126227e
[None][doc] perf-optimize: document the disagg_sol block where a user…
hyukn Sep 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
422 changes: 422 additions & 0 deletions agent-flow/agent_flow/workflows/perf_optimize/bench_cli.py

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions agent-flow/agent_flow/workflows/perf_optimize/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
import sys
from pathlib import Path

import yaml

from agent_flow.workflows.perf_analyze.sol_methodology import resolve_sol_methodology

from .disagg import has_disagg
from .prompts import build_perf_optimize_prompts
from .sol_track import track_name
from .state import STATE_FILENAME
from .task_schema import (
TaskSchemaError,
Expand Down Expand Up @@ -104,11 +107,97 @@ def _parse_args(argv: list[str] | None = None) -> argparse.Namespace:
"`optimize.item_execution` mode). "
"Ignored on resume — the checkpointed budget wins.",
)
_add_dry_run(parser)
return parser.parse_args(argv)


def _run_disagg_sol(args) -> None:
"""The staged two-track path: fix the operating point, then optimize at it.

Dispatched on the shape of `task.yaml` rather than on a flag, so one file
describes the whole campaign and there is one place to look for what it
will do. The single-track path below is untouched: a spec without a
`disagg_sol` block reaches it exactly as before.
"""
import json

import yaml

from . import spawn
from .disagg_sol import DisaggSolError, supervise

raw = yaml.safe_load(Path(args.task).read_text(encoding="utf-8")) or {}
block = raw.get("disagg_sol") or {}
root = Path(args.workspace)
try:
record = supervise(
raw,
sweeps={k: Path(v) for k, v in (block.get("sweeps") or {}).items()},
repos={k: Path(v) for k, v in (block.get("repos") or {}).items()},
workspace_root=root,
label=block.get("label") or root.name,
incumbent=block.get("incumbent"),
dry_run=bool(getattr(args, "dry_run", False)),
# Only when the spec says where the skill lives. Without it the
# design stays an input and an unestablished one is refused --
# which is the safer default for a step that costs an order of
# magnitude more than the campaigns it enables.
designer=(
(
lambda instruction: spawn.design(
instruction,
cwd=Path(block["config_repo"]),
log=root / "design.log",
)
)
if block.get("config_repo")
else None
),
)
except DisaggSolError as exc:
print(f"error: {exc}", file=sys.stderr)
sys.exit(2)
print(json.dumps(record, indent=2, default=str))


def _add_dry_run(parser: argparse.ArgumentParser) -> None:
parser.add_argument(
"--dry-run",
action="store_true",
help=(
"staged disagg only: select the operating point and write every "
"campaign's task.yaml, then stop without starting them"
),
)


def main(argv: list[str] | None = None) -> None:
args = _parse_args(argv)
# Before schema validation: a staged spec is a different shape, and the
# single-track schema would reject it for the fields it deliberately lacks.
try:
_raw = yaml.safe_load(Path(args.task).read_text(encoding="utf-8")) or {}
except (OSError, yaml.YAMLError) as exc:
print(f"error: could not read {args.task}: {exc}", file=sys.stderr)
sys.exit(2)
if isinstance(_raw, dict) and "disagg_sol" in _raw:
_run_disagg_sol(args)
return
# Refused rather than ignored. The flag is on the shared parser because
# argparse cannot know which path the spec takes until the file is read,
# and only the staged path implements it -- so on a single-track spec it
# used to be accepted and then silently dropped, which turns "show me
# what this would do" into a full multi-hour campaign on real hardware.
# The one failure mode a dry run must not have.
if getattr(args, "dry_run", False):
print(
"error: --dry-run is implemented for the staged disagg path only "
f"(a spec with a 'disagg_sol' block); {args.task} is a single-track "
"campaign, and running it without the flag would start it for real. "
"Re-run without --dry-run when you mean to.",
file=sys.stderr,
)
sys.exit(2)
try:
task_data = load_and_validate_task_yaml(
args.task,
Expand Down Expand Up @@ -139,6 +228,7 @@ def main(argv: list[str] | None = None) -> None:
kernel_coverage=kernel_coverage(task_data),
sol_methodology=methodology.name,
include_disagg=has_disagg(task_data),
sol_track=track_name(task_data),
)
with PerfOptimizeWorkflow(
workspace=args.workspace,
Expand Down
Loading
Loading