How germanyy0410/graph-attention-network-fpga works
Based on our analysis of the provided file tree and README, this project is an FPGA-based hardware accelerator for Graph Attention Networks (GAT). The goal is to optimize key GAT computations – including DMVM, SPMM, custom softmax, and aggregation – by mapping them onto an FPGA. The project is organized into modules for hardware description (SystemVerilog under the rtl folder), synthesis constraints (syn folder), testbenches (tb folder), and input/output data management (data folder with examples for Citeseer and Cora datasets).
Main Components
a. Input Data & Preprocessing:
• Data files organized under “data” (e.g., input text files for a.txt, h_data.txt, node_info.txt, weight.txt) to represent graph data.
• Two layers indicated in the file tree (layer_1 and layer_2) suggest a multi-stage or multi-layer GAT architecture.
b. Hardware Accelerator Modules:
• DMVM Module – Found under rtl/src/DMVM, with supporting files in the corresponding “data” outputs.
• SPMM Module – Found under rtl/src/SPMM, including multiple submodules such as SP_PE and controllers.
• Aggregator Module – Located under rtl/src/aggregator, dealing with feature aggregation.
• Softmax Module – Located specifically in rtl/src/softmax, with its custom implementation utilizing bit-shift operations instead of conventional exponential calculations.
c. Additional Supporting Components:
• Memory Controllers and BRAM/URAM modules – Detailed under rtl/src/memory and rtl/src/others/BRAM.
• Scheduler – Found in rtl/src/scheduler, responsible for controlling the load and operation sequence (e.g., W_loader, scheduler_conv2).
• Other utility modules (multipliers, dividers) in rtl/src/others (e.g., fxp_mul_pipe, fxp_div_pipe).
• Top-level integration modules such as gat_top, gat_conv1, gat_conv2, and the top wrapper (rtl/src/gat_top_wrapper.v) that tie the overall design together.
d. Verification/Testing:
• Testbench modules (tb folder) and simulation artifacts which help verify individual modules and overall system integration.
• Synthesis files (syn folder) and scripts for FPGA implementation.
Relationships and Interactions
• Data flows from external inputs (graph data) through a preprocessing stage to feed into the processing modules (DMVM, SPMM, Aggregator, Softmax).
• Each module processes a portion of the GAT computations. For instance, DMVM and SPMM are used for matrix-vector operations that are integral to the GAT’s layer calculations.
• Softmax is implemented with a custom algorithm for hardware efficiency; it receives intermediate results from the aggregator stage.
• The Memory Controller facilitates efficient storage and retrieval across these stages, coordinating with the scheduler.
• The scheduler governs the operation sequencing and data loading to ensure smooth operation across parallel processing elements.
• The top-level module (gat_top and its wrapper) integrates and connects these pipelines so that the accelerator processes the input graph data in a layered, modular fashion.
Architectural Patterns and Design Principles
• Modularity: The RTL code is organized per functional blocks (DMVM, SPMM, etc.), which helps to understand data and control flow.
• Parallel Processing: Special emphasis is on parallelism (e.g., multiple processing elements in SPMM) optimizing latency and throughput.
• Hardware-specific Optimizations: The custom softmax using bit-shift operations and dynamic quantization (to INT8) are specially designed for FPGA resource optimization.
• Data and Control Flow Separation: Clearly defined input, processing, and output stages, with dedicated scheduler and memory controller blocks ensuring synchronized operations.
Relevant Technologies and Frameworks
• FPGA design using SystemVerilog and Verilog.
• Synthesis constraints (syn folder with XDC files) tailored for FPGA resource utilization.
• Testbench designs (tb folder) likely employing simulation tools to validate behavior.
• Parallel processing and memory optimization techniques implemented in hardware.