forked from scala-lms/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.scala
158 lines (100 loc) · 3.78 KB
/
index.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/**
Tutorials and Documentation
===========================
This tutorial series introduces _Lightweight Modular Staging_ (LMS), a framework for
runtime code generation in Scala.
Outline:
<div id="tableofcontents"></div>
Quick Start
-----------
These docs are a collection of literate Scala files. Clone the [GitHub repo](http://github.com/scala-lms/tutorials):
git clone https://github.com/scala-lms/tutorials.git
Check the [`README.md`](https://github.com/scala-lms/tutorials/blob/master/README.md) file for prerequisites and start hacking!
### Why Generative Programming ?
Because it enables **abstraction without regret**: the key idea is to write very high-level
and generic programs that generate specialized and extremely fast low-level code at runtime.
Programming abstractions that would usually be avoided in performance-sensitive code
(objects, type classes, higher-order functions) can be used **during generation** without
affecting performance of the **generated code**.
### Why LMS ?
Because it is **lightweight** and **modular**: LMS is just a Scala library. With types, it distinguishes
expressions that are evaluated _now_ (type `T`) vs _later_ (type `Rep[T]`).
LMS comes with **batteries included**: it provides many optimizations such as common subexpression elimination out of the box, and it goes beyond purely generative approaches by
providing an extensible intermediate representation that can be used to implement
sophisticated domain-specific compiler pipelines.
At the same time LMS is **hackable**: since it is just a library, all aspects can be
modified or extended to suit a particular purpose.
Self-Contained Tutorials
------------------------
The following tutorials are available:
- [Getting Started](start.html)
Rep[T] vs T
- [Shonan HMM Challenge](shonan.html)
Sparse matrix vector multiplication
Selective unrolling and precomputation
- [Regular Expressions](regex.html)
From interpreters to compilers using staging
- [Ackermann's Function](ack.html)
From recursive functions to automata
Automatic specialization using staging
- [Automata-Based Regex Matcher](automata.html)
NFA to DFA conversion using staging
- [SQL Engine](query.html)
Efficient data processing
- [Fast Fourier Transform (FFT)](fft.html)
Numeric kernels and rewriting optimizations
- [Sliding Stencil](stencil.html)
Rearranging loop shapes
<!--
LMS In-Depth
------------
<div class="alert alert-danger" role="alert"> <strong>TODO:</strong> flesh out </div>
### Getting Started
- Why generative programming?
_Because abstraction without regret!_
- Why LMS?
_Because batteries included and hackable!_
- Hellow World
### Design Patterns
Purely generative:
- Specialization on static data
- Abstractions in the meta-language
- From interpreter to compiler
- Mixed-stage data structures
- Type classes and generic programming
Including IR:
- DSLs with multiple abstraction levels
### From Zero to LMS
- Program generation with Strings
- Program generation with Trees
- Program generation with Graphs
### LMS Internals
- Graph IR
- Effects
- Code Motion
- Transformers
- Code Generators
Advanced:
- Functions
- Structs
### Integration
- LMS for Scala
- LMS for JavaScript
- LMS for C
Advanced:
- LMS for Scala Macros
- LMS for Vector Intrinsics
- LMS for GPUs
- LMS for FPGAs
- LMS for SMT Solvers
- LMS for Truffle / Graal
-->
LMS In Depth
------------
The material below has been extracted from Tiark's PhD thesis ([PDF](http://infoscience.epfl.ch/record/180642/files/EPFL_TH5456.pdf)) and is still undergoing
revision for the web.
1. [About generative programming](01_overview.html)
1. [Generative programming and LMS basics](02_basics.html)
1. [Intermediate representation and optimizations](03_compiler.html)
1. [Staging and LMS at work](04_atwork.html)
*/