Skip to content

Commit c0a0ca3

Browse files
committed
[None][fix] trtllm_modeling_v2: queue revise and rebase turns' jobs at the tuner priority
The tune campaign measures one candidate at a time at priority PERF (-1), and a tuner's own jobs are meant to queue below it at TUNER (-2). Negative priorities never age, so a job at the scheduler's default priority 0 always ranks ahead of the campaign's measurement and holds back every candidate behind it. The new-candidate and split requests and the speed-of-light profiling step tell the tuner to pass --priority; the revise and rebase requests and the turn prompt's operating rules show spoolctl launch without it, so those turns' tests and A/B jobs queue at 0. In a long campaign most late turns are rebases. On an earlier revision of the harness, where no tuner job carried a priority class, the serial measurement was seen waiting for hours behind tuner jobs at the default priority. On main, the revise and rebase turns are the remaining gap. The revise and rebase requests and the turn prompt shared by every tuner turn now give the --priority TUNER flag. Signed-off-by: Ruocheng Jia <ruochengj@nvidia.com>
1 parent c388c69 commit c0a0ca3

2 files changed

Lines changed: 43 additions & 9 deletions

File tree

‎agent-flow/agent_flow/workflows/trtllm_modeling_v2/tune/requests.py‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ def render_revise_request(
244244
fix the declaration or the harness.
245245
246246
Run the target tests on the dev spools ({", ".join(f"`{s}`" for s in ctx.dev_spools)}; launch + poll,
247-
`--tree {worktree}`, env script `{ctx.env_script}`), commit with `git -C {worktree} commit -s`, and
248-
update `{out_dir / "decision.yaml"}` in place: `commits:` = `git -C {worktree} rev-list --reverse
249-
{best_branch}..HEAD`, `decision: CANDIDATE`, or `DROPPED` when the failure is the idea's, not the
250-
code's. {FINDINGS_ASK} The stage measures the revision once more, the same way; there is no second
251-
revise.
247+
`--priority {TUNER} --tree {worktree}`, env script `{ctx.env_script}`), commit with
248+
`git -C {worktree} commit -s`, and update `{out_dir / "decision.yaml"}` in place: `commits:` =
249+
`git -C {worktree} rev-list --reverse {best_branch}..HEAD`, `decision: CANDIDATE`, or `DROPPED`
250+
when the failure is the idea's, not the code's. {FINDINGS_ASK} The stage measures the revision once
251+
more, the same way; there is no second revise.
252252
{_attempts_section(ctx)}"""
253253
path = out_dir / "revise-request.md"
254254
path.write_text(text)
@@ -266,8 +266,10 @@ def turn_prompt(request: Path) -> str:
266266
267267
## Operating rules
268268
269-
- Run GPU work as jobs on the dev spools (`spoolctl.py launch ... --tree <worktree>`) and poll them;
270-
the host your turn runs on may have no GPU.
269+
- Run GPU work as jobs on the dev spools (`spoolctl.py launch --priority {TUNER} ... --tree
270+
<worktree>`) and poll them; the host your turn runs on may have no GPU. Every job takes
271+
`--priority {TUNER}`: the campaign measures one candidate at a time, and a job at the default
272+
priority queues ahead of that measurement and holds back every candidate behind it.
271273
- Never emit more than ~150 lines in a single Write/Edit call; build big files with several calls.
272274
- Always give grep/rg/find an explicit search root (your worktree's target dir, a shared module path, the
273275
package); never search from the repository root or the current directory: it is slow and floods the
@@ -301,8 +303,8 @@ def render_rebase_request(
301303
to which it applies, including prefill/decode when separate). Read your own `decision.yaml` in `{out_dir}`
302304
for what the candidate does.
303305
2. Run the target tests covering both sides and the applicable shared contract tests in this checkout on the
304-
dev spools ({", ".join(f"`{s}`" for s in ctx.dev_spools)}; launch + poll, `--tree {worktree}`, env script
305-
`{ctx.env_script}`).
306+
dev spools ({", ".join(f"`{s}`" for s in ctx.dev_spools)}; launch + poll,
307+
`--priority {TUNER} --tree {worktree}`, env script `{ctx.env_script}`).
306308
3. Commit with `git -C {worktree} commit -s` if you changed code beyond the conflict markers. Do not push.
307309
4. Update `{out_dir / "decision.yaml"}` in place: `commits:` = `git -C {worktree} rev-list --reverse
308310
{best_branch}..HEAD`, `rebased_onto: <sha>`, a `notes` line on the conflict and its resolution;

‎agent-flow/tests/workflows/trtllm_modeling_v2/test_tune_stage.py‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,3 +878,35 @@ def test_a_split_candidate_gets_one_member_gated_variant_that_is_kept(tmp_path):
878878
assert "the requests this rank runs in the step >= 128" in request
879879
assert str(spec.workdir / "worktrees" / "fast-path-gated") in request
880880
assert f"--priority {TUNER}" in request
881+
882+
883+
def test_every_tuner_turn_queues_its_jobs_below_the_campaigns_measurement(tmp_path):
884+
"""A revise or a rebase turn's jobs queue at TUNER too, as a new candidate's do.
885+
886+
A tuner's job at the scheduler's default priority ranks ahead of the campaign's measurement,
887+
which runs one candidate at a time, and holds back every candidate waiting behind it.
888+
"""
889+
from agent_flow.workflows.trtllm_modeling_v2.tune.requests import (
890+
CampaignContext,
891+
render_rebase_request,
892+
render_revise_request,
893+
turn_prompt,
894+
)
895+
896+
ctx = CampaignContext(
897+
repo=tmp_path,
898+
package=tmp_path,
899+
campaign_dir=tmp_path / "campaign",
900+
perf_root=tmp_path / "perf",
901+
target_dir="t/",
902+
target_tests="t/",
903+
model="m",
904+
dev_spools=[tmp_path / "s1"],
905+
env_script=tmp_path / "env.sh",
906+
workload="isl 8192, osl 1024",
907+
standings_table="",
908+
)
909+
for render in (render_revise_request, render_rebase_request):
910+
request = render(ctx, slug="x", worktree=tmp_path / "wt", best_branch="best", reason="r")
911+
assert f"--priority {TUNER} --tree {tmp_path / 'wt'}" in request.read_text()
912+
assert f"--priority {TUNER}" in turn_prompt(request)

0 commit comments

Comments
 (0)