betaFeedback

WorksComputer Science

Native FPGA Hard-Block Implementation from High-Level Synthesis

Abstract

High-level synthesis (HLS) maps computations to FPGA hard blocks, yet often leaves their arithmetic modes, internal registers, and cascade links idle and recreates them in the fabric, costing area and timing. We present a C++ template library that reaches native hard-block implementations without modifying the HLS compiler. Templates fix source patterns, and an automatic flow picks scheduling settings and verified RTL patches. On AMD Versal, our matrix multiplication uses 2.4–4.5x fewer lookup tables (LUTs) than AutoSA systolic arrays at equal or higher estimated throughput. Our INT8 matrix–vector units reach the three multiply–accumulates per DSP of hand-written FINN RTL, versus at most 1.29 for HLS libraries. In hls4ml, Allo, and Stream-HLS, the templates cut LUTs by up to 2.7x and DSPs by up to 2x.

Introduction

High-level synthesis (HLS) lets developers build field-programmable gate array (FPGA) accelerators from C++ instead of register-transfer-level (RTL) code. Pragmas control pipelining, parallelism, and storage, while the compiler binds operations to resources [1, 2]. In particular, it maps arithmetic to digital signal processing (DSP) blocks and arrays to block RAM (BRAM) and UltraRAM (URAM). These hard blocks offer more than a multiplier or a memory array. They also provide pre-adders, wide accumulators, single-instruction multiple-data (SIMD) and floating-point modes, optional internal pipeline registers, and dedicated cascade links that pass operands and partial sums to neighboring blocks without general routing [3]. Recent device families extend this set further, with INT8 dot products and single-precision floating-point (FP32) and complex arithmetic in the DSPs, and configurable cascades in the memories [4, 5, 6].

However, inferring a hard block does not mean its capabilities are fully utilized. Rather, HLS often rebuilds some of these in the fabric, as Figure 1a illustrates. We call a mapping native when arithmetic, state, and communication stay inside the hard blocks, through their modes, internal registers, and cascade links. Figure 2 shows a 64-tap finite impulse response (FIR) filter, y[n]=∑k=063hkx[n−k]y[n] = \sum_{k=0}^{63} h_k x[n-k]. Both versions use 64 DSPs, one per coefficient hkh_k. In plain HLS (Figure 2a), the compiler sums the products with an adder tree and cascades only the pairs at its bottom level. As a result, it forms 32 of the 62 possible cascade links, and the delayed partial sums zkz_k move to fabric shift registers (SRLs) and flip-flops (FFs). The filter then needs 1008 lookup tables (LUTs), 1437 SRLs, and 5086 FFs around its DSPs. In contrast, the native mapping (Figure 2b) chains the DSPs in two columns of 32. Each DSP multiplies, adds the partial sum arriving from its neighbor (PCIN), keeps the delay in its own result register (P), and passes the sum on (PCOUT). Only 70 LUTs remain, to load the coefficients. Such extra fabric costs area and, because it sits on the paths between blocks, complicates timing closure as designs grow [7].

Overview of conventional HLS and the proposed template-based flow

Figure 1. Overview. (a) Conventional HLS rebuilds hard-block capabilities in the fabric. (b) Our templates, scheduling settings, and verified RTL patches keep them inside the hard blocks.

A 64-tap FIR filter mapped by plain HLS and the proposed library

Figure 2. A 64-tap FIR filter mapped by (a) plain HLS and (b) our library.

Existing approaches do not close this gap from HLS. Hand-written RTL libraries, such as FINN’s matrix–vector units [8, 9], reach native mappings but depart from general purpose HLS. HLS libraries and frameworks, such as finn-hlslib [10], hls4ml [11], AutoSA [12], Allo [13], and Stream-HLS [14], decide loops, dataflow, and schedules, but leave binding to the compiler and therefore inherit its mapping. Finally, research on better DSP mapping targets RTL generators or earlier devices, and arithmetic only [15, 16]. We therefore ask the following research question. Can HLS code reach the native mapping of FPGA hard blocks without changing the HLS compiler?

We answer it with a C++ template library for FPGA hard blocks, summarized in Figure 1b. The library addresses three issues. The first issue is that HLS selects a hard-block configuration only for specific source patterns. Therefore, each template fixes the C++ expression and pragmas that produce one configuration, found by inspecting placed designs. The second issue is that HLS scheduling decides where pipeline registers go. In particular, the clock uncertainty and operator latencies decide whether a register stays inside a DSP or moves to the fabric. Thus, an automatic flow sets them from per-operator timing budgets. The third issue is that HLS cannot express some configurations, such as accumulation in the DSP result register. For these, the flow applies small RTL patches after HLS and keeps only those that verifiably improve the design. Our contributions are as follows:

  • A native mapping library. Templates for memories, integer, INT8, SIMD, FP32, and complex arithmetic, cascades, lanes, and matrix tiles achieve native configurations of the AMD Versal hard blocks from HLS (Section II).

  • An automatic mapping flow. It selects clock uncertainty, operator latencies, and RTL patches without modifying the compiler (Section III).

  • An evaluation at three levels. We compare isolated operations with plain HLS, complete kernels with FINN RTL, finn-hlslib, and AutoSA, and integrations into hls4ml, Allo, and Stream-HLS (Section IV).

On a Versal VC1902, our matrix multiplication uses 2.4–4.5× fewer LUTs than the leanest AutoSA systolic array at equal or higher estimated throughput. Moreover, its INT8 matrix–vector units reach three multiply–accumulates (MACs) per DSP, as FINN RTL does, whereas HLS libraries reach at most 1.29.

The Template Library

Each template of our library is a C++ function, with explicit width, timing, and control parameters, whose body HLS maps to one hard-block configuration. This section describes which configurations the library covers, how we found the source pattern for each, and the RTL patches that complete the configurations HLS cannot express.

Target Configurations

The templates follow the capabilities of modern FPGA hard blocks [5, 6], grouped into the families of Table I. For DSPs, these capabilities are the arithmetic modes, accumulator widths, internal registers, and cascade links. For memories, they are the widths and depths, operating modes, and cascade links. Lanes replicate a template up to 64 times, and tiles compose templates into matrix units, such as a 4×44 \times4 matrix multiply whose 16 DSPs keep their sums locally. Most templates leave at most a few LUTs and FFs around their blocks.

Some accumulators also take an explicit clear input (CLR), which restarts the sum inside the DSP. To use a template, a developer replaces an operator or an array in existing C++ code with a template call, and the rest of the design, including its pragmas, stays unchanged.

Finding the Source Patterns

For each template, we explored C++ expressions and pragmas until HLS produced the intended configuration. Each candidate was synthesized by HLS and then synthesized and placed out of context (OOC). We then inspected the primitive types and counts, the enabled modes and internal registers, the cascade links, the remaining fabric logic, and the timing slack, and kept the candidates that matched the intended mapping. For example, the FIR template of Figure 2b expresses the filter as a chain in which each tap adds its product to the registered sum of the previous tap, rather than as one sum over all taps. Most templates reach their mapping with pragmas alone.

RTL Patches

Some remaining templates need a configuration that the compiler does not expose. For these, we patch the RTL after HLS. Attribute patches change a primitive setting without changing the surrounding logic. For example, raising the URAM cascade height above its default builds deeper memories through native cascade loads. Logic patches change the generated datapath or control. For example, one patch replaces an external accumulator register with the DSP’s internal result register. The italic entries in Table I mark the families that need a patch or a scheduling setting. Each patch is written for the RTL structure that HLS generates for its template. If the surrounding code leads HLS to generate a different structure, the patch may not apply or may break the design. Therefore, the flow in the next section checks every patch before applying it.

Template / configurationTypical cost
Memories
Cascade height; write mode; URAM ROM
BRAM/URAM, ROMs, packed/banked arrays and buffers1 block/array, 0 LUT/FF
URAM (up to 32K words)0 LUT; deeper arrays cascade
Integer DSP Clearable sum
27×24 multiply, multiply–add, pre-add, 58-bit add1 DSP, 0 LUT
Accumulator1 DSP, 1 LUT, 4 FF
Accumulator with CLR1 DSP, 0 LUT, 3 FF
48×48 multiply5 DSP, 0 LUT
64/96-bit accumulator3 DSP, 0 LUT
Cascades
64-tap FIR64 DSP, 70 LUT, 0 FF
Result-cascaded and memory-fed dot products1 B18/tap, 0 LUT/SRL
INT8 and SIMD SIMD; logic
Three-product INT8 dot1 DSP, 0 LUT
At 800 MHz1 DSP, 1 LUT
2×24- or 4×12-bit add1 DSP, 0 LUT
Floating point Uncertainty; operand gating
FP32 add, subtract, multiply and multiply–add1 DSP, at most 2 LUT
FP32 complex multiply4 DSP
Dot products and sums at II=1
Complex Numbers Adder merge
18×18 complex multiply2 DSP, 0 LUT/FF
Multiply–add and two-term dot product0 LUT
Lanes and pairs
LL lanes (up to 64 integer/FP32 or 32 complex)LL blocks, 0 LUT/lane
Memory–DSP pairs0 LUT/FF
One clock region24 B36 + 96 DSP
Tiles Clearable sum
INT16 GEMV (cascaded, up to 128 DSP)0 LUT/DSP
4×4 matrix multiply with local sums16 DSP, 1 LUT, 4 FF
With CLR16 DSP, 0 LUT, 3 FF
INT8 tiles12.7–15.8 LUT/DSP

Table 1. Template families and OOC costs (300 MHz unless marked). Italic entries identify RTL patches or required settings. CLR: explicit clear input; B18/B36: 18/36-Kbit BRAM. One complex operation uses two DSPs.

Automatic Mapping Flow

A template fixes what HLS should build, but the HLS scheduler still decides where pipeline registers go. If the scheduler estimates that a DSP’s output path does not fit in one cycle, it adds a fabric register after the block instead of using the block’s internal one. Moreover, some configurations cannot be reached from C++ at all. Therefore, the flow in Figure 1b acts at two points without modifying the compiler. Before HLS, it selects the clock uncertainty and operator latencies. After HLS, it selects and verifies RTL patches.

Clock Uncertainty and Operator Latency

HLS schedules each cycle against a time budget B=T−uB = T-u, where TT is the target clock period and uu is the clock uncertainty, a margin reserved for implementation delays. By default, ud=0.27Tu_d = 0.27T. However, this margin also changes the generated design. In a hard block, operands move through dedicated internal paths rather than via general-purpose fabric routing, which needs almost no margin and therefore less uncertainty. When BB is shorter than the internal path of a DSP mode, HLS adds an external result register, for example after an FP32 adder or multiply–add. We therefore measured, for each operator class cc, the budget BcB_c at which the native mapping appears. It is 2.83 ns for FP32 additions and multiply–adds, and 3.33 ns for FP32 multiplications and conversions. The flow then sets

