Clone spatial repo and checkout pir branch for latest development For place and route and simulation, you need to get access to these repos
https://github.com/arjundeopujari/plastiroute.git
https://github.com/arjundeopujari/tungsten.git
git clone https://github.com/stanford-ppl/spatial.git
cd spatial
git checkout arjund7
make update
make pir
make pir
compiles all submodules, which can takes some time for the first time. It will print bunch of stuff and make sure there's no error before proceeding. make update
initializes all submodules (plastiroute, tungsten) to the current branch and commit.
If your app extends SpatialTest
instead of SpatialApp, you can run all following passes with the script bin/test
.
cd $SPAITAL_HOME
bin/test -a <app> -b <backend> -p <project> -t <threads> [-H, -T]
Each ScalaTest has multiple backend that runs FPGA or Plasticine simulation. For Plasticine, the Tst
backend runs
the following passes (passname):
- Compile Spatial (genpir)
- Compile PIR (gentst)
- Compile generated Cpp simulator (maketst)
- Run ideal network simulation (runp2p)
- Place and route (runproute)
- Run hybrid network simulation (runhybrid)
<app>
can use wildcard matching, for example DotProduct*. Unspecified will run all apps in the project. You can provide multiple -a for a list of apps to run.
<backend>
to target plasticine use Tst, to FPGA Chisel simulation use VCS
<project>
for apps in spatial/pir/regression use pirTest
. for apps in test/spatial/tests/ use tests
-H
runs place and route and hybrid network simulation. By default the script stops at ideal network simulation.
-T
will prints logs of individual passes in console for easy debugging. it's recommanded only if you are running a single app.
-u
will recompile pir and publish pir to sbt local ivy cache. This is required if you make change
in pir.
example command:
bin/test -a DotProduct_0 -b Tst -p pirTest -T
By default bin/test cache succeeded passes. To force rerun all passes, add -r all
which will generates apps in spatial/gen/Tst_pirTest
.
While bin/test
is running, you can monitor the status with bin/log <gendir>
, which will show the progress of each pass.
You can add -m field1,field2
to get summary of the apps. Useful fields includes VPCU,VPMU,VDAG,VMC, which are number of virual CUs used. PCU,PMU,DAG,MC,for number of physical CUs used.
example: bin/log gen/Tst_pirTest -m PCU,PMU
, bin/log x --print_fields
for all possible fields to check.
To produce a snapshot of the summary with bin/log
use -s
, which will stores the parsed fields
and apps into a csv file. To change directory to store the log file, use --logdir
.
For more options in bin/log
, use bin/log --help
.
If you don't want to use bin/test, you can generate each pass by hand.
# 1. Generate app from Spatial
bin/spatial <App> --pir
cd <gendir>
# 2. Compile PIR
bash run.sh [options]
cd tungsten
# 3. Compile simulator
make tungsten
# 4. Compile for ideal network (can be merged with step 3 with just make ideal)
make ideal
# 5. Run simulation for ideal network
./tungsetn [args]
# 6. Run place and route and compile for hybrid network
make proute
# 7. Run simulation for hybrid network
./tungsten [args]
To see all possible options, run
bash run.sh --help
Optionally all options can also be set from a config file at $HOME/.pirconf Commend line options will override config file options. Example config
# compiler configs
mapping=true
stat=true # print out CU statistics
# Architectural configs
topo=mesh
row=4
col=4
Command line options start with --
. --mapping
is equivalent to mapping=true
in config file
--stat: Printing CU statistics [default=false]
--dot: Enable dot codegen [default=true]
--proutesh: passing an absolute path to a script to run plastiroute with customized options. It should be a
bash script, which will be called to run plastiroute.
--word: Word width [default=32]
--vec: Vector width of SIMD lanes and vector network [default=16]
--net: Network type [dynamic, static, p2p, asic] [default=static]
--topo: Network topology [mesh, torus, cmesh] [default=mesh]
--row: number of rows in network [default=2]
--col: number of columns in network [default=2]
--pattern: Pattern in layout of different CU types. [checkerboard,mcmcstrip]
--dag: enable dram address generator in network [default=true]
--fifo-depth: Depth of FIFO for all CUs [default=4]
--argout: number of ArgOut [default=4]
--argin: number of ArgIn [default=6]
--tokenout: number of TokenOut [default=5]
--vlink: number of static links in vector network [default=4]
--slink: number of static links in scalar network [default=2]
--pcu-stage: number of stages for PCU, similar for pmu, and dag
--mem-tech: DRAM technology. [DDR3, DDR4, HBM]