Accelerated Processing for Maximum Distance Separable Codes using Composite Extension Fields Diego Ruano∗, Daniel E. Lucani†and Olav Geil‡ ∗IMUVA-Mathematics Research Institute and Department of Algebra, Analysis, Geometry and Topology, University of Valladolid, Spain †Department of Engineering and DIGIT, Aarhus University, Denmark ‡Department of Mathematical Sciences, Aalborg University, Denmark Email:
[email protected], [email protected] , ola[email protected] Published in European Wireless 2019; 25th European Wireless Conference. Aarhus, Denmark. (2019) Abstract—This paper describes a new design of Reed-Solomon (RS) codes when using composite extension fields. Our ultimate goal is to provide codes that remain Maximum Distance Separable (MDS), but that can be processed at higher speeds in the encoder and decoder. This is possible by using coefficients in the generator matrix that belong to smaller (and faster) finite fields of the composite extension and limiting the use of the larger (and slower) finite fields to a minimum. We provide formulae and an algorithm to generate such constructions starting from a Vandermonde RS generator matrix and show that even the simplest constructions, e.g., using only processing in two finite fields, can speed up processing by as much as two-fold compared to a Vandermonde RS and Cauchy RS while using the same decoding algorithm, and more than two-fold compared to other RS Cauchy and FFT-based RS. Index Terms—Reed-Solomon codes, coding theory, composite extension finite fields I. INTRODUCTION Reed-Solomon (RS) codes were proposed for the first time in 1960 as a class of error-correcting codes [1]. Since then, RS codes have been used in a large number of applications from data communication to distributed storage both as an error-correcting code or as an erasure-correcting code and relying on several constructions for RS code generator matrices, e.g., Vandermonde, Cauchy. Although popular, these designs have remained relatively unchanged in the last decades and are typically associated with a significant computational costs for encoding (decoding) as the number of symbols (k) increases due to the finite field operation costs and the O(k2) (O(k3)) scaling. Recent proposals focused on improving the overall scaling of encoders/encoders to O(klog(k)) by using constructions based on the Fast Fourier Transform (FFT) [2], [3], [4]. However, their performance for moderate k, e.g., for communications and storage, is yet to be studied. Given the growing challenges and upcoming demands in communication and distributed storage systems, the development of efficient constructions of RS codes that can (i) seamlessly replace older constructions without modifying the system’s operation, and (ii) deliver higher encoding and decoding speeds, becomes increasingly relevant. In the context of older CPUs, Cauchy matrices were shown to be faster than Vandermonde matrices [5]. However, the use of hardware acceleration, e.g., Single Instruction Multiple Data (SIMD) operations, in Intel [6] and ARM [7] CPUs has made both approaches faster and reduced the gap between them, i.e., making them essentially equivalent in processing performance for the same implementation, e.g., consider Jerasure 2.0’s performance described in [8]. Thus, novel solutions that radically redefine the core operations of the finite fields and exploit them are needed to provide the critical speed-ups. This paper introduces a new design for RS codes with the goal to reduce the computational costs in practical systems. To achieve this, we use the fact that (i) finite fields of the form F2sfor some scan be computed faster for smaller s[7], and that (ii) it is possible to generate efficient composite extension fields that maintain compatibility in their operations (i.e., product in small field has a direct bit-by-bit mapping to the same product performed in a larger field constructed from that smaller field) [9]. Thus, our design utilizes composite extension finite fields and proposes a deterministic algorithm to maximize the number of columns in the generator matrix that are composed solely by the smallest finite field. It then proceeds to maximize the number of columns with the second smallest finite field (an intermediate finite field), and continues until columns can only be of the largest finite field allowed. We show performance gains for decoding of as much as twofold in SIMD capable CPUs while using the same decoding algorithm (Gaussian Elimination) as a Vandermonde RS code. Higher gains are expected in devices not capable of SIMD instructions and/or by improving the decoding algorithm as suggested in [9]. We focus on decoding performance as it is more challenging to achieve benefits than for the case of encoding. Encoding performance gains are expected to be the same or higher due to the fact that the encoding of each individual coded fragment does not depend on the encoding of other fragments. The paper is organized as follows. Section II describes the fundamentals for generation of matrices for RS codes
using two composite extension fields and presents a simple, deterministic algorithm based on the theoretical results. Section III shows the benefits of such a construction using a C++ implementation and measuring decoding speed performance in a real device. Section IV extends our concept to generator matrices using more than two composite extension fields. Section V summarizes our contributions and future work. II. GENERATOR MATRICES FOR REED-SOLOMON CODES WITH COMPOSITE EXTENSION FIELDS Let Fqbe a finite field with q= 2selements. A RS code Ck⊂Fn q, with dimension k, is the vector space generated by the evaluation of the monomials 1, X, . . . , Xk−1at the n= 2s−1points of Fq\ {0}. Namely, let αbe a primitive element of Fqand let ev :Fq[X]→Fn q, be given by ev(f)=(f(α0), f(α1), . . . , f(αq−2)). Then, the RS code with dimension kis Ck=h{ev(Xi) : i= 0, . . . , k −1}i Since the evaluation map is injective, an n×kgenerator matrix is obtained by considering as columns the evaluation of a monomial at Fq\ {0}, in this way one obtains the following generator matrix that is a Vandermonde matrix GV k=α(i−1)(j−1)1≤i≤n,1≤j≤k. The elements of the matrix GV kare in Fqand only the first column has all elements in F2. Note that a row in GV kis provides the coefficients for generating a coded fragment, while a column is associated to the contribution of an original fragment to the different coded fragments generated. We shall provide a different generator matrix for the RS code Ck such that as many columns as possible have all elements in F2(that is, they consist in 0’s and 1’s). Hence, we will evaluate a different set of polynomials to obtain a different generator matrix for the same code, or equivalently, one may consider elementary transformations in the previous matrix. In particular, we can evaluate kpolynomials of degree lower than ksuch that they are linearly independent. We consider polynomials that evaluate to F2, i.e., f∈Fq[X]such that ev(f)∈Fn 2, which are described by cyclotomic cosets and the trace of a polynomial [10], [11]. For an integer 0≤a<q−1, consider the cyclotomic coset modulo q−1defined by Ia={a2imod q−1 : i= 0,1,2, . . .} . We consider q= 24as a toy example for this section. The different cyclotomic cosets are I0={0},I1={1,2,4,8}, I3={3,6,12,9},I5={5,10},I7={7,14,13,11}. One has that I1=I2=I4=I8and so on. Theorem 1 provides a basis for the polynomials evaluating to F2(see [12, Section 1.3] and [13, Theorem III.8]). Theorem 1: A basis for the set of polynomials in Fq[X] evaluating to F2is [ Ia fIa,βj:j∈ {0,...,#Ia−1}, where β=α(2s−1)/(2ηa−1), with ηa= #Ia, i.e. a primitive element of F2ηa⊆F2s, and fIa,β =βXa+β2X2a+· · · + β2ηa−1X2ηa−1a. We consider again q= 24, we provide some of the polynomials given by the previous theorem: one has a cyclotomic coset with one element I0={0}and its associated polynomial is 1 = X0, that trivially evaluates to F2. The polynomials, associated to the cyclotomic coset I1={1,2,4,8}, are {fI1,1, fI1,α, fI1,α2, fI1,α3}. They are linearly independent and evaluate to F2: fI1,1=ev(X+X2+X4+X8) fI1,α =ev(αX +α2X2+α4X4+α8X8) fI1,α2=ev(α2X+α4X2+α8X4+αX8) fI1,α3=ev(α3X+α6X2+α12X4+α9X8). For I5={5,10}, we have that {fI5,1, fI5,α5}are its associated polynomials that evaluate to F2, since α5= α((16−1)/(4−1)). Namely, fI5,1=X5+X10 fI5,α5=α5X5+α10X10. Continuing this way, we get from I3four polynomials of degree 12, as I3={3,6,9,12}, and from I7, another four polynomials of degree 14, as I7={7,11,13,14}, which evaluate to F2. With these polynomials, we can construct the RS code C9with dimension 9and length 15 over F16. By Theorem 1 we can evaluate fI1,1, fI1,α, fI1,α2, fI1,α3, instead of X, X2, X4, X8, to construct the generator matrix since {1,2,4,8}⊂{0,...,8}. In this way, a generator matrix of the Reed-Solomon code C9consists of the columns ev(1), ev(fI1,1), ev(fI1,α), ev(fI1,α2), ev(fI1,α3), ev(X3), ev(X5), ev(X6)and ev(X7). Note that these polynomials will evaluate to codewords that are linearly independent since some of them have different degree and the ones with the same degree are linearly independent from each other by Theorem 1 and linearly independent from the remaining polynomials by the definition of fIa,αi. The elements of the first 5 columns of the
generator matrix are in F2. G9= 1 0 0 0 1 1 1 1 1 10010 α3α5α6α7 10100 α6α10 α12 α14 11001 α91α3α6 10011α12 α5α9α13 10110 1 α10 1α5 11101 α31α6α12 11010 α6α5α12 α4 10101 α9α10 α3α11 11011α12 1α9α3 10111 1 α51α10 11111 α3α10 α6α2 11110 α61α12 α9 11100 α9α5α3α 11000α12 α10 α9α8 Let C11 be the RS code with dimension 11 and length 15 over F16. The generator matrix of this code can be obtained by considering {ev(Xi) : i= 0,...,10}. As before, by Theorem 1, we can consider fI1,1,fI1,α,fI1,α2,fI1,α3instead of X, X2, X4, X8since {1,2,4,8} ⊂ {0,...,10}. Furthermore, we can now consider fI5,1, fI5,α5instead of X5, X10. In this way, by the same reason as before, a generator matrix of the RS code C11 is given by ev(1), ev(fI1,1), ev(fI1,α), ev(fI1,α2), ev(fI1,α3),fI5,1,fI5,α5, ev(X3), ev(X6), ev(X7), ev(X9). The elements of the first 7 columns of the generator matrix are in F2. G11 = 1000101 1 1 1 1 1001011 α3α6α7α9 1010010 α6α12 α14 α3 1100101 α9α3α6α12 1001111α12 α9α13 α6 1011010 1 1 α51 1110101 α3α6α12 α9 1101011 α6α12 α4α3 1010110 α9α3α11 α12 1101101α12 α9α3α6 1011111 1 1 α10 1 1111110 α3α6α2α9 1111001 α6α12 α9α3 1110011 α9α3α α12 1100010α12 α9α8α6 Analogously, for the RS code C13 with dimension 13 and length 15 over F16, we can construct a generator matrix with 11 columns with all elements in F2. In general, for a RS code Ckwith dimension kover Fq, one can obtain a generator matrix with X Ia⊆{0,...k−1} #Ia columns in F2. Note that, by Theorem 1, such a number of columns is optimal. For RS codes over F16, Table I shows how many columns can be obtained in F2. Dimension k1 2 3 4 5 6 7 8 #Columns in F21 1 1 1 1 1 1 1 Dimension k9 10 11 12 13 14 15 #Columns in F25 5 7 7 11 11 15 TABLE I: Optimal number of columns in F2for various kfor RS codes over F16 We have described how to construct a generator matrix by evaluating the polynomials given in Theorem 1. Alternatively, one can perform elementary operations in the Vandermonde matrix GV k: let gibe the column iof the matrix GV k, for i= 1, . . . , k. The polynomial fIa,β =βXa+β2X2a+· · · + β2#Ia−1X2#Ia−1aindicates that the column iof the matrix Gkis given by a linear combination of columns of GV k: #Ia−1 X j=0 β2jg2ja+1 mod q−1 III. IMPLEMENTATION AND EXPERIMENTAL RESULTS To test the potential benefits of this approach, we use the kodo C++ library [14] in order to implement and measure performance of both RS Vandermonde and RS Cauchy on two different finite fields and our new constructions with two finite fields. We also use the longhair1and leopard2 libraries to compare our performance against an RS Cauchy optimized implementation (SIMD capable) and an FFT-based RS implementation, respectively. The latter is based on the formulation provided in [4]. For a fair comparison, we consider non-systematic codes. This means that the RS Cauchy decoding tests will be considered using only coded packets, which limits the generation size to 128 packets. The performance evaluation is carried out on an OSX machine (2015) with a 2.2 GHz Intel Core i7 processor with Single Instruction Multiple Data (SIMD) support. Specifically, the CPU provides SSSE3, SSSE4, and AVX2 support, which allows to perform hardware acceleration of finite field operations. We measured the decoding speed of both approaches using the same decoding algorithm in order to compare fairly. However, improved algorithms for our construction can be developed using the intuition proposed in [9] due to the problem’s structure. Figure 1 shows the performance of our approach when using a combination of finite fields F2and F24compared to a RS Cauchy code and RS Vandermonde code using F24. Unfortunately, longhair and leopard do not provide support for this finite field. As expected, the performance difference between RS Vandermonde and our proposed code starts when the number of original packets (i.e., dimension) is k≥q/2 + 1 = 24/2 + 1 = 9, where qis the size of the larger field. Our results show that gains of up to 37 % 1Longhair: https://github.com/catid/longhair 2Leopard: https://github.com/catid/leopard
4 6 8 10 12 14 Dimension k [Original Data Packets] 0 500 1000 1500 2000 2500 3000 Decoding Speed [MB/s] RS Multi-Field (kodo) RS Vandermonde (kodo) RS Cauchy (kodo) Fig. 1: Decoding speeds of RS Vandermonde (F24), RS Cauchy (F24) and RS Multi-Field using F2and F24 16 50 100 150 200 260 Dimension k [Original Data Packets] 0 100 200 300 400 500 600 700 800 Decoding Speed [MB/s] RS Multi-Field (kodo) RS Vandermonde (kodo) RS Cauchy (kodo) RS Cauchy (longhair) RS FFT (leopard) - 2 losses RS FFT (leopard) - 10 losses Fig. 2: Decoding speeds of Various RS schemes using F28and RS Multi-Field using F2and F28 are attainable by simply changing the coding coefficients as described in Section II. Note that the RS Cauchy performs similarly to RS Vandermonde due to the use of similar SIMD instructions for the product operations. Figure 1 also shows that the decoding speed for a generation size (dimension) of k≥12 is kept above 1440 MB/s with our approach, while the standard RS approach continues to decrease in decoding speed for the same region. This is related to the increased number of 1 and 0 coefficients introduced with our scheme. Figure 2 shows the performance of our approach when using a combination of finite fields F2and F28, similar to Figure 1. In this case, a dimension k≥q/2 + 1 = 256/2 + 1 = 129 is necessary to see differences between our scheme and RS. In this case, we compare to RS Vandermonde and Cauchy implementations from kodo, but also longhair’s Cauchy implementation and leopard’s FFT-based RS decoder. Our results show not only that the decoding speed of our approach can be almost twice as high than RS Cauchy or Vandermonde from kodo and larger than the other schemes, but also that the decoding speed increases when k > 200. The latter means that the decoding speed is predictably never worse than 100 MB/s for this particular device using our approach, which provides some system design advantages at the time of planning and allocating resources for decoding purposes, which may rely on worst case performance of the module. The results for the RS Vandermonde and Cauchy and our scheme are not dependent on the loss patterns. However, Figure 2 shows that leopard’s decoder depends heavily on the generated redundancy and losses, e.g., there is a performance gap of five times between the performance for two losses and ten losses, with the former being slower. This makes the performance of the FFT-based RS less predictable than the other schemes, with worst case scenarios being an order of magnitude slower than other schemes. The fact that the performance is lower when fewer losses occur, may limit its use in some applications, e.g., distributed storage, where the system is likely to repair damaged fragments after a few losses. As an important remark, these results are for a computer that exploits hardware acceleration (SIMD instructions). As measured in [7], the gap between a hardware-accelerated implementation and an implementation without it is an order of magnitude. This means that the gains are expected to be much larger in devices without these capabilities, e.g., lower end smart phones, IoT devices, as the cost of processing large fields is significantly higher without SIMD functionalities with respect to processing smaller finite fields. IV. GENERATOR MATRICES WITH COLUMNS IN AN INTERMEDIATE FIELD We considered in Section II generator matrices for RS codes with as many columns with all elements in F2as possible. Although we did not consider it in our experimental results yet, one may modify the matrices obtained in Section II to construct generator matrices where some of the columns, that do not have all elements in F2, have all their elements in an intermediate field, F2r, with r|s, since F2⊂F2r⊂F2s. This modification will allow the encoders and decoders to operate in an intermediate field that is faster than the largest field, thus increasing further the encoding/decoding speeds in the system. We proceed as in Section II, considering 2r-cyclotomic cosets modulo 2s−1: I2r a={a2ri mod 2s−1 : i= 0,1,2, . . .} and rewrite Theorem 1 as follows. Theorem 2: A basis for the set of polynomials in Fq[X] evaluating to F2r, with r|s, is [ I2r a nfI2r a,βj:j∈ {0,...,#I2r a−1}o,
Dim. k1 2 3 4 5 6 7 8 #Cols. in Fn 21 1 1 1 1 1 1 1 #Cols. in Fn 4\Fn 20 0 0 0 2 2 2 2 Dim. k9 10 11 12 13 14 15 #Cols. in Fn 25 5 7 7 11 11 15 #Cols. in Fn 4\Fn 20222020 TABLE II: Optimal number of columns in F2and F4for various kfor RS codes over F16 where β=α(2s−1)/(2ηa−1), with ηa= #I2r a, i.e. a primitive element of F2ηa⊆F2s, and fI2r a,β =βXa+β2rX2ra+· · ·+ β2rηa−1X2rηa−1a. For example, for q= 24, we have that F2⊂F4⊂F16. The different 4-cyclotomic cosets are I4 0={0},I4 1={1,4},I4 2= {2,8},I4 3={3,12},I4 5={5,10},I4 6={6,9},I4 7={7,13}, I4 11 ={11,14}. Hence, one can obtain generator matrices for RS codes with the following number of columns in Fn 2and Fn 4\Fn 2, as in Table II. V. CONCLUSION This paper presented a novel construction for RS codes that is compatible with multiple composite extension fields, e.g., [9], and that has a shown potential to reduce practical computation costs in real devices. Our measurement results showed that up to twice the speed in decoding is possible in hardware-accelerated devices. This is possible even limiting our approach to the use of two finite fields, which can be deployed in current systems by simply changing the coding coefficients of the coding matrix and without modifications of the underlying finite field constructions. Further gains are expected when using our constructions for multiple composite fields and for computationally limited devices without hardwareacceleration capabilities, i.e., devices that require significantly more effort to compute larger finite fields. Future work will consider an extensive measurement campaign to understand the benefits to different classes of commercial devices. In particular, we expect lower end devices without hardware optimization (e.g., SIMD instructions) to benefit further from our new RS constructions. Future work will consider the design of systematic RS codes using composite extension fields, which is of interest in distributed storage applications. ACKNOWLEDGMENT This research is supported in part by the Spanish Ministry of Economy/FEDER, grant No. MTM2015-65764-C3-2-P and No. RYC-2016-20208 (AEI/FSE/UE), the SCALE-IoT project granted by the Danish Council for Independent Research (Grant No. DFF 7026-00042B), the Danish Council for Independent Research grant No. DFF-4002-00367, the AUFF Starting Grant Project AUFF-2017-FLS-7-1, and Aarhus Universitys DIGIT Centre. REFERENCES [1] I. S. Reed and G. Solomon, “Polynomial codes over certain finite fields,” Journal of the Society for Industrial and Applied Mathematics, vol. 8, no. 2, pp. 300–304, 1960. [2] S.-J. Lin, T. Y. Al-Naffouri, and Y. S. Han, “FFT algorithm for binary extension finite fields and its application to Reed-Solomon codes,” IEEE Trans. Info. Theory, vol. 62, no. 10, pp. 5343–5358, 2016. [3] I. Reed, R. Scholtz, T.-K. Truong, and L. Welch, “The fast decoding of Reed-Solomon codes using Fermat theoretic transforms and continued fractions,” IEEE Trans. Info. Theory, vol. 24, no. 1, pp. 100–106, Jan. 1978. [4] S. J. Lin, T. Y. Al-Naffouri, Y. S. Han, and W. H. Chung, “Novel polynomial basis with fast fourier transform and its application to reedsolomon erasure codes,” IEEE Trans.on Info. Theory, vol. 62, no. 11, pp. 6284–6299, Nov 2016. [5] J. S. Plank, J. Luo, C. D. Schuman, L. Xu, and Z. Wilcox-O’Hearn, “A performance evaluation and examination of open-source erasure coding libraries for storage,” in FAST-2009: 7th Usenix Conf. on File and Storage Tech., February 2009. [6] J. S. Plank, K. M. Greenan, and E. L. Miller, “Screaming fast Galois Field arithmetic using Intel SIMD instructions,” in FAST-2013: 11th Usenix Conf. on File and Storage Techn., San Jose, February 2013. [7] C. W. Sorensen, A. Paramanathan, J. A. Cabrera, M. V. Pedersen, D. E. Lucani, and F. H. P. Fitzek, “Leaner and meaner: Network coding in simd enabled commercial devices,” in IEEE Wireless Comm. and Networking Conf., April 2016, pp. 1–6. [8] D. Burihabwa, P. Felber, H. Mercier, and V. Schiavoni, A Performance Evaluation of Erasure Coding Libraries for Cloud-Based Data Stores. Berlin, Heidelberg: Springer, 2016, pp. 160–173. [9] J. Heide and D. Lucani, “Composite extension finite fields for low overhead network coding: Telescopic codes,” in 2015 IEEE International Conference on Communications (ICC), June 2015, pp. 4505–4510. [10] P. Delsarte, “On subfield subcodes of modified Reed-Solomon codes,” IEEE Trans. on Info. Theory, vol. IT-21, no. 5, pp. 575–576, 1975. [11] F. J. MacWilliams and N. J. A. Sloane, The theory of error-correcting codes. I. North-Holland Publishing Co., Amsterdam-New York-Oxford, 1977, north-Holland Mathematical Library, Vol. 16. [12] L. R´ edei, Lacunary polynomials over finite fields. North-Holland, 1973. [13] F. Hernando, M. E. O’Sullivan, E. Popovici, and S. Srivastava, “Subfieldsubcodes of generalized toric codes,” in IEEE Int. Symposium on Info. Theory, June 2010, pp. 1125–1129. [14] M. V. Pedersen, J. Heide, and F. H. P. Fitzek, Kodo: An Open and Research Oriented Network Coding Library. Berlin, Heidelberg: Springer Berlin Heidelberg, 2011, pp. 145–152.