Upload
allan-mclaughlin
View
236
Download
3
Embed Size (px)
Citation preview
Polynomial Datapaths Optimization Using Polynomial Datapaths Optimization Using Finite Abstract Algebra(I) Finite Abstract Algebra(I)
Presenter: 陳炳元 Graduate Institute of Electronics EngineeringGraduate Institute of Electronics Engineering,
NTU, MD – 526 ALCom Lab
mm
OutlineOutline Overall Optimization ProblemOverall Optimization Problem
• Our Focus: Fractional Optimization of Fixed-size Fractional Our Focus: Fractional Optimization of Fixed-size Fractional Arithmetic DatapathsArithmetic Datapaths
• Applications: DSP for audio, video, multimedia….Applications: DSP for audio, video, multimedia…. Problem ModelingProblem Modeling
• Polynomial Functions over Finite FieldPolynomial Functions over Finite Field
Limitations of Previous WorkLimitations of Previous Work Theory and ApproachTheory and Approach AlgorithmAlgorithm Conclusions & Future WorkConclusions & Future Work
mm
OutlineOutline Overall Optimization ProblemOverall Optimization Problem
• Our Focus: Fractional Optimization of Fixed-size Fractional Our Focus: Fractional Optimization of Fixed-size Fractional Arithmetic DatapathsArithmetic Datapaths
• Applications: DSP for audio, video, multimedia….Applications: DSP for audio, video, multimedia…. Problem ModelingProblem Modeling
• Polynomial Functions over Finite FieldPolynomial Functions over Finite Field
Limitations of Previous WorkLimitations of Previous Work Theory and ApproachTheory and Approach AlgorithmAlgorithm Conclusions & Future WorkConclusions & Future Work
mm112/04/19112/04/19 44
IntroductionIntroduction
In recent years, complexity of arithmetic circuit In recent years, complexity of arithmetic circuit design growsdesign grows exponentially exponentially In order to make it more effective, it‘s necessary to In order to make it more effective, it‘s necessary to reduce the costreduce the cost and increase performanceand increase performanceOptimization of the High Level design is necessaryOptimization of the High Level design is necessaryIn RTL level most of DSP applications (such as audio,In RTL level most of DSP applications (such as audio, 、、video and other multimedia applications) use video and other multimedia applications) use polynomials for optimizationpolynomials for optimization Our focus lies in the optimization of polynomials.Our focus lies in the optimization of polynomials.The mathematical methods being used belong toThe mathematical methods being used belong to abstract algebraabstract algebra
mm
Problem and MotivationProblem and Motivation
•
y = a0 . x1
2 + a1 . x1 + b0 . x0
2 + b1 . x0 + c . x0 . x1
mm
Fixed-Size Data-path: ModelingFixed-Size Data-path: Modeling
Control the datapath size: Fixed size
* *
Z8
Z8
Z16
Z32 * *
Z32
Z32
Z32
Z31
Image is Zp: integer values in 0,…, p-1
Fixed-size vector
arithmetic
Polynomials reduced %p
Algebra over the field Zp
Example: Anti-Aliasing FunctionExample: Anti-Aliasing Function
F = 1 = 1 = 2√a2 + b2 2√x Expand into Taylor series
• F ≈ 1 x6 – 9 x5 + 115 x4
64 32 64 – 75 x3 + 279 x2 – 81 x
16 64 32 + 85 64
Coefficients are fractional!
MAC
x = a2 + b2
coefficients coefficients
a b
x
F
DFF
mm
OutlineOutline Overall Optimization ProblemOverall Optimization Problem
• Our Focus: Fractional Optimization of Fixed-size Fractional Our Focus: Fractional Optimization of Fixed-size Fractional Arithmetic DatapathsArithmetic Datapaths
• Applications: DSP for audio, video, multimedia….Applications: DSP for audio, video, multimedia…. Problem ModelingProblem Modeling
• Polynomial Functions over Finite FieldPolynomial Functions over Finite Field
Limitations of Previous WorkLimitations of Previous Work Theory and ApproachTheory and Approach AlgorithmAlgorithm Conclusions & Future WorkConclusions & Future Work
mm
General Datapath ModelGeneral Datapath Model
Bit-vector operands with different word-lengthsBit-vector operands with different word-lengths Input variables : Input variables : {{xx11,…, ,…, xxdd} } Output variables Output variables : : ff
• xx11 Z2n1, . . . ,, . . . , x xdd Z2
nd, Image(, Image(f )f ) Zp , p: prime, p: prime
Model Model f f as polynomial function as polynomial function
f f ::Z2n1……Z2
nd Zp
mm
OutlineOutline Overall Optimization ProblemOverall Optimization Problem
• Our Focus: Fractional Optimization of Fixed-size Fractional Our Focus: Fractional Optimization of Fixed-size Fractional Arithmetic DatapathsArithmetic Datapaths
• Applications: DSP for audio, video, multimedia….Applications: DSP for audio, video, multimedia…. Problem ModelingProblem Modeling
• Polynomial Functions over Finite FieldPolynomial Functions over Finite Field
Limitations of Previous WorkLimitations of Previous Work Theory and ApproachTheory and Approach AlgorithmAlgorithm Conclusions & Future WorkConclusions & Future Work
mm
Previous WorkPrevious Work
Boolean Representations (f: B → B): BDDs, ZDDs etc.
Moment Diagrams (f: B → Z): BMDs, K*BMDs, HDDs etc. Canonical DAGs for Polynomials (f: Z → Z)
• Taylor Expansion Diagrams (TEDs)
Required: Representation for f: Z2m → Z2m
SAT, MILP, Word-level ATPG, … Vanishing Polynomial
mm
OutlineOutline Overall Optimization ProblemOverall Optimization Problem
• Our Focus: Fractional Optimization of Fixed-size Fractional Our Focus: Fractional Optimization of Fixed-size Fractional Arithmetic DatapathsArithmetic Datapaths
• Applications: DSP for audio, video, multimedia….Applications: DSP for audio, video, multimedia…. Problem ModelingProblem Modeling
• Polynomial Functions over Finite FieldPolynomial Functions over Finite Field
Limitations of Previous WorkLimitations of Previous Work Theory and ApproachTheory and Approach AlgorithmAlgorithm Conclusions & Future WorkConclusions & Future Work
Polyfunctions over Polyfunctions over ZZpp
Polynomials over Zp[x1, …, xd]
• Represented by polyfunctions from Zp[x1, …, xd] to Zp
F1 % p ≡ F2 % p => they have the same underlying polyfunction f
Use equivalence classes of polynomials
f
g
Equivalence classes
Zp[x1, …, xd] Z2m
F2
F1
G2
G1 1
mm
Unity polynomials: RequirementUnity polynomials: Requirement
Generate unity polynomials U(x)
• Test if f (x) = q(x)U(x) + r(x)
• f (x) = q(x) + r(x)
Required: To generate U(x) specific to given f (x)
Zp
Set of all unity
polynomials
f
U
Zp[x1, …, xd]
1
h: % p
mm
Cyclic groupCyclic group
Let G be a group, G is called cyclic if there is an element a G such that G = < a >, a is called generator of G
For example, (Zn , +) is a cyclic group with
generator 1(Zp\{0}, *) is also a cyclic group, and has some generator (we will prove it later)
mm
OrderOrder
(1) The order of a group is its cardinality, i.e., the number of its elements.
(2) If G is a group and a G, then order of a is | < a >|.
(3) We denote the order of a group G by o(G) and the order of an element a by o(a).
mm
PropertyProperty
Let G be a group and let a G, if o(a) = n
then < a > = { a0, a1, a2,… ,an-1, an,…}
i.e. n is the smallest positive integer an = e
mm
Unit ElementUnit Element
Definition:
Let R be a ring and aR, if a-1 exists, then we say that a is a unit
Theorem:
Let an element a in Zn, then a is unit gcd(a, n)=1
mm
Unit ElementUnit Element
Proposition:
Let P be a prime, in ZZpp all nonzero elements are unit
Let F be a field if F is a commutative ring with unity 1 and all nonzero elements are unit
mm
Polynomial FunctionPolynomial Function
Theorem: LetLet FF bebe aa functionfunction onon nn andand Image(F)Image(F)
U(U(nn),), thenthen KK >> 00 s.t.s.t. FFKK is a unity function, where is a unity function, where
U(U(nn) = { a ) = { a nn | gcd(a, n) = 1 } | gcd(a, n) = 1 }
Theorem: Let f: Zn1 X Zn2 x ... x Znd Zm be a function and
f(t) =ct whenever t = (t1, t2, …, td). Then
f is polynomial function =ct(mod m) has a solutionkk
k
xt)(
mm
ExampleExample
Let f: Z2 Z3 Z4 by f(0,0) =1, f(0,1) =3, f(0,2) =1, f(1,0) =1, f(1,1) =0, f(1,2) =1
Then (t)00X00 + (t)01X01 + (t)02X02 + (t)10X10 +
+ (t)11X11 + (t)12X12 = f(t) (mod4),
X00 + t2X01 + t2(t2 - 1)X02 + t1X10 + t1t2x11 +
+ tlt2(t2- 1)x12 = f(t1, t2) (mod4),
t1 =0, 1; t2 =0,1,2, then
mm
ExampleExample
X00 = 1 (mod4), X00 + X01 = 3 (mod4), X00 + 2X01 + 2X02 = 1 (mod4), X00 + 0X01 + 0X02 + X10 = 1 (mod4), X00 + X01 + 0X02 + X10 + X11 = 0 (mod4), X00 + 2X01 + 2X02 + X10 + 2X11+2X12= 1 (mod4).
Then we have X00= 1, X01 = 2, X02= 0, X10= 0, X11 = 1 and X12 = 1, thus F = 1 + 2y + xy2
mm
Polynomial FunctionPolynomial Function
In most cases, functions on nn are not necessarily
polynomial
Theorem:
Let P be a prime, then f is a function on Zp iff f is a
polynomial
Corollary:
Every unity function on Zp is unity polynomial
mm
Order of ElementOrder of Element
Let G = < a > be a cyclic group of order n, then o(am) = n/d, whenever d = gcd(m, n)
Proof:
(am)n/d = (an)m/d = e Let K be any positive integer such that (am)K = e Claim: K ≥ n/d (am)K = e amK = e n | mK n/d | mK/d n/d | K K ≥ n/d
mm
Euler Euler functionfunction
Given any positive integer n. Given any positive integer n. (n)(n) is the is the number of of positive integers less than or equal to positive integers less than or equal to n which are which are relativelyrelatively prime to to n. The . The function is known as the Euler is known as the Euler function. i.e. function. i.e. (n) = |(n) = |U(U(nn) |) |
Theorem: Theorem: Let n be a positive integer, thenLet n be a positive integer, then
Definition: Let p be a prime and k|p-1, Definition: Let p be a prime and k|p-1,
we define R(k) ={awe define R(k) ={a pp**| o(a) = k}| o(a) = k}
ndnd
|)(
mm
TheoremTheorem
U(Zp) is a cyclic Proof: Let s Zp\{0}and o(s) = k mean that sk = 1, may assume
f(x) = xk – 1 in Zp. According to Fundamental Theorem of Algebra, every n-th polynomial has at most n roots
{s, s2,..., sk } is solution space of f=0. t < k, gcd(t, k) = d>0 (st)k/d = (sk)t/d = 1 o(st ) < k | R(k) | (k) p - 1 = k|p-1 |R(k)| k|p-1(k) | R(k) | = (k), k |p-1 | R(p-1) | = (p-1) > 0 Therefore, U(Zp) is a cyclic
mm
OutlineOutline Overall Optimization ProblemOverall Optimization Problem
• Our Focus: Fractional Optimization of Fixed-size Fractional Our Focus: Fractional Optimization of Fixed-size Fractional Arithmetic DatapathsArithmetic Datapaths
• Applications: DSP for audio, video, multimedia….Applications: DSP for audio, video, multimedia…. Problem ModelingProblem Modeling
• Polynomial Functions over Finite FieldPolynomial Functions over Finite Field
Limitations of Previous WorkLimitations of Previous Work Theory and ApproachTheory and Approach AlgorithmAlgorithm Conclusions & Future WorkConclusions & Future Work
mm
AlgorithmAlgorithm 1: OPT_POLY (F, d, x, p, n) 2: F: polynomial; d: number of variables; 3: x[1. . . d]: list of input variables; p: prime 4: n[1. . . d]: list of bit-widths of input variables, x; 5: A = {1} ; 6: // search for generator 7: for i= 2 to p-1 do 8: Oi = order(i); 9: if (Oi == p-1) 10: then break; 11: end for 12: // A: set of elements of order 1 or k 13: for j= 2 to p-1 do 14: if (gcd(j, p-1) == (p-1)/k) // k divides p-1 15: then A = A { i j }; 16: end for
mm
AlgorithmAlgorithm 17: // construct the function g 18: for k= 0 to p-1 do 19: g(k) = Ak+1(mod r) +1k+1(mod r) +1; // r = |A| 20: end for 21: //G is polynomial of g 22: G= solver(g); 23: U = Gk; // unity polynomial 24: quo= F/U; 25: rem= F%U; 26: F= quo + rem; 27: // reduction 28: for i= 1 to d do 29: F= F%Y(0,0,..,nii,..,0); 30: end for
mm
OutlineOutline Overall Optimization ProblemOverall Optimization Problem
• Our Focus: Fractional Optimization of Fixed-size Fractional Our Focus: Fractional Optimization of Fixed-size Fractional Arithmetic DatapathsArithmetic Datapaths
• Applications: DSP for audio, video, multimedia….Applications: DSP for audio, video, multimedia…. Problem ModelingProblem Modeling
• Polynomial Functions over Finite FieldPolynomial Functions over Finite Field
Limitations of Previous WorkLimitations of Previous Work Theory and ApproachTheory and Approach AlgorithmAlgorithm Conclusions & Future WorkConclusions & Future Work
mm
Conclusions & Future WorkConclusions & Future Work
Currently, partial results show good performance of our algorithm
Fixed-size arithmetic circuit is a polynomial algebra over the finite field, Zp
We presented an efficient algorithm to optimize polynomials
Also our algorithm can deal with fractional coefficients
Future work involves extensions for optimizing
• Multiple output polynomials(II)
• Complex polynomials
• …