CIMFlow is an integrated framework for systematic design and evaluation of digital compute-in-memory (CIM) architectures.
This repository contains the CIMFlow framework, providing a full-stack solution from neural network compilation to cycle-accurate hardware simulation.
- End-to-End Flow: Unifies the entire workflow from high-level DNN model description to detailed performance analysis.
- Two-Level Compiler: CG-level optimization for workload partitioning across cores, and OP-level optimization using LLVM/MLIR for efficient code generation.
- Cycle-Accurate Simulation: SystemC-based simulator with detailed timing and energy modeling.
- Flexible Architecture: Configurable parameters for CIM macro size, memory hierarchy, NoC bandwidth, and core organization.
- Profiling & Analysis: Built-in tools for performance profiling and energy estimation.
CIMFlow consists of two main components:
- CIMFlow Compiler: Transforms high-level neural network models (ONNX) into optimized instruction sequences (ISA) for the target CIM architecture.
- CIMFlow Simulator: Executes the generated instructions on a cycle-accurate model of the hardware, producing detailed performance and energy reports.
CIMFlow provides Docker images for both tutorials and development:
| Image | Purpose | Download |
|---|---|---|
cimflow-tutorial:latest |
Pre-built with models and demos | ~3GB |
cimflow-tutorial:dev-base |
Development base with dependencies | ~1GB |
# Try the interactive tutorial
docker run -it --rm ghcr.io/buaa-ci-lab/cimflow-tutorial:latest
# Or start a development environment
./docker/dev.shSee docker/README.md for detailed instructions.
- Operating System: Ubuntu 22.04 (other Linux distributions may work but are untested)
- Disk Space: 15GB or more available
- Python 3.11 or later is required.
We recommend using Conda for Python environment management:
conda create -n cimflow python=3.11
conda activate cimflowNote: If you don't have Conda installed, see the Miniconda installation guide.
Alternatively, you can use venv:
python3.11 -m venv .venv
source .venv/bin/activateInstall the required system packages (Ubuntu 22.04):
# Build tools
sudo apt install build-essential cmake ninja-build ccache
# Clang toolchain (for LLVM/MLIR build)
sudo apt install clang lld
# Java Development Kit (for ANTLR parser)
sudo apt install openjdk-11-jdk
# Required libraries
sudo apt install libeigen3-dev libunwind-devgit clone https://github.com/BUAA-CI-LAB/CIMFlow.git
cd CIMFlowWith your virtual environment activated, run the installation script:
./install.shThis script will:
- Initialize and update submodules (
CIMFlow-Compiler,CIMFlow-Simulator). - Build the compiler (LLVM/MLIR) and simulator (SystemC).
- Install the Python package and CLI tools.
- Generate the default configuration in
config/tool_paths.json.
Tip: Run
./install.sh --helpfor additional options (resume, repair, uninstall, etc.).
Runtime paths are defined in config/tool_paths.json. This file is automatically created during installation.
Post-installation: Check config/tool_paths.json to ensure it points to the correct directories for your setup.
Run a full pipeline (compile + simulate) using a config file:
# Copy the template
cp config_templates/batch.json config/batch.json
# Run the batch
cimflow run from-file config/batch.jsonYou can also run individual steps or override parameters via the CLI:
# Run pipeline with specific model and hardware parameters
cimflow run pipeline -m model.onnx -o output -t 8 -b 16
# Enable profiling
cimflow run pipeline -m model.onnx -o output --profile=from-config
# Enable verbose logging
cimflow run pipeline -m model.onnx -o output -l VERBOSE- Default: Simulation reports are saved in the output directory.
- Debug (
--keep-ir): Saves all intermediate files (IR, ISA, logs) in timestamped folders.
CIMFlow includes interactive tutorials to help you get started. Run them in Docker or after local installation:
# Demo 0: Setup verification
./tutorial/demo0_setup.sh
# Demo 1: Quick end-to-end pipeline
./tutorial/demo1_quickstart.sh
# Demo 2: Step-by-step compilation stages
./tutorial/demo2_stages.sh
# Demo 3: Design space exploration
./tutorial/demo3_exploration.shThe tutorials cover:
- Demo 0: Verify installation and explore CLI commands
- Demo 1: Run a complete compile-simulate pipeline on ResNet-18
- Demo 2: Understand each compilation stage (CG, OP, Simulation)
- Demo 3: Batch processing for hardware design exploration
We welcome contributions! Please see CONTRIBUTING.md for guidelines on how to get started.
If you use CIMFlow in your research, please cite our paper:
@inproceedings{qi2025cimflow,
title={CIMFlow: An Integrated Framework for Systematic Design and Evaluation of Digital CIM Architectures},
author={Qi, Yingjie and Yang, Jianlei and Wang, Yiou and Wang, Yikun and Wang, Dayu and Tang, Ling and Duan, Cenlin and He, Xiaolin and Zhao, Weisheng},
booktitle={2025 62nd ACM/IEEE Design Automation Conference (DAC)},
pages={1--7},
year={2025},
doi={10.1109/DAC63849.2025.11133270}
}This project is licensed under the Apache License 2.0 - see the LICENSE file for details.