English

LEGO: A Layout Expression Language for Code Generation of Hierarchical Mapping

Programming Languages 2025-12-16 v2 Distributed, Parallel, and Cluster Computing Performance

Abstract

We describe LEGO, a new approach to optimizing data movement whereby code is expressed as a layout-independent computation and composed with layouts for data and computation. This code generator organization derives complex indexing expressions associated with hierarchical parallel code and data movement for GPUs. LEGO maps from layout specification to indexing expressions, and can be integrated into existing compilers and code templates. It facilitates the exploration of data layouts in combination with other optimizations. We demonstrate LEGO's integration with the Triton and MLIR compilers, and with CUDA templates. We show that LEGO is capable of deriving performance competitive with Triton, and shows broad applicability for data and thread layout mapping optimizations in its integration with CUDA and MLIR.

Keywords

Cite

@article{arxiv.2505.08091,
  title  = {LEGO: A Layout Expression Language for Code Generation of Hierarchical Mapping},
  author = {Amir Mohammad Tavakkoli and Cosmin Oancea and Mary Hall},
  journal= {arXiv preprint arXiv:2505.08091},
  year   = {2025}
}
R2 v1 2026-06-28T23:30:37.350Z