diff --git a/README.md b/README.md index 72916db..30754aa 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # ttVecAdd -A simple vector-addition on Tenstorrent devices using tt-Metalium. +A simple vector-addition demo on Tenstorrent devices using tt-Metalium. -## How to use +This demo works on grayskull e150 and e75. - -Before building this project. Setup the enviroment variables that Metalium needs +## Setup +Before building this project. Setup the enviroment variables in `setup_env.sh` that Metalium needs, e.g.: ```bash export ARCH_NAME=grayskull @@ -13,44 +13,36 @@ export TT_METAL_HOME=/path/to/your/root/of/tt-metal/ export TT_METAL_ENV=dev ``` -Then build the project +`ln -s $(pwd)/vecadd_kernels $TT_METAL_HOME/ttvecadd_kernels` in `setup_env.sh` will also create a link in the root of TT_METAL_HOME (this is needed at this time because tt-metal looks in its root dir for kernels). +## Build ```bash -cd ttVecAdd -# HACK: Metalium only searches kernels under it's directories -ln -s vecadd_kernels $TT_METAL_HOME/vecadd_kernels - -mkdir build cd build cmake .. make ``` -To run - -``` -➜ ./ttvecadd +## Run +```bash +$ ./ttvecadd Metal | INFO | Initializing device 0 Device | INFO | Opening user mode device driver -2024-03-26 10:24:40.877 | INFO | SiliconDriver - Detected 1 PCI device : [0] - Metal | INFO | AI CLK for device 0 is: 1300 MHz - Metal | INFO | DPRINT enabled on device 0, worker core (x=0,y=0) (physical (x=1,y=1)). - Metal | INFO | DPRINT Server attached device 0 - Verif | INFO | Created a random vector of size 512 - Verif | INFO | Created a random vector of size 512 +2024-04-07 19:02:21.965 | INFO | SiliconDriver - Detected 1 PCI device : {0} + Metal | INFO | AI CLK for device 0 is: 1202 MHz + Verif | INFO | Created a random vector of size 32768 + Verif | INFO | Created a random vector of size 32768 Kernel execution finished Partial results: (note we are running under BFP16. It's going to be less accurate) - 17.625 + 8.1875 = 25.875 - 6.34375 + 17.125 = 23.5 - 5.0625 + 4.3125 = 9.375 - 17.375 + 4.53125 = 21.875 - 3.25 + 10.5625 = 13.8125 - 17 + 3.25 = 20.25 - 7.40625 + 6.8125 = 14.25 - 17.875 + 0.369141 = 18.25 - 15.75 + 10.75 = 26.5 - 15.1875 + 15.8125 = 31 + 2.32812 + 2.26562 = 4.59375 + 4.25 + 3.46875 = 7.71875 + 0.0114746 + 7.4375 = 7.4375 + 4.09375 + 6.9375 = 11.0625 + 3.89062 + 7.03125 = 10.9375 + 6.84375 + 6.0625 = 12.9375 + 0.0195312 + 3.71875 = 3.73438 + 9.4375 + 7.6875 = 17.125 + 6.8125 + 4.96875 = 11.8125 + 4.25 + 5.46875 = 9.75 Metal | INFO | Closing device 0 - Metal | INFO | DPRINT Server dettached device 0 Device | INFO | Closing user mode device drivers ``` diff --git a/setup_env.sh b/setup_env.sh new file mode 100644 index 0000000..58a328b --- /dev/null +++ b/setup_env.sh @@ -0,0 +1,7 @@ +export ARCH_NAME=grayskull +export TT_METAL_HOME=~/Desktop/devs/tt-metal/ +export TT_METAL_ENV=dev + +mkdir build + +ln -s $(pwd)/vecadd_kernels $TT_METAL_HOME/ttvecadd_kernels