Optimising Transformations Optimising Transformations for for Hardware Compilation Hardware Compilation Ashley Brown, Department of Computing, Imperial College London Contributions Contributions • Transformation language for restructuring and Transformation language for restructuring and optimisation of Handel-C supporting data- optimisation of Handel-C supporting data- integrity conditions. integrity conditions. • Prototype transformation engine for the Prototype transformation engine for the language. language. • Automatic transformations giving a 35-70% Automatic transformations giving a 35-70% reduction in execution time. reduction in execution time. • An insight into the interaction of An insight into the interaction of transformations: variability between platforms, transformations: variability between platforms, difficulty of prediction. difficulty of prediction.
49
Embed
Optimising Transformations for Hardware Compilation Ashley Brown, Department of Computing, Imperial College London Final Project Presentation, 21 st June.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Ashley Brown, Department of Computing, Imperial College London
Final Project Presentation, 21st June 2005
ContributionsContributions• Transformation language for restructuring and optimisation of Transformation language for restructuring and optimisation of
Handel-C supporting data-integrity conditions.Handel-C supporting data-integrity conditions.• Prototype transformation engine for the language.Prototype transformation engine for the language.• Automatic transformations giving a 35-70% reduction in Automatic transformations giving a 35-70% reduction in
execution time.execution time.• An insight into the interaction of transformations: variability An insight into the interaction of transformations: variability
between platforms, difficulty of prediction.between platforms, difficulty of prediction.
ContributionsContributions• Transformation language for restructuring and optimisation of Transformation language for restructuring and optimisation of
Handel-C supporting data-integrity conditions.Handel-C supporting data-integrity conditions.• Prototype transformation engine for the language.Prototype transformation engine for the language.• Automatic transformations giving a 35-70% reduction in Automatic transformations giving a 35-70% reduction in
execution time.execution time.• An insight into the interaction of transformations: variability An insight into the interaction of transformations: variability
between platforms, difficulty of prediction.between platforms, difficulty of prediction.
IntroductionIntroduction
21st June 2005 Ashley Brown # 3
What would we like to do?What would we like to do?
• Take an algorithm in written in C.• Generate an efficient hardware design, run it on an
FPGA.• Fast design cycle, easy to maintain code.• C programmers should be able to create fast hardware!
21st June 2005 Ashley Brown # 4
Background: Handel-CBackground: Handel-C
• C-based programming language for digital system design.
• One clock-cycle per statement.
• Explicit parallelism.
• Compiler generates hardware design from Handel-C source.
while (j != 3) { par { t0 = aa[0] * bb[0]; t1 = aa[1] * bb[1]; } par { cc[i][j] = t0 + t1; j++; }}
Handel-C code example.
21st June 2005 Ashley Brown # 5
ProblemsProblems
• Software programmers: Bad Handel-C, poor hardware.– No exploitation of statement-level parallelism.– Long expressions.– Lots of for loops!
• Experienced Handel-C designers: good hardware, hard to read code.– Trickery to reduce clock cycles, increase clock rate.
• Finding the “optimal” solution is not easy.– Optimisation effectiveness depends on the target architecture
(see the results later!)
21st June 2005 Ashley Brown # 6
SolutionsSolutions
• Restructure Handel-C code to optimise.– Can parallelise if desired.– Duplicate hardware if necessary.
• Apply transformations to the original source, leaving it intact.– The original readable description is still available.– A more efficient version is used for hardware generation.
• Allow the user to define custom transformations with a transformation language.
• Generate a whole design-space of solutions, with different optimisations.
21st June 2005 Ashley Brown # 7
Current SolutionsCurrent Solutions
• ROSE, Stratego, CTT.• CTT has straightforward syntax.
– Others are more complicated, not intuitive.
• Stratego support strategies.– Strategies in the hardware world difficult to decide.– Need a different strategy for each architecture.
• Haydn-C: restructuring of code similar to Handel-C– But not user-specified transformations.
21st June 2005 Ashley Brown # 8
What’s New?What’s New?
• Previous work with user-specified transformations has been:– For software-based C.
– Aimed at parallelising/optimising for microprocessors
• Can’t duplicate microprocessor hardware on the fly – it’s either there or not.We can duplicate hardware, pipeline – FASTER DESIGN!
• Previous work on hardware language transformations do not allow the user to describe transformations (Haydn-C).We do – the user can target their code explicitly.
• Exploring an entire design-space is usually done at the hardware level, not high-level language (although not always, e.g. ASC).We generate a full design-space – find *the* best solution.
The Transformation The Transformation LanguageLanguage
21st June 2005 Ashley Brown # 10
Cobble-CMLCobble-CML
• Cobble: compiler framework for Handel-C.
• CML: partially defined proposal for a transformation language for Cobble, builds on CTT.
• Assume design with an fmax of 104MHz, must match that.
• Many solutions matching.– we should consider other factors such as area, power or
number of cycles.
• Being brief: look at solutions 139 and 232.• Only partially parallelised. Solution with most parallelism
(239) does not meet the fmax requirement.
21st June 2005 Ashley Brown # 45
Future WorkFuture Work
• Extensions to the language to allow additional matching.• expr replicator, complex expression matching.• Preservation of structure – e.g. a++; does not become a
= a + 1;• Heuristics for selecting transformations to apply.• Genetic algorithms for transformation selection? “Breed”