MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
enzyme.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12
13#ifndef MFEM_ENZYME_HPP
14#define MFEM_ENZYME_HPP
15
16#ifdef MFEM_USE_ENZYME
17/*
18 * Variables prefixed with enzyme_* or function types prefixed with __enzyme_*,
19 * are variables which will get preprocessed in the LLVM intermediate
20 * representation when the Enzyme LLVM plugin is loaded. See the Enzyme
21 * documentation (https://enzyme.mit.edu) for more information.
22 */
23
24extern int enzyme_dup;
25extern int enzyme_dupnoneed;
26extern int enzyme_out;
27extern int enzyme_const;
28
29template <typename return_type, typename... Args>
30return_type __enzyme_autodiff(Args...);
31
32template <typename return_type, typename... Args>
33return_type __enzyme_fwddiff(Args...);
34
35#define MFEM_ENZYME_INACTIVENOFREE __attribute__((enzyme_inactive, enzyme_nofree))
36#define MFEM_ENZYME_INACTIVE __attribute__((enzyme_inactive))
37#define MFEM_ENZYME_FN_LIKE(x) __attribute__((enzyme_function_like(#x)))
38
39#else
40#define MFEM_ENZYME_INACTIVENOFREE
41#define MFEM_ENZYME_INACTIVE
42#define MFEM_ENZYME_FN_LIKE(x)
43#endif
44
45#define MFEM_ENZYME_FN_LIKE_FREE MFEM_ENZYME_FN_LIKE(free)
46#define MFEM_ENZYME_FN_LIKE_DYNCAST MFEM_ENZYME_FN_LIKE(__dynamic_cast)
47
48#endif
int enzyme_dup
int enzyme_dupnoneed
return_type __enzyme_autodiff(Args...)
int enzyme_out
int enzyme_const
return_type __enzyme_fwddiff(Args...)
kernels::InvariantsEvaluator2D::Buffers Args