reduced precision floa1ng point analysis via binary
play

Reduced-Precision Floa1ng-Point Analysis via Binary - PowerPoint PPT Presentation

Reduced-Precision Floa1ng-Point Analysis via Binary Modifica1on Mike Lam, UMD Jeff Hollingsworth, UMD Context Floa1ng-point arithme1c represents real


  1. Reduced-­‑Precision ¡ Floa1ng-­‑Point ¡Analysis ¡via ¡ Binary ¡Modifica1on ¡ Mike ¡Lam, ¡UMD ¡ Jeff ¡Hollingsworth, ¡UMD ¡

  2. Context ¡ Floa1ng-­‑point ¡arithme1c ¡represents ¡real ¡numbers ¡as ¡ ¡ ( ± ¡1. frac ¡ × ¡2 exp ) ¡ – Sign ¡bit ¡ – Exponent ¡ – Significand ¡(“man1ssa” ¡or ¡“frac1on”) ¡ ¡ 32 16 8 4 0 Single ¡Precision ¡ ¡ Exponent ¡(8 ¡bits) ¡ Significand ¡(23 ¡bits) ¡ ¡ 64 32 8 4 0 16 Double ¡Precision ¡ Exponent ¡(11 ¡bits) ¡ Significand ¡(52 ¡bits) ¡ ¡ 2 ¡

  3. Context ¡ • Floa1ng-­‑point ¡is ¡ubiquitous ¡ but ¡problema4c ¡ – Rounding ¡error ¡ • Accumulates ¡aXer ¡many ¡opera1ons ¡ • Not ¡always ¡intui1ve ¡(e.g., ¡non-­‑associa1ve) ¡ • Naïve ¡approach: ¡higher ¡precision ¡ – Lower ¡precision ¡is ¡preferable ¡ • Tesla ¡K20X ¡is ¡2.3X ¡faster ¡in ¡single ¡precision ¡ • Xeon ¡Phi ¡is ¡2.0X ¡faster ¡in ¡single ¡precision ¡ • Single ¡precision ¡uses ¡50% ¡of ¡the ¡memory ¡bandwidth ¡ 3 ¡

  4. Research ¡Contribu1ons ¡ • SoXware ¡framework ¡(CRAFT) ¡ • Previous ¡work ¡ – Cancella1on ¡detec1on ¡[PARCO2012] ¡ – Mixed-­‑precision ¡configura1on ¡[ICS’13] ¡ • Recent ¡work ¡ – Reduced-­‑precision ¡analysis ¡ 2.7182818 • Future ¡work ¡ 284590452 353603... ¡ 4 ¡

  5. Framework ¡ CRAFT : ¡Configurable ¡Run1me ¡Analysis ¡for ¡Floa1ng-­‑point ¡Tuning ¡ 2.7182818 284590452 353603... ¡ 5 ¡

  6. Framework ¡ • Dyninst: ¡a ¡binary ¡analysis ¡library ¡ – Parses ¡executable ¡files ¡ ¡(Instruc1onAPI ¡& ¡ParseAPI) ¡ – Inserts ¡instrumenta1on ¡ ¡(DyninstAPI) ¡ – Supports ¡full ¡binary ¡modifica1on ¡ ¡(PatchAPI) ¡ – Rewrites ¡binary ¡executable ¡files ¡ ¡(SymtabAPI) ¡ • XED ¡instruc1on ¡decoder ¡(from ¡Intel’s ¡Pin) ¡ 6 ¡

  7. Framework ¡ • CRAFT ¡framework ¡ – Dyninst-­‑based ¡binary ¡mutator ¡(C/C++) ¡ – Swing-­‑based ¡GUI ¡viewers ¡(Java) ¡ – Automated ¡search ¡scripts ¡(Ruby) ¡ – Over ¡30K ¡LOC ¡total ¡ – LGPL ¡on ¡Sourceforge: ¡ ¡ ¡ sf.net/p/crafthpc ¡ 7 ¡

  8. Cancella1on ¡Detec1on ¡ • Loss ¡of ¡significant ¡digits ¡due ¡to ¡subtrac1on ¡ 2.491264 (7) 1.613647 (7) 2.491264 (7) 1.613647 (7) - 2.491252 (7) - 1.613647 (7) - 2.491252 (7) - 1.613647 (7) 0.000012 (2) 0.000000 (0) 0.000012 (2) 0.000000 (0) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(5 ¡digits ¡cancelled) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(all ¡digits ¡cancelled) ¡ • Cancella1on ¡detec1on ¡ – Instrument ¡every ¡addi1on ¡and ¡subtrac1on ¡ – Report ¡cancella1on ¡events ¡ 8 ¡

  9. Mixed ¡Precision ¡ • Frequent ¡opera1ons ¡use ¡single ¡precision ¡ • Crucial ¡opera1ons ¡use ¡double ¡precision ¡ Mixed-­‑precision ¡ 1: ¡ ¡LU ¡← ¡PA ¡ linear ¡solver ¡ 2: ¡ ¡solve ¡Ly ¡= ¡Pb ¡ [Buqari ¡2008] ¡ 3: ¡ ¡solve ¡Ux 0 ¡= ¡y ¡ 4: ¡ ¡for ¡k ¡= ¡1, ¡2, ¡... ¡do ¡ Red ¡text ¡indicates ¡ 5: ¡r k ¡← ¡b ¡– ¡Ax k-­‑1 ¡ double-­‑precision ¡ 6: ¡solve ¡Ly ¡= ¡Pr k ¡ (all ¡other ¡steps ¡are ¡ 7: ¡solve ¡Uz k ¡= ¡y ¡ single-­‑precision) ¡ 8: ¡x k ¡← ¡x k-­‑1 ¡+ ¡z k ¡ 9: ¡check ¡for ¡convergence ¡ 50% ¡speedup ¡on ¡average ¡ 10: ¡ ¡end ¡for ¡ (12X ¡in ¡special ¡cases) ¡ 9 ¡

  10. Automated ¡Search ¡ 10 ¡

  11. Automated ¡Search ¡ 11 ¡

  12. Mixed ¡Precision: ¡Results ¡ Benchmark ¡ Candidate ¡ % ¡Dynamic ¡ (name.CLASS) ¡ Instruc4ons ¡ Replaced ¡ bt.A ¡ 6,262 ¡ 78.6 ¡ cg.A ¡ 956 ¡ ¡ ¡5.6 ¡ ep.A ¡ 423 ¡ 45.5 ¡ X.A ¡ 426 ¡ ¡ ¡0.2 ¡ lu.A ¡ 6,014 ¡ 57.4 ¡ mg.A ¡ 1,393 ¡ 36.6 ¡ sp.A ¡ 4,507 ¡ 30.5 ¡ 12 ¡

  13. Mixed ¡Precision: ¡Conclusions ¡ • Automated ¡analysis ¡can ¡illuminate ¡cancella1on ¡ behavior ¡ • Automated ¡search ¡can ¡provide ¡precision-­‑level ¡ replacement ¡insights ¡ – S1ll ¡very ¡coarse-­‑grained ¡w/ ¡binary ¡decision-­‑making ¡ 13 ¡

  14. Reduced ¡Precision ¡ • Simulate ¡reduced ¡precision ¡with ¡trunca1on ¡ – Truncate ¡result ¡aXer ¡every ¡opera1on ¡ – Allows ¡zero ¡up ¡to ¡double ¡(64-­‑bit) ¡precision ¡ – Less ¡overhead ¡(fewer ¡added ¡opera1ons) ¡ • Search ¡rou1ne ¡ – Iden1fies ¡component-­‑level ¡precision ¡requirements ¡ vs. ¡ Single ¡ Double ¡ 0 ¡ Single ¡ Double ¡ 14 ¡

  15. Reduced ¡Precision ¡ • Faster ¡search ¡convergence ¡compared ¡to ¡ mixed-­‑precision ¡analysis ¡ Benchmark ¡ Original ¡ Speedup ¡ Wall ¡4me ¡(s) ¡ cg.A ¡ 1,305 ¡ 59.2% ¡ ep.A ¡ 978 ¡ 42.5% ¡ X.A ¡ 825 ¡ 50.2% ¡ lu.A ¡ 514,332 ¡ 86.7% ¡ mg.A ¡ 2,898 ¡ 66.0% ¡ sp.A ¡ 422,371 ¡ 44.1% ¡ 15 ¡

  16. Reduced ¡Precision ¡ • General ¡precision ¡requirement ¡profiles ¡ Low ¡sensi1vity ¡ High ¡sensi1vity ¡ 16 ¡

  17. Reduced ¡Precision: ¡Results ¡ NAS ¡(top) ¡& ¡LAMMPS ¡(boqom) ¡ mg.A ¡ ¡(36.6%) ¡ bt.A ¡ ¡(78.6%) ¡ X.A ¡ ¡(0.2%) ¡ chute ¡ lj ¡ rhodo ¡ 17 ¡

  18. Reduced ¡Precision: ¡Results ¡ NAS ¡mg.W ¡(incremental) ¡ >0.5% ¡-­‑ ¡ 9:45 ¡ >5.0% ¡-­‑ ¡ 4:66 ¡ >1.0% ¡-­‑ ¡ 5:93 ¡ >0.1% ¡-­‑ ¡ 15:45 ¡ >0.05% ¡-­‑ ¡ 23:60 ¡ Full ¡– ¡ 28:71 ¡ 18 ¡

  19. CLAMR ¡ • Cell-­‑based ¡Adap1ve ¡Mesh ¡Refinement ¡ – Los ¡Alamos ¡Na1onal ¡Lab ¡ 19 ¡

  20. CLAMR ¡ • Original ¡program ¡ – Mass ¡preserved ¡to ¡twelve ¡digits ¡ – Average ¡CPU ¡1me: ¡89.7s ¡ • AXer ¡CRAFT-­‑assisted ¡conversion ¡ – Mass ¡preserved ¡to ¡seven ¡digits ¡ – CPU ¡1me ¡speedup ¡(7.3%) ¡ – Memory ¡usage ¡reduced ¡(~7%) ¡ • AXer ¡GPU ¡mixed-­‑precision ¡rewrite ¡ – Up ¡to ¡4X ¡speed ¡improvement ¡in ¡certain ¡ subrou1nes ¡ 20 ¡

  21. Reduced ¡Precision: ¡Conclusions ¡ • Automated ¡analysis ¡can ¡iden1fy ¡fine-­‑grained ¡ precision ¡level ¡requirements ¡ • Reduced-­‑precision ¡analysis ¡provides ¡results ¡more ¡ quickly ¡than ¡mixed-­‑precision ¡analysis ¡ 21 ¡

  22. Future ¡Work ¡ • Short ¡term ¡projects ¡+ ¡planned ¡collabora1ons ¡ – Visualiza1on/graphics ¡studies ¡(JMU) ¡ – Development ¡cycle ¡integra1on ¡ • Mixed-­‑precision ¡feedback ¡in ¡IDE ¡ • Correctness/accuracy ¡integra1on ¡tes1ng ¡ – Machine ¡learning ¡techniques ¡(UMD) ¡ • Can ¡we ¡predict ¡low-­‑sensi1vity ¡por1ons ¡of ¡code? ¡ – Energy-­‑aware ¡analysis ¡(LLNL) ¡ • Min-­‑maxing ¡energy/performance ¡with ¡a ¡hard ¡bound ¡ on ¡accuracy ¡ – Further ¡case ¡studies ¡(LANL, ¡JMU) ¡ 22 ¡

  23. Future ¡Work ¡ • Long ¡term ¡ – Direct ¡GPU ¡support ¡and/or ¡CUDA ¡implementa1on ¡ – Full ¡shadow ¡value ¡analysis ¡ – Compiler-­‑based ¡implementa1on ¡ • Probably ¡LLVM ¡(see ¡Precimonious ¡for ¡similar ¡work) ¡ – Automa1c ¡program ¡transforma1ons ¡ – Program ¡modeling ¡and ¡verifica1on ¡ • Guarantees ¡for ¡ALL ¡inputs ¡ • Can ¡concolic ¡execu1on ¡help ¡here? ¡ – Probabilis1c ¡arithme1c ¡ 23 ¡

  24. “Grand ¡Vision” ¡ • A ¡suite ¡of ¡tools ¡and ¡analysis ¡techniques ¡ – Understand ¡floa1ng-­‑point ¡behavior ¡and ¡ precision-­‑level ¡profiles ¡ – Recommend ¡or ¡build ¡mixed-­‑precision ¡variants ¡ • Preserve ¡accuracy ¡ • Improve ¡performance ¡and ¡reduce ¡energy ¡use ¡ – Encourage ¡best ¡prac1ces ¡in ¡floa1ng-­‑point ¡code ¡ 24 ¡

  25. Contact ¡Info ¡ -­‑ ¡Collaborators ¡-­‑ ¡ Jeff ¡Hollingsworth ¡(advisor) ¡and ¡Pete ¡Stewart ¡ ¡(UMD) ¡ Bronis ¡de ¡Supinski, ¡Maq ¡Legendre, ¡et ¡al. ¡ ¡(LLNL) ¡ Bob ¡Robey ¡and ¡Nathan ¡DeBardeleben ¡(LANL) ¡ ¡ Email: ¡ ¡ lam2mo ¡(at) ¡jmu.edu ¡ Personal ¡website: ¡ ¡ blog.freearrow.com/about ¡ ¡ CRAFT ¡website: ¡ ¡ sf.net/p/crafthpc ¡ Intel ¡ XED2 ¡ 25 ¡

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