TL;DR
This paper introduces Couillard, a C-compiler that translates annotated C code into a data-flow graph and corresponding super-instruction code for the TALM execution model. This approach simplifies parallel programming by allowing developers to define coarse-grained parallel tasks (super-instructions) and their dependencies, enabling competitive performance on multi-core systems with less effort than traditional methods.
What Problem Does This Paper Address?
Parallel programming is notoriously complex, especially when dealing with fine-grained data-flow models that can introduce significant overhead and intricate control flow management. While data-flow naturally exposes parallelism, describing dependencies and control flow can be challenging for programmers. Existing approaches often aim to hide data-flow from the programmer, which can limit flexibility. The TALM (Architecture and Language for Multi-threading) model offers a coarse-grained approach, but its manual implementation and management of super-instructions and their connections can still be cumbersome. This paper addresses the need for a more accessible and automated way to leverage the benefits of data-flow parallelism, specifically within the TALM framework, by providing a compiler that bridges the gap between imperative C code and data-flow execution.
Methods
The core of this work is the Couillard compiler, which takes annotated C programs as input and generates two key outputs:
- Data-flow graph: Represented in Graphviz notation for visualization and in TALM's Instruction Set Architecture (ISA) for execution.
- Super-instruction C-code: This code is compiled into a dynamically linked library, allowing the TALM execution system (Trebuchet) to call these super-instructions as functions.
Couillard's front-end parses a subset of ANSI-C extended with specific directives for defining super-instructions and their input/output variables. It constructs an Abstract Syntax Tree (AST) which is then used to generate the data-flow graph. The compiler handles the complexity of translating control flow (loops, if-then-else) outside of super-instructions into TALM assembly code.
A key aspect of Couillard is its handling of parallel super-instructions and their associated variables. It introduces specific syntax (treb_super <single|parallel>, treb_parout) to manage instances of parallel tasks and their shared or instance-specific data. The compiler also provides mechanisms for specifying how instances of parallel super-instructions communicate with each other (e.g., local.<identifier>, starter.<identifier>).
The Trebuchet system, a hybrid Von Neumann/data-flow execution environment, is the target platform. It uses a set of processing elements (PEs), each associated with a host thread, to execute the data-flow graph. Trebuchet supports work-stealing for load balancing and can execute super-instructions directly.
Datasets
The paper evaluates Couillard on two state-of-the-art benchmarks from the PARSEC suite:
- Blackscholes: A regular application that calculates European option prices.
- Ferret: An irregular application used for content-based similarity search.
The authors also mention using a manually fine-tuned version of Ferret. They compare their results against popular parallel programming models like Pthreads, OpenMP, and Intel Thread Building Blocks (TBB).
Key Insights and Ideas
- Bridging Imperative and Data-Flow: Couillard effectively bridges the gap between familiar imperative C programming and the powerful parallelism offered by data-flow execution models like TALM, making advanced parallel techniques more accessible.
- Coarse-Grained Parallelism Simplifies Development: By allowing programmers to define "super-instructions" (coarse-grained blocks of code), the complexity of managing fine-grained parallelism and its associated overheads is significantly reduced.
- Flexible Parallel Task Definition: The
treb_super <single|parallel>directive allows developers to clearly distinguish between tasks that should have a single instance and those that can be replicated for parallel execution, offering fine-grained control over parallelism. - Sophisticated Data Dependency Management: The compiler's ability to handle
treb_paroutvariables and instance-specific access (:: <NUMBER>,:: mytid,:: lasttid) is crucial for correctly managing data flow between parallel instances of super-instructions. - Hiding I/O Latency: The paper demonstrates how TALM and Couillard can be used to hide I/O latency by overlapping I/O operations with computation, a common challenge in parallel applications.
- Non-Linear Pipeline Support: The framework supports the creation of non-linear parallel pipelines, showcasing its flexibility for complex application structures.
Key Results
The paper reports competitive performance for applications compiled with Couillard and run on Trebuchet, achieving speedups comparable to or even exceeding those of handcrafted Pthreads and TBB implementations on a multi-core machine (up to 24 processors).
- Blackscholes: Achieved good performance, comparable to Pthreads implementations, with the flexibility to achieve even greater results by employing more complex techniques like hiding I/O latency.
- Ferret: The parallel version using TALM and Couillard, with work-stealing for load balancing, achieved close to linear speedups for up to 24 cores, outperforming the TBB version and being very close to the Pthreads version. The work-stealing mechanism significantly contributed to performance.
Limitations and Future Work
- Limitations:
- Couillard currently supports a subset of ANSI-C, not the full grammar.
- The TALM model, and by extension Couillard, does not yet support speculative execution, meaning programmers must still prevent data races manually unless speculative execution is explicitly used (which is not yet supported by the compiler).
- Command line arguments are not directly declared within the application code but are accessed through special variables provided by Trebuchet.
- Future Work:
- Improving the work-stealing mechanism in Trebuchet for better performance in irregular applications.
- Developing efficient automatic placement strategies for applications on Trebuchet.
- Extending Couillard to support templates for common parallel patterns.
- Integrating Trebuchet's memory speculation mechanisms into Couillard.
- Exploring interfaces for calling GPGPU or FPGA accelerators and managing data transfers.
- Finding more applications that are good candidates for parallelization with Couillard.
Summary updated