1 / 34

VAL

Steven Nichols Mark Taylor Will Cecil. VAL. A data flow language. Outline. What are VAL? Why do I care? What does VAL do? How does VAL do? How do I VAL? (Syntax). What are VAL. Data Flow Language Do you remember that? (Those really cool graphs) Created by MIT (1979)

lilika
Télécharger la présentation

VAL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Steven Nichols Mark Taylor Will Cecil VAL A data flow language

  2. Outline • What are VAL? • Why do I care? • What does VAL do? • How does VAL do? • How do I VAL? (Syntax)

  3. What are VAL • Data Flow Language • Do you remember that? (Those really cool graphs) • Created by MIT (1979) • Inherently Concurrent • “Value-oriented Algorithmic Language” • “VAL was intended to be a small research language that would give everyone an opportunity to experiment with data flow computing.”

  4. Why do I care? • Automatic Parallelism • “it is totally unreasonable to ask programmers to state which operations can proceed together” • Lets the hardware decide what type of concurrency • Vectorization or Pipelining determined by compiler • Experimental Language • Designed for experimenting with Data Flow Language. • Dead (1982) • No compilers, nothing.

  5. Why do I care? (2) • Very well defined • Gehani and Wetherell wrote denotational semantic definition • Brock applied operational semantics to a subset of VAL • Ackerman applied axiomatic semantics to a VAL-like toy language. (Yes a toy of an experiment)

  6. What does VAL do? • Automatic Parallelism • Lets the hardware decide what type of concurrency • Experimental Language • Small research language, with many features unimplemented (Including I/O) • Massively Scalable • Split up tasks to run on any number of CPUs

  7. What does VAL do? • Functions can return multiple values. • Interesting Error Handling • No mid-calculation aborts like typical languages • Error type returned rather than expected result • Domain of functions defined to include errors • Every VAL function will finish. • Algebraic syntax (INFIX) • Immutable “Values” not “Variables” • “Single Assignment”/”Defined Constants” • Terrible on arrays.

  8. What does VAL do? (2) • Anything and Everything that can be concurrent will be. • Functions can return multiple values • No recursion • Tree Calculation • Can sum an array in O(log n) time.

  9. How does VAL do? • Data Flow Computing • As we learned in-class • Compiler decided vectorization and pipeline • Function as pipelines

  10. How do I Val? (VAL Syntax) • Data types: • Primitives • Arrays • Records • One of • Assignments • Expressions • Functions • If-then-else • For loop • Forall loop • Error handling

  11. Data type: Primitives • Four primitive types: • Boolean • integer • real • Character Each of these types carries an appropriate set of operators (e.g., +, - , &, I, - (not}, >,=).

  12. Data type: Primitives • Every data type has its own special error values • Automatic type conversions are never made • However, each type has functions to do conversions to all “reasonable cases”

  13. Data type: Array Arrays in VAL are unusual because array bounds are not part of the type definition: type Integer__list = array[integer]; Since the length of the array is not part of the type, this one type describes all finite-length, ordered sequences of integers.

  14. Data type: Array An array in VAL is actually an arbitrarily long list of ordered pairs. For example, [1: elementOne; 2: elementTwo] Is an array with two items.

  15. Data type: Array • VAL's unusual array definitions allow us to do some interesting things: • shift the origin • add elements at either end • delete elements at either end • change array bounds

  16. Data type: Array • Array Concurrency • All elements of an array can be specified simultaneously, thus allowing all of the evaluations of array entries to proceed together.

  17. Data type: Record • Record construction is patterned after the array construction scheme to promote concurrency. • record[x_low : low; Fx_low: lowv; • x_high: high; Fx_high: highv] • The above expression builds a record with four fields. Each field name is followed by an expression representing the value to be entered in the record.

  18. Data Type: OneOf • Sometimes it is advantageous to allow a value to appear to be different types at different times • Consider a search function that should return an array of results if there are any, but NIL if there are none type Result = oneof[none: null; more: integer_list];

  19. Assignments • The noninterference property requires that language features be incapable of producing side effects. • The concept of updating memory (i.e., modifying variables) must be thrown away. • There are no variables in VAL, everything is more like a constant. • Values can be defined and used in many places, but no value can ever be modified

  20. Assignments • The syntax for associating a value with a name is pretty straight forward: myValue: integer := 22; myBoolVal: boolean := true MyReal: real := 1.4

  21. Expressions • Expression are written with standard infix operators, to make things easy for programmer • Values for the two operands for any infix operator can always be computed in parallel. So in the expression (right - mid) * (rightv + midv) * 0.5 + (mid - left) * (midv + leftv) * 0.5 all operations inside parentheses can execute simultaneously.

  22. Functions • Functions and expression in VAL have been modified to allow multiple return values. The following function takes in 3 reals and returns 2 reals. function Stats(X, Y, Z: real returns real, real) let Mean real := ( X + Y + Z)/3; SD real := SQRT ( ( X^2 + y^2 + Z^2)/3 - Mean^2); in Mean, SD endlet endfun

  23. Sequencing Expressions • Some expression should not be run in parallel • Sequencing is imposed either to insure logical correctness or to avoid initiating operations whose results will never be used. • Expression with forced sequencing • If-then-else • For-iter loop

  24. If-then-else • Behaves just as you would expect If <boolean condition> Then <expressions> Else <more expressions>

  25. For-iter Loop • The for-iter loop is for when one pass of a loop depend on the results of the previous pass (impossible to execute in parallel) • A for expression has two separate structural parts: loop initialization and loop body. • Loop initialization appears between the reserved words for and do. • All loop parameters (identifiers that can carry information from one pass to the next) must be declared and given initial values here.

  26. For-iter Loop • The loop body appears between the do and endfor • The decision concerning loop iteration takes place inside some form of conditional expression (IF statement in our example) • The keyword iter causes the loop to initiate another pass • Loop termination happens when an expression is returned

  27. For-iter Loop Example • # Compute sum of all elements in the array, “list” • for • sum: integer := 0; • index: integer := array_liml(list); • do • if index > array_limh(list) • then sum • else iter • sum := sum + list[index]; • index := index + 1; • enditer • endfor

  28. Forall • One of the most important forms of concurrency available in VAL comes from the forall expression. • If the calculations do not depend on each other, the array could be built in one highly parallel, non-looping expression. • In conventional languages vector sums are performed by having each pass of a loop add one element to a running sum. This approach requires linear time. Faster execution can be achieved by eliminating the loop and organizing the calculation as a binary tree of partial sums. This approach requires log time. • Both of these types of concurrency are representable in VAL through one language feature called forall.

  29. Forall • We compute the sum of all the elements in an array (in log n time) with the following: • forall i in [array_liml(list), array_limh(list)] • eval plus • endall • Other merge operators include: • times, max, min, and,and or.

  30. Error Handling • Error values provide accurate information about the cause of a problem • All operators are defined over the error values, allowing error information to propagate • VAL's error prorogation rules provide absolute accuracy, sometimes at the cost of providing less information

  31. Error Handling • pos_over – positive overflow (greater magnitude) • neg_over – negative overflow • pos_under – positive underflow (greater precision) • neg_under – negative underflow • zero_divide – division by zero • miss_elt – access undefined array element • unknown – combination of over/under-flow • undef – all other errors

  32. Error Handling • Propagation • pos_over + pos_over yields pos_over • pos_over - 1 yields unknown • Special cases • Logic expression “undef = undef” produces “undef” (not true) • Test functions • VAL provides functions to test for errors. • Example: if under( value ) # tests for underflow if is_error ( value ) # tests for any errors

  33. Conclusions • Note: this is not the cool “VAL”, the one used for programming robots. • VAL is worse than LISP • No I/O at all! • No assignment statements • No globals • Ugly for loops

  34. Steven Nichols Mark Taylor Will Cecil VAL A data flow language THIS IS SLIDE n

More Related