Table of Contents
Fetching ...

Leveraging LLMs to Automate Energy-Aware Refactoring of Parallel Scientific Codes

Matthew T. Dearing, Yiheng Tao, Xingfu Wu, Zhiling Lan, Valerie Taylor

TL;DR

LASSI-EE addresses the gap in energy-aware parallel code generation by integrating runtime power profiling with an automated, multi-stage LLM workflow. It introduces energy-reduction@k to quantify expected energy savings when generating multiple code candidates, and leverages an LLM-as-a-Judge to filter functional equivalents at scale. Across 22 applications on NVIDIA A100 and AMD MI100 GPUs, LASSI-EE achieves substantial energy savings (up to ~48% at k=3) with high pass rates (≈97% at k=3), outperforming vanilla LLM prompting by up to 2.8× in single attempts. The framework demonstrates cross-platform robustness and a diverse set of optimization strategies mapped to memory hierarchy, algorithmic efficiency, device-specific tuning, and parallelism management, highlighting its potential to accelerate energy-efficient HPC code generation and guide future research.

Abstract

While large language models (LLMs) are increasingly used for generating parallel scientific codes, most efforts emphasize functional correctness, often overlooking performance, especially energy efficiency. We propose LASSI-EE, an automated LLM-based refactoring framework that generates energy-efficient parallel codes through a multi-stage, iterative approach integrating runtime power profiling, energy-aware prompting, self-correcting feedback loops, and an LLM-as-a-Judge agent for automated screening of code solutions. We introduce energy-reduction@k, a novel metric that quantifies expected energy reduction when generating k code candidates and selecting the most energy-efficient, enabling systematic evaluation of multi-attempt generation strategies. Evaluating 20 HeCBench applications and two miniApps on NVIDIA A100 and AMD MI100 GPUs, a single run (k=1) with LASSI-EE delivers refactored parallel codes with an average 29% expected energy reduction at an 81% pass rate, representing a 2.8x improvement over vanilla LLM prompting. Multiple runs (k=3) achieve an average 48% expected energy reduction at a 97% pass rate. These results are consistent across devices, demonstrating LASSI-EE's effectiveness across diverse hardware architectures.

Leveraging LLMs to Automate Energy-Aware Refactoring of Parallel Scientific Codes

TL;DR

LASSI-EE addresses the gap in energy-aware parallel code generation by integrating runtime power profiling with an automated, multi-stage LLM workflow. It introduces energy-reduction@k to quantify expected energy savings when generating multiple code candidates, and leverages an LLM-as-a-Judge to filter functional equivalents at scale. Across 22 applications on NVIDIA A100 and AMD MI100 GPUs, LASSI-EE achieves substantial energy savings (up to ~48% at k=3) with high pass rates (≈97% at k=3), outperforming vanilla LLM prompting by up to 2.8× in single attempts. The framework demonstrates cross-platform robustness and a diverse set of optimization strategies mapped to memory hierarchy, algorithmic efficiency, device-specific tuning, and parallelism management, highlighting its potential to accelerate energy-efficient HPC code generation and guide future research.

Abstract

While large language models (LLMs) are increasingly used for generating parallel scientific codes, most efforts emphasize functional correctness, often overlooking performance, especially energy efficiency. We propose LASSI-EE, an automated LLM-based refactoring framework that generates energy-efficient parallel codes through a multi-stage, iterative approach integrating runtime power profiling, energy-aware prompting, self-correcting feedback loops, and an LLM-as-a-Judge agent for automated screening of code solutions. We introduce energy-reduction@k, a novel metric that quantifies expected energy reduction when generating k code candidates and selecting the most energy-efficient, enabling systematic evaluation of multi-attempt generation strategies. Evaluating 20 HeCBench applications and two miniApps on NVIDIA A100 and AMD MI100 GPUs, a single run (k=1) with LASSI-EE delivers refactored parallel codes with an average 29% expected energy reduction at an 81% pass rate, representing a 2.8x improvement over vanilla LLM prompting. Multiple runs (k=3) achieve an average 48% expected energy reduction at a 97% pass rate. These results are consistent across devices, demonstrating LASSI-EE's effectiveness across diverse hardware architectures.
Paper Structure (20 sections, 4 equations, 4 figures, 4 tables)

This paper contains 20 sections, 4 equations, 4 figures, 4 tables.

Figures (4)

  • Figure 1: Diagram of the LASSI-EE pipeline.
  • Figure 2: Cross-device pass@$k$ results averaged across all 22 applications. LASSI-EE (orange) achieves similar gains on AMD MI100 and NVIDIA A100 over vanilla LLM (blue) for each $k\in \{1, 3, 5\}$.
  • Figure 3: Cross-device expected energy-reduction@$k$ results averaged across all 22 applications. LASSI-EE (orange) achieves similar gains on AMD MI100 and NVIDIA A100 over vanilla LLM (blue) for each $k\in \{1, 3, 5\}$.
  • Figure 4: Optimization category distribution across all applications: (a) Overall distribution shows balanced utilization across four categories: Memory Hierarchy Optimization (MHO), Algorithmic & Computational Efficiency (ACE), Device-Specific Tuning (DST), and Parallelism & Thread Management (PTM). (b) Cross-device comparison demonstrates consistent categorical emphasis on both AMD MI100 and NVIDIA A100 platforms.