Skip to content
Zhixun Tan edited this page Nov 23, 2017 · 3 revisions
TypeCode ::= Int
           | UInt
           | Float
           | Handle // Wat?

Type (
    code : TypeCode, // Primitive type
    bits : Int,      // To support int8_t, int16_t, ...
    lanes : Int,     // SIMD width
    handle : Wat?    // Wat?
)

CallType ::= Extern
           | ExternCPlusPlus
           | PureExtern
           | Halide
           | Intrinsic
           | PureIntrinsic

Expr ::= IntImm ^
       | UIntImm ^
       | FloatImm ^
       | StringImm ^
       | Cast
       | Add | Sub | Mul | Div | Mod ^
       | Min | Max ^
       | EQ | NE | LT | LE | GT | GE ^
       | And | Or | Not
       | Select (condition : Expr, true_value : Expr, false_value : Expr)
       | Load (buffer_var : VarExpr, index : Expr, predicate : Expr)
       | Ramp (base : Expr, stride : Expr, lanes : Int)
       | Broadcast (value : Expr, lanes : Int)
       | Let (var : VarExpr, value : Expr, body : Expr)
       | Call (name : String, args : [Expr], call_type : CallType)
       | Variable
       | Shuffle

Stmt ::= LetStmt (var : VarExpr, value : Expr, body : Stmt)
       | AttrStmt ??
       | AssertStmt
       | ProducerConsumerStmt
       | Store
       | Provide
       | Allocate
       | Free
       | Realize
       | Block (first : Stmt, rest : Stmt)
       | IfThenElse
       | Evaluate (value : Expr)
       | For (loop_var : VarExpr, min : Expr, extent : Expr,
              for_type : ForType, device_api : DeviceAPI, body : Stmt)
       | Prefetch (func : FunctionRef, value_index : Int,
                   type : Type, bounds : Region)

Clone this wiki locally