Length-Aware Subwarp Kernels for Tri-Plane Scans on Real Clinical Volumes

Tri-plane state-space models avoid the cubic cost of 3D attention. A state-space model (here Mamba) is a sequence layer that reads tokens one after another and carries a running summary. The tri-plane variant runs these scans along a 3D volume's three axes instead of letting every voxel attend to every other. On paper the savings are large: Tri-Plane Mamba reports 2.37 GFlops per adapter block against 18.86 for self-attention on a 96×96×96 crop. That accounting, however, assumes every scan line looks alike.

Real CT and MRI volumes are anisotropic. Slices are often far thicker than in-plane pixels, so lines along the depth axis can be several times shorter than in-plane lines. Volume geometry also varies across the scanners in a multi-center collection such as AMOS. On a GPU, threads run in lockstep groups of 32 called warps. If each short depth line occupies a whole warp, or a thread block sized for long lines, most threads idle. The long in-plane lines may be fine.

This proposal builds a scan kernel that packs short lines into subwarps, meaning groups of 2 to 16 threads inside one warp that each own a line. It gives long lines full warps and decides the split per axis from the measured line length. The second contribution is a test of whether kernel benchmarks run on synthetic isotropic cubes rank kernel designs the same way benchmarks run on real clinical volume geometries do.

Core Claim

Two claims follow, and the second does not depend on the first. The first concerns the mechanism. On real anisotropic clinical volumes, a length-adaptive subwarp scan kernel will beat the strongest simple implementation of a tri-plane scan in end-to-end volume latency and in warp execution efficiency (the fraction of the 32 lanes doing useful work). The kernel produces numerically equivalent outputs, so segmentation accuracy is unchanged.

The second concerns evaluation. The usual benchmark for such kernels uses fixed synthetic cubes, and that benchmark is a simulation with a reality gap of its own. It hides exactly the line-length irregularity that real scanner geometry introduces. We therefore expect kernel rankings measured on synthetic cubes to disagree with rankings measured on real AMOS and BTCV volume shapes. If they agree, we report that as a negative result.

Relation to Prior Work

The mechanism comes from subwarp work on irregular workloads that are not images. SALoBa splits warps into subwarps for Smith-Waterman dynamic programming. It adds "lazy spilling" to shared memory so that global-memory writes are coalesced, and reports up to 43.6% speedup over GASAL2 on RTX3090. Parallel K-clique counting on GPUs uses sub-warp partitioning for irregular graph search and reports 1.98× and 1.73× geometric-mean gains. That paper also cautions that heuristic guidelines for choosing the subwarp size still trail the best-tuned setting by about 1.17×.

We reuse both techniques, subwarp ownership of variable-length work and shared-memory staging before coalesced writes. Neither paper touches spatial tensors or learned sequence layers. The K-clique result constrains our design: a fixed subwarp size is likely to leave performance on the table, so we treat size selection as a first-class ablation.

The application side motivates the problem. Tri-Plane Mamba scans along height-width, depth-height and depth-width planes, but it is evaluated only on 30-scan BTCV at a fixed crop and says nothing about kernel behavior. CAMS-Net uses bidirectional weight-shared scans but remains limited to 2D slices. That is precisely the dimensionality limitation we want to remove at acceptable cost.

UNETR shows that native 3D context helps on small, irregular organs, reaching 0.891 average Dice on BTCV. It also notes that GPU memory forced 16³ patches, which is one reason linear-cost scans are attractive.

GPU scheduling systems sit at a different granularity. LithOS atomizes kernels across groups of streaming multiprocessors (Thread Processing Clusters). Miriam shards kernels at the thread-block level for edge multi-DNN inference. Both work above the warp and are evaluated on trace replays with 2D or language workloads. We work inside the warp, on volumetric operators, with real volume shapes.

AMOS supplies both the evaluation lens and the data. It shows more than a 20% Dice collapse on MRI from unseen scanners, evidence that single-source evaluation overstates readiness. We apply the same logic to systems benchmarking.

Research Program

We first characterize the line-length distribution of real data. For every AMOS CT and MRI volume and every BTCV volume, we compute per-axis line lengths at native spacing and under common anisotropic patching. We do this per scanner model, because the claim lives or dies on how irregular these distributions really are.

We then profile reference and transposed scan implementations with hardware counters across axes. The quantities of interest are active lanes per warp, DRAM sectors per request, and achieved bandwidth. This step tests the premise that the depth-axis scans, not the in-plane scans, are where efficiency is lost.

