skip to main content
research-article

MeshTaichi: A Compiler for Efficient Mesh-Based Operations

Published:30 November 2022Publication History
Skip Abstract Section

Abstract

Meshes are an indispensable representation in many graphics applications because they provide conformal spatial discretizations. However, mesh-based operations are often slow due to unstructured memory access patterns. We propose MeshTaichi, a novel mesh compiler that provides an intuitive programming model for efficient mesh-based operations. Our programming model hides the complex indexing system from users and allows users to write mesh-based operations using reference-style neighborhood queries. Our compiler achieves its high performance by exploiting data locality. We partition input meshes and prepare the wanted relations by inspecting users' code during compile time. During run time, we further utilize on-chip memory (shared memory on GPU and L1 cache on CPU) to access the wanted attributes of mesh elements efficiently. Our compiler decouples low-level optimization options with computations, so that users can explore different localized data attributes and different memory orderings without changing their computation code. As a result, users can write concise code using our programming model to generate efficient mesh-based computations on both CPU and GPU backends. We test MeshTaichi on a variety of physically-based simulation and geometry processing applications with both triangle and tetrahedron meshes. MeshTaichi achieves a consistent speedup ranging from 1.4× to 6×, compared to state-of-the-art mesh data structures and compilers.

Skip Supplemental Material Section

Supplemental Material

3550454.3555430.mp4

mp4

318.7 MB

