MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
lower.h
Go to the documentation of this file.
1#pragma once
2
3#include <mim/phase.h>
4
6
7/// Lowers the high-level tensor axioms into the low-level tensor axioms (`map_reduce`,
8/// `broadcast`, …). For axioms that come with a matching `*_impl` annex (a `lam` with
9/// the same signature as the axiom) the lowering simply re-applies the args to the
10/// `_impl` annex; each `_impl` body references the `_impl` variants of its
11/// dependencies, so the chain of beta-reductions bottoms out at the low-level axioms
12/// in one step. `broadcast_in_dim` does not have an `_impl` counterpart and is
13/// desugared directly. The resulting low-level axioms are then expected to be
14/// lowered to primitives by `LowerMapReduce`.
15class Lower : public RWPhase {
16public:
19
20private:
21 const Def* rewrite_imm_App(const App*) final;
22
23 const Def* lower_broadcast_in_dim(const App*);
24 const Def* lower_via_impl(const App*, const Def* impl_annex);
25};
26
27} // namespace mim::plug::tensor::phase
Base class for all Defs.
Definition def.h:246
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition phase.h:194
World & world()=delete
Hides both and forbids direct access.
flags_t annex() const
Definition pass.h:81
The World represents the whole program and manages creation of MimIR nodes (Defs).
Definition world.h:36
const Def * rewrite_imm_App(const App *) final
Definition lower.cpp:107
Lower(World &world, flags_t annex)
Definition lower.h:17
u64 flags_t
Definition types.h:39