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/// Each high-level axiom comes with a matching `*_impl` annex (a
9/// `lam` with the same signature as the axiom); the lowering simply re-applies the args
10/// to the `_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 in
12/// one step. The resulting low-level axioms are then lowered to primitives by
13/// `LowerMapReduce`.
14class Lower : public RWPhase {
15public:
18
19private:
20 const Def* rewrite_imm_App(const App*) final;
21
22 const Def* lower_via_impl(const App*, const Def* impl_annex);
23 /// `tensor.fastest_axis` applied to the dot family's right operand (of the given rank):
24 /// the reflection the dot `_impl`s take as their leading argument, pre-applied here because the
25 /// operand is only concrete at this staging point. The schedule decision built on the answer
26 /// stays in the `_impl`'s IR (see tensor.dot_product_impl).
27 const Def* fastest_axis_2(const App*, const Def* rank);
28};
29
30} // namespace mim::plug::tensor::phase
Base class for all Defs.
Definition def.h:273
flags_t annex() const
Definition phase.h:81
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition phase.h:431
World & world()=delete
Hides both and forbids direct access.
The World represents the whole program and manages creation of MimIR nodes (Defs).
Definition world.h:40
const Def * rewrite_imm_App(const App *) final
Definition lower.cpp:35
Lower(World &world, flags_t annex)
Definition lower.h:16
u64 flags_t
Definition types.h:39