0. Getting Started

Prerequisites

First, make sure to download and install the following prerequisites:

While it’s not at all required, it may be easier to learn to use Spatial if you’ve had experience with Scala or a similar functional programming language in the past. Knowledge of Scala will allow you to use meta-programming to assist your Spatial designs.

If you’d like, check out this Scala tutorial .

Finally, please sign up for the Spatial users google group if you have any questions.

Installation (From Source)

Run the following (bash) commands to clone and update the spatial-lang repository:

git clone https://github.com/stanford-ppl/spatial-lang.git
cd spatial-lang
git submodule update --init

This will pull Spatial’s submodules argon, apps, and scala-virtualized.

You may need to export your JAVA_HOME environment variable to point to your Java installation (usually /usr/bin)

You are now ready to compile the language. Run the following:

cd spatial-lang # Navigate to root of spatial-lang repository
sbt compile

A good habit would be to pull from these repositories often and run sbt compile in your spatial-lang directory.

That’s it! Up next, you will learn how to use the language by working through a series of examples. The concepts you will learn in these tutorials are listed below. Feel free to skip around the apps as you find convenient:

  • Application skeleton (import statements, application creation, accel scope, host scope)
  • ArgIn
  • ArgOut
  • HostIO
  • DRAM
  • SRAM
  • Reg
  • Typing system
  • Data transfer between host and accel (setArg, setMem, getArg, getMem, load, store, gather, scatter)
  • Basic debugging hooks
  • Compiling an app
  • Tiling
  • Reduce and Fold
  • Sequential execution and Coarse-grain pipelining
  • Parallelization
  • Basic buffering and banking
  • MemReduce and MemFold
  • Debugging with instrumentation
  • Advanced banking
  • Advanced buffering
  • LineBuffer
  • ShiftRegister
  • LUT
  • Spatial Functions and Multifile Projects
  • FSM
  • Branching
  • FIFO
  • Systolic Arrays
  • File IO and text management
  • Asserts, Breakpoints, and Sleep