Next: Risks
Up: First Year Plan of Optimisation
Previous: Introduction
The basic task, as described above, is to investigate usage-type
systems, for the purpose of driving optimising transformations in the
Glasgow Haskell Compiler GHC. I propose to break down this task as
follows.
- 1.
- Digest and understand the work of Turner,
Mossin, and Wadler [TWM95a,TWM95b]
and of Mogensen [Mog97].
- 2.
- Implement one or other, or a combination of
both, in a `toy' functional language for the purposes of
experimentation.
- (a)
- Usage-type checking only at
first.
- (b)
- Add usage-type inference to the
system. Usage-type inference means inferring usage types for terms
that already have explicit conventional types. We suspect that this
is easier than full type inference on unannotated terms. If possible,
build two separate inference engines, one for
[TWM95a] and one for [Mog97].
- (c)
- The papers mention some problems with
usage types and polymorphism. These will need to be investigated,
since polymorphism is certainly required in this system.
Specifically, while it is relatively simple to treat polymorphic
functions as monomorphic in the usage of their arguments, this is not
necessarily the best approach.
- 3.
- Investigate various possible forms of
usage-type annotation, compare their advantages and disadvantages, and
select one as most appropriate for the application. We want a uniform
notation, rather than the ad-hoc ones that appear
in [TWM95a] and [Mog97]. Note that
we must consider not only the type representation, but also the
term representation: how do the types show up in the terms, and
what consequences does this have for, e.g., the semantics of function
application? The chosen notation must not merely work; it must be
manageable. The investigation will probably involve trying out
various possibilities in the toy language.
- 4.
- With the chosen system of usage types,
investigate optimisations.
- (a)
- Identify the optimisations that can
be performed using this usage-type information.
- (b)
- Investigate how existing
optimisations may be rationalised, controlled, and/or subsumed by this
system.
- 5.
- Investigate the theoretical benefits of
the system.
- (a)
- Find an appropriate work model for
checking the `safety' of optimisations (intuitively, an optimisation
is safe if it never or almost never duplicates work); i.e., formalise
Peyton Jones' notion of
-safety [PJS97, §4.1].
- (b)
- Attempt to prove the safety of the
optimisations. Possibly prove other formal properties; e.g., check
the details of [TWM95a, §5]'s claim of soundness and
completeness of their reduction rules with respect to their
operational semantics.
- (c)
- Investigate whether the
optimisations will provide a significant benefit (if the work model
has sufficient resolution).
- 6.
- Investigate the practical benefits of the
system.
- (a)
- Insert the usage-type inference and the
optimisations into GHC itself.
- (b)
- Perform tests on real programs to
determine whether significant gains are made by using this system.
- 7.
- Document background and related work.
- (a)
- Compare usage-type inference with
other similar systems such as linear types, uniqueness types, and
others.
- (b)
- Do a literature survey, especially
of those who are doing practical work with linear types. Simon
suspects there are very few people doing this; Tom thinks maybe some
are. I must know which individuals are doing related work.
- 8.
- Investigate related areas of interest.
- (a)
- Investigate the lambda-cube style
of syntax for Haskell's intermediate language (i.e., the Henk
approach [PJM97]), as a kind of trial run /
experiment for applying it to Haskell itself. This (probably) has low
value to my PhD, but high value to Simon and GHC.
Next: Risks
Up: First Year Plan of Optimisation
Previous: Introduction
Keith S. Wansbrough
1/9/1998