Introduction
Modern distributed computing frameworks often provide high-level "drop-in" libraries, such as cuPyNumeric or Legate Sparse, which allow users to write standard NumPy or SciPy code that scales to hundreds of GPUs. These libraries operate by decomposing high-level mathematical operations into a stream of tasks managed by a runtime system. However, this abstraction frequently incurs a significant performance penalty. Because these libraries are developed independently, they lack cross-boundary visibility, leading to excessive temporary distributed arrays, poor data locality, and missed opportunities for loop fusion.
The Diffuse System
To address these challenges, we present Diffuse, a system designed to automatically optimize distributed computations by fusing tasks and their underlying kernels. Diffuse bridges the gap between high-level libraries and low-level runtimes like Legion through three primary mechanisms.
Scale-free Intermediate Representation (IR)
Traditional compiler analyses often scale poorly as the number of processors increases. Diffuse overcomes this by utilizing a symbolic IR that describes data partitions (e.g., tiling patterns) rather than enumerating individual data chunks. This "scale-free" approach ensures that analysis time remains independent of the cluster size.
Distributed Task and Kernel Fusion
Diffuse analyzes a sliding window of incoming tasks to identify candidates for merging. It applies formal fusion constraints—such as verifying launch domain equivalence—to ensure that fusion does not introduce unnecessary inter-GPU communication. Once tasks are fused, Diffuse employs a Just-In-Time (JIT) compiler based on the MLIR framework to perform kernel fusion. This process rewrites loops and promotes temporary distributed arrays to task-local data, significantly reducing memory traffic.
Memoization
To mitigate the overhead of runtime analysis and compilation, Diffuse implements a memoization strategy. By recognizing recurring task structures through a technique similar to alpha-equivalence, the system can reuse optimized kernels even when specific memory addresses change across iterations.
Evaluation and Results
The performance of Diffuse was evaluated using a suite of scientific computing benchmarks, including Black-Scholes, Conjugate Gradient (CG), and Computational Fluid Dynamics (CFD) simulations, on an NVIDIA A100 DGX SuperPOD scaling up to 128 GPUs.
The system achieved a geometric mean speedup of 1.86x across all applications. Notably, in the Black-Scholes benchmark, Diffuse achieved a 10.7x speedup by collapsing 67 separate tasks into a single efficient GPU kernel. Furthermore, Diffuse-optimized Python code for the Conjugate Gradient solver outperformed both manually fused versions and the industry-standard PETSc MPI implementation.
Conclusion and Future Work
Diffuse demonstrates that the "abstraction penalty" of high-level languages can be largely automated away, allowing naturally written Python to match or exceed the performance of hand-tuned C++ and MPI. While the current implementation shows strong weak-scaling, future work will focus on reducing JIT warmup overhead and extending the symbolic IR to support more irregular, dynamic data partitions.
Summary updated