against platform uncertainties
play

against Platform Uncertainties Thomas Wahl Northeastern University - PowerPoint PPT Presentation

Stabilizing Numeric Programs against Platform Uncertainties Thomas Wahl Northeastern University August 28, 2017 Example: Ray Tracing int raySphere( float *r, float *s, float radiusSq) { float A = dot3(r,r); float B = -2.0 * dot3(s,r); float C =


  1. Stabilizing Numeric Programs against Platform Uncertainties Thomas Wahl Northeastern University August 28, 2017

  2. Example: Ray Tracing int raySphere( float *r, float *s, float radiusSq) { float A = dot3(r,r); float B = -2.0 * dot3(s,r); float C = dot3(s,s) - radiusSq; float D = B*B - 4*A*C; if (D > 0.00001) { float sign = ( C > 0.00001 ) ? 1 : -1; โ‹ฎ For the input on the right: AMD GPU A8-3850: ๐ธ = โˆ’0.000122 NVIDIA Quadro 600 GPU: ๐ธ = +0.000244

  3. CPU: 9.0 + 0.9 + 0.09 + 0.009 + 0.0009 + 0.00009 + 0.000009 + 0.0000009 9.9 GPU: 9.0 + 0.9 + 0.09 + 0.009 + 0.0009 + 0.00009 + 0.000009 + 0.0000009 0.099 0.0000099 9.9 0.00099 9.999 0.0009999 9.9999 999

  4. Platform Variations: Contracted Operations ๐‘ ๐‘ ๐‘ ๐‘ Fused Multiply-Add (FMA) MULT MULT ๐‘‘ ROUND ๐‘‘ ADD ADD ROUND ROUND ๐‘ ร— ๐‘ โŠ• ๐‘‘ ๐‘ โŠ— ๐‘ โŠ• ๐‘‘

  5. VOLATILITY IN NUMERIC PROGRAMS

  6. Volatile Expressions = expression whose semantics depends on the (expression) evaluation model, which determines: โ€ข evaluation order โ€ข availability and use of hardware features such as fused multiply-add (FMA) ๐‘” 1 ๐ฝ + ๐‘” 2 ๐ฝ + โ€ฆ + ๐‘” ๐‘œ (๐ฝ) Sums, products: Dot products: ๐‘” 1 ๐ฝ ร— ๐‘• 1 ๐ฝ + โ€ฆ + ๐‘” ๐‘œ ๐ฝ ร— ๐‘• ๐‘œ (๐ฝ)

  7. Quantifying Volatility Let ๐‘Œ be a floating-point expression in the program. The volatile bound of ๐‘Œ for input ๐ฝ is min ๐‘ ๐‘Œ ๐ฝ, ๐‘ , max ๐‘ ๐‘Œ ๐ฝ, ๐‘ ๐‘ : expression evaluation models Questions: ๏ƒ˜ How do we compute this, for input ๐ฝ ? ๏ƒ˜ Once computed, what is it good for?

  8. Volatility in Matrix Calculations ๏ƒผ well-designed programs ๏ƒผ high degree of reproducibility

  9. But: Ray Tracing int raySphere( float *r, float *s, float radiusSq) { float A = dot3(r,r); float B = -2.0 * dot3(s,r); float C = dot3(s,s) - radiusSq; float D = B*B - 4*A*C; if (D > 0.00001) { float sign = ( C > 0.00001 ) ? 1 : -1; โ‹ฎ For some inputs: AMD GPU A8-3850: ๐ธ = โˆ’0.000122 NVIDIA Quadro 600 GPU: ๐ธ = +0.000244

  10. Stabilizing Numeric Programs: Overview Goal: โ€ข Improve reproducibility of program results Naive solution: โ€œ determinize โ€ the whole program cl /fp:strict source.cpp โ€ข implements strict evaluation: FMA disabled, expressions from left to right

  11. Local Stabilization

  12. Identifying Major Destabilizers int raySphere( float *r, float *s, float radiusSq) { float A = dot3(r,r); float B = -2.0 * dot3(s,r); float C = dot3(s,s) - radiusSq; float D = B*B - 4*A*C; if (D > 0.00001) { float sign = ( C > 0.00001 ) ? 1 : -1; โ‹ฎ

  13. Stabilizing ๐ธ โ€™s expression int raySphere( float *r, float *s, float radiusSq) { float A = dot3(r,r); float B = -2.0 * dot3(s,r); float C = dot3(s,s) - radiusSq; /* donโ€™t optimize ... */ float D = B*B - 4*A*C; if (D > 0.00001) { float sign = ( C > 0.00001 ) ? 1 : -1; โ‹ฎ Stabilizing D = B*B โ€“ 4*A*C : new volatile bound for ๐ธ of [ โˆ’0.250000000, 0.125000000 ]

  14. Stabilizing ๐ธ โ€™s expression not enough Two causes of large volatile bounds for ๐‘ฌ : 1. volatility caused by ๐ธ โ€™s defining expression 2. volatility inherited from earlier expressions, which causes bloated inputs to ๐ธ !

  15. Provenance of ๐ธ โ€™s Volatility = for each preceding expression (here: ๐ต, ๐ถ, ๐ท ), the contribution to (impact on) ๐ธ โ€™s volatility [VMCAI 2017]

  16. int raySphere( float *r, float *s, float radiusSq) { float A = dot3(r,r); /* FMA forbidden! */ float B = -2.0 * dot3(s,r); /* donโ€™t reorder! */ float C = dot3(s,s) - radiusSq; float D = B*B - 4*A*C; if (D > 0.00001) { float sign = ( C > 0.00001 ) ? 1 : -1; โ‹ฎ ๏ƒ˜ Stabilizing B = 2.0 * dot3(s,r) : new bound for ๐ธ : [-0.002806663, 0.156753913] ๏ƒ˜ Stabilizing C = dot3(s,s) - radiusSq new bound for ๐ธ : [0.125000000, 0.156753913]

  17. Take-Home Messages ๏ƒผ FPA expressions are volatile: semantics fragile against platform variations ๏ƒผ expose volatility , or prove robustness , on a per-input basis ๏ƒผ repair: make program robust against platform uncertainties Future plans: ๏ƒ˜ platform uncertainties in machine learning (or other big-data) ๏ƒ˜ prove robustness for a range of inputs ๏ƒ˜ trade-offs: num. stability vs. accuracy ( โ„ !) vs. efficiency

  18. Acknowledgements Joint with (@ NEU): โ€ข Yijia Gu (stud.), Computer and Information Science โ€ข Miriam Leeser (fac.) and Mahsa Bayati (stud.), Engineering http://www.ccs.neu.edu/home/wahl/Research/ /FPA-Heterogeneous/Non-Portability Financial Support:

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