machine learning in compiler optimization
DESCRIPTION
Machine Learning in Compiler Optimization. By Namita Dave. Overview. What are compiler optimizations? Challenges with optimizations Current Solutions Machine learning techniques Structure of Adaptive compilers. Introduction. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/1.jpg)
Machine Learning in Compiler
OptimizationBy Namita Dave
![Page 2: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/2.jpg)
OverviewWhat are compiler optimizations?Challenges with optimizationsCurrent SolutionsMachine learning techniquesStructure of Adaptive compilers
![Page 3: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/3.jpg)
IntroductionOptimization refers to process of modifying to
achieve maximum efficiency in terms of storage, cost or time.
Machine learning techniques can be effectively used for optimizing based on specifics of program and target platform
![Page 4: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/4.jpg)
ChallengesInherently hard ProblemsInteractions between optimizations
![Page 5: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/5.jpg)
Inherently hard problemsDue to the interaction of compiler optimization
with the hardwareExample – Register allocation
![Page 6: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/6.jpg)
Interaction between optimizations
There can be positive or negative interactionsIt depends in the order in which optimizations
are appliedPositive Interaction Example
GCSE and Loop unrollingNegative interaction example
Instruction scheduling and Register allocation
![Page 7: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/7.jpg)
Instruction Scheduling vs Register Allocation
z = x[i] tmp = x[i+1+n]
Pre pass Post Pass
![Page 8: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/8.jpg)
Current SolutionsEmploy Heuristics
To decide whether to apply an optimization or notExample – In lining decisions
Phase orderingTo decide the sequence of optimizations so as to
minimize negative interactions
![Page 9: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/9.jpg)
Typical Optimizing compiler
![Page 10: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/10.jpg)
Problem?Compiler Heuristics and Phase ordering is
manual and predeterminedThe solution needs to be dependent on specifics
of program and the target platform
![Page 11: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/11.jpg)
SolutionUsing machine learning techniques, a near optimal solution can be developed.
![Page 12: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/12.jpg)
Heuristic selectionMachine learning techniques like supervised
classification, function approximation and function selection can be employed for heuristic selection
Example Supervised classification can be used to predict
best unroll loop factorGenetic programming can be used for learning
priority functions
![Page 13: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/13.jpg)
Automatic Phase OrderingUnsupervised learning techniques can automate
phase orderingBased on the notion of similarity of programsOffline training data can be used to identify a
set of best phase orderings for similar programsBased on feature vectors, similar programs can
be found for a given new program
![Page 14: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/14.jpg)
Structure of Adaptive compiler
![Page 15: Machine Learning in Compiler Optimization](https://reader033.vdocument.in/reader033/viewer/2022051221/56816386550346895dd47066/html5/thumbnails/15.jpg)
Thank You