+
+ {t.title}:{' '}
+ {loading
+ ? t.loading
+ : points.length > 0
+ ? t.summary(selected.available, selected.total)
+ : t.none}
+
+ {!loading && (
+ <>
+
{t.scope}
+
+ {Object.entries(selected.counts)
+ .filter(([, count]) => count > 0)
+ .map(([state, count]) => `${t.labels[state as PowerAvailabilityState]}: ${count}`)
+ .join(' · ')}
+
+
{
+ if (event.currentTarget.open) track('inference_power_availability_opened');
+ }}
+ >
+ {t.all}
+
+ {availability.map((entry) => (
+ -
+
+
+ ))}
+
+ {t.note}
+
+ {sources.size > 0 && (
+
+ {t.evidence}
+
+ {[...sources.values()].map(({ point, state, count }, index) => (
+ -
+ {point.hwKey}: {t.labels[state]} ({count})
+ {point.power_invalid_reasons?.length
+ ? ` · ${point.power_invalid_reasons.join(', ')}`
+ : ''}
+ {point.power_audit?.source ? ` · ${point.power_audit.source}` : ''}
+ {point.run_url &&
+ /^https:\/\/github\.com\/[\w.-]+\/[\w.-]+\/actions\/runs\/\d+(?:\/attempts\/\d+)?$/u.test(
+ point.run_url,
+ ) && (
+ <>
+ {' '}
+ ·{' '}
+
+ {t.run}
+
+ >
+ )}
+
+ ))}
+
+
+ )}
+ >
+ )}
+
+ );
+}
+
+/** Reuse pre-metric rows, including overlays: absent power must not erase its own explanation. */
+export function PowerMetricAvailability({
+ metric,
+ onSelect,
+}: {
+ metric: string;
+ onSelect: (metric: string) => void;
+}) {
+ const { selectionPoints = [], loading, refreshing } = useInferenceData();
+ const {
+ selectedModel,
+ selectedSequence,
+ selectedPrecisions,
+ activeHwTypes,
+ quickFilters,
+ compareGpuPair,
+ } = useInferenceFilters();
+ const { getOverlayData, activeOverlayHwTypes, isUnofficialRun, localOfficialOverride } =
+ useUnofficialRun();
+ const points = useMemo(() => {
+ const officialHw = isUnofficialRun ? (localOfficialOverride ?? activeHwTypes) : activeHwTypes;
+ const official = selectionPoints.filter(
+ (point) =>
+ selectedPrecisions.includes(point.precision) && officialHw.has(String(point.hwKey)),
+ );
+ const overlay = getOverlayData?.(selectedModel, selectedSequence, 'interactivity')?.data ?? [];
+ return [
+ ...official,
+ ...overlay.filter(
+ (point) =>
+ selectedPrecisions.includes(point.precision) &&
+ activeOverlayHwTypes.has(String(point.hwKey)) &&
+ matchesQuickFilters(point, quickFilters) &&
+ (!compareGpuPair || hardwareKeyMatchesAnyBase(String(point.hwKey), compareGpuPair)),
+ ),
+ ];
+ }, [
+ selectionPoints,
+ selectedPrecisions,
+ activeHwTypes,
+ getOverlayData,
+ selectedModel,
+ selectedSequence,
+ activeOverlayHwTypes,
+ isUnofficialRun,
+ localOfficialOverride,
+ quickFilters,
+ compareGpuPair,
+ ]);
+ if (!isMeasuredEnergyConfigKey(metric)) return null;
+ return (
+