This repository demonstrates buddy-mlir capabilities through selected representative workloads running on Chipyard 1.13.1 platform. These example models are lowered to Gemmini Dialect by buddy-mlir, where Gemmini is a DNN accelerator integrated in Chipyard. The workloads are simulated using tools provided by Chipyard: the FireSim FPGA-accelerated simulation.
- Environment Dependencies
Before getting started, please ensure your system meets the following dependency requirements:
- Anaconda/Miniconda (environment management)
- Ninja Build System
- Initialize repository in one step:
git clone https://github.com/buddy-compiler/buddy-examples.git
cd buddy-examples
./scripts/init.sh- Activate environment
# buddy environment
cd buddy-examples
source ./env.sh
# firesim environment
cd buddy-examples/thirdparty/chipyard/sims/firesim
source ./env.sh
source ./sourceme-manager.sh --skip-ssh-setup
cd ~/.ssh
ssh-agent -s > AGENT_VARS
source AGENT_VARS
ssh-add firesim.pem- Build hardware in FireSim
We have tested these examples on VCU118 and Alveo U280 platforms.
-
Configuration setup
- replace
default_build_dirwith your desired directory path for storing generated bitstream files. - replace
default_simulation_dirwith your desired directory path for storing simulation-related files.
- replace
-
Generate bitstream and run simulation
./sims/firesim/build-firesim.shBuild the FPGA bitstream and launch FireSim simulations. The bitstream generation process may take several hours depending on your hardware configuration.
cd buddy-examples
source ./env.shNote: This guide assumes you have basic knowledge of FireSim. For detailed FireSim configuration instructions, please refer to the official FireSim documentation.
Then, you can start running the examples below.
This example uses the LeNet model with the MNIST dataset. Note that the build process will automatically download the dataset and train the model locally before building workloads, which may take some time.
- Build Workloads
cd buddy-examples
source ./env.sh
./sims/marshal/build-image.sh lenet-gemmini- Simulation in firesim
# activate firesim environment
cd buddy-examples/thirdparty/chipyard/sims/firesim
source ./env.sh
source ./sourceme-manager.sh --skip-ssh-setup
cd ~/.ssh
ssh-agent -s > AGENT_VARS
source AGENT_VARS
ssh-add firesim.pem
cd buddy-examples
./sims/firesim/run-firesim.sh- Monitor simulation process in a new terminal
ssh localhost
screen -r fsim0 - Final step!
Now, you can login to the system! The username is root and there is no password. The steps described here are for manual execution. The corresponding log files will be recorded in the
/firesim/deploy/results-workloadfolder.
$ ./buddy-gemmini-lenet-runIf all steps go well, you will see the output below. Good luck.
- Build Workloads
cd buddy-examples
source ./env.sh
./sims/marshal/build-image.sh resnet-gemmini- Simulation in firesim
# activate firesim environment
cd buddy-examples/thirdparty/chipyard/sims/firesim
source ./env.sh
source ./sourceme-manager.sh --skip-ssh-setup
cd ~/.ssh
ssh-agent -s > AGENT_VARS
source AGENT_VARS
ssh-add firesim.pem
cd buddy-examples
./sims/firesim/run-firesim.sh- Monitor simulation process in a new terminal
ssh localhost
screen -r fsim0 - Final step!
Now, you can login to the system! The username is root and there is no password. The steps described here are for manual execution. The corresponding log files will be recorded in the
/firesim/deploy/results-workloadfolder.
$ ./buddy-gemmini-resnet-runIf all steps go well, you will see the output below. Good luck.
- Build Workloads
cd buddy-examples
source ./env.sh
./sims/marshal/build-image.sh mobilenetv3-gemmini- Simulation in firesim
# activate firesim environment
cd buddy-examples/thirdparty/chipyard/sims/firesim
source ./env.sh
source ./sourceme-manager.sh --skip-ssh-setup
cd ~/.ssh
ssh-agent -s > AGENT_VARS
source AGENT_VARS
ssh-add firesim.pem
cd buddy-examples
./sims/firesim/run-firesim.sh- Monitor simulation process in a new terminal
ssh localhost
screen -r fsim0 - Final step!
Now, you can login to the system! The username is root and there is no password. The steps described here are for manual execution. The corresponding log files will be recorded in the
/firesim/deploy/results-workloadfolder.
$ ./buddy-gemmini-mobilenetv3-runIf all steps go well, you will see the output below. Good luck.
Notes The current sequence length limit is set to 5 tokens for test, which can be increased appropriately (the model's maximum limit is 512).
- Build Workloads
cd buddy-examples
source ./env.sh
./sims/marshal/build-image.sh bert-gemmini- Simulation in firesim
# activate firesim environment
cd buddy-examples/thirdparty/chipyard/sims/firesim
source ./env.sh
source ./sourceme-manager.sh --skip-ssh-setup
cd ~/.ssh
ssh-agent -s > AGENT_VARS
source AGENT_VARS
ssh-add firesim.pem
cd buddy-examples
./sims/firesim/run-firesim.sh- Monitor simulation process in a new terminal
ssh localhost
screen -r fsim0 - Final step!
Now, you can login to the system! The username is root and there is no password. The steps described here are for manual execution. The corresponding log files will be recorded in the
/firesim/deploy/results-workloadfolder.
$ ./buddy-gemmini-bert-runIf all steps go well, you will see the output below. Good luck.
Notes This model needs to download weights from Hugging Face. Please make sure your environment variables are configured correctly so that Hugging Face can be accessed normally.
- Build Workloads
cd buddy-examples
source ./env.sh
./sims/marshal/build-image.sh stablediffusion-gemmini- Simulation in firesim
# activate firesim environment
cd buddy-examples/thirdparty/chipyard/sims/firesim
source ./env.sh
source ./sourceme-manager.sh --skip-ssh-setup
cd ~/.ssh
ssh-agent -s > AGENT_VARS
source AGENT_VARS
ssh-add firesim.pem
cd buddy-examples
./sims/firesim/run-firesim.sh- Monitor simulation process in a new terminal
ssh localhost
screen -r fsim0 - Final step!
Now, you can login to the system! The username is root and there is no password. The steps described here are for manual execution. The corresponding log files will be recorded in the
/firesim/deploy/results-workloadfolder.
$ ./buddy-gemmini-stablediffusion-runIf all steps go well, you will see the output below. Good luck.
Notes This model needs to download weights from Hugging Face. Please make sure your environment variables are configured correctly so that Hugging Face can be accessed normally. In addition, please configure your API in this file.
- Build Workloads
cd buddy-examples
source ./env.sh
./sims/marshal/build-image.sh llama2-gemmini- Simulation in firesim
# activate firesim environment
cd buddy-examples/thirdparty/chipyard/sims/firesim
source ./env.sh
source ./sourceme-manager.sh --skip-ssh-setup
cd ~/.ssh
ssh-agent -s > AGENT_VARS
source AGENT_VARS
ssh-add firesim.pem
cd buddy-examples
./sims/firesim/run-firesim.sh- Monitor simulation process in a new terminal
ssh localhost
screen -r fsim0 - Final step!
Now, you can login to the system! The username is root and there is no password. The steps described here are for manual execution. The corresponding log files will be recorded in the
/firesim/deploy/results-workloadfolder.
$ ./buddy-gemmini-llama2-runIf all steps go well, you will see the output below. Good luck.
Notes This model needs to download weights from Hugging Face. Please make sure your environment variables are configured correctly so that Hugging Face can be accessed normally.
- Build Workloads
cd buddy-examples
source ./env.sh
./sims/marshal/build-image.sh deepseekr1-gemmini- Simulation in firesim
# activate firesim environment
cd buddy-examples/thirdparty/chipyard/sims/firesim
source ./env.sh
source ./sourceme-manager.sh --skip-ssh-setup
cd ~/.ssh
ssh-agent -s > AGENT_VARS
source AGENT_VARS
ssh-add firesim.pem
cd buddy-examples
./sims/firesim/run-firesim.sh- Monitor simulation process in a new terminal
ssh localhost
screen -r fsim0 - Final step!
Now, you can login to the system! The username is root and there is no password. The steps described here are for manual execution. The corresponding log files will be recorded in the
/firesim/deploy/results-workloadfolder.
$ ./buddy-gemmini-deepseekr1-runIf all steps go well, you will see the output below. Good luck.

