NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Gensor: A Graph-based Construction Tensor Compilation Method for Deep Learning

Hangda Liu, Boyu Diao, Yu Yang, Wenxin Chen, Xiaohui Peng, Yongjun Xu

Introduction

Deep Learning (DL) performance is fundamentally tied to the efficiency of "tensor programs"—low-level code responsible for data movement and mathematical operations on hardware like GPUs. Optimizing these programs has traditionally involved a trade-off between slow, exhaustive search-based methods and fast but rigid rule-based constructive compilers. Gensor introduces a novel middle ground: a graph-based constructive tensor compiler. By modeling the optimization space as a graph and employing Markov analysis for navigation, Gensor generates high-performance kernels in seconds, achieving up to a 30% speedup over existing constructive methods.

The Challenge: Speed vs. Performance

Current tensor compilation strategies generally fall into two categories:

  1. Search-based Methods (e.g., Ansor): These utilize machine learning to explore thousands of potential configurations. While they produce highly optimized code, the compilation process can take hours, making them unsuitable for dynamic models with frequently changing input shapes.
  2. Constructive Methods (e.g., Roller): These use predefined rules to build programs rapidly. However, their reliance on "tree-based" approaches—which typically follow a single objective like cache reuse—often leads to "local optima." They find a satisfactory solution quickly but may miss the global optimum because they lack the ability to backtrack or consider multiple performance factors simultaneously.
Figure 1: Traditional tree-based methods (red path) often settle for local optima, whereas Gensor's approach (green path) identifies higher-performance configurations.

Methodology: From Trees to Graphs

Gensor's core innovation lies in reimagining the optimization space as a state-transition graph rather than a decision tree. This shift is particularly crucial for "unbalanced" search spaces—where one matrix dimension significantly outweighs others—a common characteristic of Large Language Model (LLM) workloads that tree-based methods often struggle to optimize.

Graph-based Construction and Markov Analysis

In Gensor, every version of a tensor program is represented as a node in a graph. Edges between these nodes represent scheduling primitives such as tiling, loop unrolling, or caching. This structure allows for more complex exploration paths and the ability to revisit states.

To navigate this vast space efficiently, Gensor applies Markov analysis. It calculates transition probabilities between nodes based on hardware-aware metrics (e.g., GPU bandwidth, latency, and peak FLOPS). Since the next optimization step in a tensor program is largely independent of previous steps, the process fits the mathematical definition of a Markov process.

Figure 4: The Gensor optimization workflow, showing the state-transition graph across memory levels and the action space used for Markov analysis.

Enhanced Tensor IR and Virtual Threads

Gensor introduces an Enhanced Tensor IR (ETIR) that supports virtual threads (vThreads). This allows the compiler to interleave tasks across physical GPU threads, effectively hiding memory latency—a sophisticated technique typically requiring manual expert intervention. To ensure convergence, Gensor employs a simulated annealing algorithm that narrows the search as the "temperature" decreases.

Evaluation and Results

The researchers evaluated Gensor across 32 operator benchmarks (including Conv2d, GEMM, and GEMV) and several end-to-end models (ResNet-50, GPT-2, BERT-small, MobileNetV2) on hardware ranging from the NVIDIA RTX 4090 to the edge-focused NVIDIA Orin Nano.

  • Compilation Speed: Gensor generates optimized kernels in seconds, outperforming search-based methods by 3 to 5 orders of magnitude.
  • Operator Performance: Gensor improved performance by an average of 18% (up to 30%) compared to Roller, the previous state-of-the-art constructive method.
  • End-to-End Acceleration: Full models saw an average performance boost of 20%.
  • Edge Device Efficiency: On the NVIDIA Orin Nano, Gensor was 1.19x faster than Roller and 2.6x faster than standard PyTorch implementations.

Ablation studies confirmed that the graph-based structure accounted for 79% of the performance gains, while virtual thread support contributed the remaining 21%.

Conclusion and Future Work

Gensor successfully bridges the gap between compilation speed and kernel performance. By leveraging graph theory and Markov processes, it avoids the pitfalls of local optima inherent in tree-based methods.

Future development aims to address current limitations, such as the difficulty of optimizing "black-box" vendor functions and the need for manual hardware formula tuning. The ultimate goal is to integrate Gensor into real-time, self-evolving deep learning systems that can adapt to new hardware and dynamic workloads automatically.

Summary updated

BibTeX
@inproceedings{liu2025gensor,
  author = {Hangda Liu and Boyu Diao and Yu Yang and Wenxin Chen and Xiaohui Peng and Yongjun Xu},
  title = {{Gensor: A Graph-based Construction Tensor Compilation Method for Deep Learning}},
  booktitle = {IPDPS},
  year = {2025},
}
Figure