Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions ci/automation.just
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ci-rocm-preflight:
inference-contracts:
@PYTHONPATH=scripts "{{ automation_python }}" scripts/tests/inference_build.py
@PYTHONPATH=scripts "{{ automation_python }}" scripts/tests/inference_contracts.py
@PYTHONPATH=scripts "{{ automation_python }}" scripts/tests/inference_probe.py
@PYTHONPATH=scripts "{{ automation_python }}" scripts/tests/jy_read_recovery.py
@PYTHONPATH=scripts "{{ automation_python }}" scripts/tests/inference_markdown.py
@PYTHONPATH=scripts "{{ automation_python }}" scripts/tests/inference_nightly.py
Expand Down
2 changes: 2 additions & 0 deletions scripts/inference-execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from lib.inference_inputs import admit, fixture, input_hashes, record
from lib.inference_ladder import plan
from lib.inference_admission import split_admissions_digest
from lib.inference_probe import measure


def authority():
Expand Down Expand Up @@ -160,6 +161,7 @@ def execute(profile, key, mode):
score(coordinate, output, profile)
if profile == "pr":
streaming(coordinate, output)
measure(coordinate, output)
scope = "GPU startup, deterministic endpoint repeats and bounded streaming smoke"
else:
performance(profile, coordinate, context, output, inputs)
Expand Down
15 changes: 9 additions & 6 deletions scripts/inference-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,22 @@ while IFS= read -r row; do
if [[ $state == Passed && -f $rates ]]; then
# Invalid current evidence remains a reporting failure, not an unavailable baseline.
validate_rates "$rates" "$receipt" "$SOURCE_SHA" "$row" || fail 'Comment throughput evidence identity mismatch'
prefill=$(rate "$rates" prefill)
decode=$(rate "$rates" decode)
if baseline=$(baseline_for_row "$row" 2> /dev/null); then
prefill_delta=$(delta "$rates" "$baseline/$row-throughput.json" prefill "$receipt" "$baseline/$row-job.json")
decode_delta=$(delta "$rates" "$baseline/$row-throughput.json" decode "$receipt" "$baseline/$row-job.json")
# Producer and protected reporter can straddle a deployment. Never relabel legacy samples.
if jq -e '.workload == "DGX Spark warm probe v2"' "$rates" > /dev/null; then
prefill=$(rate "$rates" prefill)
decode=$(rate "$rates" decode)
if baseline=$(baseline_for_row "$row" 2> /dev/null); then
prefill_delta=$(delta "$rates" "$baseline/$row-throughput.json" prefill "$receipt" "$baseline/$row-job.json")
decode_delta=$(delta "$rates" "$baseline/$row-throughput.json" decode "$receipt" "$baseline/$row-job.json")
fi
fi
fi
printf "| \`%s\` | %s | %s | %s | %s | %s | %s | %s |\n" "$row" "$state" "$prefill" "$prefill_delta" "$decode" "$decode_delta" "$action" "$lab" >> "$temporary/body.md"
done < "$temporary/rows.txt"

cat >> "$temporary/body.md" <<'EOF'

TPS describes the first response of each of three short scored smoke cases at concurrency 1; deterministic repeats are excluded. Each rate is total tokens / total server-reported phase time, not an average of request rates. Prefill excludes cached prompt tokens. These short samples include startup/warmup effects and are not sustained benchmarks or controlled speedup comparisons. Missing or invalid timings show as Unavailable.
TPS comes from three separate warmed, uncached probes at concurrency 1, each generating exactly 128 tokens. The scored correctness answers and each probe's 64-token warmup are excluded. Each rate is total tokens / total server-reported phase time, not an average of request rates. Client elapsed times and raw responses are retained in throughput-probe.json. These bounded samples are not sustained benchmarks or controlled speedup comparisons. Legacy short-answer receipts and missing or invalid probe evidence show as Unavailable.

Deltas use unrounded rates from matching PR-profile smoke receipts on the latest successful main run, including the nightly smoke evidence. Positive means faster. Changed workload inputs, different serving host classes, unequal phase token counts or missing evidence show Unavailable. Physical Spark placement and runtime conditions can differ; deltas are descriptive, not controlled speedup claims.

