Skip to content

purdue-nrl/PUMASim-v2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PUMASim-v2

This repository provides an extended and unified framework for the PUMA Compiler and PUMA Simulator, enabling detailed simulation of in-memory computing (IMC) architectures.

PUMASim-v2 is used in the following works:

  1. Scalable In-Memory Computing Architecture with Optimal Weight-Data Flow from Off-chip DRAM
  2. HASTILY: Hardware-Software Co-Design for Accelerating Transformer Inference Leveraging Compute-in-Memory

Acknowledgements

This repository extends and integrates both tools to support enhanced architectural modeling, scheduling, and analysis.


Overview

PUMASim-v2 consists of two components:

  • PUMA Compiler (C++)
    Translates a neural network model (e.g., CNNs or Transformers) into PUMA ISA instruction files for each tile and core.

  • PUMA Simulator (Python)
    Executes the generated instruction files to evaluate latency, energy, and area.

Both components are required to run a complete simulation.


Tutorial

This section provides a basic end-to-end workflow.

Step 1: Build the PUMA Compiler

1. Set the compiler library path

export LD_LIBRARY_PATH=<YOUR_PUMA_COMPILER_PATH>/src:$LD_LIBRARY_PATH

Example:

export LD_LIBRARY_PATH=/local/scratch/a/user/PUMASim-v2/puma-compiler-v4/src:$LD_LIBRARY_PATH

2. Compile the compiler source

cd puma-compiler-v4/src
make

Step 2: Generate PUMA ISA Instructions

3. Build and run an example model

cd ../test
make clean
make cnn.test
./cnn.test

This generates multiple .puma instruction files, for example:

cnn-tile0-core0.puma
cnn-tile0-core1.puma
...

Each .puma file contains the PUMA ISA instructions executed by a specific tile and core.

Note

  • The model name (cnn) is defined in your model source file (cnn.cpp), for example:

    Model model = Model::create("cnn");
  • If you have your own model source file (e.g., xyz.cpp), build and run it as follows:

    make xyz.test
    ./xyz.test
  • If it gives segmentation fault, try increasing N_TILES_PER_NODE in src/common.h.


Step 3: Prepare Instructions for the PUMA Simulator

The generated .puma instruction files must be converted into a format readable by the PUMA Simulator.

Before proceeding, make sure the simulator path is correctly set in the following files:

  • puma-compiler-v4/test/generate-py.sh
  • puma-compiler-v4/test/populate.py
SIMULATOR_PATH = <path_to_puma-simulator-v4>

4. Run the conversion script

./generate-py.sh

This script will:

  • Create a directory named after the model (e.g., cnn/)
  • Copy this directory into: puma-simulator-v4/test/testasm/

Note
The generated directory name depends on the model name you specified. If errors occur during this step, check for configuration mismatches between:

  • puma-compiler-v4/src/common.h
  • puma-simulator-v4/include/config.py

In particular, the following parameters must be consistent:

  • MVMU Dimension
  • Number of MVMUs per core
  • Number of cores per tile

Step 3: Run the PUMA Simulator

5. Execute the simulation

Navigate to the simulator src directory and run:

cd ../../puma-simulator-v4/src
python dpe.py -n cnn

Here, cnn refers to the directory located in:

puma-simulator-v4/test/testasm/

6. View simulation results

Simulation results are generated in the following directory:

puma-simulator-v4/test/traces/cnn/

This directory contains detailed traces and statistics for latency, energy, and area.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages