acceptodds
Under review as a conference paper at ICLR 2027

Loom: A GPU Compiler for Scalar Functions over Finite Index Maps

Abstract

AI for science applications often mix two kinds of computations: dense matrix operations that benefit greatly from GPU architecture, and application of small scientific formula on an irregular, indexed data structure, that is a poor candidate for the modern GPU if implemented naively. During the evaluation of the scientific formula, separate kernels for indexed read, arithmetic and reductions may cost more time moving the intermediate arrays than the actual compute. We introduce Loom, a GPU compiler for scalar functions over finite index maps. The user supplies a fixed-shape JAX function and a description of where each array element lives; Loom fuses the computation into GPU kernels specialized around one contiguous axis of independent lanes for vectorization. It accepts declared algebraic constants such as and rewrites polynomial arithmetic so that it can apply exact cancellations. Loom lowers programs, including those built by JAX automatic differentiation, through StableHLO, generates many PTX implementations and selects one based on timing. We compare Loom to existing domain-specific libraries: on NVIDIA B200 and A100 GPUs, benchmarked for two sparse equivariant operations that are widely used in machine-learned interatomic potentials, Loom-generated hot kernels are up to approximately 2× faster. By lowering the optimization to the compiler level, Loom trades a costly first call, paid once per program, for fast kernels specific to the shapes of a given problem. Loom shows that specialized compilers can complement performance-driven domain-specific AI for science libraries.

Primary area:
infrastructure, software libraries, hardware, systems, etc.
Keywords:
GPU compilation, kernel fusion, automatic differentiation, equality saturation, equivariant neural networks, machine-learned interatomic potentials

Reviews

Among:
Shape:
1234this paper, Bottom 27%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 2.00 over 3 reviews, above 27% of the others.
Reviewer_TFSwOpenReview ↗
Rating
2
Confidence
2
Informativeness
1
Presentation
2
Soundness
1
Read review
Paper summary

This paper presetns Loom, a GPU compiler for scalar functions over finite index maps. The user supplies a fixed-shape JAX function and a description of where each array element lives; Loom fuses the computation into GPU kernels specialized around one contiguous axis of independent lanes for vectorization. It accepts declared algebraic constants such as √3/2 and rewrites polynomial arithmetic so that it can apply exact cancellations. Loom lowers programs, including those built by JAX automatic differentiation, through StableHLO, generates many PTX implementations and selects one based on timing. Evaluation on NVIDIA B200 and A100 GPUs shows that Loom-generated hot kernels are up to approximately 2× faster than SoTA baseline.

Critical strengths
  • THis paper identifies why existing tools struggle: a sequence of indexed reads, scalar arithmetic, and reductions emitted as separate kernels can cost more in kernel launch overhead and intermediate data movement than arithmetic computations. The opening example is concrete and illustrative.
  • On the benchmark cases where Loom’s assumptions hold, the results are compelling: 1.16–3.11× faster than cuEquivariance in 8/8 cases (except one EP variant), 2.1–182.9× faster than OpenEquivariance, and 3.2–16× faster than FlashTP. The ablation (Table 2) credibly attributes these gains to specific mechanisms.
Critical weaknesses
  • This paper may be out of the scope of the ICLR conference; reviewers can not find out the direct contributions to the AI applications and AI systems.
  • The discussion of why Loom’s search chose fiber walks here and whether this is a systematic limitation of the search heuristic is insufficient.
  • in Table 6, Loom’s first call takes 37–535 seconds, versus 2~7 seconds for the domain baselines. This is an order-of-magnitude difference.
Questions for authors
  • How does Loom’s compilation time scale with program complexity such teh number of StableHLO ops, number of polynomial terms...
  • The benchmark graphs use arithmetic sequence index maps (the paper acknowledges this is Loom’s best case). How does Loom perform on truly irregular graphs (random wiring, power-law degree distributions) where fiber sizes vary widely?
  • To better understand the performance gain, it would help to show some critical PTX (Parallel Thread Execution) and SASS (Streaming Assembler).
  • The real-arithmetic contract means Loom’s output may differ from IEEE-754 JAX by more than rounding. Could you discuss on the guarantees users have about the maximum deviation, and whether this is acceptable for physics-critical applications ?
5 comments

Thank you for your review.

