Compiling with Arrays
David Richter, Timon B\"ohler, Pascal Weisenburger, Mira Mezini

TL;DR
This paper introduces a formal logical foundation for arrays in linear algebra, enabling advanced compiler optimizations like maximal loop fission through a novel intermediate representation called AiNF.
Contribution
It develops a positive type-based formulation of arrays, integrating typed partial evaluation and subexpression elimination into a new normalization algorithm.
Findings
AiNF facilitates maximal loop fission and optimizations
The translation to AiNF terminates and preserves types
Maximally fissioned terms improve computational efficiency
Abstract
Linear algebra computations are foundational for neural networks and machine learning, often handled through arrays. While many functional programming languages feature lists and recursion, arrays in linear algebra demand constant-time access and bulk operations. To bridge this gap, some languages represent arrays as (eager) functions instead of lists. In this paper, we connect this idea to a formal logical foundation by interpreting functions as the usual negative types from polarized type theory, and arrays as the corresponding dual positive version of the function type. Positive types are defined to have a single elimination form whose computational interpretation is pattern matching. Just like (positive) product types bind two variables during pattern matching, (positive) array types bind variables with multiplicity during pattern matching. We follow a similar approach for Booleans…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
