FPGA-based acceleration of TinyLLaVA-Phi-2-SigLIP-3.1B inference on AMD Alveo U280 using Vitis HLS.
C++
3
131 commits
updated Feb 5, 2026
This repository contains the implementation of the TinyLLaVA-Phi-2-SigLIP-3.1B multimodal model inference on the AMD Alveo U280 FPGA, accelerated using High-Level Synthesis (HLS).
The project focuses on optimizing the Vision Encoder (SigLIP) and Large Language Model (Phi-2) components to overcome memory bottlenecks and maximize computational throughput on resource-constrained hardware.
Deploying Large Multimodal Models (LMMs) on FPGAs presents significant challenges due to limited on-chip memory and memory bandwidth. This project leverages the Xilinx Vitis platform to offload compute-intensive kernels to the FPGA, achieving efficient inference through architectural and algorithmic optimizations.
The system implements the full TinyLLaVA pipeline, partitioning the workload between the Host (CPU) and the Kernel (FPGA).
The host code manages tokenization, memory mapping, and controls the generation loop. This part of the codebase is modified and adapted from the bol-edu/course-lab_3 repository (originally targeting Alveo U50, Vitis 2022.1). We extended it to support the specific memory requirements and kernel interactions of the TinyLLaVA model on the U280.
We partitioned the Phi-2 model into 10 separate kernels for execution on the Alveo U280.
Figure 1: System Architecture showing the partition between Host (CPU) and Kernel (FPGA) for the Phi-2 model.
The Vision Encoder requires complex dataflow management. We designed a specific buffering strategy to handle the data dependencies between Layernorm, Linear, and Attention layers.
Figure 2: Dataflow and memory buffering strategy for the SigLIP Vision Encoder on FPGA.
Due to the U280's 8GB HBM limit and the model's ~6GB parameter size, we implemented a strict memory allocation strategy:
We applied several HLS-specific optimizations to achieve hardware acceleration:
To address the "storage fragmentation" issue in URAM, we transposed the weights of the MLP FC2 layer. This allows the kernel to compute partial results with a much smaller local buffer (reducing requirements from 2560 to 8 elements), significantly saving on-chip memory.
Figure 3: Illustration of the Matrix Rotation strategy in the MLP FC2 layer to minimize on-chip memory usage.
Standard implementation of Reshape and Transpose operations involves expensive division and modulo operations. We replaced these with efficient counter-based logic, which tracks head_num and offset to generate indices directly. This significantly reduced DSP/LUT usage and latency.
Figure 4: Tiling strategy and optimized counter-based indexing for efficient Attention computation.
ap_fixed<40, 16>.By optimizing memory access and applying fixed-point arithmetic, we achieved a similar speed compared to the baseline Pytorch version running on i9-14900k.
| Version | Precision | Hardware | Execution Time |
|---|---|---|---|
| C++ Version | Float32 | CPU (i9-14900k) | 2029.44 s / token |
| Pytorch Version | Float32 | CPU (i9-14900k) | 2.206 s / token |
| Original HLS | Float32 | Alveo U280 | 9.093 s / token |
| Optimized (v2) | Fixed<40,16> | Alveo U280 | 3.986 s / token |
Through Tiling and Counter-based indexing, the Vision Encoder performance improved significantly.
| Kernel | Original Time (ms) | Optimized Time (ms) | Speedup |
|---|---|---|---|
| Linear | 4502 | 1191 | 3.7x |
| Attention | 20975 | 5601 | 3.7x |
| MLP | 62602 | 8037 | 7.8x |
| Total (One Layer) | 88.1s | 14.8s | ~5.9x |
FPGA-based acceleration of TinyLLaVA-Phi-2-SigLIP-3.1B inference on AMD Alveo U280 using Vitis HLS.
C++
3
131 commits
updated Feb 5, 2026
This repository contains the implementation of the TinyLLaVA-Phi-2-SigLIP-3.1B multimodal model inference on the AMD Alveo U280 FPGA, accelerated using High-Level Synthesis (HLS).
The project focuses on optimizing the Vision Encoder (SigLIP) and Large Language Model (Phi-2) components to overcome memory bottlenecks and maximize computational throughput on resource-constrained hardware.
Deploying Large Multimodal Models (LMMs) on FPGAs presents significant challenges due to limited on-chip memory and memory bandwidth. This project leverages the Xilinx Vitis platform to offload compute-intensive kernels to the FPGA, achieving efficient inference through architectural and algorithmic optimizations.
The system implements the full TinyLLaVA pipeline, partitioning the workload between the Host (CPU) and the Kernel (FPGA).
The host code manages tokenization, memory mapping, and controls the generation loop. This part of the codebase is modified and adapted from the bol-edu/course-lab_3 repository (originally targeting Alveo U50, Vitis 2022.1). We extended it to support the specific memory requirements and kernel interactions of the TinyLLaVA model on the U280.
We partitioned the Phi-2 model into 10 separate kernels for execution on the Alveo U280.
Figure 1: System Architecture showing the partition between Host (CPU) and Kernel (FPGA) for the Phi-2 model.
The Vision Encoder requires complex dataflow management. We designed a specific buffering strategy to handle the data dependencies between Layernorm, Linear, and Attention layers.
Figure 2: Dataflow and memory buffering strategy for the SigLIP Vision Encoder on FPGA.
Due to the U280's 8GB HBM limit and the model's ~6GB parameter size, we implemented a strict memory allocation strategy:
We applied several HLS-specific optimizations to achieve hardware acceleration:
To address the "storage fragmentation" issue in URAM, we transposed the weights of the MLP FC2 layer. This allows the kernel to compute partial results with a much smaller local buffer (reducing requirements from 2560 to 8 elements), significantly saving on-chip memory.
Figure 3: Illustration of the Matrix Rotation strategy in the MLP FC2 layer to minimize on-chip memory usage.
Standard implementation of Reshape and Transpose operations involves expensive division and modulo operations. We replaced these with efficient counter-based logic, which tracks head_num and offset to generate indices directly. This significantly reduced DSP/LUT usage and latency.
Figure 4: Tiling strategy and optimized counter-based indexing for efficient Attention computation.
ap_fixed<40, 16>.By optimizing memory access and applying fixed-point arithmetic, we achieved a similar speed compared to the baseline Pytorch version running on i9-14900k.
| Version | Precision | Hardware | Execution Time |
|---|---|---|---|
| C++ Version | Float32 | CPU (i9-14900k) | 2029.44 s / token |
| Pytorch Version | Float32 | CPU (i9-14900k) | 2.206 s / token |
| Original HLS | Float32 | Alveo U280 | 9.093 s / token |
| Optimized (v2) | Fixed<40,16> | Alveo U280 | 3.986 s / token |
Through Tiling and Counter-based indexing, the Vision Encoder performance improved significantly.
| Kernel | Original Time (ms) | Optimized Time (ms) | Speedup |
|---|---|---|---|
| Linear | 4502 | 1191 | 3.7x |
| Attention | 20975 | 5601 | 3.7x |
| MLP | 62602 | 8037 | 7.8x |
| Total (One Layer) | 88.1s | 14.8s | ~5.9x |