uc={T−Bcif T−ud<Bc≤T,udotherwise.(1)u_c = \begin{cases} T-B_c & \text{if } T-u_d < B_c \le T, \\ u_d & \text{otherwise.} \end{cases} \tag*{(1)}

In other words, (1) lowers the uncertainty just enough when the default budget is too short. At slower clocks, the default budget already suffices, and at faster clocks (T<BcT < B_c), no non-negative uncertainty reaches BcB_c. For example, at 300 MHz, T=3.33T = 3.33 ns and the default budget is 2.43 ns, below the 2.83 ns that an FP32 adder needs. Thus, the flow sets u=0.50u = 0.50 ns, or 15% of TT. Complex-number operators behave in the opposite way. Their DSP mode enables all internal pipeline registers only when B<1.43B < 1.43 ns, so the flow raises the uncertainty to uc=max⁡(ud,T−Bc)u_c = \max(u_d, T-B_c).

A lower uncertainty can also let HLS shorten an operator’s pipeline and drop internal DSP registers. Hence, for FP32 operators at reduced uncertainty, the flow also tries fixed latencies taken from a table of measured operator configurations. Operators absent from the table keep the default uncertainty.

The selection proceeds as follows. The flow first synthesizes the design with udu_d and identifies its operators. Without FP32 or complex operators, it keeps udu_d. Otherwise, it builds the candidates above and rejects those in which an operator has a lower latency than in the default synthesis, unless a measurement confirms that it still meets TT. Among the candidates that meet timing, it selects the one with the lowest resource cost and the most native mappings. In case of equality, it prefers udu_d, and otherwise the uncertainty closest to udu_d. If no candidate meets timing, the flow reports the one with the highest worst negative slack (WNS) and its unmet margin. Finally, because the uncertainty applies to a whole kernel, operators with conflicting requirements cannot both be served. In that case, the flow recommends splitting them into separate kernels.

Patch Selection and Verification

After scheduling, the flow takes each patch in its registry (Section II) and dry-runs it on a copy of the RTL. It then checks the conditions that the patch relies on in the source and in the HLS reports, for example that an accumulator loop never stalls. A patched design must build and keep the intended primitive types. The flow accepts the patch if it lowers the resource cost and either meets timing or loses at most 0.1 ns of slack, which admits a slightly negative WNS. An attribute patch that leaves the cost unchanged still qualifies if it shortens the achievable clock period by more than 0.05 ns.

Experimental Results

We evaluate whether our library reaches native mappings in isolation, how close it comes to hand-written RTL and generated accelerators, and whether existing frameworks benefit from it.

Setup

We implemented our library for AMD Versal, whose enhanced DSPs support INT8, FP32, and complex arithmetic, and whose BRAMs and URAMs enable configurable cascades [4, 5, 6]. Experiments target the VC1902 device on the VCK5000 board [17] using Vitis HLS and Vivado 2022.1 at 300 MHz. Each table and figure states whether results come from OOC placement or from post-route kernels. Throughput values are estimates at the target clock. Plain HLS denotes the same computation written in C++ with standard pragmas and without our library. We compare at three levels. First, isolated operations against plain HLS. Second, complete kernels against FINN RTL [8] and finn-hlslib [10], and against systolic arrays generated by AutoSA [12]. Third, integrations into hls4ml [11], Allo [13], and Stream-HLS [14], using their own workloads, some from PolyBench [18].

Some baselines were written for earlier devices, so we adapted them to the Versal. For AutoSA, we updated its storage pragmas and selected its configurations from HLS measurements instead of its UltraScale+ resource predictor. For hls4ml, we restored its disabled DSP pipeline registers to the HLS default. For Stream-HLS, we set the cost of an FP32 addition or multiplication to 1 DSP and the budget to the device’s 1968 DSPs.

Native Operations

Native mapping removes nearly all fabric around the hard blocks, whereas its effect on DSP count and timing depends on the operation. Figure 3 shows that all six integer operations drop to zero LUTs, and the two FP32 operations to 9 and 170 LUTs. The DSP count falls when a native mode replaces several blocks. For example, IM8 maps each INT16 multiplication to one DSP (15 to 8), and D32 keeps its whole sum on one result cascade (48 to 32 DSPs). Conversely, it rises when a DSP absorbs fabric logic. W48 uses one more DSP for its native partial-product cascade, and S8 moves SIMD additions from 1401 LUTs into eight DSPs. Internal registers explain the FF savings. MACc and M4c accumulate in the DSP result register (55 to 3 and 775 to 3 FFs), and in F8 the uncertainty from Section III removes the external result registers (728 to 38 FFs).

Primitive mappings after OOC placement at 300 MHz

Figure 3. Primitive mappings after OOC placement at 300 MHz (all II = 1).

However, equal DSP counts and II do not imply an equally native mapping. In FD8, plain HLS reaches the same DSPs and II by interleaving partial sums, which costs 772 LUTs

IM8: 8-lane INT16 multiply; W48: 48×48 multiply; S8: 8-lane 4×12-bit SIMD add; MACc: MAC with CLR; M4c: INT16 4×4 matrix multiply with CLR; D32: INT16 dot, 32 MAC; F8: 9-lane FP32 multiply–add; FD8: FP32 dot, 8 MAC.

DSP: total, and in parentheses the number in INT8 mode (three 8-bit multiply-accumulates per DSP); B/U: BRAM/URAM; M/D: MAC per DSP per cycle; C: cascade links. LUTs used as memory are excluded; in the convolution, plain HLS, finn-hlslib, and FINN RTL keep their buffers in 315, 2328, and 2299 such LUTs.

instead of 170. Native mapping also tends to improve timing. The WNS rises in six of the eight operations, for example from 0.51 to 1.64 ns in D32, as fewer paths leave the hard blocks. It drops only in IM8 and F8, yet stays above 0.97 ns.

Native INT8 Packing Against RTL

Our library reaches the DSP packing of hand-written RTL from HLS, with only a modest fabric overhead. FINN [8, 19] provides quantized neural-network operators both in RTL [9] and in HLS [10]. Its RTL is written by experts and already uses INT8 packing, cascades, and accumulation in internal registers. It is therefore the gold standard for what a native mapping can reach. In Table 2, each processing element (PE) receives the same 512 weight words per memory as our corresponding tile.

VersionDSP (INT8)B36/UM/DLUTFFCII
INT8 matrix–vector 4×9: 36 MAC/cycle
plain HLS28 (4)4/01.29224452121
finn-hlslib20 (8)4/00.602980703343
FINN RTL12 (12)4/03.0019038781
Ours12 (12)4/03.0015214401
INT8 matrix–vector 16×18: 288 MAC/cycle
plain HLS224 (32)32/01.2920963792961
finn-hlslib224 (48)32/01.29658116311963
FINN RTL96 (96)32/03.005741226801
Ours96 (96)32/03.001520224401
INT8 3×3 convolution: 288 MAC/cycle
plain HLS224 (48)0/01.29502510389961
finn-hlslib184 (58)0/00.78921219584662
FINN RTL96 (96)0/03.0032878695801
Ours96 (96)32/43.004833701301
INT16 matrix–vector 8×8: 64 MAC/cycle
plain HLS72 (0)16/00.89280270401
finn-hlslib72 (0)15/00.89531313254401
Ours64 (0)16/01.008290561

Table 2. FINN layers after OOC placement at 300 MHz.

The INT8 mode of the DSP performs three 8-bit MACs per cycle. Plain HLS and finn-hlslib reach at most 1.29 MACs per DSP per cycle, and finn-hlslib also misses an II of one in two of the three INT8 configurations. In contrast, FINN RTL and our library reach 3.00, with the same DSP count and an II of one in all three INT8 configurations. Even without packing, in the INT16 case, ours needs 64 DSPs instead of 72 and 8 LUTs instead of 280, with 56 cascade links instead of 40.

Matching FINN-RTL from HLS costs little. FINN RTL accumulates in DSP result registers through result cascades, whereas our INT8 templates accumulate partial sums in fabric. Even so, ours uses less fabric than FINN RTL at the small size (152 vs. 190 LUTs) and about a thousand more LUTs and FFs at the 16×18 size. For convolution, FINN RTL uses fewer LUTs, while ours uses fewer FFs and keeps its buffers in 32 BRAMs and four URAMs instead of LUTs. Reaching the arithmetic efficiency of expert RTL at this fabric cost, while keeping the productivity of HLS, is a favorable trade-off.

Matrix Multiplication Against Systolic Arrays

Broadcasting operands to DSPs that accumulate in place costs far less logic than a systolic array with the same MAC rate. AutoSA [12] generates systolic arrays from loop nests. Both designs compute C=ABTC = AB^{T} on 1536×1536 matrices with INT16 inputs, 32-bit results, and one 512-bit port per matrix. INT16 is the widest power-of-two width that fits one DSP multiplier, so every MAC maps to one DSP in both designs. Thus, the comparison isolates how operands reach the DSPs. We compare at equal peak rates of 256 and 1536 MACs per cycle, with the same clock, ports, and tools. Our design is a grid of pragma-only 4×4 output-stationary tiles. Each memory read is broadcast to the four DSPs of a tile row or column, and each DSP keeps its sum in its result register.

For AutoSA, we build a classic layout (A-C) with many small PEs, and the leanest layout (A-L), which has the fewest LUTs among 11 tested legal configurations and uses fewer PEs with 32-lane dot products.

Table 3 shows that our design uses 2.4–4.5× fewer LUTs and 3.8–8.6× fewer FFs than A-L, and reaches 99.8–100% of peak throughput instead of the 95.4–97.7% of A-L. At the larger size, A-C does not fit, because it needs 998 BRAMs while only 967 are available. The difference lies in communication. AutoSA passes operands between PEs through FIFOs rather than through operand cascades, and it sums partial dot products over result cascades and fabric adder trees. Moreover, its systolic tiles spend cycles filling and draining, which lowers throughput. Both designs must also keep data on chip. AutoSA holds it in FIFOs and ping-pong buffers spread across its PEs, whereas our design places it in BRAMs and URAMs next to the DSPs that consume it. Keeping data in memory blocks rather than in the fabric itself is a native use of the hard blocks. In 36-Kbit equivalents, ours even needs fewer BRAMs (117 vs. 149 and 437 vs. 479), complemented by 8 and 24 URAMs.

Peak: 256 MAC/cycle → 153.6 GOPS
MetricOursA-LA-C
PE shape16T2×4/S328×8/S4
LUT9466(2.4×↑) 22759(7.4×↑) 70022
FF13021(3.8×↑) 50046(8.5×↑) 110370
B36/B18/U50/134/8138/22/0406/66/0
P/A/B0/0/0128/0/0128/0/0
GOPS(100%) 153.6(95.4%) 146.6(99.3%) 152.5
Peak: 1536 MAC/cycle → 921.6 GOPS
MetricOursA-LA-C
PE shape96T4×12/S3212×16/S8
LUT22385(4.5×↑) 101536Implementation failed: it requires 998 BRAMs
FF24792(8.6×↑) 214024
B36/B18/U50/774/24438/82/0
P/A/B0/0/0768/0/0
GOPS(99.8%) 919.7(97.7%) 900.1(967 available)

Table 3. INT16 GEMM: post-route kernel results at 300 MHz. A-L/A-C: leanest/classic AutoSA; parentheses: AutoSA cost relative to ours, or share of peak for the estimated GOPS. T: 4×4 tile; S: SIMD width; P/A/B: result/operand cascade links.

Mapping Neural-Network Layers

Inside an existing framework, our library helps most where the framework leaves a native capability unused. We evaluate it on two neural-network layers generated by hls4ml [11]. Figure 4 uses a 64-input, 32-output dense layer from a jet-tagging network [11] and a 3×3 convolution with 16 input and output channels on a 15×15 input [20]. Both use the ‘resource’ strategy of hls4ml, in which the reuse factor RR sets how many times each multiplier is reused. We replace only the dot-product kernel, so the convolution keeps the streaming interface and line buffer of hls4ml.

Neural-network layers from hls4ml

Figure 4. Neural-network layers from hls4ml (post-route, 300 MHz).

In the 8-bit convolution, INT8 packing raises the MACs per DSP per cycle from 0.80 to 2.41, which halves the DSPs and cuts cycles by 1.5×. More importantly, native mapping extends beyond arithmetic to the memory blocks. Packing nine 8-bit weights into each 72-bit word matches the native BRAM width. As a result, it fills the capacity that the shallow, wide weight ROMs of hls4ml leave unused, and needs 6× fewer BRAMs. In contrast, the 16-bit dense layer of hls4ml already accumulates in the DSP. Here, our library keeps the same DSPs and cycles and trades memory depth for logic. It splits the weights into shallower BRAM banks (8 instead of 4.5), and in return reduces LUTs by 1.2× and FFs by 1.3×.

Integration Into Accelerator Generators

Templates drop into generated designs without changing their schedules, provided that the schedule meets the templates’ assumptions. We first integrate our library into Allo, keeping its loops, pragmas, buffers, and interfaces and replacing only operations. In the packed-INT8 systolic GEMM of Allo, written for an older DSP, each PE computes absolute values and restores the signs in logic. Our pre-adder template instead computes the signed products inside the DSP. As a result, it reduces LUTs by 14% (19,652 to 16,834) and FFs by 20% (16,917 to 13,611) across 128 PEs, with the same 128 DSPs and schedule. Similarly, in the FP32 GEMM, the multiply–add template with the uncertainty of Section III keeps the DSP schedule but removes the surrounding registers, which reduces FFs by 38% (305 to 190) for 17 more LUTs.

The integration fails when the schedule breaks a template’s assumption. In the INT8 4×44 \times4 systolic GEMM of Allo, a handshake starts and stops each tile’s loop, so the loop can stall. However, the accumulator template assumes a free-running pipeline. Thus, the accumulation falls back to the fabric. With the same DSPs, LUTs grow by 27% (2,135 to 2,711) and latency by 19% (5,333 to 6,321 cycles).

In Stream-HLS, the templates save DSPs under the original schedule, and once the cost model reflects native mapping, the scheduler chooses a faster design. We use three Stream-HLS benchmarks in Figure 5, namely GEMM, two chained matrix multiplications (2mm), and a transformer feed-forward network block (FFN). We report OOC results, exactly as the original Stream-HLS study does [14], so that our baseline is directly comparable with its published setting. First, we keep its task graph and schedule and replace only the arithmetic at the leaves. Stream-HLS lets HLS build adder trees that cost about 1.4 DSPs per MAC, whereas our library builds chains with one DSP per product and one adder per chain. This saves 11–15% of the DSPs at almost the same cycle count. Then, we re-solve the scheduling model of Stream-HLS with the actual costs of our templates, in which a multiplier feeding an adder counts as one fused multiply–add. The solver now unrolls wider tiles and cuts the cycles by 1.5×1.5\times in GEMM and 2mm and by 2×2\times in the FFN block. To do so, the solver invests more of the device into wider tiles, more BRAMs, and, in GEMM and 2mm, more DSPs and LUTs, while staying within its DSP budget. In the FFN block, it even uses fewer DSPs and LUTs than the original design.

Bar charts comparing DSP, LUT, and cycle counts for GEMM, 2mm, and FFN relative to Stream-HLS

Figure 5. Stream-HLS benchmarks (OOC placement, 300 MHz).

Related Work

HLS compilers translate algorithmic descriptions into hardware through scheduling, pipelining, and resource binding [1], [2]. Higher-level frameworks extend this process. ScaleHLS provides multi-level compiler optimizations [21], Allo separates computation from composable hardware customizations [13], AutoSA generates systolic-array accelerators [12], and Stream-HLS optimizes dataflow schedules and resource allocation [14]. These frameworks focus on organizing and scheduling computation, whereas our library improves how operators and storage structures map to FPGA hard blocks.

Previous work has explored DSP capabilities beyond conventional arithmetic inference. Arithmetic expression graphs have been mapped onto DSP48E1 blocks, exploiting their internal operations and cascade connections [15], [22]. Xilinx WP486 describes packing two INT8 products with a shared operand into a DSP48E2 [23], and DSP-Packing extends arithmetic packing to other operand widths [16]. Our library extends native mapping across arithmetic modes, internal registers, dedicated interconnections, and memories.

Application-specific frameworks also exploit FPGA hard blocks. FINN and FINN-R generate accelerators for quantized neural networks [8], [19], and FINN provides optimized RTL matrix–vector multiplication alongside an HLS implementation in finn-hlslib [9], [10]. We use FINN RTL as the reference for native DSP use and reach its mapping from HLS. Similarly, hls4ml translates neural networks into HLS [11], [20], and our integration replaces its dot-product computation while preserving the surrounding layer architecture. These comparisons show how native mapping complements specialized accelerator libraries and HLS frameworks.

Conclusion

We asked whether HLS code can reach the native mapping of FPGA hard blocks without changing the compiler. Our library shows it can for the wide range of configurations we evaluated. C++ templates fix the source patterns, an automatic flow sets the scheduling parameters, and verified RTL patches cover what HLS cannot express. On AMD Versal, our matrix multiplication uses 2.42.4–4.5×4.5\times fewer LUTs than AutoSA at equal or higher estimated throughput, and its INT8 matrix–vector units match the three MACs per DSP of FINN RTL. Its templates also improve hls4ml, Allo, and Stream-HLS designs in place. The main lesson is that careful source patterns, scheduling settings, and targeted patches extract native mappings and high performance from HLS, which is conventionally assumed to require hand-written RTL. Future work will support more templates, such as moving INT8 accumulation into the DSPs and extend to other FPGA architectures.

Content Generated by AI

ChatGPT and Claude assisted with parts of the code, tables, and figures, and in improving the writing clarity.

References

References

  1. [1]J. Cong, B. Liu, S. Neuendorffer, J. Noguera, K. Vissers, and Z. Zhang, “High-level synthesis for FPGAs: From prototyping to deployment,” IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, vol. 30, no. 4, pp. 473–491, 2011.DOI
  2. [2]Vitis High-Level Synthesis User Guide, AMD, 2022, UG1399 (v2022.1). [Online]. Available: https://docs.amd.com/r/2022.1-English/ug1399-vitis-hls
  3. [3]A. Boutros and V. Betz, “FPGA architecture: Principles and progression,” IEEE Circuits and Systems Magazine, vol. 21, no. 2, pp. 4–29, 2021.DOI
  4. [4]B. Gaide, D. Gaitonde, C. Ravishankar, and T. Bauer, “Xilinx adaptive compute acceleration platform: Versal architecture,” in Proceedings of International Symposium on Field-Programmable Gate Arrays (FPGA), 2010.
  5. [5]Versal ACAP DSP Engine Architecture Manual, AMD, 2022, AM004 (v1.2.1). [Online]. Available: https://docs.amd.com/r/en-US/am004-versal-dsp-engine
  6. [6]Versal Adaptive SoC Memory Resources Architecture Manual, AMD, 2026, AM007 (v1.2.1). [Online]. Available: https://docs.amd.com/r/en-US/am007-versal-memory
  7. [7]L. Guo, Y. Chi, J. Lau, L. Song, X. Tian, M. Khatti, W. Qiao, J. Wang, E. Ustun, Z. Fang, Z. Zhang, and J. Cong, “TAPA: A scalable task-parallel dataflow programming framework for modern FPGAs with co-optimization of HLS and physical design,” ACM Transactions on Reconfigurable Technology and Systems, vol. 16, no. 4, pp. 1–31, 2023.DOI
  8. [8]Y. Umuroglu, N. J. Fraser, G. Gambardella, M. Blott, P. Leong, M. Jahre, and K. Vissers, “FINN: A framework for fast, scalable binarized neural network inference,” in Proceedings of the International Symposium on Field-Programmable Gate Arrays (FPGA), 2017.
  9. [9]Xilinx, “FINN: Dataflow compiler for QNN inference on FPGAs,” GitHub repository, includes finn-rtl; accessed: Oct. 17, 2026. [Online]. Available: https://github.com/Xilinx/finn
  10. [10]———, “finn-hlslib: Vitis HLS library for FINN,” GitHub repository, accessed: Oct. 17, 2026. [Online]. Available: https://github.com/Xilinx/finn-hlslib
  11. [11]J. Duarte, S. Han, P. Harris, S. Jindariani, E. Kreinar, B. Kreis, J. Ngadiuba, M. Pierini, R. Rivera, N. Tran, and Z. Wu, “Fast inference of deep neural networks in FPGAs for particle physics,” Journal of Instrumentation, vol. 13, no. 07, p. P07027, 2018.DOI
  12. [12]J. Wang, L. Guo, and J. Cong, “AutoSA: A polyhedral compiler for high-performance systolic arrays on FPGAs,” in Proceedings of the International Symposium on Field-Programmable Gate Arrays (FPGA), 2021.DOI
  13. [13]H. Chen, N. Zhang, S. Xiang, Z. Zeng, M. Dai, and Z. Zhang, “Allo: A programming model for composable accelerator design,” in Proceedings of the ACM on Programming Languages, vol. 8, no. PLDI, pp. 593–620, 2024.DOI
  14. [14]S. Basalama and J. Cong, “Stream-HLS: Towards automatic dataflow acceleration,” in Proceedings of the International Symposium on Field Programmable Gate Arrays (FPGA), 2025.DOI
  15. [15]B. Ronak and S. A. Fahmy, “Mapping for maximum performance on FPGA DSP blocks,” IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, vol. 35, no. 4, pp. 573–585, 2016.DOI
  16. [16]J. Sommer, M. A. Özkan, O. Keszöcze, and J. Teich, “DSP-packing: Squeezing low-precision arithmetic into FPGA DSP blocks,” in Proceedings of the International Conference on Field-Programmable Logic and Applications (FPL), 2022.DOI
  17. [17]VCK5000 Data Center Acceleration Development Kit Hardware Installation Guide, AMD, 2023, UG1531 (v1.1). [Online]. Available: https://docs.amd.com/r/en-US/ug1531-vck5000-install
  18. [18]L.-N. Pouchet and T. Yuki, “PolyBench/C 4.2.1,” 2016, version 4.2.1 beta, released May 2016. [Online]. Available: https://sourceforge.net/projects/polybench/
  19. [19]M. Blott, T. B. Preußer, N. J. Fraser, G. Gambardella, K. O’Brien, Y. Umuroglu, M. Leeser, and K. Vissers, “FINN-R: An end-to-end deep-learning framework for fast exploration of quantized neural networks,” ACM Transactions on Reconfigurable Technology and Systems, vol. 11, no. 3, pp. 1–23, 2018.
  20. [20]T. Aarrestad, V. Loncar, N. G. Ghelimetti, M. Pierini, S. Summers, J. Ngadiuba, C. Petersson, H. Linander, Y. Iiyama, G. Di Guglielmo, J. Duarte, P. Harris, D. Rankin, S. Jindariani, K. Pedro, N. Tran, M. Liu, E. Kreinar, Z. Wu, and D. Hoang, “Fast convolutional neural networks on FPGAs with hls4ml,” Machine Learning: Science and Technology, vol. 2, no. 4, p. 045015, 2021.
  21. [21]H. Cao, J. Cheng, H. Jeong, J. Huang, S. Neuendorffer, and D. Chen, “ScaleHLS: A new scalable high-level synthesis framework on multi-level intermediate representation,” in Proceedings of the International Symposium on High-Performance Computer Architecture (HPCA), 2022.
  22. [22]B. Ronak and S. A. Fahmy, “Efficient mapping of mathematical expressions into DSP blocks,” in Proceedings of the International Conference on Field Programmable Logic and Applications (FPL), 2014.DOI
  23. [23]Xilinx, “Deep learning with INT8 optimization on Xilinx devices,” Xilinx, Inc., White Paper WP486 (v1.0.1), 2017. [Online]. Available: https://docs.amd.com/v/u/en-US/wp486-deep-learning-int8

Paper details

vlnc:W_69bg92qm
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents