Reordering Sparse Matrices for Tensor Cores Along Their Hidden Trajectory

GPUs multiply sparse matrices fastest when the scattered nonzero entries can be gathered into small dense blocks that the matrix-multiply hardware (NVIDIA Tensor Cores) handles natively. The best current method, SMaT, finds those blocks by reordering rows so that rows with similar nonzero columns sit next to each other. That reordering is a one-time preprocessing cost that SMaT's authors flag as prohibitive whenever the matrix changes. This proposal argues that the cost is not an engineering accident. In general, finding good row groupings is a similarity-search problem that is probably impossible to solve in less than quadratic time. It becomes easy when the rows lie along a low-dimensional curve or manifold. That is exactly the structure trajectory inference in biology assumes: cells laid out along a developmental path.

The concrete plan has three parts. First, prove a conditional lower bound: under the Strong Exponential Time Hypothesis, near-optimal grouping of rows into Tensor-Core tiles needs roughly quadratic time on worst-case inputs. Second, give a near-linear algorithm for matrices with low intrinsic dimension. It orders rows by a diffusion-pseudotime-like coordinate, then fixes the remaining boundary decisions with a small linear program (LP) whose fractional answer is rounded so that every tile holds exactly the right number of rows. Third, show that this algorithm makes repeated sparse multiplications on large single-cell and histopathology graphs fast enough to re-tile as the graph changes. The two-sentence version: pseudotime is a matrix reordering, and the theory says when such geometric orderings are the only cheap way to get Tensor-Core-friendly layouts. We build that ordering, refine it with exact-capacity LP rounding, and test whether it beats general-purpose reordering on matrices with and without hidden low-dimensional structure.

Core Claim

Fix a tile height $b$ (SMaT uses $16 \times 8$ half-precision blocks, so $b = 16$). Each row $r$ of an $n$-row sparse matrix touches a set $C(r)$ of column blocks. A layout assigns rows to $n/b$ tiles $T_1, \dots, T_{n/b}$ with exactly $b$ rows each. The cost is the number of dense blocks the hardware must actually process:

$$\mathrm{cost}(T) = \sum_{t} \Big| \bigcup_{r \in T_t} C(r) \Big|.$$

We make two claims. The hardness claim is that for column-block dimension $d = \omega(\log n)$, approximating the minimum cost within a factor $(1+\delta)$ for some constant $\delta > 0$ requires $n^{2-o(1)}$ time under SETH. The proof would go through a reduction from Orthogonal Vectors, in which orthogonal pairs become pairs of rows that cannot share blocks. The tractability claim is the positive counterpart: if the rows' supports come from a $k$-nearest-neighbor graph on points with low doubling dimension, which is the standard modeling assumption in trajectory inference, then a one-dimensional diffusion ordering followed by a windowed LP repair gives a constant-factor approximation in $O(n \cdot \mathrm{poly}(w))$ time, where $w$ is a window width.

This mirrors the threshold structure in Computational Limits of Low-Rank Adaptation (LoRA) Fine-Tuning for Transformer Models. That paper uses SETH to show LoRA gradients are quadratic above a norm threshold and near-linear below it, and then uses the threshold to design faster training. Here the controlling parameter is intrinsic dimension rather than norm, and the object is a memory layout rather than a gradient.

Grounding and Relation to Prior Work

The systems motivation comes from two kernel papers. Sparse GPU Kernels for Deep Learning (Sputnik) speeds up moderately sparse neural-network matrices with tiling, aligned vector loads and load balancing. It never reorders rows into dense blocks. High Performance Unstructured SpMM Computation Using Tensor Cores (SMaT) does reorder rows, greedily by Jaccard similarity, into blocked format for Tensor Cores. It reports large gains on SuiteSparse and enormous gains on banded matrices, but its reordering is static and expensive. We keep SMaT's kernel and replace its preprocessing, so SMaT supplies the execution method and also serves as the main competitor.

The research file frames single-cell graphs as falling into Sputnik's "moderate sparsity trap" of 70–95% sparsity. That framing is wrong. A 15-neighbor graph on $10^5$ cells is more than 99.98% sparse, which puts it in SuiteSparse territory. The relevant comparison is therefore SMaT versus cuSPARSE, not Sputnik versus dense cuBLAS. We design the evaluation around that correction.

The ordering idea comes from Diffusion pseudotime robustly reconstructs lineage branching. That paper orders cells by random-walk diffusion distances from a root cell and detects branches. We reuse its diffusion coordinate, but as a bandwidth-reducing permutation rather than a biological readout. At branch points a single 1D order breaks down, so branches are where the LP repair has to do real work.

The rounding method comes from A Nearly-linear Time Algorithm for Submodular Maximization with a Knapsack Constraint. Its key trick is "controlled fractionality": keep only a few variables fractional so that the relaxation stays cheap, then use swap rounding, which shifts probability mass between pairs of variables so that budget constraints hold exactly. We use the same trick. Starting from the diffusion order, only rows within $w$ positions of a tile boundary receive fractional assignments. Each tile's size constraint, exactly $b$ rows, is a cardinality constraint that swap rounding preserves with probability one. Our setting avoids that paper's huge constants, $(1/\epsilon)^{O(1/\epsilon^4)}$, because each local LP is a small covering program solved exactly rather than a multilinear extension.

The hardness template comes from Hardness of Approximate Diameter: Now for Undirected Graphs, which reduces $k$-Orthogonal Vectors to graph distance problems while preserving gaps. We adapt the gap-preservation style to block counts rather than distances.

Two further papers constrain the design. Learning latent progression states from spatial heterogeneity in uterine histopathology (SpaTIE) runs diffusion pseudotime over more than 62 million tissue patches whose embeddings come from a fine-tuned foundation model. Graphs at that scale are refit as embeddings change, which is where static reordering hurts. Relative Entropy Estimation in Function Space: Theory and Applications to Trajectory Inference warns that snapshot-level metrics cannot identify dynamics. That warning is why we evaluate biological fidelity only as a sanity check, confirming that results are unchanged under reordering. We do not present faster layouts as better biology.

Research Program

The theory track has two goals. The first is the SETH lower bound for tile cost at $b \ge 2$. Here $b = 2$ is a maximum-overlap pairing, the natural first step. The second is the upper bound under a doubling-dimension assumption, stated with explicit dependence on $k$, $b$ and dimension. Together the two bounds give a falsifiable prediction. Matrices whose supports have no low-dimensional geometry should leave cheap reorderings little room to help. Matrices from manifolds should let them approach what SMaT's quadratic-style preprocessing achieves.

The algorithm track builds the windowed LP. Variables $x_{r,t} \in [0,1]$ assign boundary rows to neighboring tiles, and $y_{t,c} \ge x_{r,t}$ for every column block $c \in C(r)$ mark which blocks tile $t$ must process. The LP minimizes $\sum y_{t,c}$ subject to every tile holding exactly $b$ rows. Swap rounding then produces an integral layout with tile sizes preserved. The same local repair handles graph updates: when edges change, only the affected windows are re-solved.

The systems track feeds these layouts into SMaT's kernel unchanged. That way any speed difference comes from the layout and not from kernel engineering.

Baselines

The naive reference point is the matrix in its given row order, which for single-cell data is usually cell-barcode or batch order. It is run through both cuSPARSE and SMaT's blocked kernel with no reordering. This measures how much any reordering buys.

The classical sparse-matrix baseline is reverse Cuthill–McKee, a breadth-first bandwidth-reducing ordering that runs in near-linear time. It is the cheapest serious competitor and the one most likely to capture manifold structure for free.

The strongest existing method is SMaT's own Jaccard-similarity reordering, run with its released settings on the same GPU, matrices and dense right-hand-side widths. SMaT reports up to a 125× speedup over cuSPARSE on SuiteSparse, an average 2.6× over the next-best library (DASP), and an 8.4× reduction in the standard deviation of blocks per row on matrix mip1 (High Performance Unstructured SpMM Computation Using Tensor Cores). For non-blocked kernels, Sputnik's reported geometric-mean speedup of 3.58× over cuSPARSE on V100 (Sparse GPU Kernels for Deep Learning) anchors the comparison.