The kernel itself assigns each line to a subwarp whose width is chosen from that line's length. It packs several short lines into one warp, gives long lines a full warp with a chunked parallel scan, and stages strided depth-axis reads and writes through shared memory so that global traffic is coalesced. The width choice comes from a small offline cost model calibrated per GPU. We compare it against an oracle search to quantify the gap that the K-clique paper warns about.

Finally, we put the kernel inside Tri-Plane Mamba blocks and check numerical equivalence, then measure Dice on BTCV and AMOS. As a secondary, exploratory question, we ask whether cheaper scans make native-spacing, whole-volume inference affordable. If so, we test whether it changes cross-scanner Dice on held-out AMOS scanners.

Baselines

The naive reference point is the Tri-Plane Mamba layer as published, run on 96³ isotropic crops with its standard scan implementation and the usual sliding-window inference. The file gives this layer's FLOPs (2.37 GFlops per block, Tri-Plane Mamba) but no wall-clock latency, so no reported result was found on Lacuna for tri-plane scan latency. We measure it ourselves.

The strongest competitor is not exotic. For each axis, it physically transposes the tensor so that the scan axis is contiguous, batches all lines of that axis together, and calls a standard fused one-dimensional selective-scan kernel. This is what a competent engineer would write first. It removes strided access at the price of one transpose per axis.

We run it on the same GPUs (an RTX3090-class card and an A100, matching the hardware classes in SALoBa and LithOS) and on the same real and synthetic shape suites, with equal autotuning time for both kernels. We beat it if we achieve at least a 1.3× median speedup in end-to-end per-volume latency on the AMOS-shape suite, with no Dice change beyond floating-point tolerance. If the speedup appears only on synthetic cubes, we have not beaten it.

For accuracy, the strongest reported reference is 3D-UNet at 89.04% mDice on the AMOS CT test set, against 86.32% for Swin-UNETR (AMOS). Any tri-plane model we accelerate is judged against that number and against 3D-UNet latency on the same hardware.

Ablations isolate each ingredient. One fixes the subwarp width at a single value. One removes shared-memory staging. One replaces the cost model with the oracle width. One evaluates every variant on synthetic cubes rather than real shapes, which tests the evaluation claim.

Why not just…?

Why not just transpose each axis to be contiguous and use an existing fused scan kernel? This is the real threat. If depth lines are long enough to fill warps after batching, transposition may capture most of the benefit. Our expectation is that short, scanner-dependent depth lengths still leave lanes idle, but it is only an expectation. The profiling step measures lane occupancy for the transposed baseline directly. If its median warp efficiency on AMOS shapes exceeds roughly 85%, we drop the custom kernel and report the evaluation finding alone.

Why not just resample every volume to isotropic spacing, so all lines are equal? Resampling erases the irregularity, but upsampling thick slices multiplies voxel count along depth and therefore scan work. We measure total latency for "resample plus uniform kernel" against "native spacing plus subwarp kernel" on the same volumes. Resampling wins if its added voxels cost less than the idle lanes it removes. That is plausible for mildly anisotropic CT, and we will say so where it happens.

Why not just use a 3D-UNet, which AMOS shows is more accurate than Swin-UNETR? The accuracy evidence favors convolutions on AMOS CT (89.04 vs 86.32 mDice), and nothing in the file shows tri-plane models beating 3D-UNet there. We therefore report 3D-UNet latency and Dice alongside ours. The contribution stands only if accelerated tri-plane models are competitive on the accuracy-latency trade-off. Their documented advantage, about 12% higher Dice than conventional 3D networks with 12% of the training data (Tri-Plane Mamba), is the regime where the comparison matters most.

Why not just process slices in 2D, where kernels already fill warps? This throws away the depth context the scans exist to capture. Your other Left! shows 2D-slice presentation reducing positional reasoning to roughly 50% accuracy, and UNETR's gains are largest on small irregular organs. We still include a 2D slice-wise baseline for latency so the cost of 3D context is stated explicitly.

Proposed Experiments

We construct two shape suites. The synthetic suite uses fixed cubes. The realistic suite uses the actual geometries of all 600 AMOS volumes, split by its eight scanner models, together with BTCV. Every kernel variant is run on both suites on both GPUs, and also under a co-located training job, since Miriam reports residual L2 and texture-cache contention of about 15 μs that synthetic isolated runs do not show.

We report per-volume latency, warp execution efficiency, DRAM sectors per request, and Dice on BTCV and AMOS. Two checks are decisive. The first is whether the subwarp kernel beats the transpose-and-batch baseline by the stated margin on realistic shapes. The second is whether the Spearman rank correlation of kernel variants between the synthetic and realistic suites falls clearly below one. If both fail, the honest conclusion is that tri-plane scans need no warp-level redesign and that synthetic cubes are an adequate benchmark, and we will publish that.