Scope (weakness 1). Loom accelerates the equivariant graph neural networks used as interatomic potentials, under three topics of ICLR's call for papers: "infrastructure, software libraries, hardware, etc.", "learning on graphs and other geometries & topologies" and "applications to physical sciences". GPU kernels for ML operators appear at ML venues: FlashAttention (NeurIPS 2022), FlashAttention-2 (ICLR 2024). Equivariant networks are an ICLR line since Spherical CNNs (ICLR 2018), with MACE (NeurIPS 2022), Equiformer (ICLR 2023) and now foundation models such as MACE-MP-0 and UMA (NeurIPS 2025), run for millions of molecular-dynamics (MD) steps. Their cost lies in two operators, the tensor product along edges and the symmetric contraction, and in their derivatives: forces are a gradient, and training needs a second derivative. Tensor products take up to 75% of training time (FlashTP, ICML 2025), and speeding them up is an ML-venue topic: eSCN (ICML 2023), the Gaunt tensor product (ICLR 2024), FlashTP. Loom compiles these operators and all their derivatives from the model's JAX code. In the public pre-trained MACE-MP-0, it makes the force step 11–23% faster, graph construction included, and MD 26–28% faster than with cuEquivariance (cuEq).

First call (weakness 3). The first call compiles and tunes once per program and size, and its result is cached. On the B200 it now takes 10–37 s for the edge product and 37–400 s for the symmetric contraction, against 37–535 s in the submission, mostly because the float64 reference that checks each new program now runs on the GPU. A later process, reusing the tuned kernels and check verdicts, takes 5–13 s and 24–218 s. In exchange, Loom's kernels are 1.1–2.0× faster than cuEq's on the eight benchmark programs with edges sorted by receiver, the order neighbour lists usually come in and cuEq's best case, and 1.5–2.5× in the submission's order. In MD with MACE-MP-0 on 10k atoms (35 against 28 steps/s), the first call is repaid after 16,600–17,300 steps (8.3–8.6 ps), while production runs last nanoseconds.

Compile time and program size (question 1). Raising the edge product's L from 1 to 5, compile time grows sublinearly with the number of polynomial terms, about as cuEq's does: as terms^0.60–0.91 for Loom and terms^0.67–0.90 for cuEq; at L = 5, Loom takes 62–429 s and cuEq 35–546 s.

