${hardwareConfig[d.hwKey] ? getDisplayLabel(hardwareConfig[d.hwKey]) : d.hwKey}
From 4e074c69c517715076e0dabc4eae861610376aa2 Mon Sep 17 00:00:00 2001
From: adibarra <93070681+adibarra@users.noreply.github.com>
Date: Thu, 19 Mar 2026 20:50:31 -0500
Subject: [PATCH 7/9] show series date in GPU tooltip with actual date when
they differ
---
packages/app/src/components/inference/utils/tooltipUtils.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/app/src/components/inference/utils/tooltipUtils.ts b/packages/app/src/components/inference/utils/tooltipUtils.ts
index 620fa48..b50fecd 100644
--- a/packages/app/src/components/inference/utils/tooltipUtils.ts
+++ b/packages/app/src/components/inference/utils/tooltipUtils.ts
@@ -235,7 +235,7 @@ export const generateGPUGraphTooltipContent = (config: TooltipConfig): string =>
${isPinned ? '
Click elsewhere to dismiss
' : ''}
- Date: ${d.date}
+ Date: ${d.date}${d.actualDate && d.actualDate !== d.date ? ` (data from ${d.actualDate})` : ''}
GPU Config: ${hardwareConfig[d.hwKey] ? getDisplayLabel(hardwareConfig[d.hwKey]) : d.hwKey}
From 93fc7e24744bacbea04d16cf505e531c96508626 Mon Sep 17 00:00:00 2001
From: adibarra <93070681+adibarra@users.noreply.github.com>
Date: Thu, 19 Mar 2026 21:03:18 -0500
Subject: [PATCH 8/9] use exact date matching for GPU comparison benchmark
queries
---
packages/app/src/app/api/v1/benchmarks/route.ts | 7 ++++---
.../src/components/inference/hooks/useChartData.ts | 4 +++-
packages/app/src/hooks/api/use-benchmarks.ts | 11 ++++++++---
packages/app/src/lib/api.ts | 3 ++-
packages/db/src/queries/benchmarks.ts | 6 +++++-
5 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/packages/app/src/app/api/v1/benchmarks/route.ts b/packages/app/src/app/api/v1/benchmarks/route.ts
index 50e5569..fb65640 100644
--- a/packages/app/src/app/api/v1/benchmarks/route.ts
+++ b/packages/app/src/app/api/v1/benchmarks/route.ts
@@ -9,9 +9,9 @@ import { cachedJson, cachedQuery } from '@/lib/api-cache';
export const dynamic = 'force-dynamic';
const getCachedBenchmarks = cachedQuery(
- async (dbModelKey: string, date?: string) => {
+ async (dbModelKey: string, date?: string, exact?: boolean) => {
const sql = getDb();
- return getLatestBenchmarks(sql, dbModelKey, date);
+ return getLatestBenchmarks(sql, dbModelKey, date, exact);
},
'benchmarks',
{ blobOnly: true },
@@ -21,13 +21,14 @@ export async function GET(request: NextRequest) {
const params = request.nextUrl.searchParams;
const model = params.get('model') ?? '';
const date = params.get('date') ?? undefined;
+ const exact = params.get('exact') === 'true';
const dbModelKey = DISPLAY_MODEL_TO_DB[model];
if (!dbModelKey) {
return NextResponse.json({ error: 'Unknown model' }, { status: 400 });
}
try {
- const rows = await getCachedBenchmarks(dbModelKey, date);
+ const rows = await getCachedBenchmarks(dbModelKey, date, exact || undefined);
return cachedJson(rows);
} catch (error) {
console.error('Error fetching benchmarks:', error);
diff --git a/packages/app/src/components/inference/hooks/useChartData.ts b/packages/app/src/components/inference/hooks/useChartData.ts
index 3c8854f..16d7717 100644
--- a/packages/app/src/components/inference/hooks/useChartData.ts
+++ b/packages/app/src/components/inference/hooks/useChartData.ts
@@ -100,7 +100,9 @@ export function useChartData(
}, [selectedGPUs, selectedDates, selectedDateRange, selectedRunDate]);
const comparisonQueries = useQueries({
- queries: comparisonDates.map((date) => benchmarkQueryOptions(selectedModel, date, enabled)),
+ queries: comparisonDates.map((date) =>
+ benchmarkQueryOptions(selectedModel, date, enabled, true),
+ ),
});
const comparisonLoading = comparisonQueries.some((q) => q.isLoading);
diff --git a/packages/app/src/hooks/api/use-benchmarks.ts b/packages/app/src/hooks/api/use-benchmarks.ts
index 1556bde..c20eda8 100644
--- a/packages/app/src/hooks/api/use-benchmarks.ts
+++ b/packages/app/src/hooks/api/use-benchmarks.ts
@@ -3,10 +3,15 @@ import { useQuery, keepPreviousData } from '@tanstack/react-query';
import { fetchBenchmarks } from '@/lib/api';
/** Shared query options — reused by useQueries for comparison dates. */
-export function benchmarkQueryOptions(model: string, date: string, enabled: boolean = true) {
+export function benchmarkQueryOptions(
+ model: string,
+ date: string,
+ enabled: boolean = true,
+ exact?: boolean,
+) {
return {
- queryKey: ['benchmarks', model, date] as const,
- queryFn: () => fetchBenchmarks(model, date),
+ queryKey: ['benchmarks', model, date, exact ? 'exact' : 'latest'] as const,
+ queryFn: () => fetchBenchmarks(model, date, exact),
enabled: enabled && Boolean(model),
};
}
diff --git a/packages/app/src/lib/api.ts b/packages/app/src/lib/api.ts
index 107b774..63efd0e 100644
--- a/packages/app/src/lib/api.ts
+++ b/packages/app/src/lib/api.ts
@@ -94,9 +94,10 @@ async function fetchJson(url: string): Promise {
return res.json();
}
-export function fetchBenchmarks(model: string, date?: string) {
+export function fetchBenchmarks(model: string, date?: string, exact?: boolean) {
const params = new URLSearchParams({ model });
if (date) params.set('date', date);
+ if (exact) params.set('exact', 'true');
return fetchJson(`/api/v1/benchmarks?${params}`);
}
diff --git a/packages/db/src/queries/benchmarks.ts b/packages/db/src/queries/benchmarks.ts
index edbeca0..59673c7 100644
--- a/packages/db/src/queries/benchmarks.ts
+++ b/packages/db/src/queries/benchmarks.ts
@@ -38,9 +38,13 @@ export async function getLatestBenchmarks(
sql: NeonClient,
modelKey: string,
date?: string,
+ exact?: boolean,
): Promise {
if (date) {
// Date-filtered: use base table with DISTINCT ON (the view only has the absolute latest)
+ // exact=true: only return data from this exact date (for GPU comparison)
+ // exact=false (default): return latest data as of this date (for main chart)
+ const dateFilter = exact ? sql`br.date = ${date}::date` : sql`br.date <= ${date}::date`;
const rows = await sql`
SELECT DISTINCT ON (br.config_id, br.conc, br.isl, br.osl)
c.hardware,
@@ -71,7 +75,7 @@ export async function getLatestBenchmarks(
JOIN latest_workflow_runs wr ON wr.id = br.workflow_run_id
WHERE c.model = ${modelKey}
AND br.error IS NULL
- AND br.date <= ${date}::date
+ AND ${dateFilter}
ORDER BY br.config_id, br.conc, br.isl, br.osl, br.date DESC
`;
return rows as unknown as BenchmarkRow[];
From f2786c1b75fa93858777e9496fa16f017bd1c813 Mon Sep 17 00:00:00 2001
From: adibarra <93070681+adibarra@users.noreply.github.com>
Date: Thu, 19 Mar 2026 21:22:08 -0500
Subject: [PATCH 9/9] fix tests for exact date benchmark query param
---
.../src/app/api/v1/benchmarks/route.test.ts | 19 +++++++++++++++++--
.../app/src/hooks/api/use-benchmarks.test.ts | 7 ++++++-
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/packages/app/src/app/api/v1/benchmarks/route.test.ts b/packages/app/src/app/api/v1/benchmarks/route.test.ts
index 6970358..4b7e574 100644
--- a/packages/app/src/app/api/v1/benchmarks/route.test.ts
+++ b/packages/app/src/app/api/v1/benchmarks/route.test.ts
@@ -52,7 +52,7 @@ describe('GET /api/v1/benchmarks', () => {
expect(res.status).toBe(200);
const body = await res.json();
expect(body).toEqual(mockRows);
- expect(mockGetLatestBenchmarks).toHaveBeenCalledWith('mock-sql', 'dsr1', undefined);
+ expect(mockGetLatestBenchmarks).toHaveBeenCalledWith('mock-sql', 'dsr1', undefined, undefined);
});
it('passes date param to query when provided', async () => {
@@ -60,7 +60,22 @@ describe('GET /api/v1/benchmarks', () => {
const res = await GET(req('/api/v1/benchmarks?model=DeepSeek-R1-0528&date=2026-03-01'));
expect(res.status).toBe(200);
- expect(mockGetLatestBenchmarks).toHaveBeenCalledWith('mock-sql', 'dsr1', '2026-03-01');
+ expect(mockGetLatestBenchmarks).toHaveBeenCalledWith(
+ 'mock-sql',
+ 'dsr1',
+ '2026-03-01',
+ undefined,
+ );
+ });
+
+ it('passes exact=true when query param set', async () => {
+ mockGetLatestBenchmarks.mockResolvedValueOnce([]);
+
+ const res = await GET(
+ req('/api/v1/benchmarks?model=DeepSeek-R1-0528&date=2026-03-01&exact=true'),
+ );
+ expect(res.status).toBe(200);
+ expect(mockGetLatestBenchmarks).toHaveBeenCalledWith('mock-sql', 'dsr1', '2026-03-01', true);
});
it('returns 500 when query throws', async () => {
diff --git a/packages/app/src/hooks/api/use-benchmarks.test.ts b/packages/app/src/hooks/api/use-benchmarks.test.ts
index 250113e..7329896 100644
--- a/packages/app/src/hooks/api/use-benchmarks.test.ts
+++ b/packages/app/src/hooks/api/use-benchmarks.test.ts
@@ -5,7 +5,12 @@ import { benchmarkQueryOptions } from '@/hooks/api/use-benchmarks';
describe('benchmarkQueryOptions', () => {
it('builds query key from model and date', () => {
const opts = benchmarkQueryOptions('DeepSeek-R1-0528', '2026-03-01');
- expect(opts.queryKey).toEqual(['benchmarks', 'DeepSeek-R1-0528', '2026-03-01']);
+ expect(opts.queryKey).toEqual(['benchmarks', 'DeepSeek-R1-0528', '2026-03-01', 'latest']);
+ });
+
+ it('builds exact query key when exact=true', () => {
+ const opts = benchmarkQueryOptions('DeepSeek-R1-0528', '2026-03-01', true, true);
+ expect(opts.queryKey).toEqual(['benchmarks', 'DeepSeek-R1-0528', '2026-03-01', 'exact']);
});
it('produces distinct keys for different models', () => {