References

  1. David Baraff and Andrew Witkin. 1998. Large steps in cloth simulation. In Proceedings of the 25th annual conference on Computer graphics and interactive techniques. 43--54.Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Bruce G Baumgart. 1972. Winged edge polyhedron representation. Technical Report. STANFORD UNIV CA DEPT OF COMPUTER SCIENCE.Google ScholarGoogle Scholar
  3. Gilbert Louis Bernstein and Fredrik Kjolstad. 2016. Perspectives: Why New Programming Languages for Simulation? ACM Transactions on Graphics (TOG) 35, 2 (2016), 1--3.Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Gilbert Louis Bernstein, Chinmayee Shah, Crystal Lemire, Zachary Devito, Matthew Fisher, Philip Levis, and Pat Hanrahan. 2016. Ebb: A DSL for physical simulation on CPUs and GPUs. ACM Trans. Graph. 35, 2 (2016), 21:1--21:12.Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Volker Blanz and Thomas Vetter. 1999. A morphable model for the synthesis of 3D faces. In Proceedings of the 26th annual conference on Computer graphics and interactive techniques. 187--194.Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Mario Botsch, Stephan Steinberg, Stephan Bischoff, and Leif Kobbelt. 2002. Openmesh-a generic and efficient polygon mesh data structure. (2002).Google ScholarGoogle Scholar
  7. Sofien Bouaziz, Sebastian Martin, Tiantian Liu, Ladislav Kavan, and Mark Pauly. 2014. Projective dynamics: Fusing constraint projections for fast simulation. ACM transactions on graphics (TOG) 33, 4 (2014), 1--11.Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Ajay Brahmakshatriya, Emily Furst, Victor A Ying, Claire Hsu, Changwan Hong, Max Ruttenberg, Yunming Zhang, Dai Cheol Jung, Dustin Richmond, Michael B Taylor, et al. 2021. Taming the Zoo: The unified GraphIt compiler framework for novel architectures. In 2021 ACM/IEEE 48th Annual International Symposium on Computer Architecture (ISCA). IEEE, 429--442.Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Luciano A Romero Calla, Lizeth J Fuentes Perez, and Anselmo A Montenegro. 2019. A minimalistic approach for fast computation of geodesic distances on triangular meshes. Computers & Graphics 84 (2019), 77--92.Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Swen Campagna, Leif Kobbelt, and Hans-Peter Seidel. 1998. Directed edges---a scalable representation for triangle meshes. Journal of Graphics tools 3, 4 (1998), 1--11.Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. He Chen, Hyojoon Park, Kutay Macit, and Ladislav Kavan. 2021. Capturing Detailed Deformations of Moving Human Bodies. arXiv preprint arXiv:2102.07343 (2021).Google ScholarGoogle Scholar
  12. Mathieu Desbrun, Mark Meyer, Peter Schröder, and Alan H Barr. 1999. Implicit fairing of irregular meshes using diffusion and curvature flow. In Proceedings of the 26th annual conference on Computer graphics and interactive techniques. 317--324.Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Zach DeVito, Niels Joubert, Francisco Palacios, Stephen Oakley, Montserrat Medina, Mike Barrientos, Erich Elsen, Frank Ham, Alex Aiken, Karthik Duraisamy, Eric Darve, Juan Alonso, and Pat Hanrahan. 2011. Liszt: A Domain Specific Language for Building Portable Mesh-based PDE Solvers. Proceedings of 2011 SC - International Conference for High Performance Computing, Networking, Storage and Analysis 3, 9.Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Antonio DiCarlo, Alberto Paoluzzi, and Vadim Shapiro. 2014. Linear algebraic representation for topological structures. Computer-Aided Design 46 (2014), 269--274.Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Yu Fang, Minchen Li, Ming Gao, and Chenfanfu Jiang. 2019. Silly rubber: an implicit material point method for simulating non-equilibrated viscoelastic and elastoplastic solids. ACM Transactions on Graphics (TOG) 38, 4 (2019), 1--13.Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Ming Gao, Xinlei Wang, Kui Wu, Andre Pradhana-Tampubolon, Eftychios Sifakis, Yuksel Cem, and Chenfanfu Jiang. 2018. GPU Optimization of Material Point Methods. ACM Trans. Graph. (Proc. SIGGRAPH Asia) 32, 4 (2018), 102.Google ScholarGoogle Scholar
  17. Leonidas Guibas and Jorge Stolfi. 1985. Primitives for the manipulation of general subdivisions and the computation of Voronoi. ACM transactions on graphics (TOG) 4, 2 (1985), 74--123.Google ScholarGoogle Scholar
  18. Yuanming Hu, Luke Anderson, Tzu-Mao Li, Qi Sun, Nathan Carr, Jonathan Ragan-Kelley, and Frédo Durand. 2020. DiffTaichi: Differentiable Programming for Physical Simulation. ICLR (2020).Google ScholarGoogle Scholar
  19. Yuanming Hu, Yu Fang, Ziheng Ge, Ziyin Qu, Yixin Zhu, Andre Pradhana, and Chenfanfu Jiang. 2018a. A moving least squares material point method with displacement discontinuity and two-way rigid body coupling. ACM Trans. Graph. (Proc. SIGGRAPH Asia) 37, 4 (2018), 150.Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Yuanming Hu, Tzu-Mao Li, Luke Anderson, Jonathan Ragan-Kelley, and Frédo Durand. 2019. Taichi: a language for high-performance computation on spatially sparse data structures. ACM Transactions on Graphics (TOG) 38, 6 (2019), 201.Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Yuanming Hu, Jiafeng Liu, Xuanda Yang, Mingkuan Xu, Ye Kuang, Weiwei Xu, Qiang Dai, William T. Freeman, and Frédo Durand. 2021. QuanTaichi: A Compiler for Quantized Simulations. ACM Trans. Graph. 40, 4, Article 182 (July 2021), 16 pages.Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Yixin Hu, Qingnan Zhou, Xifeng Gao, Alec Jacobson, Denis Zorin, and Daniele Panozzo. 2018b. Tetrahedral meshing in the wild. ACM Trans. Graph. 37, 4 (2018), 60--1.Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Markus Ihmsen, Nadir Akinci, Markus Becker, and Matthias Teschner. 2011. A parallel SPH implementation on multi-core CPUs. In Computer Graphics Forum, Vol. 30. Wiley Online Library, 99--112.Google ScholarGoogle Scholar
  24. Chenfanfu Jiang, Theodore Gast, and Joseph Teran. 2017. Anisotropic elastoplasticity for cloth, knit and hair frictional contact. ACM Transactions on Graphics (TOG) 36, 4 (2017), 1--14.Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Chenfanfu Jiang, Craig Schroeder, Andrew Selle, Joseph Teran, and Alexey Stomakhin. 2015. The affine particle-in-cell method. ACM Transactions on Graphics (TOG) 34, 4 (2015), 1--10.Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Petr Kadleček, Alexandru-Eugen Ichim, Tiantian Liu, Jaroslav Křivánek, and Ladislav Kavan. 2016. Reconstructing personalized anatomical models for physics-based body animation. ACM Transactions on Graphics (TOG) 35, 6 (2016), 1--13.Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Lutz Kettner and Fernando Cacciola. 2006. Halfedge data structures. CGAL User and Reference Manual 3 (2006).Google ScholarGoogle Scholar
  28. Fredrik Kjolstad, Shoaib Kamil, Jonathan Ragan-Kelley, David I. W. Levin, Shinjiro Sueda, Desai Chen, Etienne Vouga, Danny M. Kaufman, Gurtej Kanwar, Wojciech Matusik, and Saman Amarasinghe. 2016. Simit: A language for physical simulation. ACM Trans. Graph. 35, 2 (2016), 20:1--20:21.Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Fredrik Berg Kjolstad and Marc Snir. 2010. Ghost cell pattern. In Proceedings of the 2010 Workshop on Parallel Programming Patterns. 1--9.Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Chris Lattner and Vikram Adve. 2004. LLVM: A compilation framework for lifelong program analysis & transformation. In Code Generation and Optimization.Google ScholarGoogle Scholar
  31. Tiantian Liu, Adam W Bargteil, James F O'Brien, and Ladislav Kavan. 2013. Fast simulation of mass-spring systems. ACM Transactions on Graphics (TOG) 32, 6 (2013), 1--7.Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Miles Macklin, Matthias Müller, and Nuttapong Chentanez. 2016. XPBD: position-based simulation of compliant constrained dynamics. In Proceedings of the 9th International Conference on Motion in Games. 49--54.Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Ahmed H. Mahmoud, Serban D. Porumbescu, and John D. Owens. 2021. RXMesh: A GPU Mesh Data Structure. ACM Trans. Graph. 40, 4, Article 104 (July 2021), 16 pages.Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Martti Mäntylä. 1987. An introduction to solid modeling. Computer Science Press, Inc.Google ScholarGoogle Scholar
  35. Nelson L. Max. 1999. Weights for Computing Vertex Normals from Facet Normals. J. Graphics, GPU, & Game Tools 4 (1999), 1--6.Google ScholarGoogle Scholar
  36. Matthias Müller, Bruno Heidelberger, Marcus Hennix, and John Ratcliff. 2007. Position based dynamics. Journal of Visual Communication and Image Representation 18, 2 (2007), 109--118.Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Ken Museth, Jeff Lait, John Johanson, Jeff Budsberg, Ron Henderson, Mihai Alden, Peter Cucka, David Hill, and Andrew Pearce. 2013. OpenVDB: an open-source data structure and toolkit for high-resolution volumes. In Acm siggraph 2013 courses. 1--1.Google ScholarGoogle Scholar
  38. Rahul Narain, Matthew Overby, and George E Brown. 2016. ADMM⊇ projective dynamics: fast simulation of general constitutive models.. In Symposium on Computer Animation, Vol. 1. 2016.Google ScholarGoogle Scholar
  39. Hang Si. 2015. TetGen, a Delaunay-Based Quality Tetrahedral Mesh Generator. ACM Trans. Math. Softw. 41, 2, Article 11 (feb 2015), 36 pages.Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Eftychios Sifakis and Jernej Barbic. 2012. FEM simulation of 3D deformable solids: a practitioner's guide to theory, discretization and model reduction. In Acm siggraph 2012 courses. 1--50.Google ScholarGoogle Scholar
  41. Demetri Terzopoulos, John Platt, Alan Barr, and Kurt Fleischer. 1987. Elastically deformable models. In Proceedings of the 14th annual conference on Computer graphics and interactive techniques. 205--214.Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Zangyueyang Xian, Xin Tong, and Tiantian Liu. 2019. A scalable galerkin multigrid method for real-time simulation of deformable objects. ACM Transactions on Graphics (TOG) 38, 6 (2019), 1--13.Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Cem Yuksel, Scott Schaefer, and John Keyser. 2009. Hair meshes. ACM Transactions on Graphics (TOG) 28, 5 (2009), 1--7.Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Yunming Zhang, Mengjiao Yang, Riyadh Baghdadi, Shoaib Kamil, Julian Shun, and Saman Amarasinghe. 2018. GraphIt: A high-performance graph DSL. Proceedings of the ACM on Programming Languages 2, OOPSLA (2018), 121.Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Yili Zhao and Jernej Barbič. 2013. Interactive authoring of simulation-ready plants. ACM Transactions on Graphics (TOG) 32, 4 (2013), 1--12.Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Qingnan Zhou and Alec Jacobson. 2016. Thingi10K: A Dataset of 10,000 3D-Printing Models. arXiv preprint arXiv:1605.04797 (2016).Google ScholarGoogle Scholar

Index Terms

  1. MeshTaichi: A Compiler for Efficient Mesh-Based Operations

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in

          Full Access

          • Published in

            cover image ACM Transactions on Graphics
            ACM Transactions on Graphics  Volume 41, Issue 6
            December 2022
            1428 pages
            ISSN:0730-0301
            EISSN:1557-7368
            DOI:10.1145/3550454
            Issue’s Table of Contents

            Copyright © 2022 ACM

            Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 30 November 2022
            Published in tog Volume 41, Issue 6

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • research-article

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader