+ All Categories

VAL

Date post: 16-Jan-2016
Category:
Upload: lilika
View: 56 times
Download: 0 times
Share this document with a friend
Description:
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) - PowerPoint PPT Presentation
Popular Tags:
34
VAL Steven Nichols Mark Taylor Will Cecil A data flow language
Transcript
Page 1: VAL

VAL

Steven NicholsMark Taylor

Will Cecil

A data flow language

Page 2: VAL

Outline

What are VAL? Why do I care? What does VAL do? How does VAL do? How do I VAL? (Syntax)

Page 3: VAL

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.”

Page 4: VAL

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.

Page 5: VAL

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)

Page 6: VAL

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

Page 7: VAL

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.

Page 8: VAL

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.

Page 9: VAL

How does VAL do?

Data Flow Computing As we learned in-class

Compiler decided vectorization and pipeline Function as pipelines

Page 10: VAL

Data types:PrimitivesArraysRecordsOne of

Assignments

Expressions

Functions

If-then-else

For loop

Forall loop

Error handling

How do I Val? (VAL Syntax)

Page 11: VAL

Four primitive types:BooleanintegerrealCharacter

Each of these types carries an appropriate set of operators (e.g., +, - , &, I, - (not}, >,=).

Data type: Primitives

Page 12: VAL

• 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”

Data type: Primitives

Page 13: VAL

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.

Data type: Array

Page 14: VAL

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.

Data type: Array

Page 15: VAL

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

Page 16: VAL

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.

Page 17: VAL

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.

Page 18: VAL

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];

Page 19: VAL

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

Page 20: VAL

Assignments

• The syntax for associating a value with a name is pretty straight forward:

myValue: integer := 22;

myBoolVal: boolean := true

MyReal: real := 1.4

Page 21: VAL

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.

Page 22: VAL

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

Page 23: VAL

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

Page 24: VAL

If-then-else

• Behaves just as you would expect

If <boolean condition>

Then <expressions>

Else <more expressions>

Page 25: VAL

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.

Page 26: VAL

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

Page 27: VAL

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

Page 28: VAL

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.

Page 29: VAL

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.

Page 30: VAL

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

Page 31: VAL

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

Page 32: VAL

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

Page 33: VAL

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

Page 34: VAL

VAL

Steven NicholsMark Taylor

Will Cecil

A data flow language

THIS IS SLIDE n


Recommended