Why fiber walks, and the search (weakness 2). Loom chooses by measurement: it picks a fiber walk only when it ran faster than the alternatives it generated. A walk is at a disadvantage when a derivative also sums along the second index map: the Full and Second VJPs sum along senders as well as receivers, and a walk along receivers needs atomic additions for the sender sums. There the search had one systematic limitation: of the algebraically equivalent forms of such a derivative that compile, it timed plans for the first only. Timing all of them turns the radius graph's Full VJP from 0.87× to 1.08× of cuEq's speed, and water's from 0.91× to 1.10×. What remains is a gap in the space of plans, not in the search: at L = 4 and 5, the Feature VJP keeps a whole receiver's terms in registers (221–255 per thread, against cuEq's 56–64) and runs at 0.81× and 0.73×.

Irregular graphs (question 2). On random, radius, power-law (hubs of up to 5,074 edges) and water graphs of 10k atoms and 50k edges, Loom wins 14 of 16 cases and ties the other 2, both on the power-law graph (0.98× and 1.00×). Its speedup over the best baseline is 1.10–1.81× on random, 1.08–1.41× on radius, 0.98–1.46× on power-law and 1.10–1.44× on water.

PTX and SASS (question 3). On the edge product's Forward, Loom issues half of cuEq's instructions (48 M against 95 M for the same 3.3 GFLOP; main kernel 190 against 221 µs). Its SASS pairs channels in two-wide FMAs, with Clebsch–Gordan coefficients as immediates:

FMUL2 R138, R151.F32, 0.70710676908493041992 // 1/√2
FFMA2 R110, R116.F32x2.HI_LO, R6.F32x2.HI_LO, R110.F32x2.HI_LO // x⊗Y, two channels
FFMA2 R62, R134.F32x2.HI_LO, R110.F32x2.HI_LO, R62.F32x2.HI_LO // acc += w·(x⊗Y)

On the Full VJP it reads 916 MB from memory against cuEq's 2,845 MB, close to the 902 MB that must be read.

Accuracy (question 4). Loom's rewrites are identities over the reals, so its output differs from the program as written only by float32 rounding, which grows with the number of terms summed. Beyond that a priori bound, Loom checks: at its first call, each compiled program is compared with a float64 evaluation of the program as written, and refused if its error exceeds the larger of 32 float32 roundings and four times that of the program as written in float32 (error: largest deviation over largest float64 value, in units of 2^-24). On the benchmark, Loom's worst error is 4.4–6.4 such roundings, below cuEq's 7.7–39. In MACE-MP-0, float32 forces differ from float64 by 0.006–0.037 meV/Å RMS, the same with cuEq or Loom.

THe responses address most of my concerns, particularly regarding irregular graphs, the search strategy, and the practical relevance to MACE-MP-0. The additional results have strengthened my confidence in the paper. , I still encourage the authors to clarify the limitations of the numerical accuracy checks, eps. for physics-critical applications.

I was impressed by the SASS profiling results for typical computations e.g. FMUL2 and FFMA2.

the authors clarified the paper's fit with ICLR (e.p., by adding references), which was my main concern.

Reviewer_fRL6OpenReview ↗
Rating
2
Confidence
4
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

The paper introduces Loom, a GPU compiler for small, fixed-shape JAX functions evaluated over finite domains connected by index maps. Users specify the computation separately from data placement. Loom derives indexed reads and reductions, compiles JAX-generated derivative programs, and applies exact algebraic rewriting, register-aware partitioning, and runtime kernel selection. The evaluation covers two sparse equivariant operators and their derivatives on B200 and A100 GPUs, supported by ablations and numerical comparisons against independent float64 references. Supplementary experiments examine changing graphs, general-purpose compilers, and a finite-element operator. Loom outperforms cuEquivariance in most main benchmark cases once compilation and tuning are complete, but incurs substantially higher first-call costs.

Critical strengths
  1. The compiler abstraction is coherent and useful. The domain-map contract unifies gathers, broadcasting, and reductions and preserves their structure through automatic differentiation. It enables alternative execution strategies without separate user-written kernels. This is a promising design, although its broader practical value remains insufficiently demonstrated.

  2. The evaluation supports the proposed mechanisms on the tested workloads. Forward and derivative benchmarks, independent float64 references, and ablations provide evidence for the benefits of fiber walks and polynomial rewriting. Reporting performance losses, more realistic graphs, and compilation overhead also helps readers understand the limitations. This evidence is useful, but does not establish substantial application-level gains.

Critical weaknesses
  1. Practical application benefits are insufficiently demonstrated. The main benchmarks cover two polynomial operators at one size with favorable synthetic index maps. On random and radius graphs, gains shrink and higher derivatives lose to cuEquivariance. The only model-level test is an untrained MACE-shaped forward layer, with approximately 3% improvement (5.38 to 5.22 ms). Without a trained-model, force-evaluation, or molecular-dynamics workload, meaningful real-world gains remain unestablished.

  2. Specialization costs and comparison fairness need stronger evidence. First calls take 37–535 seconds, but the paper does not establish how hot-execution savings amortize this cost under changing shapes and input distributions. General-purpose compiler comparisons also give Loom declared algebraic constants and fiber-walk strategies, while other implementations use rounded term lists and largely atomic reductions. Matched controls are needed to separate compiler benefits from baseline formulation and tuning choices.

Questions for authors
  1. What evidence shows that Loom improves a trained MLIP force evaluation, including graph construction, layout handling, and derivatives? Do the gains hold across different graph sizes and degree distributions?

  2. How many calls are needed to offset Loom’s additional compilation and tuning cost relative to the strongest baseline? How well does a kernel plan tuned on one input distribution perform when the graph or data distribution changes but array shapes stay fixed?

  3. How does Loom compare with a general-purpose implementation using the same precomputed incoming-edge lists and per-destination reduction strategy? Under comparable representations, how much further improvement comes from algebraic rewriting, partitioning, and tuning?

  4. How have you tested supported non-polynomial operations and their derivatives, particularly when algebraic rewrites change floating-point values used by comparisons or nonlinear functions?

1 comment

Thank you for your detailed review.

Trained model, forces and MD (weakness 1, question 1). In the public pre-trained foundation model MACE-MP-0, replacing cuEquivariance (cuEq) with Loom for its two equivariant operators, everything else identical, makes the whole force step 11–23% faster and molecular dynamics (MD) 26–28% faster. This holds on systems of 1k to 10k atoms (a perovskite, water and a protein), for the force step with graph construction and layout included; the two operators alone are 1.5–1.9× faster. In MD at 10k atoms, Loom runs at 35.1–35.5 against 27.5–28.3 steps/s. Forces agree with cuEq's to 0.0006 meV/Å RMS. The submission's untrained layer gained only 3% because Loom's kernels were a quarter of its time.

Graph sizes and degree distributions (weakness 1, question 1). On random, radius, power-law (hubs of up to 5,074 edges) and water graphs of the benchmark's size (10k atoms, 50k edges), Loom, tuned on each graph, wins 14 of 16 cases and ties the other 2, both on the power-law graph (0.98× and 1.00×). Its speedup over the best baseline is 1.10–1.81× on random, 1.08–1.41× on radius, 0.98–1.46× on power-law and 1.10–1.44× on water. Where Loom used to lose, on derivatives that also sum along senders, its search had timed only the first of several algebraically equivalent forms of the derivative; it now times all of them, which turns the radius graph's Full VJP from 0.87× to 1.08× of cuEq's speed. On the power-law graph, Loom's Forward is less accurate than cuEq's (worst error 175 against 47 float32 roundings). Across sizes, Loom's speedup over cuEq is 0.88–1.57× at 1k atoms and 1.09–1.50× at 100k.

Amortization and transfer (weakness 2, question 2). In that MD run, the first call is repaid after 16,600–17,300 steps (8.3–8.6 ps). The neighbour graph changes at every rebuild, but the MD loop allocates edges at a fixed capacity, so the shapes, and with them the plan, stay the same; a new array size is a new program, with its own first call, which is cached. For the operators alone on the B200, against cuEq's fastest implementation in each case, the first call is repaid after 0.3–3.2·10⁵ calls for the edge product with edges sorted by receiver, and after 2.7–4.0·10⁵ for the symmetric contraction. A plan tuned on one bounded-degree graph (random, radius, water or the benchmark's) takes 0.95–1.57× the time of the plan tuned on the graph it runs on. On the power-law graph it is up to 41× slower (7.6–41× in 13 of 16 pairs), because the hubs need a plan of their own.

