This page contains the scribe notes for the Fall 2008 COMP 517 seminar. The scribe should add a new heading and section below on this page, or attach a separate file to this page. The heading or the file should then be linked from the course schedule.

01/26/2009: Basics of Multi-stage Programming I

Speaker: Walid

Scribe: Jun

The code that Walid wrote during class is attached.

MetaOcaml is a statically typed functional programming language based on OCaml.

Statically typed means that the compiler checks that each operation is valid in terms of types:

# 1 + 1;;
- : int = 2

The implementation found that the expression has type int (INTeger).

# let f (x) = x + 1;;
val f : int -> int = <fun>

MetaOCaml has inferred that x must be an int and that f returns int.

# f "a";;
This expression has type string but is here used with type int

MetaOCaml has found that you used f with the wrong type of argument, before attempting to execute it.

Polymorphism: when the body of the function doesn't constrain the argument variable's type, we get a generic type for a function.

# let g (x) = x;;
val g : 'a -> 'a = <fun>

Here 'a means "any type".

# g "rabbit";;
- : string = "rabbit"
# g 17 ;;
- : int = 17

OCaml's Hindley-Milner type system has type inference, meaning you don7t need to explicitly write down types in you program, and also polymorphic types shown above.

(* OCaml comments are written like this.  *)

Let's try writing a power function.

(*
We want the function to work like this:
power 2 3 = 8
power 3 2 = 9
power x 0 = 1
*)

let rec power x n =
  if n = 0
  then 1
  else ... power x (n-1) ...

What do we fill the ellipses with? Given a value for (power x (n-1)), we know that the value for (power x n) is (x * (power x (n-1)))

let rec power x n =
  if n = 0
  then 1
  else x * (power x (n-1))

Write that in a file (say p.ml), go back to the interactive interface, and type:

# #use "p.ml";;
val power : int -> int -> int = <fun>
# power 3 2 ;;
- : int = 625
# power 25 25;;
- : int = -851481255

(The last one overflowed. (Meta)OCaml's int is 31 bits long.)

Now let us use a timing utility.

# Trx.init_times ();;
- : unit = ()
# Trx.timenew;;
- : string -> (unit -> 'a) -> 'a = <fun>
# Trx.timenew "power 2 17" (fun () -> power 2 17);;
- : int = 131072

The fun creates an anonymous function. With Trx.print_times we can see the timing result.

# Trx.print_times ();;
__ power 2 17 _________ 2097152x avg= 8.973522E-04 msec

The power function above goes through the loop every single time we call it, but if we call it for a known n, all it really needs to do is the multiplication. This is where MSP comes in. MSP allows you to generate efficient, more specialized code dynamically.

# .<1 + 1>. ;;
- : ('a, int) code = .<(1 + 1)>.

The brackets ".<>." creates code that does the computation that it encloses. In the above example we have a code value that adds 1 to 1.

let rec power' x n =
  if n=0
  then .<1>.
  else .<.~x * .~(power' x (n-1))>.

We derived this code by pretending that we know what n is, but not x. In effect, we have a value for n but code for x. We should specialize this code before using it:

(* create code value that represents an optimized power function for n = 17 *)
let codepower17 = .<fun z -> .~(power' .<z>. 17)>.;;

(* "run" the code above to get a compiled function.  *)
let power17' = .!codepower17;;

# Trx.time 200000 "power17 2" (fun () -> power17 2);;
- : int = 131072
# Trx.time 200000 "power17'2" (fun () -> power17' 2);;
- : int = 131072
# Trx.print_times ();;
__power17 2 ________ 200000x avg= 9.868300E-04 msec
__power17'2 ________ 200000x avg= 2.208250E-04 msec
- : unit = ()

We see that the specialized function is about 4-5 times faster. power', given n, essentially resolves all the operations on n (namely, the decrementing, testing if it's zero, and recursive call) without requiring the value of x. For x, it just receives a placeholder ..

The power function can be made more efficient by doing the multiplication differently. Instead of computing x, x*x, x*(x*x), then x*(x*(x*x)), we can directly go from x*x to (x*x)*(x*x).

let square x = x * x;;

let rec powerl x n =  (* `l' for logarithmic time *)
  if n = 0
  then 1
  else if (n mod 2) = 0
  then square (powerl x (n / 2))
  else x * (powerl x (n-1))

We can stage this as follows

let rec powerl' x n =
  if n = 0        (* no change; we can do this if we just know n *)
  then .<1>.      (* we need to return code, not int *)
  else if (n mod 2) = 0   (* no change; can do this by just knowing n *)
  then .<square .~(powerl' x (n / 2))>.
  else .<.~x * .~(powerl' x (n-1))>.  (* just copy the one from power' *)

Note: in (simple) staging, we only add .<>. and .~ without changing the program structure.

Now go to the interactive loop and type

# powerl' .<101>. 5;;
- : (a', int) code =
.<(101 * ((... square ...)
          ((... square ...) (101 * 1)))>.

The (...square...) part just says that the function square is being referred to in the code object.

# Trx.time 200000 "power17 2" (fun () -> power17 2);;
# Trx.time 200000 "powerl17' 2" (fun () -> powerl17' 2);;
# Trx.print_times ();;
___ power17 2 ____________ 200000x avg= 6.170550E-04 msec
___ powerl17' 2 ____________ 200000x avg= 1.908000-04 msec

The staged logarithmic version is faster. But we can make it even faster by removing the reference to square ("inline" square) as well.

Exercise: Try to inline square.

(Note the ";;" that initiates execution of the expression in the interactive session.)

02/07/2009: A Gentle Intro to MSP (Part II)

Speaker: Group Discussion

Scribe: Angela

  • Eddy:
    • Why not RSRS
    • Why CPS

  • Richard:
    • What's an interpreter
    • What is CPS: Maybe example, more diagrams.
    • Is OCaml used to interpret Scheme.

  • Jun:
    • Why not standard Scheme

  • Cherif:
    • Only part that is not clear: partially static data structures
    • Why is it useful to push the code type inwards.
    • Explain of CPS have some redundancy
      • CPS explanation seems a bit repetition
      • Richard: why is CPS useful from high level point of view.
    • Interpreters is very difficult as a starting point.

  • Marisa
    • Very logical paper.
    • learned what is lambda abstraction

  • Fulong (Question)
    • CPS (page 16) is Fibonacci function using CPS? (k r = r)
    • What (fun x -> e1) e2
    • Something about dynamic scheduling and dynamic interpreting, I don't quite get that.

02/09/2009: A Gentle Intro to MSP

Speaker: Group Discussion

Scribe: Cherif

  • Section 1.1
    • lays out problem nicely
    • string vs AST
      • can we do better?
    • small improvement possible

  • Section 1.3 about basic notions of equivalence
    • doesn't need to be in the paper
    • but what is the difference between run and escape? Should it stay behind the scenes?

  • We should be focused on coming up with a really simple as streamlined as possible introduction that will get people excited about MSP.

  • Change order of evaluation (maybe an advanced topic)
    • We don't want to change the algorithm
    • Using side effects (like print statements)
    • Showing the data flow graph
    • How we explain the point about not changing the program early on? Maybe adding staging annotations only.
    • Side by side diagrams (on the top of the page) showing unstaged version staged
    • Explicitly list the kind of changes that might be allowed (let insertions and CPSing only)

  • Again, how to talk about CPSing?

  • Staging allows us to write generic functions
    • The "power" function appeared a bit late as a generic function
    • Can we use the power function to illustrate all the different abstraction mechanisms.

  • define the difference between interpretation and compilation

  • what are bytecodes?
    • Technology that has become widely known due to Java. It's an intermediate language that is supposed to be close to assembly.

  • In the "to probe further" section, we can say that MSP has been around from a long time but it was more of a hack until

  • The CPS motivation was explained much more clearly than in part II (The evil if problem) but how to do CPSing wasn't explained.
    • In the new tutorial, we need to explain why and how to CPS

02/13/2009: A Gentle Intro to MSP

Speaker: Group discussion

Cherif: difference between esc and run are not well explained.

run cannot be applied to open terms but otherwise it can appear anywhere; esc cannot be applied outside brackets but it can be applied to open terms.

Angela: Can we always replace esc with run, if the argument is a closed term?

Eddy: You get totally different results. If you have

let x = . y>. in .< C[.~x] >.

this would produce .<C[fun y -> y]>. but

let x = . y>. .< C[run x] >.

produces .< C[.! x] >. where run is not "run" yet. There are also performance differences. Moreover, if we have

.< C[ .~loop] >.

where loop is some divergent expression, this will never creates a code value, whereas

.< C[ .!loop ] >.

immediately returns with a code value that happens to contain a divergent expression.

Richard: (a question I didn't quite catch) Eddy: there's no intentional analysis of code values.

It seems that there's enough confusion with the run-esc distinction even within the group. We should make it very explicit in the tutorial.

Cherif: the power function is a good example, but it doesn't make the limits of what run/esc can do very clear.

Eddy: The first section should say what exactly MSP is.

Cherif: The only two examples I've seen are interpreters and power.

There's also generalized Fibonacci and FFT.

Cherif: what are env classifiers anyway? Should we have a small section about it? What can it do? All tutorials just say it can be ignored. As a programmer, should I be aware of it at all? (If not, why is it exposed?)

Jun: you need to be conscious about it if you want to quantify over code types, like if you want to build an generic, aggregate structure that contains code.

Ron: maybe we should have a small section mentioning "advanced topics" like env classifiers at the end, and give examples like

type 'a foo = Foo of ('a, int) code

Eddy: The point of env classifiers is to prohibit running open code.

Ron: There are type systems for MSP that don't have 'a but they're more restrictive. But it's certainly not really intuitive for the programmer.

Angela: what would be the type of .. for example?

Eddy: It depends on the context. With . .~(.!..)>. it's untypable. The way that the type system figures this out is by assigning some environment classifier (a type variable) to x and checking that the classifiers don't match.

Eddy: Classifiers seem to be a hack that just happens to work.

Ron: if you wrote a program let f x y = .<.~x>.;; what would be its type?

Richard: is there a way to write power so that it's appropriate to use more than one run?

Eddy: Not really. Most applications just need one run, at the top.

Cherif: for staged interpreter, you would want to call run over and over.

Cherif: so staged interpreter is a compiler?

Eddy: not quite.

Jun: what's the difference?

Cherif: the interpreter examples confuses me, because what's statically known and what's known is not clear. In power, n is known, x is not. What's the analogue in the interpreter?

02/18/2009: How to write a paper about MSP

Speaker: Walid

Scribe: Angela

Power to the people

  • Problem: How to explain/teach staging?
    • sub-problems 1: Keep it fun! Keep reader interested.
    • sub-programs 2: Make it useful for reference, and very clear (in reference way)
  • Thesis: The power function can be a good carrier for explain staging.
    • sub-problems are hypothesis.
  • Goal: To explain staging

Questions:

  • Who is our audience: People who want to write generic programming without paying a a runtime overhead.
    • grads, tick
    • undergrads,
    • functional programmers, tick
    • PL researchers

  • Assumption about reader
    • They know OCaml?
      • letrec
      • lambda
      • data types
      • polymorphism
      • CPS

How do we structure text?

  • Begin with background (German, Top-down)
    • Keeps things clear
    • "Boring"
  • Weave concepts together (Adventure)
    • Keeps eye on prize
    • Focus on ??? of concepts
  • Combine approaches by summoning first approach somewhere? (Hybrid)

Key concepts / Outline

  • Annotations
  • CSP: Cross Stage Persistence
  • Staged program = unstaged program + annotations
  • Two ways
    • Linear P -> No CSP
    • Logarithm P -> code duplication
  • Staging auxiliary functions is useful
  • Code duplication: Problem & solution
    • Non-linear uses of code
    • Let insertion
    • Direct let insertion does not work
    • Partially static data

  • Related topics
    • Code duplication [
      • dealing with it
    • BTA: binding time analysis
    • Partially static data
    • type isomorphism

02/20/2009: Continued discussion of paper

Speaker: Walid

Scribe: Marisa

Outline:

  • p-log
  • Code duplication (CD)
  • Partially static data (PSD)
    • arrive at CPS: monads become useful

  • BTI: binding time improvement (change made to program to stage it more effectively) –such as let insertion
  • Abstract interpretations
    • Good explanation of how to stage pairs: PSD (partially static data). Also get error faster, which is a good thing. This is an abstract interpretation in that it uses sums, but it is not because the value you are using is not in domain.

Problem: With FFT, run into the problem of needing monad, but FFT itself does not use memoization to make sure that large pieces of code are not duplicated.

To avoid code duplication: use CPS and insert let. (CPS is a transformation of the whole program.) Do not have program transformation in multi-stage programming, so:

Solution: Small-value trick in memoization: When going from CPS to monads, the monad can take care of let bindings and let insertions for you. This avoids some overhead.

Small computational expenses add up, and by chiseling away at them, a real difference in runtime can be made. What we want the student to learn here is to focus on generating the very best possible code. Small value is an important technique for giving the programmer more control over the code in the generator.

Questions:

  • How important is the small-value trick?
  • Is power the best way to illustrate this?
It does not have to be the best way, but it can be a good example to learn by, and we can point out other examples along the way.
  • Is it possible to have another variant of multiplication where dynamic programming would be useful?

Sidenote: generalized Fibonacci (Gibonacci) does not change the base case very much. This is another interesting example that could be used in this paper.

Essence/slogan: Tools for building a simple and correct generator, and gradually making it better.

It is important for people to understand what goes into building a good generator. Multistage gives a much clearer insight of what it takes to build good generators than other methods out there. Does not seemingly work by magic, like FFTW.

02/25/2009: Thesis Proposal

Speaker: Fulong

Original Ideas: "Scheduler Modeling for components of Embedded Systems" Now something similar to "A Study on Scheduling Models for Component-based Embedded Systems" The focus is on hardware over software

An embedded system is constructed of a software and hardware component - This is necessary to design a larger hardware system, which is a connection of small circuits.

Problems with designing: * Directly programming in HDLs is time consuming * Verification of implementation is hard, not always sure if functions implemented * HDLs are very low level and require speciality (Programming in HDLs is different from software programming)

How to construct and verify an embedded system efficiently? * Don't want to give up expressivity and clarity * Don't want a larger work load

Three Examples: (1) finite iteration, (2) simple operating sequence, and (3) Finite State Machine (FSM)

Slide 6: Approach: Modify OCaml Program into a simple framework. OCaml makes HDL codes.

Walid: HDL code you simulator or run it? Answer: There are some software and hardware simulations. It is hard to simulate hardware. We must do a bitmap.

Walid: What I think is interesting, is one path you can simulate in OCaml, other is you can execute. But you don't want to think of FPGA as actual computation. Think that your laptop will contain an FPGA. Note: Change part where HDL code RUNS on FPGA, (don't say simulate). Simulation isn't interesting.

Walid: What happens if we don't have a match? Answer: The generator gives an error code. The OCaml program gives an error. We assume the OCaml program is correct, but maybe made mistakes in Generator.

Walid: If we don't have a match, big problem. Simulation is wrong or translation to FPGA is wrong. This slide is for your approach. We want it to always match. Even if we have a bad generator, they have to match.

Cherif: Maybe he needs a translator.

Walid: The translator has to be correct. This slide is for your approach, you don't need the sad face. With your approach if it is designed correctly, it should always work.

Slide 10-11: We need to solve multiplication, but it can't be done with current method. So we change to an iterative function.

Walid: The problem here is two function calls. In a general recursive definitions, there is more than one function call. On next page there is only one function call. You may be doing a little too much. The point of this slide is to say if we look a recursive definitions no way to translate. But if we use tail recursion, there is a easy to to interpret them. You need to use generator and translator differently.

Walid: Jun is asking f versus rec f'. This is a stylized subset of OCaml. let f' is a accumulator passing version. This f is a module. Lastly, I think this is important when you have clocking.

Walid: I think it is possible to design a small language with first level functions, unless you want to treat higher level functions as modules. You use tail-recursion to make sure all functions are expressed.

Ron: The question is getting the completeness.

Walid: IMPORTANT: You want to prove you can generate every circuit. Important theorem you want to express, you can generate any circuit. What theorem we want to establish in the end.

If we have a FSM, a translator and FSMs Slide 12: Translation of program

Walid: Visual programming languages is bared in archives. Gregory works was between circuits as graphs and languages. He had a tool to look into this.

Walid: You are going to make different FSMs for different programs. On thing is you don't want to produce a FSM for every circuit. You don't want to normalize or optimize circuit. Keep an eye on this for normalization. Don't optimize FSM. Any optimization is done somewhere else.

Slide 14: Next scheme We stage a generator. When we compute, n is not changeable. We can connect three multipliers.

What needs to be done: * Convert general non-itereated recursive functions into iterative ones * Design a smart generator

What should a generator do? * Needs to recognize input (easy to recognize) * Output (hard to recognize)

Walid: Do you go from OCaml to verilog, or FSM to verilog. Ans: I haven't created a generator, but I will. This is a framework.

Walid: Remember FSM is just a program. You have a OCaml program in FSM.

Walid: MetaOCaml won't help you. You are extending MetaOCaml. Important: In related work, You should mention offshoring and heterogeneous programming. Mention the paper I gave you. You are using offshoring in verilog so you can map this to an FPGA. It isn't a back end compiler, it is a runtime operation. It is used as if it is an OCaml function. Make this clear. Which OCaml programs can be converted into code directly.

Walid: Only on slide 11 do you want to convert programs in this subset. Easy to write generator to fill this code. Easy to write a generator to produce this code. Generator produces code in your subset. Point is you don't care about OCaml, you care about Verilog. One theorem we discussed was that proving for every circuit there is a program for the circuit. This is important. You give programmer the ability to express every circuit as a program.

Walid: Great proposal. This looks really good. Very sensible. Make presentation short.

03/20/2009: VPP Discussion

FSM: one state at a time, determined by input arrows Graphs: wires, gates, not operations-- inputs giving an output Behavioral: problems Structural: better

Issue--Structural is better than behavioral, which has problems. There are certain things that cannot be expressed behaviorally.

Example circuit, with corresponding FSM. In canonical form, there is exactly one FSM that describes the circuit. (However, Can change the circuit without changing the FSM.) So, there are multiple circuits that do the same thing. They will have differences in size and performance.

FSM doesn't tell how many delays you have. It tells how many states can be produced with the bits in the system. (10 bits gives 2^10 states, 1024.)

Important thing to do: we should have a collection of circuits that serve as examples. We have adders, multipliers, counters, mux, decoders. Suggestion: We could do sequence detector.

Walid: I'd like to see a discussion side by side of behavioral and structural. We should develop a collection of examples, like with Acumen. Even though I advocate structural approach, it is still a hypothesis and it is ok to give behavioral examples as well.

There needs to be a tutorial. Update the existing document to serve as a tutorial.

Cherif: I want to point out that behavioral is not identical to FSM. Behavioral is much higher-level than FSM.

A specific thing we want to do is generate circuits with OCaml.

Behavioral is much more like software, structural is more like hardware. Sometimes, you want to take a program and turn it into a circuit (perhaps for runtime benefits). But we're focused on the design of chips-- making hardware run faster, not making software run faster by turning it into "hardware."

Ed: With software, one wants to write at a higher level of abstraction--why not with hardware?

Walid: the idea is that just because you're generating structural code, does not mean you can't use higher level abstractions. So, in some sense, high level is great. Problem is, behavioral (which is more abstract) = structural + mush + abstractions. What we want is VPP approach = structural + clean + abstractions. Both have high-level abstractions. Behavioral = bad, structural = good! Behavioral is high-level, but is a bad way of doing it. VPP approach we're talking about here uses structural and abstractions together but keeps them separate, which is good.

Need to be able to explain by example: here is structural code and here is behavioral code; behavioral is bad.

We need a paper than explains this idea.

03/24/2009: Discussion on Staging with Side Effects

Speaker: Jun

The problem is that we can't run , because we don't know what value to use for x. When we throw in side effects, we gain the ability to create such code values.This phenomenon is called scope extrusion. The main issue here is that the type system is inadequate as a safety net, and allows us to run ill-formed code.

We reference the mutable variable to reference x. This allows us to create code of x. In MetaOCaml, there is an environmental classifier on types. It says if a code variable references an outside binding.

Walid: Two things: We know this doesn't work. Are we trying to look for scope extrusion where it isn't safe?

Jun: We are (currently) going for a system that doesn't allow scope extrusion at all.

Walid: Two goals: 1) No scope extrusion at all OR 2) Other is more expressive, but produces more junk. Any scope extrusion is dead types.

Walid: What does this example look like in Java? Let's try to do this soon! Variations in Java.

<xy....

let code =

let mrar=ref<0>

in <λ x. ~(mvar=;

<()>>;

mvar

=> ; (e', int) code

.! typechecks

: ({x:int} -> int)

<0>: (Ø->int) :> ({x:int} -> int

mvar: (Ø=> int) ref

if x is literal

mvar:({x:int}-> int)ref

(this type ≠ 'stype

if x is gen symed

say mvar holds <λ x. ~(mvar)> =><λ x.x>

Walid: What does Kim , Yi, and Calcagno do in their paper? Walid: If you want to define semantics for type it gets difficult. Eric wanted a type system where you name things in environment. That's fine, but it gets hairy. I wanted polymorphic types in the variants. His work had fallen apart when he tried to add polymorphism on environment. You would what polymorphism on environments for some interesting functions. What do they do? They have sub typing.

Jun: Ø is the universal type. What is the type of the eta expansion...

Examples: msp_eta gen = ~(gen )>

Edwin: You have rho variables.

Walid: I'm not sure how rho variables work in general. You could restrict yourself with eta expansion that all things belong to rho variables.

Jun: I think their system doesn't allow polymorphism. We had an ordinary gamma.

Note: The {x:int} is called a record, and a type variable that ranges over records are traditionally written with rho. We want the msp_eta to have type

forall rho. ((rho > 'a) -> (rho > 'b)) ->(rho > ('a -> 'b))

However, Kim et al.'s doesn't allow the "forall rho."

Jun: What is the difficulty with polymorphism?

Walid: Any other things you noticed about the language? Now you know to keep polymorphism in the back of mind. What other things did you notice about system that were interesting?

Jun: A monadic thing I was trying was like a re-implementation of this system. They also had embedding.Box is the same as bracket. Zero is the same as run.

Walid: The reason this might be problematic is that it is semantically untasteful. Box (unbox bottom) may not equal bottom. If I translate something that translates all λ calculus to number 1, this isn't what I want. This is another thing to look into.

Walid: Cross stage persistence seems orthogonal to everything that comes up. It is a small thing.

Edwin: I think this might be something important to Java. However, I see what you are saying.

Jun: I think sub-typing is important.

Jun: ~(gen )> gen is some generator that we wrote.

Walid: Backing up, I think is is good to look at this paper. Follow it by saying that this system does some interesting properties. It shows that if it doesn't work well with polymorphism, it isn't clear. I'm skeptical, but it maybe useful. If it isn't useful, we can show what it is interesting. I would like Java examples. But more importantly, the examples of one using reference and another not using reference.

Jun: Do you want to translate away the side-effects or staging?

Walid: We want to translate away side-effects. Monads won't be good for brackets and escapes.

Jun: I was planning to use monads to define regions not code types.

Walid: I am saying don't use monads to remove brackets and escapes. Use monads to remove references.

Jun: It is impossible to get inside to connect with outside.

Walid: Show me.

(this references code above) bind (getref <0> (λ mar.bind bind(ret<λx.~(bind )

Walid: Write code without brackets. Maybe we can do cps.

bind(getref<0>) (λ mar. bind(ret(λ x. set mvar x

Jun: If you remove brackets, it is a different program. Yet you can't even write this.

Walid: Part of this is the monadic translation. We want to see places where we can allow monadic translation.

Edwin: I see in a recent paper, we had this problem. We tried to write in monadic style. You need something to go inside λ. You need something to bundle it. Something like local flatten.

Walid: Your saying is on right track. I am saying you need to take it more slowly, and just apply monadic translation to where you can sensible add it, see where it can be mapped back to, we can see where we can safely put it.

Walid: In a lot of useful examples, you take an imperative program and add staging annotations. If you go to metaocaml.org, you see examples were you do computations that you can put staging in. If you can't do it for bad examples, it might be a good thing.

Walid: Say you are doing matrix computations. Say multiple matrices in which some maybe zero. You want code that does matrix computation symbolically. You want closed form as symbols instead of values. You want to reuse the closed form. Or multiple a diagonal array by itself.

Edwin: That sounds like me it doesn't use references.

Walid: Arrays are references. Write a version of the power function that keeps in it x, x*x, x*x*x, .... I think semantically, to do this translation for a imperative program, looking at targets, and sensible see where to put staging constructs, you can see in which examples this makes sense. This is a way of type checking. By doing translations and understanding effects of translation on term.

Edwin: If this doesn't work, then this is still useful, because you can show why it doesn't work.

Walid: If it doesn't work, we want to know exactly why this doesn't work. What the limitation of this type system and how we may improve it.

Edwin: It is useful to have an example of why it doesn't work.

Walid: Doing the most obvious things is extremely important for explaining results in a paper. Whatever we find out is useful information.

03/27/2009

GPCE: Deadline May 11

EMSOFT: Deadline May 1

Paper Topics

- Acumen: (Angela, Marisa) Design, semantics, and numerical accuracy -> GPCE

- Mint: (Edwin, Mathias, Jun, Ron, Dustin, Yilong, Tamer) Design, type system, and type-safety. MetaJava, an extension of Java.

- VPP: (Cherif, Fulong, Richard) Design, semantics, and expressivity - Design: Adders, Multipliers, Decoders, Sequence Detector

- Monty: (Raj, Walid) A study on how fast staged interpreters can be

- Offshoring to Verilog: (Fulong, Cherif) -> EMSOFT - MetoCaml to Verilog

- Logic Blocks: (Ron, Ed, Emir, Laurent) There is a long history of people looking at staging for logic languages.

- (Marisa, Angela, Jun) 4d graphical interface for exact real computation.

Homework for the Weekend

Deadline: Send by Tuesday, March 31st.

Walid would like a one page outline of the paper.

It should have:

1. Problem statement at beginning.

2. A list of contributions

3. Section titles

4. Related Work

Steps:

A. The lead should read the CFP, and get style file.

B. Discuss/show outline to all co-authors.

Mint

Jun: Type system. So far we have gotten to imperative programs we want to stage. Not sure if we will have a type system by May deadline.

Walid: We want one paper in language designs and applications.

Edwin: Show staging is great, it is work in OCaml. Now we are bringing it to Java, even if we don't have a type system.

Walid: Show we are moving staging from functional world to the OO world. We want to show what we discovered that is different in OO world in comparison to functional world.

Edwin: We need more intermediate examples that show staging in Java.

Walid: I want a document of what you have discovered going through this. It will keep me up to date on how far we are on type system.

VPP

Fulong: I would like a paper on parametrized sequence detector.

Walid: What is point of parametrized sequence detector? Perhaps you can talk about it when you talk about VPP as an example. I think VPP is a good benchmark for what you can do. Optimization is standard, there is no paper there. Using these optimization techniques can help you with VPP paper.

Fulong: I want to compare different designs. Last time I sent two schemes. We can use VPP to design a new sequence detector.

Walid: In another approach, by doing Karnaugh maps for each sequence, it can take a huge amount of time. In future you don't have time to optimize everything. You save time by writing a generic structure.

Acumen

Walid: I need a paper that talks about design. Where do all different choices come from in language? iAcumen wasn't on design. What we said was it seems to work. Let's working on a draft that is the right way to present iAcumen idea.

Real Analysis/Arithmetic

Walid: We want to figure out who might work on real analysis work. The background is working on Real Numbers.

Marisa: I might be interested in learning about real analysis.

Walid: Basically we think numerical software is broken in floating point arithmetic. To throw out floating point changes things. You loose error, but also loose performance. Perviously, people thought this couldn't be done. People were using ad hoc solutions when they needed exact numbers. Now we are wondering about how fast result come about.

Jun: I might be interested in theoretical aspects of this project.

Walid: Angela, make sure Marisa gets a copy of the paper.

Edwin: This sounds interesting, but I don't know how much time I have to devote to it.

Walid: Let people you know feedback by 4 PM on the paper. I think a good way to view this as a 3D rendering.

Corky: Hanz wanted a programming exercise that would push language hard. He used a Russell compiler that outputted C code.

Walid: We need to look at his code for performance.

Corky: He used a framework for Fortran optimization. He plugged in exact real operations in interpreter. It made Fortran run exact real arithmetic. In order to compare, you needed a fine tolerance.

Walid: We need to explain this to other people. A 3D system does more computations as you demand more precision. This graphical interface would be very useful. I would even like a 4D interface, something that lets you move in time and move in this. Instead of having a point in time, I would like to see things in this interval. As you squeeze the interval, you get a clearer idea of what is occurring. I don't think you can say what occurred at this point, you have to say what occurred in this interval.

Jun: You want an object shown and an arrow bar that shows this.

Edwin: Everything is a bound.

Walid: You say you want more detail, until you are satisfied. Perhaps it would be better to show one bar for time and another bar for Delta around this point.

Edwin: I think what is interesting is you can compare real numbers. Maybe you need a boolean. An exact real boolean. You know if it is true or false to a certain precision. You usually think when you need precision you need floating points. I think it is more important to approach as a graphical, instead of a semantic design.

Walid: One thing Angela did was create a list of libraries of real arithmetic designs.

Corky: Hanz is still at HP. He has a newer version.

Walid: Marisa, what is your presentation on?

Marisa: It is on a 3D bike. I have some ideas on electromagnetic examples. Should I make a whole talk on those?

Walid: Pick some good illustrations, some equations, and explain briefly. Show visualizations, math code, and Acumen code. One slide each per example. Make sure Angela includes these in her thesis. Focus on getting the Acumen paper together by this deadline. Marisa, do you want to try and write a proposal for this 3D outline for real numbers. We can't call it Plato. Give in a pre-Socratic names. We'll call it Xeno for now.

A link of philosopher schools: http://en.wikipedia.org/wiki/Pre-Socratic_philosophy

Walid: You can talk to me, Angela, Jun, and Corky for help Marisa.

Corky: What if you plugged real arthimetic into OCaml as a library?

Walid: Examples that come up early are comparisons. I would like to know trade offs for different designs of dealing with real arithmetic. In summary:

1) We can create a gui

2) Other side is classification. Dealing with some of the issues that arise when we deal with most basic operations. I don't think we even deal with comparison to the extent we would like to. With + we have ways of changing representation to limit look ahead. With -, * we can solve problem. With / or <, you might go into an infinite loop.

Corky: It looks like you might run into a problem with -.

Edwin: I think it is a language design to express things.

Walid: Another thread to look at besides graphical interface, is to look at Angela's paper to see where you can speak more on real arithmetic.

04/01/2009: EPCE & EMSOFT papers descussion

Scribe: Angela

  • Paper IDs
    • 1 VPP
    • 2 Mint
    • 3 Monty
    • 4 Acumen
    • 5 real-4D
    • 6 offshoring-verilog
    • 7 datalog

  • Milestones
    • 4/3: Walid will write draft abstract & introduction, contributions, RW pointers.
    • 4/10: R1 (Review deadline 1). Related work discussion finished
    • 4/17: R2. all result, illustration, proof, implementations are in place
    • 4/24: R3. Extended draft: complete but verbose
    • 5/1: R4. complete draft: passes interval review (all review due by this day)

  • Circulation table

Week Review Due 10-Apr 17-Apr 24-Apr 1-May
VPP-design 1 Ron Fulong Richard Marisa
Mint-design 2 Cherif Ron Fulong Richard
Monty-as-staging 3 Jun Cherif Ron Fulong
Acumen-design 4 Marisa Jun Cherif Ron
Real-4D 5 Edwin Angela Jun Cherif
Offshoring-Verilog 6 Angela Edwin Angela Jun
Datalog-ploo 7 Fulong Richard Edwin Angela

  • Comments on feedbacks
    • plain text format
    • print out, mark, and scan it.
    • Don't use acrobat editor
    • Not send email, but put it in reviews directory of the paper directory
    • Your draft paper is due two days before the review deadline
    • Things you can say: Rocks, cool idea & results, well-written, concise

04/8/2009: VPP:Sources of inaccuracy

Sources of inaccuracy:

  • arrays or aggregate types
    • solve by dependency on index
    • cycles, requires allowing estimate to be (0, infinite)

something like:

O3=max(4+i1, 3+i2, ...)

M:< p' >x< di ti >

m < p' >(n')

< di ti > - > < in tj > , < out tk Dk > where Dk is (4+i, 2+i2, ...)

Module: < pi > < in tj nj > < out tk DK >

We need to look into module instantiation.

m < ei > < ej > < ek >

This is like application, but we need substitution.

You need an environment that keeps track of delays.We can write a type system that expresses the constraints.

Let's say these are delays.

=Γ(m) ∆(nk)=Dk[nj:=∆(nj)]

––––––––––––——

Γ,∆ of m< ei < ej > < ek > where i1=D1 o2=D2 (you want to have wire names here)

when you do look up in Γ you get Dk

This equality is what you want to generate.

We need to agree on a specific description of type system. Cherif is good at making algorithm, he needs help with type system.

We can say:

nj=< i1, i2, i3 >

∆j= < d1, d2, d3 >

Dk = < dout >

we want to say , where d0=max(4+i1, 3+i2, ...)

d0[ii:=di]

Essentially we are doing a name for name substitution.

Therefore, =Γ(m) ∆(nk)=Dk[nj:=∆(nj)]

––––––––––––——

Γ,∆ of m< ei < nj > < nk > where î1=D1 ô2=D2 (you want to have wire names here)

Topic attachments
I Attachment Action Size Date Who Comment
elseml p.ml manage 1.1 K 26 Jan 2009 - 21:39 JunInoue Basics of Multi-stage Programming I: Sample
Topic revision: r36 - 08 Apr 2009 - 19:46:20 - RichardLatimer