Search arXiv⌕ Search

arXiv · 2610.10547

DLCB: Ahead-of-Time Compilation for Dynamic Deep Learning

Abstract

Deep learning workloads are increasingly deployed in settings where tensor shapes are not fully known at compile time. Batch sizes vary across requests, sequence lengths differ between inputs, and model architectures admit a range of spatial resolutions. This dynamism creates a fundamental tension: ahead-of-time compiled GPU kernels deliver peak performance but traditionally require fully static tensor shapes, while just-in-time compilation supports dynamic shapes at the cost of runtime compilation overhead. We present DLCB (Deep Learning Compiler Backend), a deep learning compiler that resolves this tension through a unified three-tier compilation strategy. For programs with fully static tensor shapes, DLCB generates static CUDA C++ kernels ahead of time. For programs whose tensor rank is statically known but whose dimension sizes are dynamic, DLCB generates AOT kernels parameterized by those dimensions, compiling once and executing across a range of shapes. For programs with tensors of unknown rank, DLCB falls back to JIT compilation at runtime. For AOT compilation with dynamic shape tensors, our approach builds a system of shape constraints from the input program, and uses a solver to reduce these to either a) fixed constraints that produce hard-coded constants in the generated kernel; b) unresolved constraints which become kernel parameters passed at launch time, along with interpreted host code to check that the constraint holds for a given set of inputs and to compute the values to pass. Our compiler and runtime are embedded in PyTorch, and use an automatic shape generalization pass to enable AOT compilation with dynamic shapes for supported subsets of PyTorch programs

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Alexander Collins, Bin Fan, Evghenii Gaburov, William Brandon, Sean Lee, Hanfeng Chen, Vinod Grover. 2026-08-19. DLCB: Ahead-of-Time Compilation for Dynamic Deep Learning. https://arxiv.org/abs/2610.10547

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related papers

Dimensional Type Systems and Deterministic Memory Management

We present a dimensional type system whose annotations remain available through the stages that require them, allowing numeric representation and deterministic memory management to be resolved within a single Program Semantic Graph (PSG). Based on Andrew Kennedy's Units of Measure, dimensions constrain admissible operations and the application of domain laws, forming our Native Type Universe (NTU). Range analysis combines those constraints with values, guards, and declared boundaries. A covering representation then determines word width and memory footprint, which participate in allocation and transfer decisions alongside lifetime and target constraints. Our Dimensional Type System (DTS) extends Hindley-Milner inference with abelian-group unification. Within that algebraic fragment, inference is decidable and admits principal types. Measures form part of source-level type identity, while numeric width and storage layout are coeffects resolved from context. A known range that exceeds every available representation produces an error at representation commitment. During program elaboration, unresolved facts can remain pending while further context is supplied. Deterministic Memory Management (DMM) uses the same graph to relate escape paths to storage lifetimes. Closure capture, return, and by-reference use supply different lifetime requirements. Allocation follows the lifetime classification and the platform's declared storage capabilities. Our unique implementation of a posit quire illustrates the interaction: exact accumulation requires a suitable numeric format, adequate capacity, and storage that persists across the accumulation. We also examine how these constraints would apply to automatic differentiation. A shared graph would allow language services to present dimensional resolution and proof status alongside the reasons for representation and placement decisions.

cs.PL↗

The Program Hypergraph: Multi-Way Relational Structure for Geometric Algebra, Spatial Compute, and Physics-Aware Compilation

Source code organizes a program as expressions and declarations, which a compiler can represent as an abstract syntax tree (AST). Some compilers introduce a further abstraction of the computation as a graph. Nodes represent operations, while connections record how values pass between them and how execution proceeds. Yet these connections can leave the full scope of conditions governing a computation implicit. Developers may then need defensive checks, rely on compiler hacks, pragmas, and implementation-specific code to maintain those conditions as the program evolves. Our thesis is that a hypergraph more faithfully represents complex computation across all targets by making joint constraints inherent to its structure, with an overall less burdensome design-time API. Our Program Hypergraph (PHG) extends our Semantic Graph with relations that connect across an operation's participants, their dependencies, and the invariants they must preserve. Joint resolution in the graph guides lowering into standard Multi-Level Intermediate Representation (MLIR). Satisfiability modulo theories (SMT) checks intrinsic to the graph discharge applicable proof obligations. Supporting information remains available until the decisions that require it are complete. As a primary benefit, verification follows from the rules used to construct and transform the graph. For properties established this way before execution, the generated program needs no added runtime checks, no 'boxing' or 'tagging' or other managed runtime support. We develop this account through geometric algebra, shared-memory capacity, and spatial placement, distinguishing structural guarantees from numerical and resource obligations that require further evidence. The proposed integration makes the same information available at design-time, so engineers can inspect the consequences of a choice before it becomes an implementation constraint.

cs.PL↗

Decidable By Construction: Design-Time Verification for Truly Fearless Systems

Concurrency, parallelism and distributed execution become truly fearless when the compiler tracks wait-for edges, proves multi-threaded work is sound and preserves distributed boundary contracts. In this design, our Composer compiler preserves proofs while lowering Clef directly to native CPU, GPU, NPU and FPGA code, without translation through C or vendor APIs. Our Program Semantic Graph retains the values, relationships and premises that justify BAREWire's unboxed boundary contracts. And C & C++ interfacing is an explicit marshaling boundary, with proofs tied to actual arguments, conversions and returned values. Four verification tiers connect an account of our design. Tier 1 supplies structural inference, founded on principal dimensional types. Tier 2 generates and checks local arithmetic, representation, and computational integrity at the node level. Tier 3 instantiates reusable domain and system lemmas, including distributed proofs supported by Iris, Actris and Aneris. Tiers 1-3 require no developer annotations, with a quotation based lemma library design to extend coverage as use cases expand. Tier 4 admits computational and probabilistic relational proofs, with project annotations identifying the required relations. We extend the same library direction toward recognizing relational constructions from hypergraph structure. A formal composition rule connects arithmetic, ownership, protocol and realization evidence. Our worked distributed reduction preserves one specified result across concurrent workers, reordered arrivals and boundary mappings. Its probabilistic extension carries worker and conversion error with an explicit failure budget. With recent work by Urschel, we show bounds supply a relevant source of reusable proof terms. These constructions make verification a core engineering discipline for truly fearless programs and systems across a variety of hardware targets.

cs.PL↗