SPB Git

spb/wp40_uqo

Public MIT
4.3 KB · 37 lines latex
1\section{Microbenchmarks}2\label{sec:micro}34\paragraph{Primitives on the laptop.} Table~\ref{tab:prim} (abridged; the full grid is in the repository) and Figure~\ref{fig:prim} report the fused realized kernel, regression sufficient statistics ($k = 4$), the rolling sum of squares ($w = 22$) and the batched GARCH negative log-likelihood with one ($P = 1$) and 64 ($P = 64$) parameter vectors per series, for series counts $S \in \{1, 10, 100, 1\,000, 10\,000\}$ and lengths $n \in \{390, 3\,900, 39\,000, 390\,000\}$ of Student-$t(5)$ synthetic returns.56\begin{table}[t]7\centering\scriptsize8\caption{Primitive kernels, laptop (M5 Max). Medians of wall-clock milliseconds over 5 repetitions; CPU MT uses 18 threads; speedup $= T_{\text{CPU MT}}/T_{\text{Metal}}$; verdict by non-overlapping bootstrap CIs.}9\label{tab:prim}10\resizebox{\textwidth}{!}{\input{tables/tab_primitives}}11\end{table}1213\begin{figure}[t]14\centering\includegraphics[width=\textwidth]{figures/fig_primitives_throughput.pdf}15\caption{Throughput of the primitives (elements per second, medians) versus problem size on the laptop.}16\label{fig:prim}17\end{figure}1819Four findings answer RQ1 at the kernel level. First, the fused realized kernel is faster than the 18-thread CPU from about $4\times10^4$ elements upward ($100\times390$: 2.4$\times$) and reaches 2.0--3.4$\times$ between $3.9\times10^6$ and $3.9\times10^7$ elements; a few shapes at $3.9\times10^5$ elements are ties. Second, regression statistics break even only around $4\times10^5$ elements for a single long series (3.9$\times$), are ties for most shapes between $4\times10^5$ and $4\times10^6$, and gain 1.1--1.4$\times$ at $4\times10^7$: the per-row cost on the CPU is already small and the GPU pays conversion and launch overhead. Third, the rolling sum of squares is a negative result: the direct $O(w)$ kernel never beats the CPU's $O(1)$ running sum (0.4--0.9$\times$ of CPU MT at every size). Fourth, batched GARCH likelihoods are the clearest GPU case, but only when many parameter vectors are evaluated per series: with $P = 1$ the CPU wins everywhere (the GPU is launch-bound and the recursion is sequential), with $P = 64$ Metal wins from 100 series (1.9$\times$) up to 7.9$\times$ at $1\,000\times3\,900$. For the reductions, device time is 5--20 times smaller than wall-clock: FP64$\to$FP32 conversion and buffer fills, not the kernels, set the wall-clock. Unified memory removes the copy to the device but not the conversion.2021\paragraph{Shader compilation and library loading.} Loading the prebuilt library takes 0.2\,ms and the first pipeline creation 14\,ms on the laptop; compiling the embedded MSL source at runtime takes 39\,ms when the system shader cache is warm and 123\,ms cold (compiler service start included). On cluster nodes the cold compile is 37--49\,ms (110\,ms on the 8\,GB M2 mini) and the warm compile 0.3--0.6\,ms (Table~\ref{tab:e7}). These costs are paid once per process and matter only for workloads of a few milliseconds.2223\paragraph{Generation sweep (E7).} Table~\ref{tab:e7} and Figure~\ref{fig:e7} report the same bundle on eleven machines. All Metal tests pass on every machine with both the prebuilt library and runtime compilation, including the 8\,GB M2 mini without developer tools. The speedup of the fused realized kernel at $1\,000\times3\,900$ ranges from 4.0$\times$ (M2, 10 GPU cores, 8 CPU cores) and 3.6$\times$ (M2~Max) down to 1.1$\times$ on the M5~Max and M5~Pro; GARCH $P = 64$ from 7.8$\times$ (M2~Max) to 1.8$\times$ (M5~Pro); the rolling kernel loses everywhere (0.2--0.65$\times$). The pattern is not ``more GPU cores, more speedup'': the ratio is governed by the CPU's multicore throughput, which grew faster across generations than the GPU throughput of these memory-bound kernels, and by the conversion overhead, which is CPU-bound. The GPU helps most on the machines with the weakest CPUs.2425\begin{table}[t]26\centering\scriptsize27\caption{E7 --- generation sweep (3 repetitions, shuffled; speedups are CPU MT / Metal medians at the stated shape; tests = Metal test suite with the prebuilt metallib / with runtime MSL compilation).}28\label{tab:e7}29\resizebox{\textwidth}{!}{\input{tables/tab_e7}}30\end{table}3132\begin{figure}[t]33\centering\includegraphics[width=.8\textwidth]{figures/fig_e7.pdf}34\caption{E7 --- Metal/CPU-MT speedup versus GPU core count for three kernels on eleven Apple Silicon machines.}35\label{fig:e7}36\end{figure}37
Files · ae5a4e6ff6df81cef716eacbb5d51143a008d45b
Menu

Theme