Black-box approximation
- f bivariate functions
David B. Thomas, Imperial College London
Black-box approximation of bivariate functions for FPGAs David B. - - PowerPoint PPT Presentation
Black-box approximation of bivariate functions for FPGAs David B. Thomas, Imperial College London Chosen approximation problem Input xy = x x y ( 2 fx Z ) x ( 2 fy Z ) Fixed-point domain: Fixed-point range: r = 2
David B. Thomas, Imperial College London
Ωxy = Ωx x Ωy ( 2fxZ ) x ( 2fyZ )
Ωr = 2frZ
f : Ωxy → Ωr
ε ( ε >=2fr )
ꓯ (x,y) Ωxy: | f(x,y) – a(x,y) | < ε
Does not need to be differentiable, analytic, or smooth
Ωxy = [-1,1) x [-1,1) fx=-8, fy=-8
Range Reduction Domain Splitting Primitive Evaluation x x* x* i Range Reconst. r* r
Range Reduction Domain Splitting Primitive Evaluation x y x* y* x* y* i Range Reconst. r* r Uniform grid Binary split Quadtree Hash-table Polynomial Spline RBF Chebfun2 Kernels Relative -> Absolute Symmetries Odd-even function
O(m) -> O(m2) coefficients
O(m) -> O(m2) multipliers
O(m) -> O(2m) stages
Domain Splitting Primitive Evaluation x y x* y* i r Binary split Polynomial
int a(int x, int y) { // Constant table of polynomials static const poly_t polynomials[...] = { ... }; // Select index of polynomial segment int i = select_segment(x,y); // Get all the coefficients poly_t poly=polynomials[i]; // Evaluate that patch at input co-ordinates return eval(poly,x,y); }
struct node_t { bool dir; int split; int left, right; }; int select_segment(int x, int y) { // Constant table of splits static const node_t n0[1] = { ... }; static const node_t n1[2] = { ... }; static const node_t n2[4] = { ... }; static const node_t n3[7] = { ... }; // Select index of polynomial segment using pipeline int i=0; i=(n0[i].dir?x:y) < n0[i].split ? n0[i].left : n0[i].right; i=(n1[i].dir?x:y) < n1[i].split ? n1[i].left : n1[i].right; i=(n2[i].dir?x:y) < n2[i].split ? n2[i].left : n2[i].right; i=(n3[i].dir?x:y) < n3[i].split ? n3[i].left : n3[i].right; return i; }
Degree=2, fracBits=-10, maxError=0.001
degree 3, polys=154 degree 4, polys=95
maxError=0.001, polys=154, maxError=0.0001, polys=676
Quadratic, maxError=0.001
64 256 1024 4096 16384 65536 10 12 14 16 18
Number of polynomials Domain Fractional Bits
func_atan2_whole func_chebfun2_ex_f1 func_gamma_p func_gamma_p_inv func_gamma_p_inva func_lbeta func_normpdf_offset func_owens_t
Cubic, maxError=0.001
64 256 1024 4096 16384 65536 10 12 14 16 18
Number of polynomials Domain Fractional Bits
func_atan2_whole func_chebfun2_ex_f1 func_gamma_p func_gamma_p_inv func_gamma_p_inva func_lbeta func_normpdf_offset func_owens_t
10 100 1000 10000
Number of polynomials Function
curvature_split naive
+ a1,0 x + a2,0 x2 + a3,0 x3 + … + a0,1 y + a1,1 x y + a2,1 x2 y + a3,1 x3 y + … + a0,2 y2 + a1,2 x y2 + a2,2 x2 y2 + a3,2 x3 y2 + … + a0,3 y3 + a1,3 x y3 + a2,3 x2 y3 + a3,3 x3 y3 + … +
+ * + c20 c22 * c23 + * + c10 c12 * c13 + * + c30 c32 * c33 + * + * x y + * + c00 c02 * c03 * + c21 * + c11 * + c31 * + c01 + *
p(x,y) = a0,0 + a1,0 x + a2,0 x2 + a3,0 x3 + … + a0,1 y + a1,1 x y + a2,1 x2 y + a3,1 x3 y + … + a0,2 y2 + a1,2 x y2 + a2,2 x2 y2 + a3,2 x3 y2 + … + a0,3 y3 + a1,3 x y3 + a2,3 x2 y3 + a3,3 x3 y3 + …
sense
5 10 15 20 25 30 10 12 14 16 18
Number of Block RAMs
Domain fractional bits
func_atan2_whole func_chebfun2_ex_f1 func_gamma_p func_gamma_p_inv func_gamma_p_inva func_lbeta func_normpdf_offset func_owens_t
100 200 300 400 500 10 12 14 16 18
Number of Block RAMs
Domain fractional bits
func_atan2_whole func_chebfun2_ex_f1 func_gamma_p func_gamma_p_inv func_gamma_p_inva func_lbeta func_normpdf_offset func_owens_t
+ c20 + * c10 c12 c30 + * + * x y + * + c00 c02 * c03 * c21 * + c11 * + c01 + *