a tensor manipulation language Elsbeth Turcan Eliana Ward-Lev - - PowerPoint PPT Presentation

a tensor manipulation language
SMART_READER_LITE
LIVE PREVIEW

a tensor manipulation language Elsbeth Turcan Eliana Ward-Lev - - PowerPoint PPT Presentation

Mohit Rajpal Daniel Schwartz a tensor manipulation language Elsbeth Turcan Eliana Ward-Lev Motivation What is a tensor? Native n-dimensional tensors Intuitive syntax: LaTeX and tensors Basic Syntax Comments Operators Tensors


slide-1
SLIDE 1

Mohit Rajpal Daniel Schwartz Elsbeth Turcan Eliana Ward-Lev

a tensor manipulation language

slide-2
SLIDE 2

Motivation

  • What is a tensor?
  • Native n-dimensional tensors
  • Intuitive syntax: LaTeX and tensors
slide-3
SLIDE 3

Basic Syntax

Comments Inferred, Static Typing Operators Tensors Function Defs

slide-4
SLIDE 4

Control Flow

Loops IF-THEN-ELSE Return

slide-5
SLIDE 5

More Features

Scoping: Static, C-Style File I/O, Formatted Strings

slide-6
SLIDE 6

Still More Features

Tensor Multiplication Tensor Slicing

slide-7
SLIDE 7

Little Language Demo

slide-8
SLIDE 8

How to Run a Ranch, East Coast Style

slide-9
SLIDE 9

Time Dilation

  • f GPS

Satellites

slide-10
SLIDE 10

Perceptron

slide-11
SLIDE 11

Testing Suite

slide-12
SLIDE 12

Implementation: Overview

Input(.tens file) Scanner  token stream Parser  AST Semant  SAST Codegen  LLVM IR

Exceptions

Std library

slide-13
SLIDE 13

Implementation: SAST

program Global environment List of globals and types List of functions with arguments and type main Functions statements expressions floats/tensors/int egers/strings if/for/while return type arguments

slide-14
SLIDE 14

Codegen

slide-15
SLIDE 15

Challenges

  • Expressions which are implicity a AST subtree
  • Most of our functionality is code expansion
  • Non-trivial as code expands to constructs which do not exist in
  • ur language
  • Callback statement (Lllvm.llbuilder -> Llvm.llbuilder)
  • Continuation Passing Style (yay!)
  • Stack depth of 32! on a tensor multiplication
slide-16
SLIDE 16

Tensor memory layout

  • Nested arrays
  • Why? Recursive heavy

languages prefer recursive data structures

  • Last level is a pointer to a
  • float. Why? Array slicing made

easy.

slide-17
SLIDE 17

Lessons Learned

  • .gitignore can be extremely valuable
  • Start early, work in a group as much as possible, and never

commit broken code

  • Mohit is 26. Whaaaaaat?!?
  • Different people code in different ways. Someone (the

manager) should be figuring out people’s strengths and playing too them.

  • This gets especially interesting when half the group prefers to work

hard but infrequently and the other half prefers frequently for short periods of time

slide-18
SLIDE 18

Moving Forward

Some of the features we would like to implement, given the chance:

  • Modify stdlib.tens to be an importable library
  • Modify our scanner to take any number of imports and include them as necessary
  • Print directly into LaTeX
  • Have our LaTeX pretty-printer methods be callable within .tens files
  • Variables, Functions, and Derivatives
  • Adding a data type and stdlib functions to play with it