Expand Down
8 changes: 6 additions & 2 deletions scripts/lib/inference-report-baseline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
validate_rates() {
jq -e --arg sha "$3" --arg row "$4" --slurpfile job "$2" '
def uint: type == "number" and . >= 0 and . == floor and . < 18446744073709551616;
(keys == (["source_sha", "configuration", "job_id", "run_id", "requests",
((keys - ["workload"]) == (["source_sha", "configuration", "job_id", "run_id", "requests",
"prefill_tokens", "prefill_ms", "decode_tokens", "decode_ms"] | sort)) and
(if has("workload") then
.workload == "DGX Spark warm probe v2" and .decode_tokens == 384
else true end) and
.source_sha == $sha and .configuration == $row and .requests == 3 and
(.prefill_tokens | uint) and (.decode_tokens | uint) and
(.prefill_ms | type == "number") and (.decode_ms | type == "number") and
Expand Down Expand Up @@ -41,7 +44,7 @@ prepare_baseline() {
# Engine sources are intentionally excluded: their performance is being measured.
local inputs
inputs='["scripts/inference-execute.py", "scripts/lib/inference_checks.py",
"scripts/lib/inference_throughput.py", "scripts/lib/inference_inputs.py",
"scripts/lib/inference_throughput.py", "scripts/lib/inference_probe.py", "scripts/lib/inference_inputs.py",
"scripts/lib/inference_ladder.py", "scripts/lib/ci_artifacts.py",
"scripts/lib/ci_process.py", "scripts/lib/ci_smoke.py",
"ci/inference-quality.json", "ci/inference-artifacts.json", ".gi/templates.yaml"]'
Expand Down Expand Up @@ -88,6 +91,7 @@ baseline_for_row() {
else .rows[0].mode == "standalone" and .rows[0].machines == 1 end)
' "$candidate/plan.json" > /dev/null || return 1
validate_rates "$candidate/$id-throughput.json" "$candidate/$id-job.json" "$baseline_sha" "$id" || return 1
jq -e '.workload == "DGX Spark warm probe v2"' "$candidate/$id-throughput.json" > /dev/null || return 1
found=$candidate
done
[[ -n $found ]] || return 1
Expand Down
1 change: 1 addition & 0 deletions scripts/lib/inference_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ def workload_label(workload):
return {
"DGX Spark AgentX nightly v1": "Nightly AgentX (v1)",
"DGX Spark smoke v1": "Smoke test (v1)",
"DGX Spark warm probe v2": "Warm throughput probe (v2)",
"DGX Spark smoke v1 (experimental split)": "Smoke test (v1, experimental split)",
}.get(workload, workload)
3 changes: 2 additions & 1 deletion scripts/lib/inference_ladder.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def plan(profile, sha):
models = ladder["models"]
if ladder["schema_version"] != 1 or not isinstance(models, list) or not models:
raise ValueError("unsupported or empty inference ladder")
checks = (["gpu-startup", "scored-quality", "streaming-smoke"] if profile == "pr"
checks = (["gpu-startup", "scored-quality", "streaming-smoke",
"bounded-throughput-probes"] if profile == "pr"
else ["correctness", "scored-quality", "agentx-performance"])
rows, ids, names = [], set(), set()
for model in models:
Expand Down
5 changes: 3 additions & 2 deletions scripts/lib/inference_nightly_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
from .inference_inputs import fixture, input_hashes
from .inference_admission import split_admissions_digest
from .inference_throughput import collect, successful_run
from .inference_probe import WORKLOAD

WORKLOADS = {"pr": "DGX Spark smoke v1", "nightly": "DGX Spark AgentX nightly v1"}
WORKLOADS = {"pr": WORKLOAD, "nightly": "DGX Spark AgentX nightly v1"}
SMOKE_METRICS = ("prefill_tok_s", "decode_tok_s")
AGENTX_METRICS = ("output_tok_s", "ttft_p95_ms", "itl_p95_ms", "requests", "request_error_pct")
METRIC_NAMES = {"pr": SMOKE_METRICS, "nightly": AGENTX_METRICS}
Expand Down Expand Up @@ -71,7 +72,7 @@ def agentx_metrics(trials):
def contract(profile, row, key):
files = HARNESS
if profile == "pr":
files += ("scripts/lib/inference_throughput.py",)
files += ("scripts/lib/inference_throughput.py", "scripts/lib/inference_probe.py")
else:
files += ("ci/inference-corpus.json", "ci/aiperf-requirements.lock")
inputs = {
Expand Down
99 changes: 99 additions & 0 deletions scripts/lib/inference_probe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
"""Bounded, warmed, uncached throughput samples separate from quality checks."""

import json
import math
import time

from .ci_artifacts import write_json
from .ci_smoke import curl
from .inference_checks import ENDPOINT

WORKLOAD = "DGX Spark warm probe v2"
PARAGRAPHS = (8, 32, 64)
WARMUP_TOKENS = 64
MEASURED_TOKENS = 128
RECORD = ("Requests traverse a gateway and inference workers; keep their routing, queue, "
"and cache state consistent.")


def payload(model, index, warmup):
# Different early tokens prevent prefix reuse; equal shapes warm the same kernels.
prefix = "A" if warmup else "B"
prompt = f"{prefix}{index}\n" + "\n".join(
f"Record {item}: {RECORD}" for item in range(PARAGRAPHS[index])
) + "\nWrite a detailed engineering analysis of this service, with concrete examples."
return {"model": model, "messages": [{"role": "user", "content": prompt}],
"temperature": 0, "seed": 42, "ignore_eos": True,
"max_tokens": WARMUP_TOKENS if warmup else MEASURED_TOKENS,
"chat_template_kwargs": {"enable_thinking": False}}


def validate_response(sample, expected):
if sample["payload"] != expected:
raise ValueError("throughput probe request differs from its workload")
response = sample["response"]
usage, timing = response["usage"], response["timings"]
count = expected["max_tokens"]
text = response["choices"][0]["message"]["content"]
if (not isinstance(text, str) or not text.strip() or response.get("error") is not None
or type(usage["completion_tokens"]) is not int or usage["completion_tokens"] != count
or type(timing["predicted_n"]) is not int or timing["predicted_n"] != count
or type(usage["prompt_tokens_details"]["cached_tokens"]) is not int
or usage["prompt_tokens_details"]["cached_tokens"] != 0
or type(usage["prompt_tokens"]) is not int or usage["prompt_tokens"] <= 0
or type(timing["prompt_n"]) is not int or timing["prompt_n"] != usage["prompt_tokens"]):
raise ValueError("throughput probe requires full output and uncached prompt tokens")
for value in (sample["client_ms"], timing["prompt_ms"], timing["predicted_ms"]):
if type(value) not in (int, float) or not math.isfinite(value) or value <= 0:
raise ValueError("throughput probe requires positive finite timings")
return timing["prompt_n"]


def validate_evidence(evidence, model):
if (type(evidence["schema_version"]) is not int or evidence["schema_version"] != 1
or evidence["workload"] != WORKLOAD
or evidence["status"] != "passed" or len(evidence["samples"]) != len(PARAGRAPHS)):
raise ValueError("incomplete warm throughput probe evidence")
responses = []
for index, sample in enumerate(evidence["samples"]):
warm = validate_response(sample["warmup"], payload(model, index, True))
measured = validate_response(sample["measured"], payload(model, index, False))
if warm != measured:
raise ValueError("throughput warmup and measurement have different prompt shapes")
responses.append(sample["measured"]["response"])
return responses


def send(request, sample):
sample["payload"] = request
body = json.dumps(request)
started = time.perf_counter_ns()
try:
sample["raw_body"] = curl(["-H", "Content-Type: application/json", "--data-binary", body,
ENDPOINT + "/v1/chat/completions"], 180)
sample["response"] = json.loads(sample["raw_body"])
finally:
sample["client_ms"] = (time.perf_counter_ns() - started) / 1_000_000


def measure(model, output):
evidence = {"schema_version": 1, "workload": WORKLOAD, "status": "incomplete", "samples": []}
try:
for index in range(len(PARAGRAPHS)):
sample = {}
evidence["samples"].append(sample)
sample["warmup"] = {}
send(payload(model, index, True), sample["warmup"])
validate_response(sample["warmup"], payload(model, index, True))
sample["measured"] = {}
send(payload(model, index, False), sample["measured"])
validate_response(sample["measured"], payload(model, index, False))
evidence["status"] = "passed"
validate_evidence(evidence, model)
except Exception as error:
# Retain partial/invalid responses for diagnosis, then preserve the failure.
evidence["status"] = "failed"
evidence["error"] = str(error)
raise
finally:
write_json(output / "throughput-probe.json", evidence)
15 changes: 11 additions & 4 deletions scripts/lib/inference_throughput.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Summarize complete scored smoke receipts for the inference report."""
"""Summarize warmed fixed-length probes after successful scored qualification."""

import math
import re
Expand All @@ -7,6 +7,8 @@

from .ci_artifacts import read_json, write_json
from .jy_qualification import PilotHTTPError
from .inference_inputs import fixture
from .inference_probe import WORKLOAD, validate_evidence

ARTIFACT_RETRIES = 6
ARTIFACT_RETRY_DELAY = 5
Expand Down Expand Up @@ -45,11 +47,15 @@ def collect(pilot, job, row, sha, output, key):
cases = read_json(Path("ci/inference-quality.json"))
if not isinstance(samples, list) or len(samples) != len(cases):
raise ValueError("incomplete scored throughput evidence")
prefill, decode = [], []
for sample, case in zip(samples, cases):
if sample.get("passed") is not True or sample.get("case") != case:
raise ValueError("unscored or mismatched throughput sample")
response = sample["response"]
inputs = fixture(key)
model = f'{inputs["repo"]}@{inputs["revision"]}'
evidence = fetch_artifact(pilot, run_id, "throughput-probe.json")
responses = validate_evidence(evidence, model)
prefill, decode = [], []
for response in responses:
timing = response.get("timings") or {}
cached = ((response.get("usage") or {}).get("prompt_tokens_details") or {}).get("cached_tokens")
prompt = timing.get("prompt_n")
Expand All @@ -60,7 +66,8 @@ def collect(pilot, job, row, sha, output, key):
d_tokens, d_ms = totals(decode)
receipt = {
"source_sha": sha, "configuration": row["id"], "job_id": job["id"], "run_id": run_id,
"requests": len(samples), "prefill_tokens": p_tokens, "prefill_ms": p_ms,
"workload": WORKLOAD,
"requests": len(responses), "prefill_tokens": p_tokens, "prefill_ms": p_ms,
"decode_tokens": d_tokens, "decode_ms": d_ms,
}
write_json(output / f'{row["id"]}-throughput.json', receipt)
Expand Down
21 changes: 15 additions & 6 deletions scripts/tests/inference-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ row=$(jq -r '.[0]' "$fixture/rows.json")
receipt="$fixture/evidence/$row-job.json"
rates="$fixture/evidence/$row-throughput.json"
jq -n --arg sha "$SOURCE_SHA" '{repo_rev:$sha,id:"job_test",status:"succeeded",runs:[{id:"run_test",status:"succeeded"}]}' > "$receipt"
jq -n --arg sha "$SOURCE_SHA" --arg row "$row" '{source_sha:$sha,configuration:$row,job_id:"job_test",run_id:"run_test",requests:3,prefill_tokens:300,prefill_ms:600,decode_tokens:30,decode_ms:300}' > "$rates"
jq -n --arg sha "$SOURCE_SHA" --arg row "$row" '{source_sha:$sha,configuration:$row,job_id:"job_test",run_id:"run_test",workload:"DGX Spark warm probe v2",requests:3,prefill_tokens:300,prefill_ms:600,decode_tokens:384,decode_ms:3840}' > "$rates"
cp "$rates" "$fixture/good-rates.json"
cp "$receipt" "$fixture/good-receipt.json"

Expand All @@ -70,6 +70,15 @@ jq -e '.body | contains("Lab Qualification: Passed") and contains("| 500.0 | Una
grep -q 'POST$' "$fixture/mutation"
cmp "$GITHUB_STEP_SUMMARY" <(jq -rj .body "$fixture/posted.json")

# Old protected producers remain readable, but their short answers are never warm TPS.
jq 'del(.workload) | .decode_tokens=11 | .decode_ms=400' "$fixture/good-rates.json" > "$rates"
report
jq -e '.body | contains("Lab Qualification: Passed") and contains("| Unavailable | Unavailable | Unavailable | Unavailable |")' "$fixture/posted.json" > /dev/null
cp "$fixture/good-rates.json" "$rates"
jq '.decode_tokens=11' "$fixture/good-rates.json" > "$rates"
reject 'short answers mislabeled as warm probes'
cp "$fixture/good-rates.json" "$rates"

# Paginated comments: ignore forged markers and preserve newer generations.
jq -n '[[],[
{id:7,user:{login:"github-actions[bot]",type:"Bot"},body:"<!-- skippy-inference-results:v1 -->\n<!-- run:42:1 -->\nold"},
Expand Down Expand Up @@ -137,7 +146,7 @@ jq -n --arg sha "$BASELINE_SHA" '[{workflow_runs:[
]}]' > "$fixture/main-runs.json"
cp "$fixture/jobs.json" "$fixture/main-jobs.json"
jq -n '{truncated:false,tree:(["scripts/inference-execute.py", "scripts/lib/inference_checks.py",
"scripts/lib/inference_throughput.py", "scripts/lib/inference_inputs.py",
"scripts/lib/inference_throughput.py", "scripts/lib/inference_probe.py", "scripts/lib/inference_inputs.py",
"scripts/lib/inference_ladder.py", "scripts/lib/ci_artifacts.py", "scripts/lib/ci_process.py",
"scripts/lib/ci_smoke.py", "ci/inference-quality.json", "ci/inference-artifacts.json",
".gi/templates.yaml"] | map({path:.,type:"blob",sha:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}))}' > "$fixture/current-tree.json"
Expand All @@ -148,7 +157,7 @@ jq -n --arg sha "$BASELINE_SHA" --arg row "$row" '{schema_version:1,source_sha:$
jq '.machine.host={arch:"aarch64",chip:"Cortex-X925",cpu_cores:20,gpu:"NVIDIA GB10",gpu_count:1}' "$receipt" > "$fixture/hardware-job.json"
cp "$fixture/hardware-job.json" "$receipt"
jq --arg sha "$BASELINE_SHA" '.repo_rev=$sha' "$receipt" > "$baseline/$row-job.json"
jq --arg sha "$BASELINE_SHA" '.source_sha=$sha | .prefill_ms=1200 | .decode_ms=150' "$rates" > "$baseline/$row-throughput.json"
jq --arg sha "$BASELINE_SHA" '.source_sha=$sha | .prefill_ms=1200 | .decode_ms=1920' "$rates" > "$baseline/$row-throughput.json"
report
jq -e '.body | contains("| 500.0 | +100.0% (main 250.0) | 100.0 | -50.0% (main 200.0) |") and contains("/runs/40/attempts/3") and contains("commit `2222222222222222222222222222222222222222`")' "$fixture/posted.json" > /dev/null
cp "$baseline/$row-throughput.json" "$fixture/main-rates.json"
Expand All @@ -173,7 +182,7 @@ for changed in '.profile="nightly"' '.source_sha="wrong"' '.rows[0].mode="split"
unavailable
done
cp "$fixture/main-plan.json" "$baseline/plan.json"
for changed in '.source_sha="wrong"' '.run_id="run_wrong"' '.prefill_ms=0 | .decode_ms=0' '.prefill_tokens=301 | .decode_tokens=31'; do
for changed in '.source_sha="wrong"' '.run_id="run_wrong"' '.prefill_ms=0 | .decode_ms=0' '.prefill_tokens=301 | .decode_tokens=31' 'del(.workload)'; do
jq "$changed" "$fixture/main-rates.json" > "$baseline/$row-throughput.json"
unavailable
done
Expand All @@ -191,8 +200,8 @@ jq '.prefill_tokens=301' "$fixture/main-rates.json" > "$baseline/$row-throughput
report
jq -e '.body | contains("| 500.0 | Unavailable | 100.0 | -50.0% (main 200.0) |")' "$fixture/posted.json" > /dev/null
# Use unrounded values: both decode rates display 100.0 but the delta is +0.1%.
jq '.decode_ms=(30000 / 100.04)' "$fixture/good-rates.json" > "$rates"
jq '.prefill_ms=600 | .decode_ms=(30000 / 99.98)' "$fixture/main-rates.json" > "$baseline/$row-throughput.json"
jq '.decode_ms=(384000 / 100.04)' "$fixture/good-rates.json" > "$rates"
jq '.prefill_ms=600 | .decode_ms=(384000 / 99.98)' "$fixture/main-rates.json" > "$baseline/$row-throughput.json"
report
jq -e '.body | contains("+0.0% (main 500.0)") and contains("100.0 | +0.1% (main 100.0)")' "$fixture/posted.json" > /dev/null
cp "$fixture/good-rates.json" "$rates"
Expand Down
Loading
Loading