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::math @ref math
7namespace mim {
8namespace plug::math {
9
10static constexpr plugin_t Plugin_Id = 0x3825490000000000;
11
12/// @name %%math.F
13///@{
14enum class F : flags_t {
15};
16
17///@}
18
19/// @name %%math.f16
20///@{
21enum class f16 : flags_t {
22};
23
24///@}
25
26/// @name %%math.f32
27///@{
28enum class f32 : flags_t {
29};
30
31///@}
32
33/// @name %%math.f64
34///@{
35enum class f64 : flags_t {
36};
37
38///@}
39
40/// @name %%math.bf16
41///@{
42enum class bf16 : flags_t {
43};
44
45///@}
46
47/// @name %%math.nvtf32
48///@{
49enum class nvtf32 : flags_t {
50};
51
52///@}
53
54/// @name %%math.amdfp24
55///@{
56enum class amdfp24 : flags_t {
57};
58
59///@}
60
61/// @name %%math.pxr24
62///@{
63enum class pxr24 : flags_t {
64};
65
66///@}
67
68/// @name %%math.F16
69///@{
70enum class F16 : flags_t {
71};
72
73///@}
74
75/// @name %%math.F32
76///@{
77enum class F32 : flags_t {
78};
79
80///@}
81
82/// @name %%math.F64
83///@{
84enum class F64 : flags_t {
85};
86
87///@}
88
89/// @name %%math.BF16
90///@{
91enum class BF16 : flags_t {
92};
93
94///@}
95
96/// @name %%math.NVTF32
97///@{
98enum class NVTF32 : flags_t {
99};
100
101///@}
102
103/// @name %%math.AMDFP24
104///@{
105enum class AMDFP24 : flags_t {
106};
107
108///@}
109
110/// @name %%math.PXR24
111///@{
112enum class PXR24 : flags_t {
113};
114
115///@}
116
117/// @name %%math.arith
118///@{
119enum class arith : flags_t {
120 add = 0x3825490000000f00,
121 sub = 0x3825490000000f01,
122 mul = 0x3825490000000f02,
123 div = 0x3825490000000f03,
124 rem = 0x3825490000000f04,
125};
126
127template<arith>
129
130///@}
131
132/// @name %%math.minus
133///@{
134enum class minus : flags_t {
135};
136
137///@}
138
139/// @name %%math.extrema
140///@{
141enum class extrema : flags_t {
142 im = 0x3825490000001100,
143 fmin = im,
144 iM = 0x3825490000001101,
145 fmax = iM,
146 Im = 0x3825490000001102,
147 ieee754min = Im,
148 IM = 0x3825490000001103,
149 ieee754max = IM,
150};
151
152template<extrema>
154
155///@}
156
157/// @name %%math.tri
158///@{
159enum class tri : flags_t {
160 ahff = 0x3825490000001200,
161 sin = ahff,
162 ahfF = 0x3825490000001201,
163 cos = ahfF,
164 ahFf = 0x3825490000001202,
165 tan = ahFf,
166 ahFF = 0x3825490000001203,
167 aHff = 0x3825490000001204,
168 sinh = aHff,
169 h = aHff,
170 aHfF = 0x3825490000001205,
171 cosh = aHfF,
172 aHFf = 0x3825490000001206,
173 tanh = aHFf,
174 aHFF = 0x3825490000001207,
175 Ahff = 0x3825490000001208,
176 asin = Ahff,
177 a = Ahff,
178 AhfF = 0x3825490000001209,
179 acos = AhfF,
180 AhFf = 0x382549000000120a,
181 atan = AhFf,
182 AhFF = 0x382549000000120b,
183 AHff = 0x382549000000120c,
184 asinh = AHff,
185 AHfF = 0x382549000000120d,
186 acosh = AHfF,
187 AHFf = 0x382549000000120e,
188 atanh = AHFf,
189 AHFF = 0x382549000000120f,
190};
191
192template<tri>
194
195///@}
196
197/// @name %%math.pow
198///@{
199enum class pow : flags_t {
200};
201
203///@}
204
205/// @name %%math.rt
206///@{
207enum class rt : flags_t {
208 sq = 0x3825490000001400,
209 cb = 0x3825490000001401,
210};
211
212template<rt>
214
215///@}
216
217/// @name %%math.exp
218///@{
219enum class exp : flags_t {
220 lbb = 0x3825490000001500,
221 exp = lbb,
222 lbB = 0x3825490000001501,
223 exp2 = lbB,
224 bin = lbB,
225 lBb = 0x3825490000001502,
226 exp10 = lBb,
227 dec = lBb,
228 lBB = 0x3825490000001503,
229 Lbb = 0x3825490000001504,
230 log = Lbb,
231 LbB = 0x3825490000001505,
232 log2 = LbB,
233 LBb = 0x3825490000001506,
234 log10 = LBb,
235 LBB = 0x3825490000001507,
236};
237
238template<exp>
240
241///@}
242
243/// @name %%math.er
244///@{
245enum class er : flags_t {
246 f = 0x3825490000001600,
247 fc = 0x3825490000001601,
248};
249
250template<er>
252
253///@}
254
255/// @name %%math.gamma
256///@{
257enum class gamma : flags_t {
258 t = 0x3825490000001700,
259 l = 0x3825490000001701,
260};
261
262template<gamma>
264
265///@}
266
267/// @name %%math.abs
268///@{
269enum class abs : flags_t {
270};
271
273///@}
274
275/// @name %%math.round
276///@{
277enum class round : flags_t {
278 f = 0x3825490000001900,
279 c = 0x3825490000001901,
280 r = 0x3825490000001902,
281 t = 0x3825490000001903,
282};
283
284template<round>
286
287///@}
288
289/// @name %%math.cmp
290///@{
291enum class cmp : flags_t {
292 ugle = 0x3825490000001a00,
293 f = ugle,
294 uglE = 0x3825490000001a01,
295 e = uglE,
296 ugLe = 0x3825490000001a02,
297 l = ugLe,
298 ugLE = 0x3825490000001a03,
299 le = ugLE,
300 uGle = 0x3825490000001a04,
301 g = uGle,
302 uGlE = 0x3825490000001a05,
303 ge = uGlE,
304 uGLe = 0x3825490000001a06,
305 ne = uGLe,
306 uGLE = 0x3825490000001a07,
307 o = uGLE,
308 Ugle = 0x3825490000001a08,
309 u = Ugle,
310 UglE = 0x3825490000001a09,
311 ue = UglE,
312 UgLe = 0x3825490000001a0a,
313 ul = UgLe,
314 UgLE = 0x3825490000001a0b,
315 ule = UgLE,
316 UGle = 0x3825490000001a0c,
317 ug = UGle,
318 UGlE = 0x3825490000001a0d,
319 uge = UGlE,
320 UGLe = 0x3825490000001a0e,
321 une = UGLe,
322 UGLE = 0x3825490000001a0f,
323 t = UGLE,
324};
325
326template<cmp>
328
329///@}
330
331/// @name %%math.conv
332///@{
333enum class conv : flags_t {
334 s2f = 0x3825490000001b00,
335 u2f = 0x3825490000001b01,
336 f2s = 0x3825490000001b02,
337 f2u = 0x3825490000001b03,
338 f2f = 0x3825490000001b04,
339};
340
341template<conv>
343
344///@}
345
346/// @name %%math.slf
347///@{
348enum class slf : flags_t {
349};
350
351///@}
352
353/// @name %%math.sgn
354///@{
355enum class sgn : flags_t {
356};
357
358///@}
359
360/// @name %%math.rrt
361///@{
362enum class rrt : flags_t {
363};
364
365///@}
366
368
369#define MIM_math_NORMALIZER_IMPL \
370 void register_normalizers(Normalizers& normalizers) {\
371 normalizers[flags_t(arith::add)] = &normalize_arith<arith::add>; \
372 normalizers[flags_t(arith::sub)] = &normalize_arith<arith::sub>; \
373 normalizers[flags_t(arith::mul)] = &normalize_arith<arith::mul>; \
374 normalizers[flags_t(arith::div)] = &normalize_arith<arith::div>; \
375 normalizers[flags_t(arith::rem)] = &normalize_arith<arith::rem>; \
376 normalizers[flags_t(extrema::im)] = &normalize_extrema<extrema::im>; \
377 normalizers[flags_t(extrema::iM)] = &normalize_extrema<extrema::iM>; \
378 normalizers[flags_t(extrema::Im)] = &normalize_extrema<extrema::Im>; \
379 normalizers[flags_t(extrema::IM)] = &normalize_extrema<extrema::IM>; \
380 normalizers[flags_t(tri::ahff)] = &normalize_tri<tri::ahff>; \
381 normalizers[flags_t(tri::ahfF)] = &normalize_tri<tri::ahfF>; \
382 normalizers[flags_t(tri::ahFf)] = &normalize_tri<tri::ahFf>; \
383 normalizers[flags_t(tri::ahFF)] = &normalize_tri<tri::ahFF>; \
384 normalizers[flags_t(tri::aHff)] = &normalize_tri<tri::aHff>; \
385 normalizers[flags_t(tri::aHfF)] = &normalize_tri<tri::aHfF>; \
386 normalizers[flags_t(tri::aHFf)] = &normalize_tri<tri::aHFf>; \
387 normalizers[flags_t(tri::aHFF)] = &normalize_tri<tri::aHFF>; \
388 normalizers[flags_t(tri::Ahff)] = &normalize_tri<tri::Ahff>; \
389 normalizers[flags_t(tri::AhfF)] = &normalize_tri<tri::AhfF>; \
390 normalizers[flags_t(tri::AhFf)] = &normalize_tri<tri::AhFf>; \
391 normalizers[flags_t(tri::AhFF)] = &normalize_tri<tri::AhFF>; \
392 normalizers[flags_t(tri::AHff)] = &normalize_tri<tri::AHff>; \
393 normalizers[flags_t(tri::AHfF)] = &normalize_tri<tri::AHfF>; \
394 normalizers[flags_t(tri::AHFf)] = &normalize_tri<tri::AHFf>; \
395 normalizers[flags_t(tri::AHFF)] = &normalize_tri<tri::AHFF>; \
396 normalizers[flags_t(Annex::Base<pow>)] = &normalize_pow; \
397 normalizers[flags_t(rt::sq)] = &normalize_rt<rt::sq>; \
398 normalizers[flags_t(rt::cb)] = &normalize_rt<rt::cb>; \
399 normalizers[flags_t(exp::lbb)] = &normalize_exp<exp::lbb>; \
400 normalizers[flags_t(exp::lbB)] = &normalize_exp<exp::lbB>; \
401 normalizers[flags_t(exp::lBb)] = &normalize_exp<exp::lBb>; \
402 normalizers[flags_t(exp::lBB)] = &normalize_exp<exp::lBB>; \
403 normalizers[flags_t(exp::Lbb)] = &normalize_exp<exp::Lbb>; \
404 normalizers[flags_t(exp::LbB)] = &normalize_exp<exp::LbB>; \
405 normalizers[flags_t(exp::LBb)] = &normalize_exp<exp::LBb>; \
406 normalizers[flags_t(exp::LBB)] = &normalize_exp<exp::LBB>; \
407 normalizers[flags_t(er::f)] = &normalize_er<er::f>; \
408 normalizers[flags_t(er::fc)] = &normalize_er<er::fc>; \
409 normalizers[flags_t(gamma::t)] = &normalize_gamma<gamma::t>; \
410 normalizers[flags_t(gamma::l)] = &normalize_gamma<gamma::l>; \
411 normalizers[flags_t(Annex::Base<abs>)] = &normalize_abs; \
412 normalizers[flags_t(round::f)] = &normalize_round<round::f>; \
413 normalizers[flags_t(round::c)] = &normalize_round<round::c>; \
414 normalizers[flags_t(round::r)] = &normalize_round<round::r>; \
415 normalizers[flags_t(round::t)] = &normalize_round<round::t>; \
416 normalizers[flags_t(cmp::ugle)] = &normalize_cmp<cmp::ugle>; \
417 normalizers[flags_t(cmp::uglE)] = &normalize_cmp<cmp::uglE>; \
418 normalizers[flags_t(cmp::ugLe)] = &normalize_cmp<cmp::ugLe>; \
419 normalizers[flags_t(cmp::ugLE)] = &normalize_cmp<cmp::ugLE>; \
420 normalizers[flags_t(cmp::uGle)] = &normalize_cmp<cmp::uGle>; \
421 normalizers[flags_t(cmp::uGlE)] = &normalize_cmp<cmp::uGlE>; \
422 normalizers[flags_t(cmp::uGLe)] = &normalize_cmp<cmp::uGLe>; \
423 normalizers[flags_t(cmp::uGLE)] = &normalize_cmp<cmp::uGLE>; \
424 normalizers[flags_t(cmp::Ugle)] = &normalize_cmp<cmp::Ugle>; \
425 normalizers[flags_t(cmp::UglE)] = &normalize_cmp<cmp::UglE>; \
426 normalizers[flags_t(cmp::UgLe)] = &normalize_cmp<cmp::UgLe>; \
427 normalizers[flags_t(cmp::UgLE)] = &normalize_cmp<cmp::UgLE>; \
428 normalizers[flags_t(cmp::UGle)] = &normalize_cmp<cmp::UGle>; \
429 normalizers[flags_t(cmp::UGlE)] = &normalize_cmp<cmp::UGlE>; \
430 normalizers[flags_t(cmp::UGLe)] = &normalize_cmp<cmp::UGLe>; \
431 normalizers[flags_t(cmp::UGLE)] = &normalize_cmp<cmp::UGLE>; \
432 normalizers[flags_t(conv::s2f)] = &normalize_conv<conv::s2f>; \
433 normalizers[flags_t(conv::u2f)] = &normalize_conv<conv::u2f>; \
434 normalizers[flags_t(conv::f2s)] = &normalize_conv<conv::f2s>; \
435 normalizers[flags_t(conv::f2u)] = &normalize_conv<conv::f2u>; \
436 normalizers[flags_t(conv::f2f)] = &normalize_conv<conv::f2f>; \
437 }
438} // namespace plug::math
439
440#ifndef DOXYGEN // don't include in Doxygen documentation
441
442template<> constexpr flags_t Annex::Base<plug::math::F> = 0x3825490000000000;
443template<> constexpr size_t Annex::Num<plug::math::F> = 0;
444template<> constexpr flags_t Annex::Base<plug::math::f16> = 0x3825490000000100;
445template<> constexpr size_t Annex::Num<plug::math::f16> = 0;
446template<> constexpr flags_t Annex::Base<plug::math::f32> = 0x3825490000000200;
447template<> constexpr size_t Annex::Num<plug::math::f32> = 0;
448template<> constexpr flags_t Annex::Base<plug::math::f64> = 0x3825490000000300;
449template<> constexpr size_t Annex::Num<plug::math::f64> = 0;
450template<> constexpr flags_t Annex::Base<plug::math::bf16> = 0x3825490000000400;
451template<> constexpr size_t Annex::Num<plug::math::bf16> = 0;
452template<> constexpr flags_t Annex::Base<plug::math::nvtf32> = 0x3825490000000500;
453template<> constexpr size_t Annex::Num<plug::math::nvtf32> = 0;
454template<> constexpr flags_t Annex::Base<plug::math::amdfp24> = 0x3825490000000600;
455template<> constexpr size_t Annex::Num<plug::math::amdfp24> = 0;
456template<> constexpr flags_t Annex::Base<plug::math::pxr24> = 0x3825490000000700;
457template<> constexpr size_t Annex::Num<plug::math::pxr24> = 0;
458template<> constexpr flags_t Annex::Base<plug::math::F16> = 0x3825490000000800;
459template<> constexpr size_t Annex::Num<plug::math::F16> = 0;
460template<> constexpr flags_t Annex::Base<plug::math::F32> = 0x3825490000000900;
461template<> constexpr size_t Annex::Num<plug::math::F32> = 0;
462template<> constexpr flags_t Annex::Base<plug::math::F64> = 0x3825490000000a00;
463template<> constexpr size_t Annex::Num<plug::math::F64> = 0;
464template<> constexpr flags_t Annex::Base<plug::math::BF16> = 0x3825490000000b00;
465template<> constexpr size_t Annex::Num<plug::math::BF16> = 0;
466template<> constexpr flags_t Annex::Base<plug::math::NVTF32> = 0x3825490000000c00;
467template<> constexpr size_t Annex::Num<plug::math::NVTF32> = 0;
468template<> constexpr flags_t Annex::Base<plug::math::AMDFP24> = 0x3825490000000d00;
469template<> constexpr size_t Annex::Num<plug::math::AMDFP24> = 0;
470template<> constexpr flags_t Annex::Base<plug::math::PXR24> = 0x3825490000000e00;
471template<> constexpr size_t Annex::Num<plug::math::PXR24> = 0;
472template<> constexpr flags_t Annex::Base<plug::math::arith> = 0x3825490000000f00;
473template<> constexpr size_t Annex::Num<plug::math::arith> = 5;
474template<> constexpr flags_t Annex::Base<plug::math::minus> = 0x3825490000001000;
475template<> constexpr size_t Annex::Num<plug::math::minus> = 0;
476template<> constexpr flags_t Annex::Base<plug::math::extrema> = 0x3825490000001100;
477template<> constexpr size_t Annex::Num<plug::math::extrema> = 4;
478template<> constexpr flags_t Annex::Base<plug::math::tri> = 0x3825490000001200;
479template<> constexpr size_t Annex::Num<plug::math::tri> = 16;
480template<> constexpr flags_t Annex::Base<plug::math::pow> = 0x3825490000001300;
481template<> constexpr size_t Annex::Num<plug::math::pow> = 0;
482template<> constexpr flags_t Annex::Base<plug::math::rt> = 0x3825490000001400;
483template<> constexpr size_t Annex::Num<plug::math::rt> = 2;
484template<> constexpr flags_t Annex::Base<plug::math::exp> = 0x3825490000001500;
485template<> constexpr size_t Annex::Num<plug::math::exp> = 8;
486template<> constexpr flags_t Annex::Base<plug::math::er> = 0x3825490000001600;
487template<> constexpr size_t Annex::Num<plug::math::er> = 2;
488template<> constexpr flags_t Annex::Base<plug::math::gamma> = 0x3825490000001700;
489template<> constexpr size_t Annex::Num<plug::math::gamma> = 2;
490template<> constexpr flags_t Annex::Base<plug::math::abs> = 0x3825490000001800;
491template<> constexpr size_t Annex::Num<plug::math::abs> = 0;
492template<> constexpr flags_t Annex::Base<plug::math::round> = 0x3825490000001900;
493template<> constexpr size_t Annex::Num<plug::math::round> = 4;
494template<> constexpr flags_t Annex::Base<plug::math::cmp> = 0x3825490000001a00;
495template<> constexpr size_t Annex::Num<plug::math::cmp> = 16;
496template<> constexpr flags_t Annex::Base<plug::math::conv> = 0x3825490000001b00;
497template<> constexpr size_t Annex::Num<plug::math::conv> = 5;
498template<> constexpr flags_t Annex::Base<plug::math::slf> = 0x3825490000001c00;
499template<> constexpr size_t Annex::Num<plug::math::slf> = 0;
500template<> constexpr flags_t Annex::Base<plug::math::sgn> = 0x3825490000001d00;
501template<> constexpr size_t Annex::Num<plug::math::sgn> = 0;
502template<> constexpr flags_t Annex::Base<plug::math::rrt> = 0x3825490000001e00;
503template<> constexpr size_t Annex::Num<plug::math::rrt> = 0;
504
505template<> struct Axiom::Match<plug::math::f16> { using type = Axiom; };
506template<> struct Axiom::Match<plug::math::f32> { using type = Axiom; };
507template<> struct Axiom::Match<plug::math::f64> { using type = Axiom; };
508template<> struct Axiom::Match<plug::math::bf16> { using type = Axiom; };
509template<> struct Axiom::Match<plug::math::nvtf32> { using type = Axiom; };
510template<> struct Axiom::Match<plug::math::amdfp24> { using type = Axiom; };
511template<> struct Axiom::Match<plug::math::pxr24> { using type = Axiom; };
512template<> struct Axiom::Match<plug::math::F16> { using type = Axiom; };
513template<> struct Axiom::Match<plug::math::F32> { using type = Axiom; };
514template<> struct Axiom::Match<plug::math::F64> { using type = Axiom; };
515template<> struct Axiom::Match<plug::math::BF16> { using type = Axiom; };
516template<> struct Axiom::Match<plug::math::NVTF32> { using type = Axiom; };
517template<> struct Axiom::Match<plug::math::AMDFP24> { using type = Axiom; };
518template<> struct Axiom::Match<plug::math::PXR24> { using type = Axiom; };
519template<> struct Axiom::Match<plug::math::minus> { using type = Axiom; };
520template<> struct Axiom::Match<plug::math::slf> { using type = Axiom; };
521template<> struct Axiom::Match<plug::math::sgn> { using type = Axiom; };
522template<> struct Axiom::Match<plug::math::rrt> { using type = Axiom; };
523
524#endif
525} // namespace mim
526
527#ifndef DOXYGEN // don't include in Doxygen documentation
528
529template<> struct fe::is_bit_enum<mim::plug::math::arith> : std::true_type {};
530template<> struct fe::is_bit_enum<mim::plug::math::extrema> : std::true_type {};
531template<> struct fe::is_bit_enum<mim::plug::math::tri> : std::true_type {};
532template<> struct fe::is_bit_enum<mim::plug::math::rt> : std::true_type {};
533template<> struct fe::is_bit_enum<mim::plug::math::exp> : std::true_type {};
534template<> struct fe::is_bit_enum<mim::plug::math::er> : std::true_type {};
535template<> struct fe::is_bit_enum<mim::plug::math::gamma> : std::true_type {};
536template<> struct fe::is_bit_enum<mim::plug::math::round> : std::true_type {};
537template<> struct fe::is_bit_enum<mim::plug::math::cmp> : std::true_type {};
538template<> struct fe::is_bit_enum<mim::plug::math::conv> : std::true_type {};
539
540#endif
Helper class to retrieve Infer::arg if present.
Definition def.h:86
static constexpr plugin_t Plugin_Id
Definition autogen.h:10
Ref normalize_rt(Ref type, Ref c, Ref arg)
Ref normalize_abs(Ref type, Ref c, Ref arg)
Ref normalize_exp(Ref type, Ref c, Ref arg)
Ref normalize_tri(Ref type, Ref c, Ref arg)
Ref normalize_conv(Ref dst_t, Ref c, Ref x)
Ref normalize_extrema(Ref type, Ref c, Ref arg)
Ref normalize_er(Ref type, Ref c, Ref arg)
void register_normalizers(Normalizers &normalizers)
Ref normalize_round(Ref type, Ref c, Ref arg)
Ref normalize_arith(Ref type, Ref c, Ref arg)
Ref normalize_gamma(Ref type, Ref c, Ref arg)
Ref normalize_cmp(Ref type, Ref c, Ref arg)
Ref normalize_pow(Ref type, Ref c, Ref arg)
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