Skip to content
Snippets Groups Projects

Add preprocessor macro DUNE_FORCE_INLINE

Merged Simon Praetorius requested to merge feature/force-inline into master

Summary

Some recursive algorithms can only be optimized properly if the function calls are inlined. It has been observed that the compiler heuristics are not always enough to trigger this inlining, e.g., in !1447 for the tensor index contraction algorithm. This MR provides a unified way to force inlining of functions if possible, or trigger an error if not. It uses the attribute always_inline and for MSVC uses [[msvc::forceinline]]. It has been tested in !1447 (and in https://gitlab.dune-project.org/simon.praetorius/dune-tensor) and leads to better optimized code.

Discussion

The code is put into the directory dune/common/std since actually it should be available via the standard attribute [[always_inline]]. Unfortunately, not all compilers (and version) interpret this attribute correctly. Thus a convenience fallback implementation using the compiler-specific attributes is provided.

ToDo

  • Add changelog entry
Edited by Santiago Ospina De Los Ríos

Merge request reports

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading