Skip to content
/ tl Public

A new program language for tensor operation

Notifications You must be signed in to change notification settings

muzhailong/tl

Repository files navigation

Tensor Language

Features

Data Type

  • si8/ui8
  • si16/ui16
  • si32/ui32
  • si64/ui64
  • fp32
  • fp64
  • str

Statement

  • assignment statement
  • declaration statement
  • if else statement
  • slice expression
  • + - * /

Display

image

Usage

./tl test.tl --dump_ast --ast_file 1.dot --dump_mlir --mlir_file mlir.txt

MLIR

source code:

si64[32,20] self_add(si64 a,si64 b,si64[22,32]c){
    return a + b * c;
}

MLIR:

"builtin.module"() ({
  "tl.func"() ({
  ^bb0(%arg0: tensor<1xsi8>, %arg1: tensor<1xsi8>, %arg2: tensor<22x32xsi8>):
    %0 = "tl.mul"(%arg1, %arg2) : (tensor<1xsi8>, tensor<22x32xsi8>) -> tensor<*xf64>
    %1 = "tl.add"(%arg0, %0) : (tensor<1xsi8>, tensor<*xf64>) -> tensor<*xf64>
    "tl.return"(%1) : (tensor<*xf64>) -> ()
  }) {function_type = (tensor<1xsi8>, tensor<1xsi8>, tensor<22x32xsi8>) -> tensor<32x20xsi8>, sym_name = "self_add"} : () -> ()
}) : () -> ()

About

A new program language for tensor operation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published