-
Notifications
You must be signed in to change notification settings - Fork 119
Developer's Guide
tmcdonell edited this page Oct 21, 2014
·
5 revisions
TODO: developer's guide to hacking
Compiler Pipeline
- Brief overview of what happens when you call "run"
- Introduce the main steps and associated modules
- Conversion from HOAS -> de Bruijn. HOAS representation is defined in D.A.A.Smart.hs. Conversion happens in tandem with sharing recovery, implemented in D.A.A.Trafo.Sharing. The internal de Bruijn representation is defined in D.A.A.AST.
- Optimisation of the AST. Primarily this involves array fusion in D.A.A.Trafo.Fusion, and some scalar simplifications in D.A.A.Trafo.Simplify.
- The AST is then passed to each backend. In the CUDA backend, code generation and compilation is initiated for each node, via D.A.A.CUDA.Compile and D.A.A.CUDA.CodeGen. The AST is annotated with the compilation results. At the same time, we transfer input arrays to the GPU. Memory management is handled via finalisers defined in D.A.A.CUDA.Array.Table.
- The program is executed via D.A.A.CUDA.Execute. Concurrent execution is handled via D.A.A.CUDA.Execute.Stream and D.A.A.CUDA.Execute.Event.
Types
- D.A.A.Array.Sugar: surface (Elt, Array, Arrays) vs. representation (EltRepr, ArrRepr, ArrayData).
- D.A.A.Type: reified dictionaries
AST
- D.A.A.Smart: Source representation: Exp and Acc types, stratified scalar vs. collective operations
- D.A.A.AST: internal representation, explicit environments; use of representation types.
Exercises
- class instance reification
- marshalling data (weak hash tables)
- Traversing the AST, adding information to nodes using the knot-tying trick.