Introduction
Scientific computing is currently hindered by a significant "performance-productivity gap." While high-level languages like Python offer excellent readability and rapid development cycles, they often lack the execution speed required for large-scale simulations. Conversely, low-level implementations in C++ or CUDA provide high performance but are difficult to maintain and port across evolving hardware architectures. MIRGE addresses this by providing a Python-based framework that bridges high-level mathematical abstractions with high-performance GPU execution through lazy evaluation and symbolic dataflow graphs.
The MIRGE Compilation Pipeline
The core of the MIRGE framework is a multi-stage compilation pipeline designed to transform high-level Python code into optimized device kernels. This process begins with lazy evaluation, where array operations are recorded as an Array Dataflow Graph (ADFG) rather than being executed immediately.
Following graph generation, the framework performs algebraic simplifications and materialization decisions. These decisions determine whether intermediate results should be stored in memory or recomputed to save bandwidth—a critical optimization for memory-bound scientific codes. The graph is then lowered to a scalar Intermediate Representation (IR) using the loopy library, where loop fusion and contraction are applied. Finally, the optimized IR is emitted as OpenCL code for JIT compilation on the target hardware.
Metadata-Driven Optimization
A key innovation in MIRGE is the use of metadata to drive domain-specific optimizations. By tagging array axes with physical context—such as identifying which axis corresponds to a "mesh element" or a "degree of freedom"—the compiler can intelligently fuse operations that share data.
This approach allows the framework to handle the unique data layouts required by methods like Discontinuous Galerkin (DG) solvers. As shown in the mapping between mesh elements and array structures, MIRGE maintains a clear link between the physical domain and the computational representation, allowing scientists to focus on the "what" (the mathematics) while the framework optimizes the "how" (the execution).
Performance and Scalability
The framework's efficacy was evaluated using several fluid dynamics benchmarks, culminating in a simulation of the ACTII Scramjet Combustor. This "capstone" application involved a mesh of 34 million elements and over 3 billion degrees of freedom.
Key results include:
- Performance Portability: The same Python source code achieved high performance on Apple M2, NVIDIA GPUs, and AMD MI300A accelerators.
- Weak Scaling: MIRGE demonstrated near-ideal weak scaling on the Tuolumne supercomputer, utilizing up to 4,096 AMD MI300A GPUs.
- Efficiency: Throughput reached 100.4 million degrees of freedom per second on a single MI300A, with kernels operating near the theoretical limits of High Bandwidth Memory (HBM).
- Productivity: The MIRGE-Com solver required approximately 21,000 lines of code, compared to 48,000 for a functionally similar C++ solver, representing a significant reduction in development overhead.
Conclusion and Future Work
MIRGE successfully demonstrates that a high-level, array-based approach can achieve exascale-ready performance without sacrificing productivity. While the current greedy heuristic for materializing arrays is effective, future work will focus on more sophisticated profile-guided heuristics and improving communication-computation overlap to further enhance performance at extreme scales.
Summary updated