1 / 28

Vectorised / Semi – Parallel Interval Multiplication

Vectorised / Semi – Parallel Interval Multiplication. Eoin Malins eoin@infc.ulst.ac.uk. Topics. The problem with Floating-Point (FP) arithmetic. Interval Arithmetic Interval Multiplication. Vectorisation. Results. Floating-Point Rounding Errors. Generate two random numbers.

dmanriquez
Download Presentation

Vectorised / Semi – Parallel Interval Multiplication

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Vectorised / Semi – Parallel Interval Multiplication Eoin Malins eoin@infc.ulst.ac.uk

  2. Topics • The problem with Floating-Point (FP) arithmetic. • Interval Arithmetic • Interval Multiplication. • Vectorisation. • Results Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  3. Floating-Point Rounding Errors • Generate two random numbers. • Add them to a variable (Error). • Subtract the same numbers from that variable. • Do not get the number you expected. float Error = 0.0, A = 0.0, B = 0.0; loop { A = rand(); B = rand(); Error = Error + A; Error = Error + B; Error = Error - A; Error = Error - B; Print ( Error ); } • The variable “Error” will not equal zero (0). Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  4. IEEE 754 Double Precision Floating Point Rounding Errors Over 1000 Iterations Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  5. Topics • The problem with Floating-Point (FP) arithmetic. • Interval Arithmetic. • Interval Multiplication. • Vectorisation. • Results Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  6. Interval Arithmetic • An interval is defined as: • [a, b] = • Many if not all calculations suffer from errors introduced by rounding, truncation and the results being non-representable on the target architecture. • Intervals prescribe the upper and lower bounds of these errors. • The ‘true’ value must lie between these bounds. Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  7. Interval Example 3.0 3.1 3.2 3.3 3.4 Assume a system with one (1) decimal place of accuracy: The value would be rounded towards the upper and lower bounds of the values the equipment is capable of representing: Pi* = 3.14159265358979… Pi = [3.1, 3.2] Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  8. Topics • The problem with Floating-Point (FP) arithmetic. • Interval Arithmetic • Interval Multiplication. • Vectorisation. • Results Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  9. Interval Multiplication • Brute Force method • 9-Case method • Integer-Based method Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  10. Brute-Force Multiplication -3.6 Find Min : Find Max : 9.7 -3.6 9.7 Result x = XlYl XuYu Xl Xu Yl Yu XlYu XuYl [-1.1, 2.2] x [3.3, 4.4] -2.24 -3.63 7.26 9.68 = Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  11. 9-Case Method of Interval Multiplication Case Conditions Zl Zu 1 2 3 XlYl XuYu Xl 0, 0 Yl XuYl XlYu Xl 0, 0 Yl < XlYu XuYl Xu < 0, Yl 0 4 5 6 Xu < 0, Yl < 0 XlYu XlYl XlYu XuYu Xl < 0 0, Yl 0 XuYl XlYl Xl < 0 Xu, Yu < 0 7 8 9 XuYl XuYu 0 Xl 0, Yl < 0 XlYu XlYl Xl < 0, Yl < 0 Yu min(XlYu, XuYl) max(XlYl, XuYu) Xl < 0 Xu, Yl < 0 Yu Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  12. Integer-Based Interval Multiplication X = -1.1, 3.3 Y = 2.2, 4.4 X.Y = -1.1, 3.3 x 2.2, 4.4 1, 3 2 , 4 Integer Magnitude : - 1, 3 2, 4 Reapply Signs : Inner Product : x = XlYl XlYu XuYl XuYu -2 -4 6 12 Xl Xu -1 3 Yl Yu 2 4 = x Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  13. Special Case 1/3 • According to interval specifications, the calculation : • Is defined as follows : • In FP arithmetic, the multiplication of by 0 is undefined and produces the value ‘NaN’ “Not a Number”. • Subsequent comparisons between a float and a NaN result in another NaN. Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  14. Special Case 2/3 • When a comparison to a NaN occurs, in order to ensure coverage, normally, interval bounds must be extended to . • The product of X = and Y = • Would be sorted as: [2, 3] x [-1, 4] Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  15. Special Case 3/3 [2, 3] x [-1, 4] Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  16. Topics • The problem with Floating-Point (FP) arithmetic. • Interval Arithmetic • Interval Multiplication. • Vectorisation. • Results Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  17. Scalar Minimum Function int min(int a, int b) { if (a < b ) { return a; }else{ return b; } } Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  18. Code Branching - Introduces Wait States Prefetch Instruction Stream X = A + B Get Instruction 2 Instruction 1 Y = C + D Get Instruction 3 Instruction 2 IF X < Y Get? WAIT Instruction 3 Instruction n Instruction m Get Instruction m+1 Get Instruction n+1 RETURN Y RETURN X Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  19. Vectorised Minimum / IF Function • Vec_cmplt: Each element of the mask is TRUE if A is less than B otherwise FALSE. • Vec_sel: Each bit of the result is set to the corresponding bit of A or B if the mask bit is 0 or 1 respectively. Prefetch Instruction Stream mask = vec_cmplt (A , B) Get Instruction 2 Instruction 1 result = vec_sel (A, B, mask) Instruction 2 Get Instruction 3 Instruction 3 RETURN RESULT Get Instruction 4 . . Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  20. 9-Case Bitmap and Vectorisation 0 12 3 Pointer array 15 1 2 3 4 15 16 INDEX Condition is true 1 a a 13 Condition is false 4 7 5 Function_case_1(Interval A, interval B) Function_case_2(Interval A, interval B) Function_case_3(Interval A, interval B) Function_case_4(Interval A, interval B) . . Function_case_15(Interval A, interval B) Function_case_16(Interval A, interval B) Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  21. Vectorised Interval Multiplication SIMD Multiply Product vector P SIMD MIN P Min vector M Xu Yl Xl Xl Xu Yl Yu Yu 128 bit vector A B Rotate P R1 R2 XuYl Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  22. Topics • The problem with Floating-Point (FP) arithmetic. • Interval Arithmetic. • Interval Multiplication. • Vectorisation. • Results. Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  23. Results Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  24. Program Size Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  25. Assembled Instructions Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  26. Average Time for 1x106 Interval Multiplications Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  27. Summary • 9-case method was fastest, followed respectively by the brute force, vectorised and finally integer implementations. • Integer method of IA requires ½ the number of FP operations of its counterparts, has no special cases and is also applicable to interval division. • Integer method applicable mainly to systems with an high FPU (Floating Point Unit) latency. • Vectorised implementation was in fact slower due to the overheads incurred in setting up the appropriate data structures. Eoin Malins: Vectorised / Semi-Parallel Interval Multiplication

  28. Vectorised/Semi-Parallel Interval ArithmeticEoin Malins Questions

More Related