TopSort: A High-Performance Two-Phase Sorting Accelerator Optimized on HBM-Based FPGAs

Weikang Qiao, Licheng Guo, Zhenman Fang, Mau-Chung Frank Chang, Jason Cong

TL;DR

TopSort is a novel two-phase sorting accelerator designed to fully exploit the massive bandwidth of High-Bandwidth Memory (HBM) on FPGAs. By intelligently reusing hardware logic between two distinct sorting phases, it overcomes the "resource wall" where on-chip logic requirements typically outpace available memory bandwidth, achieving a 6.7× speedup over high-end CPUs.

What Problem Does This Paper Address?

For years, the performance of sorting accelerators on FPGAs was limited by the "memory wall"—the slow speed of traditional off-chip DRAM. The arrival of High-Bandwidth Memory (HBM) changed the game, offering roughly 6× the bandwidth of standard DRAM.

However, simply scaling up existing "merge tree" sorters to match HBM's speed is impossible. Why? Because as you increase a sorter's throughput ($p$), the required on-chip resources (like Look-Up Tables) grow at a much faster rate—specifically $\theta(p \log^3 p)$. While HBM provides 6× more bandwidth, modern FPGAs only provide about 1.2× more on-chip resources. This creates a new "resource wall." Furthermore, HBM is split into 32 independent channels, making it notoriously difficult to manage data layout and avoid internal congestion.

Methods

The authors introduce TopSort, which tackles these challenges through a two-phase architecture and hardware reuse:

  1. Phase 1 (Parallel Sorting): TopSort deploys 16 parallel merge trees. Each tree handles a portion of the data using two HBM channels (one for reading, one for writing). This phase is designed to saturate the bandwidth of all 32 HBM channels.
  2. Phase 2 (Final Merge): Instead of building a massive, separate circuit to merge the results from Phase 1, TopSort reuses the logic from four of the Phase 1 merge trees. It adds a few extra levels of merge units to create a "wider" tree capable of producing the final sorted sequence.
  3. HBM-Specific Optimizations:
    • Interface Reduction: To save logic, the authors use HBM's internal crossbars so that one AXI interface can access two adjacent channels, halving the resource overhead of memory controllers.
  4. Data Layout: They carefully map data to specific HBM channels to minimize "lateral" traffic across the chip, which can cause performance-killing contention.
  5. Floorplanning: The design is manually spread across the three physical dies (SLRs) of the Xilinx U280 FPGA to ensure the signals can actually "fit" and run at high clock speeds (214 MHz).

Datasets

The system was evaluated using synthetic datasets of key-value pairs (32-bit key, 32-bit value).

  • Distribution: Uniformly distributed keys.
  • Scale: Data sizes ranging from 32 MB up to 4 GB.
  • Validation: Results were verified against a standard Python-based sort to ensure correctness.

Key Insights and Ideas

  • The Logic Reuse Trick: The most elegant insight is that a large merge tree is essentially made of smaller merge trees. By reconfiguring the data flow rather than building new hardware, the authors bypassed the resource limitations that would have otherwise prevented them from using HBM's full speed.
  • Bandwidth vs. Resources: The paper highlights a critical shift in FPGA design: we are moving from an era where we were "starved for data" to an era where we are "starved for space" to process that data.
  • Physical Awareness: On modern multi-die FPGAs, where the HBM is physically located at the bottom of the chip, "blind" high-level synthesis (HLS) often fails. TopSort’s success relies on a "coarse-grained floorplanning" strategy that respects the physical layout of the hardware.

Key Results

  • Throughput: TopSort achieved an overall sorting performance of 15.6 GB/s.
  • Comparison:
    • 6.7× faster than a state-of-the-art CPU-based in-memory sorter (Intel Xeon).
  • 2.2× faster than the previous state-of-the-art FPGA sorter (Bonsai).
  • Efficiency: In Phase 1, the system utilized at least 318 GB/s of HBM bandwidth, demonstrating that the bottlenecks were successfully shifted away from the memory interface.

Limitations and Future Work

  • Capacity Limit: TopSort can currently sort up to 4 GB of data at a time. While the U280 FPGA has 8 GB of HBM, the two-phase approach requires half the channels for reading and half for writing, effectively capping the "in-flight" data at half the total capacity.
  • Resource Scaling: Even with logic reuse, the on-chip resource usage is high (54.6% of LUTs). Scaling to even faster memory technologies in the future will require even more radical architectural changes or more efficient merge unit designs.
  • Data Distribution: The current work focuses on uniform distributions; future iterations could explore how the system handles highly skewed data, which can sometimes cause "bubbles" or stalls in merge trees.

Summary updated

BibTeX
@article{qiao2023topsort,
  author = {Weikang Qiao and Licheng Guo and Zhenman Fang and Mau-Chung Frank Chang and Jason Cong},
  title = {{TopSort: A High-Performance Two-Phase Sorting Accelerator Optimized on HBM-Based FPGAs}},
  journal = {IEEE Trans. Emerg. Top. Comput.},
  year = {2023},
  doi = {10.1109/tetc.2022.3228575},
}
Figure