Bounds on the Geometric Mean of Arc Lengths for Bounded- Degree Planar Graphs M. K. Hasan Sung-eui Yoon Kyung-Yong Chwa KAIST, Republic of Korea
Image Rendering
Two Level I/O Memory Model a c d b f e g h 2-block cache Memory with infinite capacity
Memory Layout a c d b f e g h 2-block cache Memory with infinite capacity abcdefg h …
Performance of the Layout a c d b f e g h 2-block cache Memory with infinite capacity Not Available In Cache h abcdefg…
Performance of the Layout a c d b f e g h 2-block cache Memory with infinite capacityNumber of misses: 1 h abcdefg…abc
Performance of the Layout a c d b f e g h 2-block cache Memory with infinite capacityNumber of misses: 1 h abc defg… Hit ! abc
Performance of the Layout a c d b f e g h 2-block cache Memory with infinite capacityNumber of misses: 1 h abc defg… Hit ! abc
Performance of the Layout a c d b f e g h 2-block cache Memory with infinite capacityNumber of misses: 1 h abc defg… Not Available In Cache abc
Performance of the Layout a c d b f e g h 2-block cache Memory with infinite capacityNumber of misses: 2 h abc defg…abcdef
Performance of the Layout a c d b f e g h 2-block cache Memory with infinite capacityNumber of misses: 2 h abc defg…abc def
Performance of the Layout a c d b f e g h 2-block cache Memory with infinite capacityNumber of misses: 2 h abc defg…abc def Hit !
Performance of the Layout a c d b f e g h 2-block cache Memory with infinite capacityNumber of misses: 2 h abc defg…abc def Hit !
Performance of the Layout a c d b f e g h 2-block cache Memory with infinite capacityNumber of misses: 2 h abc defg…abc def Not Available In Cache
Performance of the Layout a c d b f e g h 2-block cache Memory with infinite capacityNumber of misses: 3 h abc defg…abc def hg…
Performance of the Layout a c d b f e g h 2-block cache Memory with infinite capacityNumber of misses: 3 h defg…abc def hg…
Performance of the Layout a c d b f e g h 2-block cache Memory with infinite capacityNumber of misses: 3 h defg…abc def hg… Hit !
Example of a “Bad Layout” a c d b f e g h a h g c b f d e … 2-block cache Memory with infinite capacityNumber of misses = 4
Cache Parameters In reality we do not know the block size and cache size In the Cache-Oblivious environment our objective is to develop efficient algorithm and/or layout without knowing the cache parameters Reducing the number of cache misses is the only goal. It does not matter how bad the algorithm is (in terms of complexity) as long as it is polynomial.
Cache-Oblivious Mesh Layout Optimization problem: Find the layout of a mesh which minimizes the number of cache misses for a set of applications: –Rendering –Collision Detection –Ray Tracing
We Need a Metric Given a layout –We want to know the number of cache misses for a particular class of applications –How can we get that if we do not know the cache parameters (cache size, block size)? –We need a metric which reflects the expected number of cache misses for the application class –The metric must be related to the layout and must not be dependent on the cache parameters Cache-Obliviousness
Efficient Layout Suppose we have chosen a metric which reflects the expected number of cache misses for our target application. Now, our objective is to develop a layout of the input mesh such that the metric value is minimized
Related Work : Derivation of Metrics [Yoon and Lindstrom(2006)] Consider two types of block size progressions –1, 2, 3, … –2 0, 2 1, 2 2, … The second one is more reasonable choice, e.g., 32 and 128 bytes for L1 and L2 caches and 4KB for the virtual page Based on these progressions we find two metrics –Arithmetic mean of edge spans: –Logarithm of geometric mean of edge spans: a c b d dacb MeshLayout
Related Work : Comparison of Two Metrics [Yoon and Lindstrom(2006)]
Related Work : Multi-level Construction Algorithm [Yoon and Lindstrom(2006)] Algorithm: Partition the input graph using graph partitioning tool. Make the layout of each small component using M g metric Marge the layout of each component to get the layout of the whole graph Average query times for collision detection between the Lucy model and Dragon Model Result: Experimental results show nice performance of multi-level construction algorithm However there is no theoretical bound for the performance and the complexity of the algorithm
Our Contribution We have given an algorithm which gives a layout for bounded-degree planar graph such that the M g value of the layout is within a constant factor of the M g value of the optimal layout (optimal in terms of M g value). Our algorithm is simple and easy to implement. The time complexity of our algorithm is O(n ⅹ log 2 n)
Separator Theorem For Planar Graphs [Lipton and Tarjan(1979)] B A |C| 2 ⅹ 2 1/2 ⅹ n 1/2 No edge between A and B |A|≤2 ⅹ n/3|B|≤2 ⅹ n/3 C Planar Graph with n vertices
Algorithm: Given Bounded-Degree Planar Graph G with n (a power of 2 ) Vertices G
Algorithm: Split G Into Three Parts A, B and C BA C |C|=O(n 1/2 ) |B|≤n/2 |A|≤n/2 Number of external edges = O(n 1/2 ) Number of internal edges = O(n 1/2 ) No edge between A and B
Algorithm: Split C into C 1 and C 2 BA C1C1 |A|+|C 1 |=n/2 C2C2 |B|+|C 2 |=n/2 Each edge is either an external or an internal edge crossing Number of crossing edges = O(n 1/2 )
Algorithm: Combine A,C 1 and B,C 2 |A|+|C 1 |=n/2|B|+|C 2 |=n/2 BA C1C1 C2C2
Algorithm: Recurse on A ’ and B ’ Make Layout of A ’ with 1…n/2 and B ’ with n/2+1…n recursively A ’ = A ∪ C 1 B ’ = B ∪ C
Cost of The Split of a n Vertices Bounded Degree Planar Graph Layout with values [1…n./2] A ’ = A ∪ C 1 B ’ = B ∪ C 2 Number of crossing edges = O(n 1/2 ) Cost of crossing edges = O(n 1/2 log n) Cost Layout with values [n/2…n]
Bounding M G Value …………………………………… l=0 l=1. ………………………… Number of subgraphs Number of crossing edges Cost of each crossing edge
Results Summary Value of M g metric of the layout generated by the recursive algorithm is O(1), where, Lower bound of M g of any layout is Ω (1) under suitable assumptions The recursive algorithm gives a constant approximation factor for M g The upper bound of M g value for any layout is O (log n) The time complexity of our algorithm is O(n ⅹ log 2 n)
Future Works We can extend the algorithm to handle three dimensional mesh For applications like streaming mesh and mesh smoothing, we can develop good metrics and cache-oblivious layouts based on those metrics