Skip to content
Open
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
32 changes: 32 additions & 0 deletions packages/app/src/components/GlobalFilterContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,38 @@ export function GlobalFilterProvider({ children }: { children: ReactNode }) {
});
}, [availabilityRows, unofficialAvailable]);

// Auto-switch the selected model when an unofficial run is loaded that
// doesn't include the currently selected model. Without this, navigating
// to `?unofficialrun=<id>` while the default `g_model=DeepSeek-R1` sticks
// leaves the user staring at a chart with no overlay points — they'd have
// to know to open the dropdown and pick the run's model themselves.
//
// Skipped when `g_model` was set explicitly in the URL (respect the user's
// intent) and when the current model is already covered by the overlay.
//
// We key the "did we already switch?" check against the stringified set of
// (model, sequence) pairs from the unofficial run, so navigating from one
// run to another with a different model will re-trigger the switch — but
// a manual model change while the same run set is loaded will stick.
const lastAutoSwitchKeyRef = useRef<string>('');
useEffect(() => {
if (unofficialAvailable.length === 0) {
lastAutoSwitchKeyRef.current = '';
return;
}
const urlModel = getUrlParam('g_model');
if (urlModel) return;
const key = unofficialAvailable
.map((a) => `${a.model}|${a.sequence}`)
.toSorted()
.join(',');
if (lastAutoSwitchKeyRef.current === key) return;
lastAutoSwitchKeyRef.current = key;
const unofficialModels = new Set(unofficialAvailable.map((a) => a.model));
if (unofficialModels.has(selectedModel)) return;
setSelectedModel(unofficialAvailable[0].model);
}, [unofficialAvailable, selectedModel]);

// Sequences available for the selected model (DB ∪ unofficial run for this model)
const availableSequences = useMemo(() => {
const unofficialSeqs = unofficialAvailable
Expand Down
4 changes: 4 additions & 0 deletions packages/db/src/etl/normalizers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ describe('hwToGpuKey', () => {
expect(hwToGpuKey('B200-DSV4')).toBe('b200');
});

it('strips -cw suffix', () => {
expect(hwToGpuKey('gb300-cw')).toBe('gb300');
});

it('strips runner index suffix before other suffixes', () => {
expect(hwToGpuKey('mi355x-amd_0')).toBe('mi355x');
expect(hwToGpuKey('mi355x-amd_2')).toBe('mi355x');
Expand Down
3 changes: 2 additions & 1 deletion packages/db/src/etl/normalizers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export function hwToGpuKey(hw: string): string | null {
.replace(/-dgxc$/, '')
.replace(/-nb$/, '')
.replace(/-dsv4$/, '')
.replace(/-nv$/, '');
.replace(/-nv$/, '')
.replace(/-cw$/, '');
return GPU_KEYS.has(base) ? base : null;
}

Expand Down
Loading