Skip to main content
QUICK REVIEW

[Paper Review] TSFC: a structure-preserving form compiler

Miklós Homolya, Lawrence Mitchell|arXiv (Cornell University)|May 10, 2017
Parallel Computing and Optimization TechniquesComputer Science32 references6 citations
TL;DR

TSFC is a novel form compiler for finite element methods that preserves the structural integrity of weak form expressions throughout compilation, enabling high-level optimizations. By employing a two-stage process—first lowering finite element constructs to tensor algebra, then scheduling operations—it maintains tensor structure longer than prior compilers, resulting in superior compile-time performance, especially for complex and non-affine problems.

ABSTRACT

A form compiler takes a high-level description of the weak form of partial differential equations and produces low-level code that carries out the finite element assembly. In this paper we present the Two-Stage Form Compiler (TSFC), a new form compiler with the main motivation to maintain the structure of the input expression as long as possible. This facilitates the application of optimizations at the highest possible level of abstraction. TSFC features a novel, structure-preserving method for separating the contributions of a form to the subblocks of the local tensor in discontinuous Galerkin problems. This enables us to preserve the tensor structure of expressions longer through the compilation process than other form compilers. This is also achieved in part by a two-stage approach that cleanly separates the lowering of finite element constructs to tensor algebra in the first stage, from the scheduling of those tensor operations in the second stage. TSFC also efficiently traverses complicated expressions, and experimental evaluation demonstrates good compile-time performance even for highly complex forms.

Motivation & Objective

  • Address the challenge of maintaining high-level expression structure during finite element code generation to enable advanced optimizations.
  • Improve compile-time performance for complex finite element forms, particularly with non-affine geometry mappings and high-order elements.
  • Develop a clean separation between lowering finite element constructs to tensor algebra and scheduling those operations for extensibility and optimization.
  • Enable efficient compilation of discontinuous Galerkin methods by preserving block structure in local tensors.
  • Support interactive scientific computing workflows by ensuring form compilation remains sub-second even for complex forms.

Proposed method

  • Introduce a two-stage compilation pipeline: first translating UFL expressions into a tensor algebra intermediate representation, then scheduling tensor operations.
  • Implement a structure-preserving method to isolate contributions to subblocks of the local tensor in discontinuous Galerkin formulations.
  • Use efficient expression traversal algorithms to minimize compilation overhead, especially for complex forms and non-affine cells.
  • Decouple tensor algebra lowering from operation scheduling to allow independent optimization of the schedule or integration with downstream tools.
  • Leverage UFL’s high-level specification of weak forms and discrete function spaces as input, preserving mathematical structure through compilation.
  • Support both C and FFC-compatible representations, enabling integration into existing FEniCS/Firedrake stacks with minimal disruption.

Experimental results

Research questions

  • RQ1How can finite element form compilers preserve the structural semantics of weak forms throughout compilation to enable high-level optimizations?
  • RQ2What performance penalties arise in legacy compilers like FFC when handling complex or non-affine finite element forms, and how can they be mitigated?
  • RQ3To what extent does a two-stage compilation approach improve maintainability and optimization opportunities in form compilers?
  • RQ4Can structure-preserving compilation significantly reduce compile times for high-order and discontinuous Galerkin finite element problems?
  • RQ5How does TSFC’s performance compare to UFLACS and FFC variants in terms of compile-time scalability across increasing form complexity?

Key findings

  • TSFC achieves compile times within the same order of magnitude as UFLACS and FFC, but with significantly better scaling for complex forms.
  • For the most complex test case (Holzapfel-Ogden model in 3D), TSFC compiles in 3.7 seconds, which can be reduced to 2.2 seconds by disabling certain optimizations.
  • The modified FFC quadrature representation (fd_bendy) ran out of memory after 6 hours on 64GB RAM for the 3D Holzapfel-Ogden case, highlighting scalability issues.
  • TSFC’s compile-time performance remains acceptable even for highly complex forms, with all test cases compiling in under 4 seconds on a standard CPU.
  • The two-stage design enables clean separation of lowering and scheduling, facilitating future optimization and integration with tools like COFFEE.
  • TSFC outperforms legacy FFC representations in terms of compile-time efficiency, especially for non-affine geometry mappings and high-order elements.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.