How eki-project/finn-plus works
Project Type and Purpose
• This is an open-source, pipeline-driven “dataflow compiler” (FINN+) for building customized FPGA accelerators targeting quantized neural networks.
• It offers a Python-based CLI/API (“finn”), a layered transformation pipeline (ONNX → QONNX → fpgadataflow), a builder backend that emits HLS/C++/RTL, and hardware libraries (finn-rtllib) for Vivado/Vitis flows.
High-Level Component Breakdown
a. User Interface Layer
• CLI/Config: finn command, YAML build_config files, installDependencies.sh
• Python API: src/finn/interface/run_finn.py, utils for dependency & test management
b. Transformation Pipeline
• ONNX → QONNX passes: src/finn/transformation/qonnx
• Streaming-dataflow transformations: src/finn/transformation/fpgadataflow
• Streamline optimizations: src/finn/transformation/streamline
c. Builder / Code Generation
• Build orchestration: src/finn/builder/build_dataflow.py, build_dataflow_steps.py
• Custom step plugins: src/finn/builder/custom_step_library
• Dataflow export: C++ simulation, HLS IP packaging, Vivado/Vitis project generation
d. Hardware & Simulation Libraries
• Hardware IP templates & RTL: finn-rtllib/axi, fifo, dwc, memstream, mvu, etc.
• HLS C++ kernels & templates: custom_hls/
• XSI-based simulator engine: finn_xsi/finn_xsi
e. Analysis & Benchmarking
• Performance/QoR estimation: src/finn/analysis/fpgadataflow
• Throughput tests & simulation exec: src/finn/core
• Benchmark harnesses: src/finn/benchmarking
f. External Dependencies & Tools
• Xilinx tools: Vivado, Vitis HLS, Vitis SDK
• Python libraries: ONNX, Brevitas, PyYAML, numpy, etc.
• CI/Testing: GitHub Actions, GitLab CI, pytest in tests/
Relationships and Data Flow
• User invokes finn build (CLI) → Interface module reads YAML config
• Transformation pipeline modules apply successive graph rewrites to ONNX model
• Builder modules generate HLS/C++/RTL IP, script files, and Vivado/Vitis projects
• Hardware library IPs from finn-rtllib are instantiated into the design
• Xilinx tools synthesize & implement bitstream
• Python core and XSI engine run simulations; analysis modules collect performance data
• Benchmark scripts orchestrate on-hardware or simulated performance measurements
Architectural Patterns & Design Principles
• Layered/pipeline architecture: clear separation of interface, transformation, builder, and backend
• Plugin pattern: custom steps and custom_op libraries for extensibility
• Modular hardware library: reusable RTL/HLS blocks in finn-rtllib
• CI/test harness: comprehensive test suite ensures correctness at each layer