# Compiler Optimization for Irregular Memory Access Patterns in PGAS Programs

**Authors:** Thomas B. Rolinger, Christopher D. Krieger, Alan Sussman  
**arXiv:** [2303.13954](https://arxiv.org/abs/2303.13954)  
**Date:** 2023-03-24  
**Summary page:** https://www.summarizepaper.com/en/paper/2303.13954v1/

## Key points

- Irregular memory access patterns can be challenging for distributed-memory systems, leading to fine-grained remote communication and unknown data access patterns until runtime.
- The Partitioned Global Address Space (PGAS) programming model provides users with a view of a distributed-memory system that resembles a single shared address space, but this approach often results in poor performance due to fine-grained remote communication caused by the code written by programmers.
- Previous research has shown that manually applying optimizations can improve the performance of irregular applications written in Chapel, a high-level PGAS language. However, such manual optimization reduces productivity advantages provided by Chapel and the PGAS model.
- This paper presents an inspector-executor based compiler optimization for Chapel programs that automatically performs remote data replication for irregular memory accesses to distributed arrays. This work is unique as it presents the first such optimization within the Chapel compiler.
- The paper evaluates the performance of the optimization across two irregular applications on two different distributed-memory systems. Results show that the optimization can improve performance by up to 52x on a Cray XC system with low-latency interconnect and 364x on a standard Linux cluster with Infiniband interconnect without sacrificing user productivity.
- Chapel is a high-level language designed for productive parallel computing at scale through constructs for distributed arrays, remote communication, and both data and task parallelism. Tasks in Chapel are executed in parallel through multiple threads implemented by a tasking layer. For distributed-memory programming, Chapel introduces locales as units of machine resources on which tasks execute.
- In conclusion, this paper presents an automatic compiler optimization for irregular memory accesses in Chapel programs that significantly improves their performance without reducing productivity advantages provided by Chapel and PGAS model. Future work could explore the application of this optimization to other PGAS languages and investigate its performance on larger-scale systems.

## Summary

Irregular memory access patterns can pose significant challenges for distributed-memory systems, leading to fine-grained remote communication and unknown data access patterns until runtime. The Partitioned Global Address Space (PGAS) programming model addresses these challenges by providing users with a view of a distributed-memory system that resembles a single shared address space. However, this approach often results in poor performance due to fine-grained remote communication caused by the code written by programmers. Previous research has shown that manually applying optimizations can improve the performance of irregular applications written in Chapel, a high-level PGAS language. However, such manual optimization reduces productivity advantages provided by Chapel and the PGAS model. To address this issue, this paper presents an inspector-executor based compiler optimization for Chapel programs that automatically performs remote data replication for irregular memory accesses to distributed arrays. This work is unique as it presents the first such optimization within the Chapel compiler. The paper also discusses how features specific to Chapel, such as implicit processor affinity, require a different approach to implementing inspector-executor technique compared to other PGAS languages. The paper evaluates the performance of the optimization across two irregular applications on two different distributed-memory systems. Results show that the optimization can improve performance by up to 52x on a Cray XC system with low-latency interconnect and 364x on a standard Linux cluster with Infiniband interconnect without sacrificing user productivity. Chapel is a high-level language designed for productive parallel computing at scale through constructs for distributed arrays, remote communication, and both data and task parallelism. Tasks in Chapel are executed in parallel through multiple threads implemented by a tasking layer. For distributed-memory programming, Chapel introduces locales as units of machine resources on which tasks execute. In conclusion, this paper presents an automatic compiler optimization for irregular memory accesses in Chapel programs that significantly improves their performance without reducing productivity advantages provided by Chapel and PGAS model. The evaluation results demonstrate its effectiveness across two irregular applications and two different distributed-memory systems. Future work could explore the application of this optimization to other PGAS languages and investigate its performance on larger-scale systems.