Matched controls (weakness 2, question 3). Even when JAX and PyTorch versions use the same precomputed incoming-edge lists and per-destination sums, Loom is 2.3–9.4× faster than the best of them, through algebraic rewriting and through partitioning with tuning. With rewriting, partitioning and tuning turned off, Loom runs at 0.83–1.31× the speed of the best control. Rewriting then adds 1.8–3.6×, and partitioning with tuning 1.1–2.9×. For example, on the Forward, the best control takes 0.80 ms, Loom with all three off 0.74 ms, and Loom with all on 0.19 ms; on the Full VJP, 3.52, 2.69 and 0.39 ms.

Non-polynomial operations (question 4). Rewrites never change, beyond rounding, a value that enters a comparison or a nonlinear function. We tested four such functions and their derivatives against float64: no comparison flips, and errors agree with JAX's to within 1.7%. Loom is 1.6–2.2× faster than JAX on a gated activation and 1.8–1.9× on a Morse potential. It is slower on a Bessel basis's value (0.49×), where three small JAX kernels around each call cost as much as Loom's own, and on a switching function (0.09–0.62×), where Loom places one thread per edge and so leaves most of the GPU idle.

Reviewer_xJpQOpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This paper presents Loom, a GPU compiler designed for scientific computing workloads with irregular data access patterns. It combines kernel fusion, aggregation optimization, mathematical expression rewriting, and autotuning to improve GPU execution efficiency. The authors evaluate Loom on two atomic interaction operators and a finite element computation task, comparing its performance against existing GPU optimization methods.

Critical strengths
  • This paper addresses GPU execution inefficiencies caused by irregular data access patterns and complex mathematical operations in scientific computing, offering a practical compilation and optimization approach.
  • Loom outperforms existing methods, particularly cuEquivariance, in most benchmarks on B200 and A100 GPUs, demonstrating substantial performance improvements.
  • Comprehensive baseline comparisons and ablation studies. The authors compare Loom against representative optimization methods. They also conduct ablation studies on key components, demonstrating their contributions to performance.
Critical weaknesses
  • The main optimization techniques employed in Loom, including kernel fusion, aggregation optimization, mathematical expression rewriting, and autotuning, have been extensively studied. Its contribution primarily lies in integrating existing techniques, with limited novel optimization mechanisms.
  • The main performance experiments focus on fixed problem sizes, without systematically varying the number of atoms, edges, or feature dimensions. This makes it difficult to assess whether the performance improvements remain consistent across different scales.
  • The paper primarily demonstrates speedups for individual operators, while the simulated MACE layer experiment in the appendix shows only approximately 3% improvement over cuEquivariance. This provides limited evidence of substantial performance benefits in complete real-world applications.
  • The main experiments focus on two MLIP operators. Although the appendix includes an additional finite element computation experiment, the overall application coverage remains narrow, making it difficult to establish the broader applicability of Loom across scientific computing domains.
