Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] View of /branches/vis12/src/compiler/gen/il/mid-il.spec
 [diderot] / branches / vis12 / src / compiler / gen / il / mid-il.spec

# View of /branches/vis12/src/compiler/gen/il/mid-il.spec

Fri Jul 6 14:54:21 2012 UTC (7 years, 2 months ago) by jhr
File size: 5536 byte(s)
```  Working on ":" support
```
```# specification of operators for MidIL version of the IR.  Each line (other than comments)
# specifies an operator using five fields, which are separated by ":".  The fields are
#	name
#	argument type		(optional)
#       result arity
#	arity
#	comment			(optional)
#
# type-indexed arithmetic operations
Add : ty : 1 : 2 :
Sub : ty : 1 : 2 :
Mul : ty : 1 : 2 :
Div : ty : 1 : 2 :
Neg : ty : 1 : 1 :
Abs : ty : 1 : 1 :
LT : ty : 1 : 2 :
LTE : ty : 1 : 2 :
EQ : ty : 1 : 2 :
NEQ : ty : 1 : 2 :
GT : ty : 1 : 2 :
GTE : ty : 1 : 2 :
Not : : 1 : 1 : boolean negation
Max : : 1 : 2 :
Min : : 1 : 2 :
# Clamp<ty>(lo, hi, x) -- clamps x to the range lo..hi
Clamp : ty : 1 : 3 : clamp argument to range
# Lerp<ty>(a, b, t) -- computes a + t*(b-a)
Lerp : ty : 1 : 3 : linear interpolation between 0 and 1
#
### vector operations
# Dot<n>(u, v)	-- computes dot product of u and v; n specifies u and v's arity
Dot : int : 1 : 2 :
# MulVecMat<m,n>(v, M) -- computes v*M, where M is an mxn-matrix and v is an m-vector
MulVecMat : int * int : 1 : 2 : vector times matrix multiplication
# MulMatVec<m,n>(M, v) -- computes M*v, where M is an mxn-matrix and v is a n-vector
MulMatVec : int * int : 1 : 2 : matrix times vector multiplication (type is matrix type)
# MulMatMat<m,n,p>(M, N) -- computes M*N, where M is an mxn-matrix and N is an nxp-matrix
MulMatMat : int * int * int : 1 : 2 : matrix times matrix multiplication
# MulVecTen3<m,n,p>(v, T) -- computes v*T, where T is an mxnxp-tensor and v is an m-vector
MulVecTen3 : int * int * int : 1 : 2 : vector times 3rd-order tensor multiplication
# MulTen3Vec<m,n,p>(v, T) -- computes T*v, where T is an mxnxp-tensor and v is a p-vector
MulTen3Vec : int * int * int : 1 : 2 : 3rd-order tensor times vector multiplication
# ColonMul<ty1,ty2>(T1, T2) -- computes T1:T2, where T1 (resp. T2) has type ty1 (resp. ty2)
ColonMul : ty * ty : 1 : 2 : colon product
# Cross(u, v)	-- computes cross product of u and v
Cross : : 1 : 2 :
# Norm<ty>(x) -- returns the norm of the tensor x, which has type ty
Norm : ty : 1 : 1 :
# Normalize<n>(v)   -- returns the unit vector in direction u; n is the length ov u
Normalize : int : 1 : 1 :
# Scale<ty>(s,u) -- multiply scalar s time tensor u; ty specifies u's type
Scale : ty : 1 : 2 : scalar*tensor multiplication
PrincipleEvec : ty : 1 : 2 : principle eigenvector; ty is result vector type
EigenVecs2x2 : : 1 : 1 : Eigen vectors and values for 2x2 matrix
EigenVecs3x3 : : 1 : 1 : Eigen vectors and values for 3x3 matrix
EigenVals2x2 : : 1 : 1 : Eigen values for 2x2 matrix
EigenVals3x3 : : 1 : 1 : Eigen values for 3x3 matrix
# Identity<n>() -- nxn identity matrix
Identity : int : 1 : 0 : identity matrix
# Zero<ty>() -- zero tensor
Zero : ty : 1 : 0 : identity matrix
# Trace<n>(m) -- computes trace of nxn matrix m
Trace : int : 1 : 1 : compute trace of matrix
#
# operations on sequences
# Select<ty,i>(u)  -- select ith element of tuple; ty is tuple type
Select : ty * int : 1 : 1 :
# Index<ty,i>(u)  -- select ith element of sequence; ty is sequence type
Index : ty * int : 1 : 1 :
# Subscript<ty>(u,i) -- select ith element of sequence; ty is type of sequence
Subscript : ty : 1 : 2 :
# MkDynamic<ty,n> -- make a sequence with type ty{n} into a dynamic sequence
MkDynamic : ty * int : 1 : 1 : make a fixed-length sequence dynamic
Append : ty : 2 : 1 : append an element onto a dynamic sequence
Prepend : ty : 2 : 1 : prepend an element onto a dynamic sequence
Concat : ty : 2 : 1 : concatenate two dynamic sequences
# Length<ty> -- return the length of a sequence with type ty{}
Length : ty : 1 : 1 : return the length of a dynamic sequence
#
# compute integral parts of reals
Ceiling : int : 1 : 1 : compute real ceiling of a vector
Floor : int : 1 : 1 : compute real floor of a vector
Round : int : 1 : 1 : compute real rounding to nearest integral real of a vector
Trunc : int : 1 : 1 : compute real truncation to integral real of a vector
#
### conversions; the real to int forms are vector ops
IntToReal : : 1 : 1 :
RealToInt : int : 1 : 1 : cast real vector to int vector
#
### image/kernel operations
# VoxelAddress<I,offset>(V, i, j, ...) -- compute the address of the voxel data indexed by i, j, ...
# for non-scalar images, the offset specifies which sample and I specifies the stride.
VoxelAddress : ImageInfo.info * int : 1 : * : compute the address of a voxel
LoadVoxels : ImageInfo.info * int : 1 : 1 : load a vector of voxel values from an address
# PosToImgSpace<I>(V,u) -- transforms the world-space position u into the image-space specified by V.
PosToImgSpace : ImageInfo.info : 1 : 2 : transform a world-space position to image-space
# TensorToWorldSpace<I,ty>(V,u) -- transforms the image-space tensor u to from V's image space to world space
TensorToWorldSpace : ImageInfo.info * ty : 1 : 2 : transform an image-space gradient to world-space
# EvalKernel<i,h,k>(u) -- computes (D^k h)(u), where i is the size of vector u.
EvalKernel : int * Kernel.kernel * int : 1 : 1 : apply a kernel function to a scalar or vector of arguments