Prioritize uncovered prefill scheduler candidates
This commit is contained in:
@@ -3407,6 +3407,110 @@ class CoreFlowTests(unittest.TestCase):
|
||||
|
||||
self.assertGreater(targets[1], targets[0])
|
||||
|
||||
def test_prefill_scheduler_coverage_precedes_gmu_microtune(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
tmp_path = Path(tmp)
|
||||
study_path = _write_study_assets(
|
||||
tmp_path,
|
||||
engine_overrides={
|
||||
"base_flags": {
|
||||
"host": "127.0.0.1",
|
||||
"port": 8000,
|
||||
"tensor-parallel-size": 2,
|
||||
"data-parallel-size": 1,
|
||||
"gpu-memory-utilization": 0.7,
|
||||
"max-num-seqs": 8,
|
||||
},
|
||||
"tunable_flags": [
|
||||
"tensor-parallel-size",
|
||||
"data-parallel-size",
|
||||
"gpu-memory-utilization",
|
||||
"max-num-batched-tokens",
|
||||
"max-num-seqs",
|
||||
"enable-chunked-prefill",
|
||||
],
|
||||
"topology_constraints": {
|
||||
"allowed_tensor_parallel_sizes": [2, 4],
|
||||
"allowed_data_parallel_sizes": [1],
|
||||
"allowed_tp_dp_products": [2, 4],
|
||||
},
|
||||
},
|
||||
trace_overrides={"max_concurrency": 64},
|
||||
)
|
||||
|
||||
def write_result(name: str, request_rate: float) -> Path:
|
||||
path = tmp_path / f"{name}.json"
|
||||
path.write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"status": "completed",
|
||||
"best_sampling_u": 0.5,
|
||||
"best_request_rate": request_rate,
|
||||
"best_pass_rate": 0.95,
|
||||
"probes": [
|
||||
{
|
||||
"threshold": 0.5,
|
||||
"feasible": True,
|
||||
"payload": {
|
||||
"request_rate": request_rate,
|
||||
"pass_rate": 0.95,
|
||||
"latency_summary": {
|
||||
"failed_reason_counts": {"ttft_ms>4000.0": 24}
|
||||
},
|
||||
},
|
||||
}
|
||||
],
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
return path
|
||||
|
||||
study = load_study_spec(study_path)
|
||||
state = StudyState(
|
||||
study_id=study.study_id,
|
||||
best_trial_id="trial-0001",
|
||||
best_parallel_size=2,
|
||||
best_request_rate=4.05,
|
||||
best_request_rate_per_gpu=2.025,
|
||||
trials=[
|
||||
TrialSummary(
|
||||
trial_id="trial-0001",
|
||||
status="completed",
|
||||
parallel_size=2,
|
||||
best_request_rate=4.05,
|
||||
best_request_rate_per_gpu=2.025,
|
||||
result_path=str(write_result("trial-0001", 4.05)),
|
||||
config_patch={"env_patch": {}, "flag_patch": {}},
|
||||
),
|
||||
TrialSummary(
|
||||
trial_id="trial-0002",
|
||||
status="completed",
|
||||
parallel_size=4,
|
||||
best_request_rate=8.0,
|
||||
best_request_rate_per_gpu=2.0,
|
||||
result_path=str(write_result("trial-0002", 8.0)),
|
||||
config_patch={
|
||||
"env_patch": {},
|
||||
"flag_patch": {"tensor-parallel-size": 4},
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
context = build_harness_context(
|
||||
study=study,
|
||||
window_summary={"prompt_tokens_p95": 7774, "prompt_tail_ratio_p95_p50": 3.0},
|
||||
state=state,
|
||||
)
|
||||
action = context["experiment_plan"]["next_action"]
|
||||
self.assertEqual(action["knob_family"], "prefill-scheduler-interaction")
|
||||
self.assertEqual(action["action_id"], "seed_chunked_prefill_quantum")
|
||||
self.assertGreater(
|
||||
action["score_factors"]["uncovered_scheduler_dimension_bonus"],
|
||||
0.0,
|
||||
)
|
||||
|
||||
def test_prefill_scheduler_not_active_for_short_prompt_workload(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
tmp_path = Path(tmp)
|
||||
|
||||
Reference in New Issue
Block a user