Method and Apparatus for Configuring a Reduced Instruction Set Computer Processor Architecture to Execute a Fully Homomorphic Encryption Algorithm
20260044347 · 2026-02-12
Inventors
- Morris Jacob Creeger (Santa Clara, CA, US)
- Tianfang LIU (Santa Clara, CA, US)
- Frederick Furtek (Santa Clara, CA, US)
- Paul L. Master (Santa Clara, CA, US)
Cpc classification
G06F17/142
PHYSICS
G06F7/57
PHYSICS
International classification
G06F9/38
PHYSICS
G06F17/14
PHYSICS
G06F7/48
PHYSICS
Abstract
Systems and methods for configuring a reduced instruction set computer processor architecture to execute fully homomorphic encryption (FHE) logic gates as a streaming topology. The method includes parsing sequential FHE logic gate code, transforming the FHE logic gate code into a set of code modules that each have in input and an output that is a function of the input and which do not pass control to other functions, creating a node wrapper around each code module, configuring at least one of the primary processing cores to implement the logic element equivalents of each element in a manner which operates in a streaming mode wherein data streams out of corresponding arithmetic logic units into the main memory and other ones of the plurality arithmetic logic units.
Claims
1. A method for compressing neural network weight data on a multiple processor core system, wherein the multiple processor core system comprises a chip including a plurality of processor cores, each processor core comprising one or more processing elements, an internal cache, and an external memory, wherein the processor cores or their processing elements are operable in a streaming mode, and wherein the compression is performed automatically upon output from a data reordering module and/or a convolution module, the method comprising: receiving a set of neural network weight values arranged in a multidimensional WHC structure; dividing the neural network weight values into a plurality of fixed sized groups; generating, for each group, a bitmask indicating whether each weight value in the group is zero or non-zero; identifying sparsity patterns including randomly interspersed zeros and short bursts of zero values within the data; and storing, for each group, only the non-zero values and the associated bitmask as compressed weight data, wherein the compressed weight data is stored in a main memory external to the chip and accessible by the plurality of processor cores thereby reducing external bandwidth and overall power consumption by avoiding transmission and computation of zero values, whereby decompression allows the data stream to avoid multiplications by zero to improve utilization of computation resources.
2. A method for decompressing compressed neural network weight data on a multiple processor core system, data on a multiple processor core system, wherein the multiple processor core system comprises a chip including a plurality of processor cores, each processor core comprising one or more processing elements an internal cache, and an external memory, wherein the processor cores or their processing elements are operable in a streaming mode, the method comprising: retrieving a plurality of groups of the compressed weight data and corresponding bitmasks from a main memory external to a processor chip; reconstructing each group of weight values by using the corresponding bitmask for that group to determine locations for zero values thereby eliminating multiplications and excess data movements; and supplying the reconstructed weight values to one or more neural network layers for processing in a convolution.
3. A method for compressing neural network weight data on a multiple processor core system, wherein the multiple processor core system comprises a chip including a plurality of processor cores, each processor core comprising one or more processing elements an internal cache, and an external memory, wherein the processor cores or their processing elements are operable in a streaming mode, and wherein the compression is performed automatically upon output from a data reordering module and or a convolution module to reduce bandwidth, power and computation load, the method comprising: receiving a set of neural network weight values arranged in a multidimensional WHC structure; dividing the neural network weight values into a plurality of fixed sized groups; generating, for each group, a bitmask indicating whether each weight value in the group is zero or non-zero; identifying sparsity patterns including randomly interspersed zeros and short bursts of zero values within the data; storing, for each group, only the non-zero values and the associated bitmask as compressed weight data, wherein the compressed weight data is stored in a main memory external to the chip and accessible by the plurality of processor cores, thereby reducing external bandwidth and overall power consumption by avoiding transmission and computation of zero values, whereby decompression allows the data stream to bypass unnecessary multiplications with zero, improving utilization of computation resources; retrieving the plurality of groups of the compressed weight data and corresponding bitmasks from a main memory external to a processor chip; reconstructing each group of weight values by using the corresponding bitmask for that group to determine locations for zero values thereby eliminating multiplications and excess data movements; and supplying the reconstructed weight values to one or more neural network layers for processing in a convolution.
4. A method for compressing neural network weight data on a multiple processor core system, wherein the multiple processor core system comprises a chip including a plurality of processor cores, each with one or more processing elements and internal cache, and wherein the system is operable to stream data, the method comprising: receiving a set of weight values; for each weight value, appending a bit indicating whether the value is zero or non-zero; for one or more sequences of consecutive zero values, appending a multi-bit field indicating a count of the consecutive zeros; and transmitting the resulting compressed stream over a data bus to an external memory; whereby the inclusion of per-value indicators and count fields increases the bit width of the data bus but provides a simpler compression implementation.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
DETAILED DESCRIPTION
[0058] The inventors have developed an architecture and methodology that allows processor cores, such as known RISC processors to be leveraged for increased computing power. The processor cores, referred to as primary cores herein, are segregated into control logic and simple processing elements, such as arithmetic logic units. A node wrapper allows the architecture to be configurable into a streaming mode (fractured mode) in which pipelines are defined and data is streamed directly to the execution units/processing elements as secondary cores. Applicant refers to secondary cores using the tradename Fractal Cores. In a streaming mode, the processor control logic need not be used. The secondary cores are addressed individually and there is reduced need for data to be stored in temporary storage as the data is streamed from point to point in the pipelines. The architecture is extensible across chips, boards and racks.
[0059]
[0060] A wrapper is generally known as hardware or software that contains (wraps around) other hardware, data or software, so that the contained elements can exist in a newer system. The wrapper provides a new interface to an existing element. In embodiments, the node wrappers provide a configurable interface that can be configured to allow execution in a conventional control-centric mode or in a streaming mode, or fractured mode, that is described below.
[0061] In a conventional control-centric mode (RISC mode), the architecture uses the core control logic to control data flow and operates in a manner wherein data is read from and written to the cache memory and processed by a primary core in accordance with control logic. However, secondary cores 114 may be selectively fractured to operate in a fractured mode, as part of a pipeline, wherein data streams out of the corresponding secondary core into the main memory and other ones of the plurality of secondary cores and data streams from the main memory and other secondary cores to stream into the corresponding core, as described in greater detail below. As an example, a rectangular partition can be created from a result matrix y using single precision floating point arithmetic.
[0062] The node wrappers 110 may be configured to partition logic and an input state machine for transferring data from memory to the processing element and wherein each arithmetic logic unit has an output that is associated with an output memory. The output memory may be updated throughout processing with the latest sum as it is computed. Arithmetic logic units 114 of the RISC processor can be used as streaming secondary cores in the streaming mode. Each node wrapper 110 can be configured to define multiple hardware streams, i.e. pipelines, to be allocated to specific ones of the cores.
[0063]
[0064] As illustrated schematically in
[0069] Referring to
[0070] In some implementations, the architecture may be formed on a single chip. Each cache memory may be a nodal memory including multiple small memories. In some implementations, each core may have multiple arithmetic logic units. In some implementations, by way of non-limiting example, the arithmetic logic units may include at least one of integer multipliers, integer multiplier accumulators, integer dividers, floating point multipliers, floating point multiplier accumulators, floating point dividers. In some implementations, the arithmetic logic units may be single instruction multiple data units. As a simple example, an architecture can be made up of 500 primary processor cores 108 each having 16 processing elements. In the streaming mode, up to 8000 secondary cores 114 can be addressed individually. This allows for performance of massive mathematical operations, as is needed in Artificial Intelligence applications. The primary cores and secondary cores can be dynamically mixed to implement new algorithms.
[0071] The process and mechanism for configuring the architecture is described below. As noted above, the fractured mode is accomplished by defining one or more pipelines of streaming data between the secondary cores.
TABLE-US-00001 class source: public threadModule { // code to run on a RISC core outputStream
[0072] In the objects above code( ) can point to the source code below:
TABLE-US-00002 // Example of code which can be run on a RISC core void source::code( ) { int x; for (x = 0; x < 1000; ++x) // Put 1000 ints into outStrm { printf(Generating Data %d\n, x); outStrm << x; // TruStream put } } //Example of code which can be run on a Fractured Core void pipeline::code( ) { int x; int sum = 0; inStrm >> x; // get data from input stream sum += x * 3;// perform some computation outStrm << sum; // TruStream put, send data to output stream } // Example of code which can be run on a RISC core void sink::code( ) { int x; for (x = 0; x < 1000; ++x) { inStrm >> x; // get data from input stream printf(Received Data %d\n, x); } }
[0073] The code below serves to connect the topology of pipeline of
TABLE-US-00003 class pipelineTest: public streamModule { source src; pipeline pipe; sink snk; public: pipelineTest( ) // Constructor { src >> pipe >> pipe >> pile >> pipe >> snk; // Connect modules end( ); // Housekeeping } };
[0074]
[0075]
[0076] Each processing element 114 in
[0077] The programming and data information in the central access memory includes a setup word for each processing element 114 that contains partition information for the processing element 114. That setup word configures the partition logic at each processing element 114 to only use data with rows and columns associated with the processing element's partition. Both the pre-load X matrix data and the streaming A matrix data arrive over the same path and use the same partition setup to select data out of the data stream from the central memory. Selected data at each processing element 114 gets written into the node input memory and held until the access manager completes transferring data and starts the processing. When processing starts, the processing uses only the data that has been transferred into the node memories and stops when the end of the data has been reached. If the repeat bit is set in the start word, the pointer into the node input memory is reset to 0 when the end of the buffered data is reached and allowed to repeat the data indefinitely. This allows power measurements to be made.
[0078]
[0079] An operation 602 may include providing configuration code to one or more node wrappers. An operation 604 may include executing the configuration code to set the interconnections of the NOC in a manner which creates at least on pipeline. An operation 606 may include operating the architecture in a streaming mode wherein data streams out of the corresponding secondary core into the main memory and other ones of the plurality of secondary cores and data streams from the main memory and other secondary cores to stream into the corresponding core in a streaming mode or the control-centric mode.
[0080]
[0081] As illustrated in
[0088] The embodiments facilitate more efficient data compression. Neural Networks, by their very definition, contain a high degree of sparsity, for the SegNet CNN over 3 the computations involve a zero element. Clearly, having an architecture that can automatically eliminate the excess data movements for zero data, and the redundant multiply by zero for both random and non-random sparsity would result in higher performance and lower power dissipation. Data which is not moved results in a bandwidth reduction and a power savings. Multiplications that do not need to be performed also save power dissipation as well as allowing the multiplier to be utilized for data which is non-zero. The highest bandwidth and computation load in terms of multiply accumulates occurs in the DataStreams exiting the Reorder modules in 801 which feed the Convolve Modules 802. Automatically compressing the data leaving the reorder module, 801, reduces the bandwidth required to feed the convolve modules as well as reducing the maximum MAC (multiply accumulates) that each convolve performs. There are several possible zero compression schemes that may be performed, what is illustrated is a scheme which takes into account the nature of convolution neural networks. The input to a convolver, 802, consists of a 3-dimensional data structure (WidthHeightChannel). Convolution is defined as multiplying and summing (accumulating) each element of the WHC against a Kernel Weight data structure also consisting of (WidthHeightChannel). The data input into the convolver exhibits two types of sparsity-random zeros interspersed in the WHC data structure and short bursts of zeros across consecutive (W+1)(H+1)C data elements. The compressed data structure that is sent from the Reorder Modules to the Convolver modules is detailed in
[0089]
[0090] As noted above, the streaming topologies described herein can be applied to achieve FHE processing with far fewer computing resources than would be required with conventional processors. FHE has specialized logic gates that are very complicated and computing resource intensive. For example, the BootsAND logic gate of TFHE has two inputs (LweSample) that are each 501 32 bit integers. Transforming FHE logic, such as TFHE logic, to the streaming topologies desired herein yields processing that is much more efficient. Implementations described herein include topologies derived from three TFHE functions: (1) bootsAND, (2) tfhe_MuxRotate_FFT and (3) tGswFFTExternMulToTLwe.
[0091] Below are the constants used in the TFHE code. They are used to compute the sizes of the data members and for-loop limits in the streaming topology as described below.
TABLE-US-00004 static const int32_t N = 1024; static const int32_t k = 1; static const int32_t n = 500; static const int32_t bk_l = 2; static const int32_t bk_Bgbit = 10; static const int32_t ks_basebit = 2; static const int32_t ks_length = 8; static const double ks_stdev = 2.44e5; //standard deviation static const double bk_stdev = 7.18e9; //standard deviation static const double max_stdev = 0.012467; //max standard a 1/4 msg space deviation for
[0092] Torus32 is a key typedef used in the TFHE code and in the TruStream topologies below:
TABLE-US-00005 typedef int int32_t; typedef unsigned int uint32_t; typedef unsigned long long uint64_t; typedef int32_t Torus32; // avant uint32_t
[0093] The TFHE code is divided into references (structs) which are composite data type declarations defining a physically grouped list of variables under one name. Structs can be thought of as the data processed by the functions. For example, the TFHE bootsAND code includes 23 structs that can be classified as either 1) STATIC/NON-STREAMING (data values of these types are fixed/static for a particular Boolean AND gate and can therefore be stored in SRAM) or 2) DYNAMIC/STREAMING (data values which are periodically or constantly changing, and are streamed from one core to another).
[0094] The TFHE code is expressed in C/C++, both of which make extensive use of: [0095] new (a library function that requests memory allocation on a process's heap) [0096] malloc (a library function that allocates the requested memory and returns a pointer to it.) [0097] delete (a library function that requests removal of memory allocation on a process's heap) [0098] pointers.
[0099] The streaming topology described herein does not use these system functions. Instead, it uses streams. This has implications for the nine DYNAMIC/STREAMING structs of the TFHE code, when being adapted for a streaming processor arrangement. Implementations use a mechanism to replace the pointer data-members in these nine structs with the actual arrays being pointed to because instead of passing an array pointer from one function to another, a streaming program passes/streams the actual array from one module to another. On a conventional microprocessor, however, the benefits of a streaming programming model are best achieved by streaming pointers. However, this arrangement, conventional processors streaming pointers, is disadvantageous for the following reasons. [0100] The streaming compute fabric is arbitrarily scalable [0101] The streaming compute fabric can achieve much, much higher levels of performance [0102] the streaming compute fabric has none of the bottlenecks that plague conventional microprocessors, like caching, context switching, scheduling and dispatching [0103] The streaming compute fabric has no bloat code (such as control code), the only code running in the streaming compute fabric is application code [0104] the streaming compute fabric is far more efficient in terms of energy consumption and usage of silicon real-estate.
[0105] Accordingly, the dynamic structs of the TFHE bootsAND code can be converted into the following structs that can be streamed (the S designates a streaming struct.
TABLE-US-00006 1S. Struct TGswSample // DYNAMIC / STREAMING { int32_t all_sample[ (k + 1) * bk_l ]; // (k + 1) * l = 4 int32_t bloc_sample[ k + 1]; // k + 1 = 2 const int32_t k; // STATIC / NON-STREAMING const int32_t l; // STATIC / NON-STREAMING }; 2S. Struct Ts_LweSample // DYNAMIC / STREAMING { int32_t a[ n ]; // n = 500 int32_t b; double current_variance; }; 3S. Struct Ts_TGswSampleFFT // DYNAMIC / STREAMING { int32_t all_samples[ (k + 1) * l ]; // (k + 1) * l = 4 int32_t sample[ k + 1 ]; // k + 1 = 2 const int32_t k; // STATIC / NON-STREAMING const int32_t l; }; 4S. Struct Ts_IntPolynomial // DYNAMIC / STREAMING/** This structure represents an integer polynomial modulo X{circumflex over ()}N+1 */ { const int32_t N; // N = 1024 int32_t coefs[ N ]; }; 5S. Struct Ts_TlweSample // DYNAMIC / STREAMING { int32 a[ (k + 1) * N ]; // (k + 1) * N = 2048 int32 b; // Alias of a[k], DONT CARE double current_variance; const int32_t k; // STATIC / NON-STREAMING }; 6S Struct Ts_TLweSampleFFT // DYNAMIC / STREAMING { int32_t a[ (k + 1 ) * N ]; // (k + 1) * N = 2048 int32_t b; // Alias of a[k], DONT CARE double current_variance; const int32_t k; // STATIC / NON-STREAMING }; 7S. Struct Ts_TgswSample // DYNAMIC / STREAMING { int32_t all_sample[ (k + 1) * l ]; // (k + 1) * l = 4 int32_t bloc_sample[ k + 1 ]; // k + 1 = 2 const int32_t k; // STATIC / NON-STREAMING const int32_t l; // STATIC, NON-STREAMING }; 8S. Struct Ts_LagrangeHalfCPolynomial_IMPL // DYNAMIC / STREAMING /** structure that represents a real polynomial P mod X{circumflex over ()}N+1 as the N/2 complex numbers: P(w), P(w{circumflex over ()}3), ..., P(w{circumflex over ()}(N1)) where w is exp(i.pi/N) */ { double coefsC[ N ]; // N = 1024 N/2 complex numbers2 FFT_Processor_Spqlios* proc; }; 9S Struct Ts_TorusPolynomial // DYNAMIC / STREAMING/** This structure represents an torus polynomial modulo X{circumflex over ()}N+1 */ { const int32_t N; // N = 1024 int32_t coefsT[ N ]; };
[0106] The streaming structs above can be created from the original structs by, for example, the following process: [0107] locate a pointer in the code; [0108] backtrack through the code to find data that was created and the allocated block of data that is pointed to; [0109] determine the size of the allocated block; [0110] replace the pointer with a data array corresponding to the allocated block; and [0111] use the array as streaming data.
[0112]
TABLE-US-00007 EXPORT void tfhe_bootstrap_woKS_FFT(LweSample *result, const LweBootstrappingKeyFFT *bk, Torus32 mu, const LweSample *x) { const TGswParams *bk_params = bk>bk_params; const TLweParams *accum_params = bk>accum_params; const LweParams *in_params = bk>in_out_params; const int32_t N = accum_params>N; const int32_t Nx2 = 2 * N; const int32_t n = in_params>n; TorusPolynomial *testvect = new_TorusPolynomial(N); int32_t *bara = new int32_t[N]; // Modulus switching int32_t barb = modSwitchFromTorus32(x>b, Nx2); for (int32_t i = 0; i < n; i++) { bara[i] = modSwitchFromTorus32(x>a[i], Nx2); } // the initial testvec = [mu,mu,mu,...,mu] for (int32_t i = 0; i < N; i++) testvect>coefsT[i] = mu; // Bootstrapping rotation and extraction tfhe_blindRotateAndExtract_FFT(result, testvect, bk>bkFFT, barb, bara, n, bk_params); delete[ ] bara; delete_TorusPolynomial(testvect); }
[0113] A corresponding module is created:
TABLE-US-00008 class tfhe_bootstrap_woKS_FFT_Module: public threadModule // A threadModule class { inputStream_NoAutoAck
[0114] Code for the module is generated:
TABLE-US-00009 void tfhe_bootstrap_woKS_FFT_Module::code( ) // tfhe_bootstrap_woKS_FFT_Module thread { static const Torus32 mu = modSwitchToTorus32( 1, 8 ); for (int32_t h = 0; h < (FHE_FIFO_Size + 1); h++) // Create array of TorusPolynomials { testvect[h] = new_TorusPolynomial( N ); // N = 1024 bara[h] = new int32_t[ N ]; // N = 1024 for (int32_t i = 0; i < N; ++i) // Initialize bara[h] { bara[h][i] = 0; } } while (1) // An infinite loop { for (int32_t h = 0; h < (FHE_FIFO_Size + 1); h++) // Process a burst of input data { x_inStrm >> x; // Get next LweSample pointer from x_inStrm barb = modSwitchFromTorus32( x>b, Nx2 ); // Nx2 = 2048 for (int32_t i = 0; i < n; i++) { bara[h][i] = modSwitchFromTorus32( x>a[i], Nx2 ); // Nx2 = 2048 } x_inStrm.backwardAck( ); // Tell x_inStrm source that we're done with x for (int32_t i = 0; i < N; i++) // N = 1024 { testvect[h]>coefsT[i] = mu; } testvect_outStrm << testvect[h]; // Put testvect[h] into testvect_outStrm bara_outStrm << bara[h]; // Put bara[h] into bara_outStrm barb_outStrm << barb; // Put barb into barb_outStrm } } }
[0115] Finally, a streaming module is created:
TABLE-US-00010 class bootsAND_Topology: public streamModule// bootsAND_Topology streamModule { bootsAND_ModulebAND; tfhe_bootstrap_woKS_FFT_ModulewoKS;// tfhe_bootstrap_woKS_FFT_Module data member tfhe_blindRotateAndExtract_FFT_Module rotX; tfhe_blindRotate_FFT_TopologyrotTop; tLweExtractLweSample_ModulexSamp; IweKeySwitch_ModulekeySwitch; public: bootsAND_Topology( const TFheGateBootstrappingCloudKeySet* cks ) : bAND( cks ), woKS( cks>bkFFT ), rotX( cks>bkFFT>bk_params ), rotTop( cks>bkFFT ), xSamp( cks>bkFFT>accum_params ), keySwitch( cks, (char*)/Users/fredfurtek/Desktop/FCF MacBook Pro/QST/TruStreamCPP/TruStreamFHE/LweSAmple_result.txt ) { setName( bootsAND_Topology ); bAND >> woKS >> rotX >> rotTop >> xSamp >> keySwitch;// Create bootsAND_Topology pipeline end( ); } };
[0116] As a result, each box of
[0117] The biggest factor limiting the performance of TFHE is a 500-iteration for-loop in the TruStream module tfhe_blindRotate_FFT. In partial loop-unrolling, an n-iteration for-loop is replaced with a pipeline containing m for-loops, each with n/m iterations. In a partially unrolled pipeline, the loops are performed in parallel, while the steps within each loop are performed serially. In full loop-unrolling, an n-iteration for-loop is replaced with a loop-free pipeline containing n instances of each step in the for-loop. In a fully unrolled pipeline, all steps are performed in parallel.
[0118]
[0119]
[0120] It is necessary to determine and upper bound on the throughput of a streaming topology. Applicants have developed an algorithm for determining an upper bound on the throughput of a streaming topology that performs a sequence of operations: the upper bound on throughputin clock cycles per operationfor a Streaming topology is the maximum number of data values carried on a single topology stream during a single operation. This is so because a stream can transport data values at a maximum rate of one data value per clock cycle. For each stream, transport of data values for one operation must be completed before transport of data values for the next operation can begin. It follows that operations cannot be performed any faster than one operation per N clock cycles, where N is the maximum number of data values carried on a single stream during a single operation.
[0121] For example, the upper bound on throughput for the topology in
[0122] or 2,048*500=1,024,000 clock cycles per operation. While the upper bound on throughput for the topology in
[0123] If the loop in
[0124] Table 1 summarizes the bootsAND function throughput numbers for two clock frequencies: a). 125 MHz, the clock rate for some FPGA implementations of streaming topology, and b) 1 GHz, the expected clock rate for some custom-ASIC implementations of the topology.
TABLE-US-00011 TABLE 1 Throughput in Throughput in Throughput in Microseconds at Microseconds Clock Cycles 125 MHz at 1 GHz bootsAND (no 1,024,000 8,192 1,024 unrolling bootsAND (4x 256,000 2,048 256 unrolling bootsAND (full 2,048 16 2 unrolling
[0125] Using the numbers in Table 1, we are able to calculate the times needed to perform a thousand of most common arithmetic operations, including: addition, subtraction, min, max and average. Table 2 illustrates the times to perform a thousand of the most common arithmetic operations, including addition, subtraction, min, max, and average, using the streaming topology.
TABLE-US-00012 Milliseconds at Milliseconds Clock Cycles 125 MHz at 1 GHz bootsAND (no 1,024,000 8,192 1,024 unrolling bootsAND (4x 256,000 2,048 256 unrolling bootsAND (full 2,048 16 2 unrolling
[0126] It can be seen that the streaming topology described herein provides greatly enhanced efficiency in processing FHE functions on a computer. However, the core of FHE processing is Fast Fourier Transforms (FFT) and Inverse Fast Fourier Transforms (IFFT). Therefore, additional efficiencies can be gained if FFT and IFFT can be processed faster. Applicants have discovered that some known techniques for optimizing Fourier Transforms can be leveraged to create even more efficient processing in a streaming environment.
[0127] The Fourier transform (FT) decomposes a function of time into its constituent frequencies. The Fourier transform of a function of time is itself a complex-valued function of frequency, whose magnitude (modulus) represents the amount of that frequency present in the original function, and whose argument is the phase offset of the basic sinusoid in that frequency. The Fourier transform is not limited to functions of time, but the domain of the original function is commonly referred to as the time domain. The inverse Fourier transform mathematically synthesizes the original function from its frequency domain representation. Linear operations performed in one domain (time or frequency) have corresponding operations in the other domain, which are sometimes easier to perform. Therefore, Fourier Transforms have many applications in data processing and are critical to some FHE implementations.
[0128] Implementations described herein define new way to process FFTs and IFFTs. The FFT can then be mapped into a new computational implementation, such as the streaming topology described herein, with high parallelism. Further, implementations process an FFT of each polynomial and multiply term-wise in the frequency domain then convert back to the time domain. Conventional processing uses a coefficient representation (i.e. multiplies the coefficient of each term). Conventional computation costs are on the order of N.sup.2 squared (where N is order of polynomial). The method described herein yields a computation cost that is roughly NLog(N).
[0129] Implementations described herein create a pipeline architecture that calculates FFT algorithms with a special stage at the endpoints that calculate multiples of order N polynomials. This greatly reduces computational requirements.
[0130] The discrete Fourier Transform (DFT) of a finite length sequence of N is:
[0131] Using Decimation in Frequency methodologies, we can divide the output sequence of the DFT into smaller subsequences with the following equations.
[0132]
[0133] A basic flow graph of a butterfly structure is illustrated in
[0134]
[0135] The input sequence of an FFT (x[n]) can be also decomposed into smaller and smaller subsequences by applying Decimation-In-Time (DIT) transform algorithms. As discussed above, in the DIF algorithm, the decimation is done in the frequency domain. That's the reason, the frequency indices are in bit-reversed order. In DIT, we start, for example, with a single 8-point DFT, progress on to two 4-point DFTs and end with four 2-point DFTs by applying equation 3.1 below.
[0136] Each sum in equation (3.1) is the (N/2)-point DFT. The first sum is the (N/2)-point DFT of the even numbered points of the original input sequence and the second sum is the (N/2)-point DFT of the odd numbered points of the input sequence.
[0137]
which are polynomials of degreebound n, their product, C(x)A(x)B(x) is a polynomial of degreebound 2n1.
[0138] Such a computation takes O(n.sup.2) time when we represent polynomial in the point-value format.
where, the vectors a and b are padded with zeros to length 2n, and .Math. denotes the component-wise of two 2n-length element vectors.
[0139] Given the fact that the elements in these vectors are real numbers (as opposed to complex numbers used as the standard input of an FFT) and the vectors have length of n and zero padded to length 2n, the FFT can be optimized by deploying a special first stage and an (N/2)-point FFT as shown in
[0140] In theory, to multiply two polynomials at order of N, an efficient way is to apply FFT to coefficients of each polynomial, pointwise multiply the FFT coefficients and perform the inverse FFT. The dimension of both the FFT and IFFT should be 2N. The coefficients of each polynomial are zero-padded to be a 2N dimension vector. The multiplication of two polynomials at order of N is in the order of 2N1. In TFHE, the modular arithmetic operation with a polynomial is required. After multiplication of two Torus polynomials, the final product (2N1 order polynomial) is reduced to modulo of X.sup.N+1 based on the following equations.
[0141] On the FFT implementation side, the FFT input is adjusted to achieve this modular operation before performing the 2N-point FFT by applying the following equations.
[0142] Because of this unique input structure, the Decimation-in-Frequency Decomposition can be applies to optimize the FFT by deploying a special first stage and an (N)-point FFT. Similarly, the IFFT can optimized by deploying an (N)-point IFFT and a special last stage. Because of the modular arithmetic operation of polynomial in TFHE, there is no need to calculate the IFFT coefficients for i=N, N+1, . . . 2N1.
[0143] The stages of the streaming topologies for the FFT and the IFFT noted above can be connected to create a single streaming topology for each. The results are the FFT topology illustrated in
[0144] The embodiments disclosed herein can be used in connection with various computing platforms. The platforms may include electronic storage, one or more processors, and/or other components. Computing platforms may include communication lines, or ports to enable the exchange of information with a network and/or other computing platforms. The computing platforms may include a plurality of hardware, software, and/or firmware components operating together to provide the functionality attributed herein. Electronic storage may comprise non-transitory storage media that electronically stores information
[0145] Although the present technology has been described in detail for the purpose of illustration based on what is currently considered to be practical implementations, it is to be understood that such detail is solely for that purpose and that the technology is not limited to the disclosed implementations, but, on the contrary, is intended to cover modifications and equivalent arrangements that are within the spirit and scope of the appended claims. For example, it is to be understood that the present technology contemplates that, to the extent possible, one or more features of any implementation can be combined with one or more features of any other implementation.