How ucb-bar/baremetal-nn works
Main Components
a) Model Conversion Pipeline:
• PyTorch Model Input
• Converter Module (in converter/src/torchconverter)
• Generated C Code Output (model.h, weights.h, operators.h)
b) Runtime Components:
• Core Neural Network Library (nn/ directory)
• Device-Specific Backends
• Memory Management System
[Input Layer]
PyTorch Models
• ↓
[Conversion Layer]
TorchConverter
• ↓
[Output Generation Layer]
Generated C Files
• ↓
[Runtime Layer]
Backend Implementation Layer → Device-Specific Optimizations
• ↓
[Hardware Layer]
Target Platforms (RISC-V, x86, K230, etc.)
Key Elements to Highlight
a) Model Processing Pipeline:
• Flow from PyTorch model → Converter → C code generation
• Three main output files (nn.h, operators.h, weights.h)
b) Backend Support Matrix:
• Datatype support (F16, F32, I32)
c) Memory Management:
• NHWC memory layout system
• Up to 4-dimension tensor support
Implementation Details
• Tensor Operations Support
• Supported operators (matmul, linear, relu, etc.)
• Datatype variants
• Backend Implementations
• RISC-V Vector support
• Scalar CPU implementation
• Gemmini support (marked as in-progress)
• Build System Integration
• CMake configuration options
• Toolchain support
Specific Technical Notes
• RISC-V Vector backend with FP16 support requirements
• Assembly implementations for GCC<14.0
• Relationship between different device backends
• Tensor operation dispatch system
Remember to include a version number and date, as this is an actively developed project (current version 0.2.0).