SCM Repository
Annotation of /branches/vis12/src/compiler/gen/il/mid-il.spec
Parent Directory
|
Revision Log
Revision 2027 - (view) (download)
1 : | jhr | 266 | # specification of operators for MidIL version of the IR. Each line (other than comments) |
2 : | jhr | 1640 | # specifies an operator using five fields, which are separated by ":". The fields are |
3 : | jhr | 266 | # name |
4 : | # argument type (optional) | ||
5 : | jhr | 1640 | # result arity |
6 : | jhr | 266 | # arity |
7 : | # comment (optional) | ||
8 : | # | ||
9 : | # type-indexed arithmetic operations | ||
10 : | jhr | 1640 | Add : ty : 1 : 2 : |
11 : | Sub : ty : 1 : 2 : | ||
12 : | Mul : ty : 1 : 2 : | ||
13 : | Div : ty : 1 : 2 : | ||
14 : | Neg : ty : 1 : 1 : | ||
15 : | Abs : ty : 1 : 1 : | ||
16 : | LT : ty : 1 : 2 : | ||
17 : | LTE : ty : 1 : 2 : | ||
18 : | EQ : ty : 1 : 2 : | ||
19 : | NEQ : ty : 1 : 2 : | ||
20 : | GT : ty : 1 : 2 : | ||
21 : | GTE : ty : 1 : 2 : | ||
22 : | Not : : 1 : 1 : boolean negation | ||
23 : | Max : : 1 : 2 : | ||
24 : | Min : : 1 : 2 : | ||
25 : | jhr | 1295 | # Clamp<ty>(lo, hi, x) -- clamps x to the range lo..hi |
26 : | jhr | 1640 | Clamp : ty : 1 : 3 : clamp argument to range |
27 : | jhr | 1116 | # Lerp<ty>(a, b, t) -- computes a + t*(b-a) |
28 : | jhr | 1640 | Lerp : ty : 1 : 3 : linear interpolation between 0 and 1 |
29 : | jhr | 304 | # |
30 : | jhr | 343 | ### vector operations |
31 : | jhr | 349 | # Dot<n>(u, v) -- computes dot product of u and v; n specifies u and v's arity |
32 : | jhr | 1640 | Dot : int : 1 : 2 : |
33 : | jhr | 1116 | # MulVecMat<m,n>(v, M) -- computes v*M, where M is an mxn-matrix and v is an m-vector |
34 : | jhr | 1640 | MulVecMat : int * int : 1 : 2 : vector times matrix multiplication |
35 : | jhr | 1116 | # MulMatVec<m,n>(M, v) -- computes M*v, where M is an mxn-matrix and v is a n-vector |
36 : | jhr | 1640 | MulMatVec : int * int : 1 : 2 : matrix times vector multiplication (type is matrix type) |
37 : | jhr | 1116 | # MulMatMat<m,n,p>(M, N) -- computes M*N, where M is an mxn-matrix and N is an nxp-matrix |
38 : | jhr | 1640 | MulMatMat : int * int * int : 1 : 2 : matrix times matrix multiplication |
39 : | jhr | 1939 | # MulVecTen3<m,n,p>(v, T) -- computes v*T, where T is an mxnxp-tensor and v is an m-vector |
40 : | MulVecTen3 : int * int * int : 1 : 2 : vector times 3rd-order tensor multiplication | ||
41 : | # MulTen3Vec<m,n,p>(v, T) -- computes T*v, where T is an mxnxp-tensor and v is a p-vector | ||
42 : | MulTen3Vec : int * int * int : 1 : 2 : 3rd-order tensor times vector multiplication | ||
43 : | jhr | 1945 | # ColonMul<ty1,ty2>(T1, T2) -- computes T1:T2, where T1 (resp. T2) has type ty1 (resp. ty2) |
44 : | ColonMul : ty * ty : 1 : 2 : colon product | ||
45 : | jhr | 343 | # Cross(u, v) -- computes cross product of u and v |
46 : | jhr | 1640 | Cross : : 1 : 2 : |
47 : | jhr | 1116 | # Norm<ty>(x) -- returns the norm of the tensor x, which has type ty |
48 : | jhr | 1640 | Norm : ty : 1 : 1 : |
49 : | jhr | 1116 | # Normalize<n>(v) -- returns the unit vector in direction u; n is the length ov u |
50 : | jhr | 1640 | Normalize : int : 1 : 1 : |
51 : | jhr | 1116 | # Scale<ty>(s,u) -- multiply scalar s time tensor u; ty specifies u's type |
52 : | jhr | 1640 | Scale : ty : 1 : 2 : scalar*tensor multiplication |
53 : | PrincipleEvec : ty : 1 : 2 : principle eigenvector; ty is result vector type | ||
54 : | EigenVecs2x2 : : 1 : 1 : Eigen vectors and values for 2x2 matrix | ||
55 : | EigenVecs3x3 : : 1 : 1 : Eigen vectors and values for 3x3 matrix | ||
56 : | EigenVals2x2 : : 1 : 1 : Eigen values for 2x2 matrix | ||
57 : | EigenVals3x3 : : 1 : 1 : Eigen values for 3x3 matrix | ||
58 : | jhr | 1116 | # Identity<n>() -- nxn identity matrix |
59 : | jhr | 1640 | Identity : int : 1 : 0 : identity matrix |
60 : | jhr | 1116 | # Zero<ty>() -- zero tensor |
61 : | jhr | 1640 | Zero : ty : 1 : 0 : identity matrix |
62 : | jhr | 1116 | # Trace<n>(m) -- computes trace of nxn matrix m |
63 : | jhr | 1640 | Trace : int : 1 : 1 : compute trace of matrix |
64 : | jhr | 1116 | # |
65 : | jhr | 1640 | # operations on sequences |
66 : | # Select<ty,i>(u) -- select ith element of tuple; ty is tuple type | ||
67 : | Select : ty * int : 1 : 1 : | ||
68 : | # Index<ty,i>(u) -- select ith element of sequence; ty is sequence type | ||
69 : | Index : ty * int : 1 : 1 : | ||
70 : | # Subscript<ty>(u,i) -- select ith element of sequence; ty is type of sequence | ||
71 : | jhr | 1689 | Subscript : ty : 1 : 2 : |
72 : | # MkDynamic<ty,n> -- make a sequence with type ty{n} into a dynamic sequence | ||
73 : | MkDynamic : ty * int : 1 : 1 : make a fixed-length sequence dynamic | ||
74 : | Append : ty : 2 : 1 : append an element onto a dynamic sequence | ||
75 : | Prepend : ty : 2 : 1 : prepend an element onto a dynamic sequence | ||
76 : | Concat : ty : 2 : 1 : concatenate two dynamic sequences | ||
77 : | jhr | 1925 | # Length<ty> -- return the length of a sequence with type ty{} |
78 : | Length : ty : 1 : 1 : return the length of a dynamic sequence | ||
79 : | jhr | 1640 | # |
80 : | jhr | 1116 | # compute integral parts of reals |
81 : | jhr | 1640 | Ceiling : int : 1 : 1 : compute real ceiling of a vector |
82 : | Floor : int : 1 : 1 : compute real floor of a vector | ||
83 : | Round : int : 1 : 1 : compute real rounding to nearest integral real of a vector | ||
84 : | Trunc : int : 1 : 1 : compute real truncation to integral real of a vector | ||
85 : | jhr | 266 | # |
86 : | jhr | 420 | ### conversions; the real to int forms are vector ops |
87 : | jhr | 1640 | IntToReal : : 1 : 1 : |
88 : | RealToInt : int : 1 : 1 : cast real vector to int vector | ||
89 : | jhr | 266 | # |
90 : | jhr | 343 | ### image/kernel operations |
91 : | jhr | 1116 | # VoxelAddress<I,offset>(V, i, j, ...) -- compute the address of the voxel data indexed by i, j, ... |
92 : | # for non-scalar images, the offset specifies which sample and I specifies the stride. | ||
93 : | jhr | 1640 | VoxelAddress : ImageInfo.info * int : 1 : * : compute the address of a voxel |
94 : | jhr | 1116 | # LoadVoxels<I,n>(a) -- load a vector of n voxels from the address a |
95 : | jhr | 1640 | LoadVoxels : ImageInfo.info * int : 1 : 1 : load a vector of voxel values from an address |
96 : | jhr | 1116 | # PosToImgSpace<I>(V,u) -- transforms the world-space position u into the image-space specified by V. |
97 : | jhr | 1640 | PosToImgSpace : ImageInfo.info : 1 : 2 : transform a world-space position to image-space |
98 : | jhr | 1116 | # TensorToWorldSpace<I,ty>(V,u) -- transforms the image-space tensor u to from V's image space to world space |
99 : | jhr | 1640 | TensorToWorldSpace : ImageInfo.info * ty : 1 : 2 : transform an image-space gradient to world-space |
100 : | jhr | 349 | # EvalKernel<i,h,k>(u) -- computes (D^k h)(u), where i is the size of vector u. |
101 : | jhr | 1640 | EvalKernel : int * Kernel.kernel * int : 1 : 1 : apply a kernel function to a scalar or vector of arguments |
102 : | jhr | 1116 | # Inside<I,s>(u,V) -- tests to see if image-space position u is inside the volume |
103 : | # occupied by the image V. I is the image info and s is the border width | ||
104 : | jhr | 1640 | Inside : ImageInfo.info * int : 1 : 2 : |
105 : | jhr | 266 | # |
106 : | jhr | 2027 | # nrrd file loading |
107 : | LoadSeq : ty * string : 1 : 0 : load sequence from nrrd file | ||
108 : | LoadImage : ty * string * ImageInfo.info : 1 : 0 : load image from nrrd file | ||
109 : | # | ||
110 : | jhr | 266 | # inputs |
111 : | jhr | 2011 | Input : input : 0 : 0 : program input |
112 : | jhr | 1640 | # |
113 : | # printing support for debugging | ||
114 : | Print : tys : 0 : * : print strings |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |