Dynamic Programming in faulty memory hierarchies (cache-obliviously) Saverio Caminiti, Irene Finocchi, Emanuele G. Fusco Sapienza University of Rome Francesco Silvestri University of Padua
Memory fault One or more bits is read differently from how were last written Hardware problems Due to Transient electronic noises Impact Machine crash Unpredictable output Security vulnerabilities Meeting AlgoDEEP - Rome - July 14-15, 2011 2
Faulty RAM model Based on the unit cost RAM model Adversary Adaptive Unbounded computational power Can corrupt up to d words (at any time) Small safe memory (program code, registers, ) Small private memory (random primes and derivatives) [Finocchi & Italiano, 2004] [Brodal, Jørgensen & Mølhave, 2009: Faulty external memory model] Meeting AlgoDEEP - Rome - July 14-15, 2011 3
Known results Sorting [it] Dictionaries [it+dk] Priority queues [dk] Counting [dk+de] K-d Trees [de] Dynamic data structures [us(mit)] Correctness typically relaxed: correct (only) on uncorrupted data Local-dependency dynamic programming [it] Meeting AlgoDEEP - Rome - July 14-15, 2011 4
Dynamic programming Local dependency problems Edit distance Longest Common Subsequence etc. DP table E.g., ED (correct w.h.p.) in O(n 2 + d 2+e ) time Support well-known optimization techniques [Caminiti, Finocchi, Fusco, 2011] Meeting AlgoDEEP - Rome - July 14-15, 2011 5
Latest results Extend class of DP to triply nested loop (GEP) All-pairs shortest paths (Floyd-Warshall), Matrix multiplication, Gaussian elimination, LU decomposition without pivoting, etc. Local dependency DP and FFT Meeting AlgoDEEP - Rome - July 14-15, 2011 6
A recursive approach Semi-resilient variables with decreasing resiliency levels Insert and extract operations δ resilient δ/2 resilient extract extract Write fingerprint ϕ Read fingerprint ρ Write fingerprint ϕ Based on Chowdhury & Ramachandran, SODA 2006 δ/4 resilient Irene Finocchi ADS - Bertinoro, June 2011 7
Karp-Rabin fingerprints Let A = < a 0, a 1,, a n-1 > be a vector: p: random prime number w: memory word size Can be incrementally computed while writing/reading A in O(1) private memory Fingerprint mismatch recomputation Irene Finocchi ADS - Bertinoro, June 2011 8
Recursion in faulty RAM The adversary can corrupt the recursion stack unless it is maintained in safe/private memory bounded recursion depth λ λ matrix decomposition: Resiliency decreases by a factor of λ at each call Subproblems solved in Z-order Meeting AlgoDEEP - Rome - July 14-15, 2011 9
Implications λ λ matrix decomposition has non trivial implications on fault detection: 1. Lazy fault detection on extract operations recursion on corrupted data 2. Out-of-order fingerprints read/write data access patterns are different but regular maintain O(1) amortized update time (involves exponentiations) 1 2 5 6 1 3 2 4 5 7 6 8 3 9 4 10 7 13 8 14 9 11 10 12 13 15 14 16 11 12 15 16 Meeting AlgoDEEP - Rome - July 14-15, 2011 10
Local dependency DP bounds Running time: O(n 2 + δn f ) Cache misses: O(n 2 /(MB) + δn f /B) Lower bound: Ω(n 2 /(MB) + δn /B) f = log n if private memory is Ω(log n); f = n ε otherwise M = cache size B = cache line size The algorithm is cache-oblivious Non-resilient lower bound Resilient input and output Irene Finocchi ADS - Bertinoro, June 2011 11
GEP bounds Running time: O(n 3 + δn 2 f ) Cache misses: O(n 3 /(B M) + δn 2 f /B) Lower bound: Ω(n 3 /(B M) + δn 2 /B) f = log n if private memory is Ω(log n); f = n ε otherwise M = cache size B = cache line size The algorithm is cache-oblivious Non-resilient lower bound Resilient input and output Irene Finocchi ADS - Bertinoro, June 2011 12
The End
Hidden details Traceback computation less regular than forward Data possibly not accessed during traceback Force unnecessary reads to update fingerprints correctly If l = w(1), cannot store all the horizontal and vertical boundaries (poor spatial locality) Recycle space appropriately and obtain missing data, when needed, by repeating forward computations Data accessed more than once (even w(1) times): should appear in fingerprints with different exponents: amplified fingerprints Irene Finocchi ADS - Bertinoro, June 2011 14
Hierarchical faulty RAM Main faulty memory is as usual in hierarchical memory models (cache oblivious model considers only two levels) Safe/private memory either single level (if it is small enough) or hierarchical tied to the main memory. In this case the private cache line size should be reasonable (e.g., asymptotically comparable with B) otherwise private cache missies would dominate. Meeting AlgoDEEP - Rome - July 14-15, 2011 15