Skip to content
Merged
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
42 changes: 19 additions & 23 deletions packages/db/src/queries/submissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export interface SubmissionVolumeRow {
datapoints: number;
}

/** Get unique config submissions with first/latest date and datapoint counts. */
/** Get unique config submissions with first/latest date and datapoint counts.
* Uses latest_benchmarks (deduplicated: newest per config+conc+isl+osl, no errors). */
export async function getSubmissionSummary(sql: DbClient): Promise<SubmissionSummaryRow[]> {
const rows = await sql`
SELECT
Expand All @@ -36,39 +37,34 @@ export async function getSubmissionSummary(sql: DbClient): Promise<SubmissionSum
c.prefill_ep,
c.decode_tp,
c.decode_ep,
MIN(br.date)::text AS first_date,
MAX(br.date)::text AS latest_date,
COUNT(DISTINCT br.date)::int AS run_days,
MIN(lb.date)::text AS first_date,
MAX(lb.date)::text AS latest_date,
COUNT(DISTINCT lb.date)::int AS run_days,
COUNT(*)::int AS total_datapoints,
COUNT(DISTINCT (br.isl, br.osl))::int AS distinct_sequences,
COUNT(DISTINCT br.conc)::int AS distinct_concurrencies,
MAX(br.conc)::int AS max_concurrency,
(ARRAY_AGG(br.image ORDER BY br.date DESC) FILTER (WHERE br.image IS NOT NULL))[1] AS image
FROM benchmark_results br
JOIN configs c ON c.id = br.config_id
JOIN latest_workflow_runs wr ON wr.id = br.workflow_run_id
WHERE br.error IS NULL
AND wr.conclusion IS NOT NULL
COUNT(DISTINCT (lb.isl, lb.osl))::int AS distinct_sequences,
COUNT(DISTINCT lb.conc)::int AS distinct_concurrencies,
MAX(lb.conc)::int AS max_concurrency,
(ARRAY_AGG(lb.image ORDER BY lb.date DESC) FILTER (WHERE lb.image IS NOT NULL))[1] AS image
FROM latest_benchmarks lb
JOIN configs c ON c.id = lb.config_id
GROUP BY c.model, c.hardware, c.framework, c.precision, c.spec_method, c.disagg, c.is_multinode, c.num_prefill_gpu, c.num_decode_gpu, c.prefill_tp, c.prefill_ep, c.decode_tp, c.decode_ep
ORDER BY MAX(br.date) DESC, COUNT(*) DESC
ORDER BY MAX(lb.date) DESC, COUNT(*) DESC
`;
return rows as unknown as SubmissionSummaryRow[];
}

/** Get daily datapoint counts by hardware for volume charts. */
/** Get daily datapoint counts by hardware for volume charts.
* Uses latest_benchmarks (deduplicated: newest per config+conc+isl+osl, no errors). */
export async function getSubmissionVolume(sql: DbClient): Promise<SubmissionVolumeRow[]> {
const rows = await sql`
SELECT
br.date::text,
lb.date::text,
c.hardware,
COUNT(*)::int AS datapoints
FROM benchmark_results br
JOIN configs c ON c.id = br.config_id
JOIN latest_workflow_runs wr ON wr.id = br.workflow_run_id
WHERE br.error IS NULL
AND wr.conclusion IS NOT NULL
GROUP BY br.date, c.hardware
ORDER BY br.date ASC
FROM latest_benchmarks lb
JOIN configs c ON c.id = lb.config_id
GROUP BY lb.date, c.hardware
ORDER BY lb.date ASC
`;
return rows as unknown as SubmissionVolumeRow[];
}
Loading