Optimizing Layout of Recursive Datatypes with Marmoset

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Singhal, Vidush, Koparkar, Chaitanya, Zullo, Joseph, Pelenitsyn, Artem, Vollmer, Michael, Rainey, Mike, Newton, Ryan, Kulkarni, Milind
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912106605969408
author Singhal, Vidush
Koparkar, Chaitanya
Zullo, Joseph
Pelenitsyn, Artem
Vollmer, Michael
Rainey, Mike
Newton, Ryan
Kulkarni, Milind
author_facet Singhal, Vidush
Koparkar, Chaitanya
Zullo, Joseph
Pelenitsyn, Artem
Vollmer, Michael
Rainey, Mike
Newton, Ryan
Kulkarni, Milind
contents While programmers know that the low-level memory representation of data structures can have significant effects on performance, compiler support to optimize the layout of those structures is an under-explored field. Prior work has optimized the layout of individual, non-recursive structures without considering how collections of those objects in linked or recursive data structures are laid out. This work introduces Marmoset, a compiler that optimizes the layouts of algebraic datatypes, with a special focus on producing highly optimized, packed data layouts where recursive structures can be traversed with minimal pointer chasing. Marmoset performs an analysis of how a recursive ADT is used across functions to choose a global layout that promotes simple, strided access for that ADT in memory. It does so by building and solving a constraint system to minimize an abstract cost model, yielding a predicted efficient layout for the ADT. Marmoset then builds on top of Gibbon, a prior compiler for packed, mostly-serial representations, to synthesize optimized ADTs. We show experimentally that Marmoset is able to choose optimal layouts across a series of microbenchmarks and case studies, outperforming both Gibbons baseline approach, as well as MLton, a Standard ML compiler that uses traditional pointer-heavy representations.
format Preprint
id arxiv_https___arxiv_org_abs_2405_17590
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Optimizing Layout of Recursive Datatypes with Marmoset
Singhal, Vidush
Koparkar, Chaitanya
Zullo, Joseph
Pelenitsyn, Artem
Vollmer, Michael
Rainey, Mike
Newton, Ryan
Kulkarni, Milind
Programming Languages
Performance
While programmers know that the low-level memory representation of data structures can have significant effects on performance, compiler support to optimize the layout of those structures is an under-explored field. Prior work has optimized the layout of individual, non-recursive structures without considering how collections of those objects in linked or recursive data structures are laid out. This work introduces Marmoset, a compiler that optimizes the layouts of algebraic datatypes, with a special focus on producing highly optimized, packed data layouts where recursive structures can be traversed with minimal pointer chasing. Marmoset performs an analysis of how a recursive ADT is used across functions to choose a global layout that promotes simple, strided access for that ADT in memory. It does so by building and solving a constraint system to minimize an abstract cost model, yielding a predicted efficient layout for the ADT. Marmoset then builds on top of Gibbon, a prior compiler for packed, mostly-serial representations, to synthesize optimized ADTs. We show experimentally that Marmoset is able to choose optimal layouts across a series of microbenchmarks and case studies, outperforming both Gibbons baseline approach, as well as MLton, a Standard ML compiler that uses traditional pointer-heavy representations.
title Optimizing Layout of Recursive Datatypes with Marmoset
topic Programming Languages
Performance
url https://arxiv.org/abs/2405.17590