better throughput scheduling with steady state cost model, now limited to spatial
This commit is contained in:
@@ -13,16 +13,7 @@ REPO = Path(__file__).resolve().parents[2]
|
||||
|
||||
def check_selected_program(out):
|
||||
report = json.loads((out / "reports/pipeline_selection.json").read_text())
|
||||
program = json.loads((out / "pim/config.json").read_text())
|
||||
digest = hashlib.sha256()
|
||||
for core in range(program["core_cnt"]):
|
||||
digest.update((out / f"pim/core_{core}.pim").read_bytes())
|
||||
for count in program["array_group_map"][f"core{core}"]:
|
||||
digest.update(f"{count},".encode())
|
||||
digest.update(b";")
|
||||
assert digest.hexdigest().upper() == report["candidates"][report["selection"]]["identity"], \
|
||||
"emitted program differs from the analyzed winner"
|
||||
assert report["reused_lowered_candidate"]
|
||||
assert report["strategy"] == "spatial-queue-aware" and report["lowered_candidates"] == 1
|
||||
for name in ("spatial3_scheduled_no_comm.txt", "memory_report.txt"):
|
||||
assert (out / "reports" / name).stat().st_size > 0, name
|
||||
return report
|
||||
@@ -71,12 +62,13 @@ def main():
|
||||
assert result.returncode == 0, result.stdout + result.stderr
|
||||
report = json.loads((out / "reports/pipeline_selection.json").read_text())
|
||||
assert report["static_analysis"] and report["temporary_disk_bytes"] == 0
|
||||
assert report["analyzed_candidates"] > 1, report
|
||||
assert report["generated_candidates"] > 1, report
|
||||
assert all("identity" not in c and "request_order" not in c["spatial_cost"]
|
||||
for c in report["candidates"])
|
||||
check_selected_program(out)
|
||||
assert not report["reconstructed_spatial_artifacts"]
|
||||
assert not (out / "dialects").exists()
|
||||
assert not list(out.glob("candidate*"))
|
||||
decisions.append((report["selection"], [(c["identity"], c.get("interval_ns"), c.get("alternative_tie_interval_ns"))
|
||||
decisions.append((report["selection"], [(c.get("interval_ns"), c.get("alternative_tie_interval_ns"))
|
||||
for c in report["candidates"]]))
|
||||
# Keep the test's disk peak to one selected program.
|
||||
shutil.rmtree(out)
|
||||
@@ -95,8 +87,9 @@ def main():
|
||||
result = subprocess.run(command, cwd=root, env=env, capture_output=True, text=True, timeout=90)
|
||||
assert result.returncode == 0, result.stdout + result.stderr
|
||||
report = check_selected_program(out)
|
||||
assert report["selection"] != 0 and report["reconstructed_spatial_artifacts"] == diagnostics
|
||||
identity = report["candidates"][report["selection"]]["identity"]
|
||||
assert report["selection"] != 0 and bool((out / "dialects").exists()) == diagnostics
|
||||
identity = {str(p.relative_to(out / "pim")): hashlib.sha256(p.read_bytes()).hexdigest()
|
||||
for p in (out / "pim").rglob("*") if p.is_file()}
|
||||
schedule = (out / "reports/spatial3_scheduled_no_comm.txt").read_bytes()
|
||||
if diagnostics:
|
||||
assert identity == previous_identity and schedule == previous_schedule
|
||||
@@ -123,9 +116,9 @@ def main():
|
||||
result = subprocess.run(command, cwd=root, env=env, capture_output=True, text=True, timeout=60)
|
||||
assert result.returncode == 0, result.stdout + result.stderr
|
||||
report = json.loads((out / "reports/pipeline_selection.json").read_text())
|
||||
assert report["selection"] == 0 and report["analyzed_candidates"] == 0
|
||||
assert report["generated_candidates"] == 1 and report["lowered_candidates"] == 0
|
||||
assert "ROB capacity one" in report["reason"] and report["unavailable_estimates"] > 0
|
||||
assert report["selection"] == 0 and report["single_candidate_analysis_skipped"]
|
||||
assert report["generated_candidates"] == 1 and report["lowered_candidates"] == 1
|
||||
assert "no cost comparison required" in report["reason"]
|
||||
assert report["temporary_disk_bytes"] == 0 and not list(root.glob("candidate*"))
|
||||
shutil.rmtree(out)
|
||||
out.mkdir()
|
||||
@@ -134,9 +127,9 @@ def main():
|
||||
result = subprocess.run(command, cwd=root, env=env, capture_output=True, text=True, timeout=60)
|
||||
assert result.returncode == 0, result.stdout + result.stderr
|
||||
report = json.loads((out / "reports/pipeline_selection.json").read_text())
|
||||
assert report["selection"] == 0 and report["analyzed_candidates"] == 0
|
||||
assert report["generated_candidates"] == 1 and report["lowered_candidates"] == 0
|
||||
assert "synchronization ablation" in report["reason"]
|
||||
assert report["selection"] == 0 and report["single_candidate_analysis_skipped"]
|
||||
assert report["generated_candidates"] == 1 and report["lowered_candidates"] == 1
|
||||
assert "no cost comparison required" in report["reason"]
|
||||
assert not (root / "executed").exists(), "production compiler executed a diagnostic or simulator"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user