Beating SMaT means one of two outcomes on manifold-derived matrices. The first is matching its block count within 5% at a preprocessing time at least an order of magnitude smaller. The second is a lower end-to-end time, preprocessing included, in the dynamic setting where the matrix changes every few hundred multiplications.

Two ablations isolate the key ingredients. The first uses the diffusion ordering alone, cutting tiles every $b$ rows with no LP. This shows whether the LP matters at all. The second replaces swap rounding with independent rounding followed by greedy capacity repair. This shows whether exact-capacity dependent rounding is worth its cost. Every method gets the same hardware, the same kernel and the same wall-clock tuning budget for its hyperparameters ($w$ for ours, the similarity threshold for SMaT).

Why not just…?

Why not just use reverse Cuthill–McKee or another bandwidth ordering? This is the most serious threat. On a single unbranched trajectory, such an ordering may already produce a near-banded matrix, and SMaT reports its largest gains on banded matrices. Our bet is that breadth-first orderings interleave branches and make tiles span both branches at lineage splits, where the LP repair helps. If reverse Cuthill–McKee matches us on branching graphs such as the synthetic Petal system and mESC, the algorithmic contribution shrinks to the hardness result. We would report that outcome directly.

Why not just keep SMaT's Jaccard reordering and amortize it? For static inference weights, amortization works, and we expect SMaT to remain best there. The question is matrices that change: SpaTIE-style re-embedded patch graphs, refreshed neighbor graphs, and evolving sparsity masks like those in Learning N: M Fine-grained Structured Sparse Neural Networks From Scratch. The dynamic experiment measures the number of multiplications needed to break even. The lower bound predicts that no general-purpose replacement for SMaT's similarity search can be much cheaper.

Why not just use cuSPARSE, since neighbor graphs are so sparse that dense tiles will be mostly empty? This is a real possibility. A 15-neighbor row with a good ordering touches perhaps two or three 8-column blocks, so tile fill may be only around a third. We measure fill ratio and throughput directly. If blocked execution does not beat cuSPARSE even under the best layout, then Tensor Cores are the wrong target for these graphs. In that case we would still check whether the ordering speeds up the non-blocked kernels through better cache locality.

Why not just project the graph onto hardware 2:4 sparsity? Pruning or padding neighbor edges to fit a 2-in-4 pattern changes the diffusion operator. That changes the pseudotime itself. Our layouts are permutations, so the computed result is unchanged.

Proposed Experiments

The matrices come from four sources. The first is 15- and 30-neighbor graphs built on the mESC data and on the Embryoid Body, Human Embryonic Stem Cell, Mouse Erythroid and Human Fibroblast datasets. The second is patch-similarity graphs from PK3-Uter at increasing subsample sizes up to tens of millions of nodes. The third is point clouds sampled from Petal, Lotka–Volterra and Repressilator dynamics with added ambient noise dimensions, which let us dial intrinsic dimension. The fourth is SuiteSparse matrices, including mip1, and magnitude-pruned ResNet-50 weight matrices, which serve as structure-poor controls.

Metrics are nonzero-block count, tile fill ratio, SpMM throughput at dense widths from 16 to 256, preprocessing time, and end-to-end time for the block eigensolver used by diffusion pseudotime.

The decisive checks are three. First, on the synthetic suite, the advantage of geometric ordering over random order should shrink smoothly as intrinsic dimension grows. In the noise-dominated limit, our method and SMaT should converge to similarly poor layouts while SMaT's preprocessing time grows roughly quadratically. Second, on branching biological graphs, the full method should beat both the ordering-only ablation and reverse Cuthill–McKee in block count. Third, pseudotime computed on the reordered matrices must reproduce the original ordering exactly; on mESC this means recovering the Kendall correlation of 0.78 with experimental time reported in Diffusion pseudotime robustly reconstructs lineage branching. For the pruned-weight controls, no reported Tensor-Core reordering result was found on Lacuna for magnitude-pruned ResNet-50 layers, so we establish that number ourselves.