<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>MATCHA: a fast and energy-efficient accelerator for fully homomorphic encryption over the torus</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>07/10/2022</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10353599</idno>
					<idno type="doi">10.1145/3489517.3530435</idno>
					<title level='j'>ACM/IEEE Design Automation Conference</title>
<idno></idno>
<biblScope unit="volume"></biblScope>
<biblScope unit="issue"></biblScope>					

					<author>Lei Jiang</author><author>Qian Lou</author><author>Nrushad Joshi</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[Fully Homomorphic Encryption over the Torus (TFHE) allows arbitrary computations to happen directly on ciphertexts using homomorphic logic gates. However, each TFHE gate on state-of-the-art hardware platforms such as GPUs and FPGAs is extremely slow (> 0.2ms). Moreover, even the latest FPGA-based TFHE accelerator cannot achieve high energy efficiency, since it frequently invokes expensive double-precision floating point FFT and IFFT kernels. In this paper, we propose a fast and energy-efficient accelerator, MATCHA, to process TFHE gates. MATCHA supports aggressive bootstrapping key unrolling to accelerate TFHE gates without decryption errors by approximate multiplication-less integer FFTs and IFFTs, and a pipelined datapath. Compared to prior accelerators, MATCHA improves the TFHE gate processing throughput by 2.3x, and the throughput per Watt by 6.3x.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Scheme</head><p>FHE Op. Data Type Bootstrapping BGV <ref type="bibr">[3]</ref> mult, add integer &#8764; 800&#119904; BFV <ref type="bibr">[9]</ref> mult, add integer &gt; 1000&#119904; CKKS <ref type="bibr">[5]</ref> mult, add fixed point &#8764; 500&#119904; FHEW <ref type="bibr">[8]</ref> Boolean binary &lt; 1&#119904;</p><p>TFHE <ref type="bibr">[6]</ref> Boolean binary 13ms</p><p>a cloud server that can directly evaluate homomorphic functions, e.g., encrypted neural inferences <ref type="bibr">[4]</ref> or encrypted general-purpose computing <ref type="bibr">[14]</ref>, on the ciphertexts. When all computations are completed, the server returns the encrypted results to the client without learning any intermediate or final output, due to the endto-end encrypted data flow. Only the client can decrypt the results by her secret key. Among all FHE cryptosystems, FHE over the Torus (TFHE) <ref type="bibr">[6]</ref> is the most efficient scheme supporting arbitrary operations with an unlimited computation depth, as shown in Table <ref type="table">1</ref>. First, TFHE supports arbitrary operations by various homomorphic Boolean logic gates. Traditional FHE schemes such as BGV <ref type="bibr">[3]</ref>, BFV <ref type="bibr">[9]</ref>, and CKKS <ref type="bibr">[5]</ref> can perform only homomorphic additions and multiplications, while both FHEW <ref type="bibr">[8]</ref> and TFHE <ref type="bibr">[6]</ref> can enable homomorphic Boolean algebra, e.g., NAND, XOR, and XNOR gates. Second, TFHE obtains the fastest bootstrapping. Each FHE operation inevitably introduces a certain amount of noise into the ciphertext. If there are too many FHE operations on the computational critical path, the accumulated noise in the ciphertext may exceed a threshold, and thus the ciphertext cannot be decrypted successfully. To support an unlimited computation depth, a FHE scheme has to periodically invoke a bootstrapping operation to decrease the amount of noise in the ciphertext. The bootstrapping operation is extremely expensive for BGV, BFV, and CKKS. For example, a BGV bootstrapping typically costs several hundred seconds <ref type="bibr">[11]</ref>. Therefore, these FHE schemes can support only a limited computation depth by designing a large enough noise budget. Although a bootstrapping of FHEW takes only 1&#119904;, TFHE can obtain a even faster bootstrapping, i.e., a TFHE bootstrapping requires only 13&#119898;&#119904; on a CPU. By fast bootstrapping, TFHE allows an unlimited computation depth.</p><p>Unfortunately, a TFHE-based complex circuit consisting of multiple TFHE gates is still extremely slow. For instance, a TFHE-based simple RISC-V CPU <ref type="bibr">[14]</ref> comprising thousands of TFHE gates can run at only 1.25&#119867;&#119911;. In order to realize practical TFHE-based computing, it is critical to accelerate TFHE gates by specialized hardware. However, TFHE is only well-implemented on CPUs <ref type="bibr">[16]</ref> and GPUs <ref type="bibr">[7]</ref>. Although a recent work <ref type="bibr">[10]</ref> accelerates TFHE gates on a FPGA, the TFHE gate latency on the FPGA is much longer than that on a GPU. To the best of our knowledge, there is no ASIC-based hardware accelerator for TFHE.</p><p>In this paper, we propose a fast and energy-efficient accelerator, MATCHA, to process TFHE gates. We find that the bootstrapping dominates the latency of all TFHE logic operations. The kernels of fast Fourier transform (FFT) and inverse FFT (IFFT) are the bottlenecks in a bootstrapping operation. MATCHA is designed to accelerate the TFHE bootstrapping using approximate multiplication-less integer FFTs and IFFTs. We also propose a pipelined datapath for MATCHA to support aggressive bootstrapping key unrolling <ref type="bibr">[2,</ref><ref type="bibr">22]</ref> that invokes FFTs and IFFTs less frequently. Our contributions can be summarized as follows.   <ref type="bibr">[&#119883; ]</ref>, which are the ring of polynomials of variable &#119883; with quotient &#119883; &#119873; + 1 and real coefficients modulo 1. B {0, 1} is a set, and we write vectors in bold. Given a set S, we write s $ &#8592; -S to indicate that s is sampled uniformly at random from S. We write &#119890; &#8592; X to denote that &#119890; is sampled according to X.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>TFHE.</head><p>In TFHE <ref type="bibr">[6]</ref>, we assume &#119898; &#8712; B is a plaintext. The encryption scheme works as follows: </p><p>can be XOR, NAND, AND, and OR. A TFHE logic operation involves an addition between &#119888; 0 and &#119888; 1 , and a bootstrapping. TLWE. TLWE is a torus analogue of the learning with error (LWE) problem <ref type="bibr">[3]</ref>. &#119896; is a positive integer. &#119873; is a power of 2, and X is a probability distribution over R &#119873; <ref type="bibr">[&#119883; ]</ref>. A TLWE secret key s is a vector of &#119896; polynomials over Z &#119873; <ref type="bibr">[&#119883; ]</ref> with binary coefficients, denoted as s</p><p>TGSW. TGSW is the matrix extension of TLWE. Each row of a TGSW sample is a TLWE sample. An external product that maps : &#119879;&#119866;&#119878;&#119882; &#215;&#119879;&#119882; &#119871;&#119864; &#8594; &#119879; &#119871;&#119882; &#119864; can be defined by TFHE <ref type="bibr">[6]</ref>. The product of the TGSW ciphertext of a polynomial message &#120583; &#119879;&#119866;&#119878;&#119882; &#8712; T &#119873; <ref type="bibr">[&#119883; ]</ref> and the TLWE ciphertext of a polynomial message &#120583; &#119879; &#119871;&#119882; &#119864; &#8712; T &#119873; [&#119883; ] becomes a TLWE ciphertext of a polynomial message &#120583; &#119879;&#119866;&#119878;&#119882; &#8226; &#120583; &#119879; &#119871;&#119882; &#119864; &#8712; T &#119873; <ref type="bibr">[&#119883; ]</ref> Bootstrapping. Each TFHE logic operation inevitably introduces a certain amount of noise into the resulting ciphertext. A bootstrapping has to be performed to remove the noise at the end of each TFHE logic operation. In various TFHE logic operations, the bootstrapping step is the largest performance bottleneck. The details of a TFHE bootstrapping can be viewed in <ref type="bibr">[6]</ref>. The bootstrapping procedure is shown in Algorithm 1. The dimension of the TLWE sample is set as &#119896; = 1 <ref type="bibr">[6]</ref>, which means that the TLWE sample is simply the Ring</p><p>The most computationally intensive step of a bootstrapping is the homomorphic decryption in line 7, where the message of &#119860;&#119862;&#119862; becomes a polynomial &#119883; b -&#257;s &#8226; &#119905;&#119890;&#119904;&#119905;&#119907;. Particularly, homomorphically computing &#119883; -&#257;s = &#119883; &#119899; &#119894;=1 -&#257;&#119894; s &#119894; = &#119899; &#119894;=1 &#119883; -&#257;&#119894; s &#119894; involves a great number of polynomial multiplications. Na&#239;vely multiplying two degree &#119873; polynomials has the complexity of O(&#119873; 2 ). FFT and IFFT are used to reduce the complexity of a polynomial multiplication to O(&#119873; log(&#119873; )) <ref type="bibr">[7]</ref>, where &#119873; is the degree of polynomials.</p><p>Torus Implementation. Theoretically, the scale invariant scheme of TFHE is defined over the real torus T, where all operations are modulo 1. But TFHE rescales the elements over T by a factor 2 32 , and maps them to 32-bit integers <ref type="bibr">[6]</ref>, since it can work with approximations. Therefore, TFHE does not have to actively perform modular reduction, since all operations on 32-bit integers implicitly   x i (n)</p><p>x j (n) call a native and automatic mod 2 32 operation. To maintain high conversion accuracy, TFHE uses 64-bit double-precision floating point FFT and IFFT kernels <ref type="bibr">[6]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3">Related Work and Motivation</head><p>Related Work. Except some TFHE implementations on CPUs <ref type="bibr">[6]</ref>, GPUs <ref type="bibr">[7]</ref>, and FPGAs <ref type="bibr">[10]</ref>, there is no specialized hardware accelerator that can process TFHE. A TFHE accelerator is different from the accelerators designed for other FHE schemes such as BGV, BFV, and CKKS in two points. First, although few prior accelerators <ref type="bibr">[19]</ref> support BGV and CKKS bootstrapping along a tiny multiplicative depth datapath, most prior works <ref type="bibr">[15,</ref><ref type="bibr">18,</ref><ref type="bibr">20]</ref> design hardware accelerators to process leveled BFV or CKKS homomorphic operations without bootstrapping. However, a TFHE accelerator must perform bootstrapping at the end of each TFHE gate. Second, BGV, BFV, and CKKS require NTT and INTT kernels, while TFHE needs only FFT and IFFT kernels without modular reduction.</p><p>Motivation. A TFHE gate performs not only polynomial additions but also a bootstrapping (FFT+IFFT+other) that costs 99% of the gate latency on a CPU, as shown in Figure <ref type="figure">1</ref>. Therefore, in order to shorten the latency of TFHE gates, we need to accelerate the bootstrapping step in TFHE gates. Moreover, FFTs and IFFTs consume 80% of the bootstrapping latency in various TFHE gates. In order to accelerate TFHE gates, MATCHA adopts approximate multiplication-less integer FFTs and IFFTs, and uses a pipelined datapath to support aggressive bootstrapping key unrolling <ref type="bibr">[2,</ref><ref type="bibr">22]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4">MATCHA 4.1 Approximate Fast Integer FFT and IFFT</head><p>Despite the fact that elements over T are mapped to 32-bit integers, TFHE still uses 64-bit double-precision floating point FFT and IFFT kernels, since 32-bit integer or single-precision floating point FFT and IFFT kernels are not accurate enough to guarantee the correct decryption of a ciphertext <ref type="bibr">[6]</ref>. However, processing 64-bit double-precision floating point FFT and IFFT kernels incurs significant hardware overhead and power consumption.</p><p>Novelty. We first identify the opportunity to use approximate integer FFTs and IFFTs to accelerate TFHE without decryption errors for MATCHA. It is difficult to apply approximate NTTs and INTTs in accelerating other FHE schemes, e.g., BGV, BFV, and CKKS, which do not include a bootstrapping step after each homomorphic multiplication or addition. The errors introduced by approximate NTTs and INTTs will be quickly accumulated in the ciphertext and result in a decryption error, if a bootstrapping step cannot be performed in time. On the contrary, TFHE keeps the approximation errors of integer FFTs and IFFTs in check by performing a bootstrapping step at the end of each TFHE gate.</p><p>Depth-first FFT. Most prior FHE accelerators <ref type="bibr">[18]</ref><ref type="bibr">[19]</ref><ref type="bibr">[20]</ref> perform NTTs and INTTs by the Cooley-Tukey data flow that introduces irregular memory accesses particularly in its bit-reversal stage. In order to remove the bit-reversal overhead, a prior ideal-latticebased cryptographic accelerator <ref type="bibr">[13]</ref> uses the Cooley-Tukey flow for NTTs and the Gentlemen-Sande flow for INTTs. These cryptographic accelerators store a polynomial mod &#119883; &#119873; + 1 as a list of &#119873; coefficients. For each multiplication between two polynomials, they execute two NTT kernels on two polynomials respectively, perform element-wise multiplications, and then run an INTT kernel on the result. The invoking frequency ratio between NTTs and INTTs is 2 : 1. These FHE accelerators have are many opportunities (i.e., switchings from NTT to INTT) to reduce the bit-reversal overhead. In contrast, TFHE saves a polynomial mod &#119883; &#119873; + 1 as either a list of &#119873; coefficients or the Lagrange half-complex representation consisting in the complex evaluations of the polynomial over the roots of unity &#119890;&#119909;&#119901; (&#119894; (2&#119895; + 1)&#120587;/&#119873; ) for &#119895; &#8712; 0, &#119873; 2 . FFT and IFFT kernels are required only during the conversion between these two representations. The invoking frequency ratio between FFTs and IFFTs in a TFHE gate is 1 : 4. As Figure <ref type="figure">1</ref> shows, the latency of IFFT kernels is much longer than FFT kernels. TFHE does not have many opportunities to reduce the bit-reversal overhead. Instead, for MATCHA, we focus on decreasing the computing overhead of a single FFT or IFFT kernel. We adopt the depth-first iterative conjugate-pair FFT (CPFFT) algorithm <ref type="bibr">[1]</ref>. Unlike the Cooley-Tukey or Gentlemen-Sande flow, the CPFFT requires only a single complex root of unity read per radix-4 butterfly. Two butterflies in the same block can share the same twiddle factor, further halving the number of reads to the twiddle-factor buffer <ref type="bibr">[1]</ref>. Moreover, the Cooley-Tukey and Gentlemen-Sande flows process FFTs/IFFTs stage by stage in a breadth-first manner, as shown in Figure <ref type="figure">2</ref>(a). To capture the spatial locality, as Figure <ref type="figure">2</ref>(b) shows, CPFFT traverses the FFT flow in a depth-first fashion by completing a sub-transform before moving to the next.</p><p>A Multiplication-less Butterfly. The lifting structure <ref type="bibr">[17]</ref>, a special type of lattice substrate implemented by cascading identity matrices with a single nonzero off-diagonal element, is proposed to approximate multiplications in FFT and IFFT kernels by additions and binary shifts. The basic lifting step shown in Figure <ref type="figure">3</ref>(a) can be expressed by &#119910; &#119895; (&#119899;) = &#119909; &#119895; (&#119899;), &#119910; &#119894; (&#119899;) = &#119909; &#119894; (&#119899;) + &#119879; &#119909; &#119895; (&#119899;) , &#119911; &#119895; (&#119899;) = &#119910; &#119895; (&#119899;), and &#119911; &#119894; (&#119899;) = &#119910; &#119894; (&#119899;) -&#119879; &#119910; &#119895; (&#119899;) , where &#119879; is a lifting coefficient. And thus, the lifting structure with the rounding operation can achieve integer-to-integer transform. Also, the lifting and its inverse matrices in this case are represented as 1 &#119879; 0 1 and 1 &#119879; 0 1</p><p>, respectively. A floating-point lifting coefficient can be quantized as an approximate dyadic-valued coefficient &#120572;/2 &#120573; , and hence computed with only adders and shifters, where we allocate &#120573; bits to the lifting coefficient, and &#120572;, &#120573; &#8712; N. For example, a coefficient 9/128 can be operated as 9 128 = 2 3 +2 0 2 7 = 1 2 4 + 1 2 7 . Hence, the lifting with its coefficient 9/128 and a rounding operation is replaced to</p><p>for i=1 to do n 2   the summation of 4 and 7 bit-shifters illustrated in Figure <ref type="figure">3(b)</ref>. The perfect reconstruction in lifting is always kept if floating-point coefficients are approximated to dyadic-valued coefficients.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.2">Aggressive Bootstrapping Key Unrolling</head><p>Bootstrapping Key Unrolling. A TFHE bootstrapping needs to compute external produces, i.e., &#119883; -as = &#119883; &#119899; &#119894;=1 -a &#119894; s &#119894; sequentially, thereby becoming the performance bottleneck of a TFHE gate. Instead, bootstrapping key unrolling (BKU) <ref type="bibr">[2,</ref><ref type="bibr">22]</ref> is proposed to compute &#119883; &#119899;/2 &#119894;=1 -a 2&#119894; -1 s 2&#119894; -1 -a 2&#119894; s 2&#119894; in each external product, so that the number of homomorphic additions can be reduced from &#119899; to &#119899;/2. The secret key s is sampled from B &#119899; , so &#119904; &#119894; &#8712; {0, 1}, where 0 &#8804; &#119894; &#8804; &#119899;. Based on the values of &#119904; 2&#119894; and &#119904; 2&#119894;+1 , the truth table of &#119883; &#119899;/2 &#119894;=1 -a 2&#119894; -1 s 2&#119894; -1 -a 2&#119894; s 2&#119894; can be shown in Figure <ref type="figure">4</ref>. So BKU rewrites <ref type="figure">5</ref> shows, BKU encrypts &#119904; 2&#119894; -1 &#119904; 2&#119894; , &#119904; 2&#119894; -1 (1 -&#119904; 2&#119894; ), and (1 -&#119904; 2&#119894; -1 )&#119904; 2&#119894; as TGSW ciphertexts, and builds a bootstrapping key bundle to unroll the orginal bootstrapping key for two times.</p><p>Aggressive BKU Performing Badly on CPUs. BKU can be further generalized as</p><p>where &#119898; &#8712; [2, &#119899;]. So it is possible to more aggressively unroll the bootstrapping key by increasing &#119898;. Although unrolling the bootstrapping key for two times (&#119898; = 2) reduces the bootstrapping latency by 49%, we find that further enlarging &#119898; beyond 2 even prolongs the bootstrapping latency on a CPU, as explained in Section 6. Our experimental methodology is described in Section 5.</p><p>The reason can be summarized as follows.</p><p>&#8226; The limited number of cores on a CPU. With an enlarged &#119898;, there are more terms in the exponent part of Equation CPU baseline has only 8 physical cores. Mapping each terms to a core, and summing the results from all cores introduce significant communication overhead.</p><p>&#8226; More cache conflicts. The size of bootstrapping key increases exponentially with an enlarged &#119898;. For example, as Figure <ref type="figure">5</ref> shows, instead of a single bootstrapping key, BKU with &#119898; = 2 requires three bootstrapping keys. Each TGSW scale-and-add operation happening on a term fetches its corresponding bootstrapping key to the shared last level cache, generating more cache conflicts. &#8226; The lack of a pipelined design. As Figure <ref type="figure">5</ref> highlights, in each iteration, the construction of the bootstrapping key bundle BKB and the external product operation are executed sequentially.</p><p>Although it is possible to start the computation of BKB for the next iteration and perform the external product operation of this iteration at the same time, the current BKU implementation <ref type="bibr">[22]</ref> cannot do this, due to the lack of a pipelined design. MATCHA for Aggressive BKU. In this paper, we propose a pipeline flow for MATCHA to support aggressive BKU with a larger &#119898;. Compared to our CPU baseline, our pipeline flow can be easily accelerated by a large number of specialized hardware components including TGSW clusters and External Product (EP) cores. As Figure <ref type="figure">6</ref>(a) shows, we divide the bottleneck of a TFHE bootstrapping into two steps, i.e., the construction of the bootstrapping key bundle, and the EP operation. A TGSW cluster is used to construct the bootstrapping key bundle, while an EP core processes EP operations between the bootstrapping key bundle and &#119860;&#119862;&#119862;. A TGSW cluster consists of a TGSW adder tree and multiple TGSW scale units, each of which computes one term in the bootstrapping key bundle, e.g., when &#119898; = 2, (&#119883; -&#119886; 2&#119894; -1 -&#119886; 2&#119894; -1) &#8226; BK i,0 , where BK i,0 is the TGSW ciphertext of &#119904; 2&#119894; -1 &#119904; 2&#119894; . And then, the TGSW adder sums all terms and generates the bootstrapping key bundle. With the bootstrapping key bundle (BKB i ), an EP core computes &#119860;&#119862;&#119862; &#8592; BKB i &#119860;&#119862;&#119862;. The TGSW cluster and the EP core have their separated register file banks to reduce on-chip memory conflicts. Moreover, these two steps of a TFHE bootstrapping can be deployed on a TGSW cluster and an EP core in a pipelined manner, as shown in Figure <ref type="figure">6(b)</ref>. In each time step, the EP core computes the EP operation with the bootstrapping key bundle generated by the TGSW cluster in the previous time step. When &#119898; is increased, the workload of the bootstrapping key bundle construction becomes larger.  connected to 32 scratchpad memory (SPM) banks by crossbars. MATCHA also employs a memory controller to manage the offchip memory requests issued to HBM2 DRAMs. The polynomial unit is in charge of performing polynomial additions/subtractions for each TFHE logic operation, initializing bootstrapping operations, extracting samples, and conducting key-switching operations that consist of additions, logic comparisons, and Boolean logic operations. One TGSW cluster and an EP core can support one bootstrapping pipeline. As Figure <ref type="figure">7</ref>(b) shows, a TGSW cluster 16 32-bit integer multipliers and 16 32-bit integer adders to support TGSW scale operations. Each TGSW cluster has only two register banks, since the memory accesses during a TGSW scale operation have strong spatial locality. The TGSW cluster can read a register bank while write the other bank concurrently. An EP core consists of an FFT core and four IFFT cores to accelerate the FFT and IFFT kernels during an EP operation, as shown in Figure <ref type="figure">7</ref>(c). It has 8 register banks to serve the irregular memory accesses in FFT and IFFT kernels. An EP core also has four 32-bit integer multipliers and four 32-bit integer adders to manipulate TGSW ciphertexts during an EP operation. An FFT core is similar to an IFFT core, except its data flow. As Figure <ref type="figure">7</ref>(d) highlights, an FFT core comprises an address generation unit, a twiddle factor buffer, two input/output FIFOs, and 128 butterfly cores, each of which consists of two 64-bit integer adders and two 64-bit binary shifters. The address generation unit guides butterfly cores to access the twiddle factor buffer. Design Overhead. We implemented MATCHA in RTL, and synthesized it in 16&#119899;&#119898; PTM process technology using state-of-theart tools. We used CACTI to model all SPM components and register file banks. Due to its simple structure, the entire design of MATCHA can run at 2&#119866;&#119867;&#119911;. Among various on-chip network architectures, e.g., meshs, rings, and crossbars, we selected two 8&#215;32, and one 8&#215;8 bit-sliced crossbars, i.e., SPM &#8594; cores/clusters, cores/clusters &#8594; SPM, and cores/clusters &#8594; cores/clusters. The hardware overhead and power consumption of MATCHA are shown in Table <ref type="table">2</ref>. Totally, MATCHA occupies 36.96&#119898;&#119898; 2 and consumes 39.98 Watt. The HBM2 bandwidth is 640&#119866;&#119861;/&#119904;.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.3">The</head><p>Error and Noise. The error of the polynomial multiplication result caused by approximate multiplication-less integer FFT and IFFT kernels is shown in Figure <ref type="figure">8</ref>. All polynomial coefficients are 32-bit integers, while we quantize the twiddle factors of FFT and IFFT with various bitwidths. With an increasing bitwidth of twiddle factors, the error caused by approximate FFT and IFFT decreases, and is similar to that generated by original double-precision floating point FFT and IFFT. With 64-bit dyadic-value-quantized twiddle factors (DVQTFs), the error caused by approximate FFT and IFFT is   </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5">Experimental Methodology</head><p>Simulation and Compilation: To simulate the performance of MATCHA at cycle level, we used a CGRA modeling framework, OpenCGRA <ref type="bibr">[21]</ref>, which has been validated against multiple ASIC accelerators. OpenCGRA first compiles a TFHE logic operation into a data flow graph (DFG) of the operations supported by MATCHA, solves its dependencies, and removes structural hazards. The architecture of MATCHA is abstracted to an architecture description (AD) in OpenCGRA, which computes the latency and the energy consumption of each TFHE logic operation by scheduling and mapping the DFG onto the AD.</p><p>Our Baselines. We compared MATCHA against state-of-the-art CPU-, GPU-, FPGA-, and ASIC-based TFHE hardware platforms. Our CPU baseline is a 8-core 3.7&#119866;&#119867;&#119911; Xeon E-2288G processor executing the TFHE library <ref type="bibr">[6]</ref>, while our GPU baseline is a 5120core Tesla-V100 GPU equipped with a 16GB HBM2 DRAM running the cuFHE library <ref type="bibr">[7]</ref>. TFHE Vector Engine (TVE) <ref type="bibr">[10]</ref> was implemented on a low-end ZedBoard Zynq-7000 FPGA. We implemented 8 copies of TVE on a Stratix-10 GX2800 FPGA, and used it as our FPGA baseline, since the Stratix-10 board has more resources. Because there is no existing ASIC-based design, we synthesized our FPGA baseline with the 16&#119899;&#119898; PTM process as our ASIC baseline. We enable BKU on CPU, GPU, and MATCHA but fix &#119898; = 1 on FPGA and ASIC, since they do not support BKU.</p><p>TFHE Operations and Parameters. We studied all TFHE logic operations including NOT, AND, OR, NAND, XOR, and XNOR, but we only report the results on NAND in Section 6. This is because AND, OR, NAND, XOR, and XNOR have almost the same latency which is dominated by the bootstrapping step, while NOT has no bootstrapping at all. To maintain the standard 110-bit security, we adopt the TFHE parameters from <ref type="bibr">[6]</ref>, i.e., the polynomial degree in the ring &#119873; = 1024, the TLWE dimension &#119896; = 1, the basis and length for the TGSW ciphertext decomposition &#119861;&#119892; = 1024 and &#120001; = 3.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6">Results and Analysis</head><p>Latency. The latency comparison of a TFHE NAND gate between our various baselines and MATCHA is shown in Figure <ref type="figure">9</ref>. The NAND gate on CPU costs 13.1&#119898;&#119904;, while &#119898; = 2 reduces its latency to 6.67&#119898;&#119904;. Aggressive BKU with an increasing &#119898; cannot further reduce the NAND gate latency anymore on CPU, due to the limited number of cores, more cache conflicts, and the nonpipelined processing style. It takes only 0.37&#119898;&#119904; for GPU to process a NAND gate. With an enlarging &#119898;, GPU gradually reduces the NAND gate latency. When &#119898; = 4, the NAND gate latency on GPU is 0.18&#119898;&#119904;. MATCHA reduces the NAND gate latency by 13% over GPU only when &#119898; = 3, since GPU can fully use its all resources to process one TFHE gate when &#119898; = 1 or 2. MATCHA cannot support aggressive BKU with &#119898; = 4 efficiently either, since it has only 8 TGSW clusters. FPGA and ASIC do not have any pipelined design or memory optimization to support BKU, and they need &gt; 6.8&#119898;&#119904; to complete a NAND gate when &#119898; = 1.</p><p>Throughput. The NAND gate throughput comparison between various baselines and MATCHA is shown in Figure <ref type="figure">10</ref>. FPGA and ASIC duplicate 8 copies of the TVE <ref type="bibr">[10]</ref>, so they support only &#119898; = 1. By enabling aggressive BKU, even CPU (&#119898; = 2) can achieve higher gate processing throughput than ASIC and FPGA with &#119898; = 1. GPU and MATCHA obtain much higher throughput than ASIC, FPGA and CPU. Compared to GPU, MATCH improves the NAND gate throughput by 2.3&#215; (&#119898; = 3), due to its pipelined architecture for aggressive BKU.</p><p>Throughput per Watt. The comparison of the NAND gate throughput per Watt between various baselines and MATCHA is shown in Figure <ref type="figure">11</ref>. FPGA and ASIC consume only &#8764; 40&#119882; and &#8764; 26&#119882; , and improve the NAND gate throughput per Watt by 2.4&#215; and 8.3&#215; over CPU respectively, when &#119898; = 1. Due to the large power consumption (&gt; 200&#119882; ) of GPU, the best throughput per Watt of GPU (&#119898; = 4) is only about 58% of that of ASIC. Compared to ASIC, MATCHA improves the NAND gate throughput per Watt by 6.3&#215;, since it consumes only 39.98&#119882; .</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="7">Conclusion</head><p>TFHE enables arbitrary computations with an unlimited multiplicative depth to directly occur on ciphertexts. However, TFHE gates are time-consuming and power-hungry on state-of-the-art hardware platforms. In this paper, we build MATCHA to accelerate TFHE gates. MATCHA allows aggressive bootstrapping key unrolling to process TFHE gates without decryption errors by approximate multiplication-less integer FFTs and IFFTs, and a pipelined datapath. Compared to prior CPU-, GPU-, FPGA-and ASIC-based solutions, MATCHA improves the TFHE gate processing throughput by 2.3&#215;, and the throughput per Watt by 6.3&#215;.</p></div></body>
		</text>
</TEI>
