precimonious hifptuner
play

Precimonious & HiFPTuner Tuning Assistant for Floating-Point - PowerPoint PPT Presentation

Precimonious & HiFPTuner Tuning Assistant for Floating-Point Precision Ignacio Laguna, Harshitha Menon Lawrence Livermore National Laboratory Michael Bentley, Ian Briggs, Pavel Panchekha, Ganesh Gopalakrishnan University of Utah Hui Guo,


  1. Precimonious & HiFPTuner Tuning Assistant for Floating-Point Precision Ignacio Laguna, Harshitha Menon Lawrence Livermore National Laboratory Michael Bentley, Ian Briggs, Pavel Panchekha, Ganesh Gopalakrishnan University of Utah Hui Guo, Cindy Rubio González University of California at Davis Michael O. Lam James Madison University http://fpanalysistools.org/ 1 This work was supported by through the X-Stack program funded by the U.S. Department of Energy, Office of Science, Advanced Scientific Computing Research under collaborative agreement SC0008699, NSF grant 1750983, and a gift from Oracle.

  2. Floating-Point Precision Tuning • Floating-point (FP) arithmetic used in variety of domains • Reasoning about FP programs is difficult Large variety of numerical problems o Most programmers are not experts in FP o • Common practice: use highest available precision Disadvantage: more expensive! o • Goal: automated techniques to assist in tuning floating-point precision http://fpanalysistools.org/ 2

  3. Example: Arc Length • Consider the problem of finding the arc length of the function 2 − k sin(2 k x ) X g ( x ) = x + 0 ≤ k ≤ 5 • Summing for into n subintervals x k ∈ (0 , π ) n − 1 h 2 + ( g ( x k +1 ) − g ( x k )) 2 X p h = π /n x k = kh with and k =0 Slowdown Result Precision 1 ✔ double-double 20X 5.795776322412856 double 1X 5.795776322413031 ✖ 2 mixed precision < 2X 5.795776322412856 ✔ 3 http://fpanalysistools.org/ 3

  4. Example: Arc Length long double g(long double x) { int k, n = 5; long double t1 = x; long double d1 = 1.0L; for(k = 1; k <= n; k++) { ... } return t1; } int main() { int i, n = 1000000; long double h, t1, t2, dppi; long double s1; ... for(i = 1; i <= n; i++) { t2 = g(i * h); Mixed Precision s1 = s1 + sqrt(h*h + (t2 - t1)*(t2 - t1)); t1 = t2; Program } // final answer stored in variable s1 return 0; } http://fpanalysistools.org/ 4

  5. Precimonious “Parsimonious or Frugal with Precision” Dynamic Analysis for Floating-Point Precision Tuning Annotated with TEST SOURCE error threshold INPUTS CODE P RECIMONIOUS Less Precision Modified program in TYPE MODIFIED executable format CONFIGURATION PROGRAM Speedup http://fpanalysistools.org/ 5

  6. Challenges for Precision Tuning ● Searching efficiently over variable types and function implementations ○ Naïve approach -> exponential time ○ 19,683 configurations for arclength program (3 9 ) Automated ○ 11 hours 5 minutes ○ Global minimum vs. Local minimum ● Evaluating type configurations o Less precision not necessarily faster o Based on runtime, energy consumption, etc. ● Determining accuracy constraints o How accurate must the final result be? Specified by the user o What error threshold to use? http://fpanalysistools.org/ 6

  7. Searching for Type Configuration ✔ double precision single ✘ precision http://fpanalysistools.org/ 7

  8. Searching for Type Configuration ✔ double precision ✘ ✘ single ✘ precision http://fpanalysistools.org/ 8

  9. Searching for Type Configuration ✔ double precision ✘ ✔ ✘ ✔ single ✘ precision http://fpanalysistools.org/ 9

  10. Searching for Type Configuration ✔ double double precision precision ✘ ✔ ✘ ✔ single ✘ precision http://fpanalysistools.org/ 10

  11. Searching for Type Configuration ✔ double precision ✘ ✔ ✘ ✔ ✔ ✘ single ✘ precision http://fpanalysistools.org/ 11

  12. Searching for Type Configuration ✔ double precision ✘ ✔ ✘ ✔ ✔ ✘ single ✘ precision http://fpanalysistools.org/ 12

  13. Searching for Type Configuration ✔ double precision ✘ ✔ ✘ ✔ Proposed configuration ✔ ✘ … Failed configurations single ✘ precision http://fpanalysistools.org/ 13

  14. Source code available: https://github.com/plse/precimonious Questions? http://fpanalysistools.org/ 14

  15. Directory Structure /$HOME |--/ Module-Precimonious |---/ exercise |---/ exercise-2 |--/ Module-HiFPTuner |---/ exercise |---/ exercise-2 http://fpanalysistools.org/ 15

  16. Exercise $ cd Module-Precimonious http://fpanalysistools.org/ 16

  17. Step 1: Build Precimonious ● Open setup.sh file ● Precimonious uses LLVM and is built using scons ● Execute : ○ $ ./setup.sh Success building and running tests http://fpanalysistools.org/ 17

  18. Step 2: Annotate Program (already done) The program we will tune: ● Execute : ○ $ cd exercise ○ $ ls ● Open simpsons.c file Accuracy logging & checking Performance logging http://fpanalysistools.org/ 18

  19. Step 3: Compile Program with Clang ● Execute : ○ $ make clean ○ $ make ● Creates LLVM bitcode file and optimized executable for later use http://fpanalysistools.org/ 19

  20. Step 4: Run Analysis on Program Sample output: ● Execute : ○ $ ./run-analysis.sh simpsons Type changes are listed for each explored configuration Suggested type configuration Number of explored configurations http://fpanalysistools.org/ 20

  21. Step 4: Run Analysis – Configuration File ● Open config_simpsons.json ● Original type configuration http://fpanalysistools.org/ 21

  22. Step 4: Run Analysis – Search File ● Open search_funarc.json ● Search space file ● To exclude functions edit exclude.txt ● To exclude variables edit exclude_local.txt ● Or you can directly edit search file prior to analysis http://fpanalysistools.org/ 22

  23. Step 4: Run Analysis – Output Files ● Execute : ○ $ cd results ○ $ ls http://fpanalysistools.org/ 23

  24. Step 4: Run Analysis – Output Files ● Open dd2_valid_funarc.bc.json: suggested configuration file in JSON format ● Open dd2_diff_funarc.bc.json: summary of type changes http://fpanalysistools.org/ 24

  25. Step 5: Apply Result Configuration & Compare Performance ● Execute : ○ $ cd .. ○ $ ./run-config.sh simpsons ● Execute : ○ $ time ./original_simpsons.out ○ $ time ./tuned_simpsons.out http://fpanalysistools.org/ 25

  26. Exercise 2: Run Precimonious on funarc program ● Open exercise-2/funarc.c to see annotated program ● Execute : ○ cd ../exercise-2 ○ make clean ○ make ○ ./run-analysis.sh funarc ○ ./run-config.sh funarc ● Open results/dd2_valid_funarc.bc.json to see configuration in JSON format ● Open results/dd2_diff_funarc.bc.json to see difference between original program and proposed configuration http://fpanalysistools.org/ 26

  27. Limitations of Precimonious ● Type configurations rely on inputs tested ○ No guarantees if worse conditioned input ○ Could be combined with input generation tools (e.g., S3FP) ● Getting trapped in local minimum ● Analysis scalability o Approach does not scale well for long-running applications o Need to reduce search space and reduce number of runs o Check out our follow up work on Blame Analysis (ICSE’16) ● Analysis effectiveness o Approach does not exploit relationship among variables o Check out our follow up work on HiFPTuner (ISSTA’18) http://fpanalysistools.org/ 27

  28. HiFPTuner: exploiting the community structure of the variables in precision tuning Search from top to bottom Level 2 7 8 4 2 5 3 6 1 1 4 6 8 7 3 2 5 Level 1 4 7 8 Level 0 1 2 3 5 6 http://fpanalysistools.org/ 28

  29. Search Faster and Reach Better Configurations 8 7 4 5 6 7 4 2 5 3 6 8 1 2 3 1 Same type for variables in one community One type per variable Decreased search space - only Exponential number of type ● ● exploring the configurations which configurations with regard to the satisfy the community structure of the number of variables – large search variables space Better configurations for speed-up - Trapped in local optimum introducing ● ● dependent variables are assigned with many type casts the same type which avoids type casts http://fpanalysistools.org/ 29

  30. HiFPTuner Hierarchical Floating-Point Precision Tuning TEST SOURCE INPUTS CODE 1. Dependence analysis 2. Community detection Source : https://github.com/ucd-plse/HiFPTuner Community Structure faster 3. Hierarchical Search • can be combined with any base search algorithm such as binary search or delta- debugging algorithm better TYPE CONFIGURATION http://fpanalysistools.org/ 30

  31. Exercise $ cd Module-HiFPTuner http://fpanalysistools.org/ 31

  32. Build HiFPTuner $ source ./setup.sh Check the environment variable $ echo $LIBRARY_PATH http://fpanalysistools.org/ 32

  33. Step 1 : Annotate Program and Compile it to bitcode File $ cd exercise $ ls Source: simpsons.c (annotated with accuracy logging/checking functions and timing code shown before) Compile simpsons.c to LLVM bitcode file $ make clean; make It generates simpson.bc and the executable original_simpsons.out Note: original_simpsons.out will be used later for performance comparison http://fpanalysistools.org/ 33

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend