MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
autogen.h
Go to the documentation of this file.
1#pragma once
2
3#include <mim/axiom.h>
4#include <mim/plugin.h>
5
6/// @namespace mim::plug::autodiff @ref autodiff
7namespace mim {
8namespace plug::autodiff {
9
10static constexpr plugin_t Plugin_Id = 0x9655014a1c70000;
11
12/// @name %%autodiff.Tangent
13///@{
14enum class Tangent : flags_t {
15};
16
18///@}
19
20/// @name %%autodiff.AD
21///@{
22enum class AD : flags_t {
23};
24
26///@}
27
28/// @name %%autodiff.ad
29///@{
30enum class ad : flags_t {
31};
32
34///@}
35
36/// @name %%autodiff.zero
37///@{
38enum class zero : flags_t {
39};
40
42///@}
43
44/// @name %%autodiff.add
45///@{
46enum class add : flags_t {
47};
48
50///@}
51
52/// @name %%autodiff.sum
53///@{
54enum class sum : flags_t {
55};
56
58///@}
59
60/// @name %%autodiff.ad_eval_pass
61///@{
62enum class ad_eval_pass : flags_t {
63};
64
65///@}
66
67/// @name %%autodiff.ad_zero_pass
68///@{
69enum class ad_zero_pass : flags_t {
70};
71
72///@}
73
74/// @name %%autodiff.ad_zero_cleanup_pass
75///@{
77};
78
79///@}
80
81/// @name %%autodiff.ad_ext_cleanup_pass
82///@{
84};
85
86///@}
87
89
90#define MIM_autodiff_NORMALIZER_IMPL \
91 void register_normalizers(Normalizers& normalizers) {\
92 normalizers[flags_t(Annex::Base<Tangent>)] = &normalize_Tangent; \
93 normalizers[flags_t(Annex::Base<AD>)] = &normalize_AD; \
94 normalizers[flags_t(Annex::Base<ad>)] = &normalize_ad; \
95 normalizers[flags_t(Annex::Base<zero>)] = &normalize_zero; \
96 normalizers[flags_t(Annex::Base<add>)] = &normalize_add; \
97 normalizers[flags_t(Annex::Base<sum>)] = &normalize_sum; \
98 }
99} // namespace plug::autodiff
100
101#ifndef DOXYGEN // don't include in Doxygen documentation
102
103template<> constexpr flags_t Annex::Base<plug::autodiff::Tangent> = 0x9655014a1c70000;
104template<> constexpr size_t Annex::Num<plug::autodiff::Tangent> = 0;
105template<> constexpr flags_t Annex::Base<plug::autodiff::AD> = 0x9655014a1c70100;
106template<> constexpr size_t Annex::Num<plug::autodiff::AD> = 0;
107template<> constexpr flags_t Annex::Base<plug::autodiff::ad> = 0x9655014a1c70200;
108template<> constexpr size_t Annex::Num<plug::autodiff::ad> = 0;
109template<> constexpr flags_t Annex::Base<plug::autodiff::zero> = 0x9655014a1c70300;
110template<> constexpr size_t Annex::Num<plug::autodiff::zero> = 0;
111template<> constexpr flags_t Annex::Base<plug::autodiff::add> = 0x9655014a1c70400;
112template<> constexpr size_t Annex::Num<plug::autodiff::add> = 0;
113template<> constexpr flags_t Annex::Base<plug::autodiff::sum> = 0x9655014a1c70500;
114template<> constexpr size_t Annex::Num<plug::autodiff::sum> = 0;
115template<> constexpr flags_t Annex::Base<plug::autodiff::ad_eval_pass> = 0x9655014a1c70600;
116template<> constexpr size_t Annex::Num<plug::autodiff::ad_eval_pass> = 0;
117template<> constexpr flags_t Annex::Base<plug::autodiff::ad_zero_pass> = 0x9655014a1c70700;
118template<> constexpr size_t Annex::Num<plug::autodiff::ad_zero_pass> = 0;
119template<> constexpr flags_t Annex::Base<plug::autodiff::ad_zero_cleanup_pass> = 0x9655014a1c70800;
120template<> constexpr size_t Annex::Num<plug::autodiff::ad_zero_cleanup_pass> = 0;
121template<> constexpr flags_t Annex::Base<plug::autodiff::ad_ext_cleanup_pass> = 0x9655014a1c70900;
122template<> constexpr size_t Annex::Num<plug::autodiff::ad_ext_cleanup_pass> = 0;
123
124template<> struct Axiom::Match<plug::autodiff::ad_eval_pass> { using type = Axiom; };
125template<> struct Axiom::Match<plug::autodiff::ad_zero_pass> { using type = Axiom; };
126template<> struct Axiom::Match<plug::autodiff::ad_zero_cleanup_pass> { using type = Axiom; };
127template<> struct Axiom::Match<plug::autodiff::ad_ext_cleanup_pass> { using type = Axiom; };
128
129#endif
130} // namespace mim
131
132#ifndef DOXYGEN // don't include in Doxygen documentation
133
134
135#endif
Helper class to retrieve Infer::arg if present.
Definition def.h:86
Ref normalize_Tangent(Ref, Ref, Ref arg)
static constexpr plugin_t Plugin_Id
Definition autogen.h:10
Ref normalize_sum(Ref type, Ref callee, Ref arg)
Ref normalize_ad(Ref type, Ref callee, Ref arg)
Currently this normalizer does nothin.
Ref normalize_AD(Ref type, Ref callee, Ref arg)
Ref normalize_add(Ref type, Ref callee, Ref arg)
Currently resolved the full addition.
Ref normalize_zero(Ref type, Ref callee, Ref arg)
Currently this normalizer does nothing.
void register_normalizers(Normalizers &normalizers)
Definition cfg.h:11
u64 flags_t
Definition types.h:45
absl::flat_hash_map< flags_t, NormalizeFn > Normalizers
Definition plugin.h:19
u64 plugin_t
Definition types.h:46
static constexpr size_t Num
Definition plugin.h:115
static constexpr flags_t Base
Definition plugin.h:118