Abstract
No modelo DataFlow as instruções são executadas tão logo seus operandos de entrada estejam disponíveis, expondo, de forma natural, o paralelismo em nível de instrução (ILP). Por outro lado, a exploração de paralelismo em nível de thread (TLP) passa a ser também um fator de grande importância para o aumento de desempenho na execução de uma aplicação em máquinas multicore. Este trabalho propõe um modelo de execução de programas, baseado nas arquiteturas DataFlow, que transforma ILP em TLP. Esse modelo é demonstrado através da implementação de uma máquina virtual multi-threaded, a Trebuchet. A aplicação é compilada para o modelo DataFlow e suas instruções independentes (segundo o fluxo de dados) são executadas em Elementos de Processamento (EPs) distintos da Trebuchet. Cada EP é mapeado em uma thread na máquina hospedeira. O modelo permite a definição de blocos de instruções de diferentes granularidades, que terão disparo guiado pelo fluxo de dados e execução direta na máquina hospedeira, para diminuir os custos de interpretação. Como a sincronização é obtida pelo modelo DataFlow, não é necessária a introdução de locks ou barreiras nos programas a serem paralelizados. Um conjunto de três benchmarks reduzidos, compilados em oito threads e executados por um processador quadcore Intel Core i7 920, permitiu avaliar: (i) o funcionamento do modelo; (ii) a versatilidade na definição de instruções com diferentes granularidades (blocos); (iii) uma comparação com o OpenMP. Acelerações de 4,81, 2,4 e 4,03 foram atingidas em relação à versão sequencial, enquanto que acelerações de 1,11, 1,3 e 1,0 foram obtidas em relação ao OpenMP.
Introduction: The Multicore Challenge
As single-core performance hits physical limits, the industry has shifted toward multicore processors. However, writing efficient multi-threaded code remains notoriously difficult. Traditional Von Neumann architectures rely on sequential control flow, forcing programmers to manually manage task division and synchronization using primitives like locks and barriers. These often lead to idle cores or complex bugs.
Trebuchet addresses this by revisiting the DataFlow model. In DataFlow, an instruction executes as soon as its input data is available, naturally exposing parallelism. While fine-grained DataFlow often suffers from high overhead, Trebuchet bridges this gap by creating a hybrid virtual machine (VM) that translates instruction-level parallelism (ILP) into thread-level parallelism (TLP) on modern hardware.
Methods and Architecture
Trebuchet is a multi-threaded VM based on a dynamic DataFlow architecture. The system defines "Processing Elements" (EPs), each mapped to a native thread on the host operating system. The compilation and execution pipeline is designed to automate the transition from sequential code to parallel execution units.
As shown in the workflow above, standard C code is transformed into a DataFlow-compatible source (.df.c). This source is then compiled into a binary library and an assembly representation (.fl). The final step involves allocating these instructions to specific EPs, which handle the execution and synchronization implicitly through data availability.
Super-instructions and Granularity
A key innovation in Trebuchet is the use of super-instructions. To solve the overhead associated with interpreting every single fine-grained operation (like add or sub), Trebuchet groups sequential blocks of Von Neumann code into larger units. These blocks are triggered by the DataFlow engine but execute directly on the host CPU at near-native speed.
This hybrid approach allows the system to use DataFlow for coarse-grained coordination between blocks while maintaining the raw speed of Von Neumann execution within the blocks. By adjusting the granularity—the size of these code blocks—the system can optimize the balance between communication overhead and parallel execution.
Key Results
The researchers evaluated Trebuchet using three benchmarks on an Intel Core i7 920 (8 logical threads), comparing it against sequential and OpenMP implementations:
- Ray-tracing: Achieved a 4.81x speedup over sequential execution, outperforming OpenMP by 11%.
- Recursive Determinant: Achieved a 2.4x speedup over sequential execution, outperforming OpenMP by 30%.
- Matrix Multiplication: Achieved a 4.03x speedup over sequential execution, performing on par with OpenMP.
The results demonstrate that the DataFlow model effectively scales with task complexity. In the determinant test, as matrix sizes increased, Trebuchet’s advantage over OpenMP grew, highlighting its efficiency in managing complex dependencies without manual synchronization.
Conclusion and Future Work
Trebuchet successfully demonstrates that a DataFlow VM can automatically extract TLP from ILP, providing a scalable alternative to manual multi-threading. While current implementations require some manual effort in defining super-instructions, future work aims to automate this through advanced compilers. Additionally, integrating speculative execution could further enhance the model's ability to handle complex memory hazards and dynamic load balancing.
Summary updated