Abstract: The Intel Xeon Phi (Many Integrated Core or MIC) architecture offers significant parallel processing power, yet its performance is often constrained by the latency of data transfers over the PCIe bus. This paper evaluates the use of multiple streams to overlap communication with computation and partition hardware resources. Using the hStreams library, the researchers demonstrate that systematic "streaming" can improve application performance by up to 24%. The study provides a detailed analysis of temporal and spatial sharing, offering heuristics for optimal task and resource granularity.
Introduction: The PCIe Bottleneck
In heterogeneous computing, the host CPU offloads intensive workloads to a coprocessor like the Intel Xeon Phi via the PCIe bus. This architecture frequently encounters a significant bottleneck: the time required to move data between the host and device often exceeds the speedup gained from parallel execution. While techniques like CUDA Streams are well-established for NVIDIA GPUs, the behavior of similar mechanisms on OS-enabled coprocessors like the Xeon Phi has historically been less transparent. This research aims to demystify these mechanisms and provide a framework for optimizing performance through multiple streams.
Methodology: hStreams and hBench
The researchers utilized Intel’s hStreams library to manage concurrency. Their approach involved two primary phases:
- Microbenchmarking: Using a custom tool called
hBench, they isolated the raw capabilities of the Phi, specifically testing "Temporal Sharing" (pipelining) and "Spatial Sharing" (core partitioning). - Application Evaluation: Six real-world applications, including Matrix Multiplication, Cholesky Factorization, and selections from the Rodinia Suite (Kmeans, Hotspot, NN, SRAD), were ported to the hStreams environment to test the proposed optimizations.
Temporal Sharing: Overlapping Communication and Computation
A core strategy for hiding latency is temporal sharing, where data transfers for subsequent tasks occur simultaneously with the execution of the current task.
As shown in the figure above, multiple streams (S0-S3) allow the Host-to-Device (H2D) transfer of one task to overlap with the execution (EXE) of another. However, the researchers discovered a critical limitation: unlike some high-end GPUs, the Xeon Phi performs H2D and Device-to-Host (D2H) transfers serially. The total transfer time is the sum of both directions, meaning performance gains are strictly dependent on the ability to overlap these serial transfers with computation.
Spatial Sharing: Resource Partitioning
Beyond temporal overlapping, the study explored "Spatial Sharing," which involves dividing the Phi’s many cores into independent physical partitions. This reduces resource contention and improves cache utilization.
The hStreams library maps logical streams to specific "places" in a domain, which correspond to physical core partitions on the MIC. The researchers found that choosing a number of partitions ($P$) that is a divisor of the total available cores (e.g., 56 cores divided into 4 partitions of 14) is essential for minimizing interference. Even for "non-overlappable" applications like Kmeans, spatial partitioning provided benefits by reducing dynamic memory allocation overhead and improving core utilization.
Key Results and Heuristics
The evaluation yielded several significant insights:
- Performance Gains: The researchers achieved average improvements of 24.1% for Cholesky Factorization and Kmeans, and approximately 9% for Matrix Multiplication and Nearest Neighbor.
- Optimal Granularity: A recurring finding was that most applications reached peak performance when the workload was divided into at least 4 tasks ($T=4$) mapped to 4 partitions ($P=4$).
- Multi-MIC Scaling: The hStreams approach showed promising results for scaling across multiple Phi cards without requiring manual code changes.
Conclusion and Future Work
While multiple streams significantly boost performance, achieving "full overlap" remains challenging due to stream management overhead. In some compute-light cases like the Hotspot benchmark, this overhead can even lead to slight performance degradation. Future research will focus on using machine learning to automate the selection of task and resource granularity and developing code transformation tools to refactor serial applications into stream-friendly, overlappable formats.
Summary updated