Questions for authors
  1. How does Loom balance compilation overhead against runtime benefits? Loom incurs substantially higher initial compilation and autotuning costs than some baselines. Could the authors analyze how many executions are required to offset these additional costs and whether this is practical in real-world scientific computing applications?
  2. Can Loom support reduction operations beyond summation? The current framework primarily focuses on summation-based aggregation. Could the authors discuss the feasibility and potential challenges of extending Loom to other reduction operations, such as maximum or minimum?
  3. How do different data access patterns affect Loom's performance? The appendix shows that Loom's performance advantages diminish or even reverse for certain graph structures compared to cuEquivariance. Could the authors further explain the reasons behind these differences and clarify which types of data access patterns are most suitable for Loom?
1 comment

Thank you for your review.

Novelty (weakness 1). Fusion, expression rewriting and autotuning are known individually. What is new is an index-map contract under which they apply to every derivative JAX builds, together with exact algebraic constants. Because a sum along an index map is the transpose of a gather along it, the derivative of a Loom program is again a Loom program, so one compiler handles forces and training gradients without hand-written kernels. Declaring exact constants such as √3/2 then exposes cancellations that floating-point coefficients hide. With rewriting, partitioning and tuning turned off, Loom runs about as fast as hand-written JAX and PyTorch using the same edge lists (0.83–1.31×); rewriting alone then adds 1.8–3.6×.

Sizes (weakness 2). Across sweeps of the number of atoms (1k–100k), neighbours (5 and 20), channels (32–192) and L (1–5), Loom beats cuEquivariance (cuEq) at most points, by up to 7.5×, and loses at a few, down to 0.69×: 0.88–1.57× at 1k atoms, 1.09–1.50× at 100k, 1.13–1.68× at 20 neighbours, 0.69–1.41× over 32–192 channels and 0.73–7.46× over L = 1–5.

Real model (weakness 3). In the public pre-trained foundation model MACE-MP-0, Loom makes molecular dynamics (MD) 26–28% faster than cuEq, and the force step on a given graph 12–24% faster from 1k to 10k atoms, where the two operators alone are 1.5–1.9× faster. At 10k atoms, MD runs at 35.1–35.5 against 27.5–28.3 steps/s. The submission's layer gained only 3% because Loom's kernels were a quarter of its time.

Coverage (weakness 4). Loom targets a computation pattern rather than MLIP operators alone: any scalar JAX function over finite domains connected by index maps, made of gathers along those maps, scalar arithmetic, and sums back along them. Graph message passing, both MLIP operators and the finite-element operator are instances. So are four non-polynomial functions we tested since the submission: Loom is 1.6–2.2× faster than JAX on a gated activation and 1.8–1.9× on a Morse potential, and slower on a Bessel basis's value (0.49×) and on a switching function (0.09–0.62×) (launch overhead and thread placement, respectively).

Compile overhead (question 1). Compilation and tuning run once per program and size, their result is cached, and long simulations repay them. On the B200, the first call takes 10–37 s for the edge product and 37–400 s for the symmetric contraction; in a later process, which reuses the tuned kernels and check verdicts, it takes 5–13 s and 24–218 s. In MD with MACE-MP-0 at 10k atoms, it is repaid after 16,600–17,300 steps (8.3–8.6 ps), while production runs take millions of steps.

Max and min (question 2). Loom's reductions are sums today. The fiber walk carries over: it folds each fiber in registers, and max and min are associative and commutative like a sum. The challenges lie elsewhere. The algebraic rewriting works on polynomials and does not distribute over max. The derivative of a max is no longer a sum along the same map but a selection of the argmax, which Loom would express with a comparison. A max along a map the walk does not follow would need an atomic max, as sums along senders need atomic additions. Sums came first because the derivative of a gather is a sum, so every derivative JAX builds needs them.

Access patterns (question 3). Loom suits sums along one index map, as in the Forward, where it walks each receiver's edges in registers. The Full and Second VJPs also sum along senders, which a walk along receivers can only do with atomic additions; there cuEq used to win (Full VJP 0.87× on a radius graph, Second VJP 0.74× on a power-law graph). Its search now times every algebraically equivalent form of these derivatives, and a reduction pass that only scaled three components is gone, so Loom wins those cases (1.08× and 1.00×). cuEq still wins at L = 4 and 5, where a receiver's terms do not fit in registers (Feature VJP 0.81× and 0.73×, Forward 0.99× and 0.91×), and on some small derivatives, with 32 or 64 channels, 1k atoms or L = 1 (0.69–0.96×). A later build, which orders each sum's additions so that fewer values stay live in registers, raises the Feature VJP at L = 4 and 5 to 1.005× and 0.95× and the 32-channel Second VJP from 0.69× to 0.85×; over the 72 cases of the benchmark, the graph families and these sweeps, Loom then wins 63 instead of 61, and none runs 1% slower than before.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.