Data Packing Tree Decompositions Our Algorithm Experimental Results Efficient Parameterized Algorithms for Data Packing Krishnendu Chatterjee, Amir Goharshady , Nastaran Okati, Andreas Pavlogiannis January 22, 2019 1 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results Overview Data Packing is a classical problem in Cache Management 2 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results Overview Data Packing is a classical problem in Cache Management NP-hard and Hard-to-approximate → Heuristics are used 3 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results Overview Data Packing is a classical problem in Cache Management NP-hard and Hard-to-approximate → Heuristics are used The heuristics provide no guarantee of optimality 4 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results Overview Data Packing is a classical problem in Cache Management NP-hard and Hard-to-approximate → Heuristics are used The heuristics provide no guarantee of optimality We reduce Data Packing to a graph problem 5 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results Overview Data Packing is a classical problem in Cache Management NP-hard and Hard-to-approximate → Heuristics are used The heuristics provide no guarantee of optimality We reduce Data Packing to a graph problem We show that this problem can be solved in linear time if the underlying graph has a specific structural property 6 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results Overview Data Packing is a classical problem in Cache Management NP-hard and Hard-to-approximate → Heuristics are used The heuristics provide no guarantee of optimality We reduce Data Packing to a graph problem We show that this problem can be solved in linear time if the underlying graph has a specific structural property We experimentally show that graphs obtained from many common algorithms have this property 7 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results Overview Data Packing is a classical problem in Cache Management NP-hard and Hard-to-approximate → Heuristics are used The heuristics provide no guarantee of optimality We reduce Data Packing to a graph problem We show that this problem can be solved in linear time if the underlying graph has a specific structural property We experimentally show that graphs obtained from many common algorithms have this property → We provide the first positive theoretical result for Data Packing 8 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results The Setting A two-level memory system with: large but slow main memory small but fast cache The cache can hold up to m blocks (pages) Each block can hold up to p data items When accessing a data item, its block must be in the cache 9 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results The Goal A sequence R of accesses to data elements is given The goal is to minimize cache misses over R N := | R | , n :=number of distinct data items 10 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results Two Distinct Problems Minimizing cache misses can be broken in two parts: Paging: Choosing which block to evict from the cache when a cache-miss occurs ( LRU , FIFO, etc.) Data Packing: Choosing a data placement scheme, i.e. choosing how to divide the data items into blocks and which data items to put together Data Packing is the focus of this work 11 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results Access Graph R = � a , b , c , a , b , b , d , b , d , e , c , b , f � a f b d c e 12 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results Access Graph R = � a , b , c , a , b , b , d , b , d , e , c , b , f � a f 2 1 1 b d 3 2 1 1 c e 13 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results Access Hypergraph R = � a , b , c , a , b , b , d , b , d , e , c , b , f � a, b, c, a, b, b, d, b, d, e, c, b, f 14 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results Nice Tree Decompositions a f b d c e 15 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results Previous Results Theorem (Lavaee, POPL 2016) Assuming either LRU or FIFO as the replacement policy, we have the following hardness results: For any m and any p ≥ 3 , Data Packing is NP-hard. Unless P = NP, for any m ≥ 5 , p ≥ 2 and any constant ǫ > 0 , there is no polynomial algorithm that can approximate the Data Packing problem within a factor of O ( N 1 − ǫ ) . 16 / 30
Linear-time Linear-time Theorem 4.2 NP-hard Theorem 4.1 Hard to Approximate | | | | Theorem 3.1 Theorem 2.1 NP-hard Theorem 2.1 Data Packing Tree Decompositions Our Algorithm Experimental Results Our Results q ← ( m − 1) p + 2 → → e 1 t + a m p ) i 5 x o − 3 r . p 4 m p ( m A ← e r o o t e d h r T a H 2 m 1 5 6 17 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results Minimum-weight p -partitioning m = 1 , p = 2 R = � a , b , c , a , b , b , d , b , d , e , c , b , f � a f 2 1 1 b d 3 2 1 1 c e Cross edge: An edge that goes from one partition to another 18 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results States Let G = ( V , E ) and A ⊆ V . A state over A is a pair ( ϕ, sz ) where: ϕ is a partitioning of A in which every equivalence class has a size of at most p sz is a size enlargement function sz : A /ϕ → { 0 , . . . , p − 1 } that maps each equivalence class [ v ] ϕ to a number which is at most p − | [ v ] ϕ | a a a a a a c c b b c a b b b b b c c c c a a a a a a c c b b c a b b b b b c c c c 19 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results States Realization. We say that a p -partitioning ψ realizes the state s = ( ϕ, sz ) over A , if ψ partitions the vertices in A in the same manner as ϕ if a partition [ v ] ψ of ψ intersects A , then [ v ] ψ contains as many vertices from outside of A as fixed by sz . Compatibility. Two states are compatible iff there exists a p -partitioning that realizes both of them. a c a c a f 2 1 b d b d → 1 b d 3 2 e e 1 1 c e f f 20 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results The Algorithm Step 0: Initialization. We define several variables at each node of our tree decomposition T . For every t ∈ T and every state s over the boundary X t , we define a variable dp [ t , s ] and initialize it to + ∞ . Invariant. dp [ t , s ] = The minimum total weight of cross edges over all p -partitionings of G t that realize s . 21 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results The Algorithm Step 1: Computation of dp . The dp variables are computed in a bottom-up order. Each dp value at a tree node t can be computed based on the dp values at its children. if t is a Leaf: dp [ t , s ] = 0; if t is a Join node with children t 1 and t 2 : dp [ t , s ] = sz 1+ sz 2 ≡ sz dp [ t 1 , ( ϕ, sz 1 )] + dp [ t 2 , ( ϕ, sz 2 )]; min if t is an Introduce Vertex node, introducing v , with a single child t 1 : dp [ t , s ] = dp [ t 1 , ( ϕ | Xt 1 , sz | Xt 1 )]; if t is an Introduce Edge node, introducing e , with a single child t 1 : dp [ t , s ] = dp [ t 1 , s ] + w ( e , ϕ ) , where w ( e , ϕ ) is equal to w ( e ) if e is a cross edge in ϕ and 0 otherwise; if t is a Forget Vertex node, forgetting v , with a single child t 1 : dp [ t 1 , s ′ ] . dp [ t , s ] = min s ′ . = s 22 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results The Algorithm: Introduce Edge Nodes dp [ t , s ] = dp [ t 1 , s ] + w ( e , ϕ ) t t 1 23 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results The Algorithm: Join Nodes dp [ t , ( ϕ, sz )] = sz 1 + sz 2 ≡ sz dp [ t 1 , ( ϕ, sz 1 )] + dp [ t 2 , ( ϕ, sz 2 )] min t t 1 t 2 24 / 30
Data Packing Tree Decompositions Our Algorithm Experimental Results The Algorithm Step 2: Computing the Output. The algorithm computes and return the following output: min dp [ r , s ] . s ∈ S Xr 25 / 30
e t a m i x o 3 r . p 4 p m A e o r o t e d h r T a H Linear-time Theorem 2.1 Theorem 3.1 | | | | NP-hard Theorem 4.2 Linear-time Theorem 4.1 Hard to Approximate Theorem 2.1 NP-hard Data Packing Tree Decompositions Our Algorithm Experimental Results Theorem If the access graph has constant treewidth, then Data Packing can be solved in linear time. 26 / 30
Theorem 2.1 Theorem 2.1 NP-hard Theorem 4.2 Linear-time Theorem 4.1 Hard to Approximate NP-hard | | | | Theorem 3.1 Linear-time Data Packing Tree Decompositions Our Algorithm Experimental Results Theorem If the access graph has constant treewidth, then Data Packing can be solved in linear time. q ← ( m − 1) p + 2 → → 1 e t + a m p ) i 5 x o − 3 r . p 4 m p ( m A ← e o r o t e d h r T a H 2 m 1 5 6 27 / 30
Recommend
More recommend