MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
lower_aff.h
Go to the documentation of this file.
1#pragma once
2
3#include <mim/def.h>
4#include <mim/phase.h>
5
7
8/// Lowers the buffer-world operations (`%matrix.map_reduce_aff`, `%matrix.broadcast`, `%matrix.pad`,
9/// `%matrix.concat`) into `affine.For` loop nests over `%buffer.read` / `%buffer.write` / `%buffer.alloc`,
10/// threading `%mem.M`.
11/// These are the buffer-world counterparts of the corresponding `%tensor.*` ops; the `tensor` plugin's
12/// bufferization (`%tensor.lower_to_mem`) maps the SSA tensor ops onto them.
13/// Also lowers `%buffer.constant` into a fill loop, so a large constant/splat tensor becomes a loop rather
14/// than a monolithic `%mem.store` of a giant literal array (which the LLVM backend cannot digest).
15class LowerAff : public RWPhase {
16public:
19
20private:
21 const Def* rewrite_imm_App(const App*) override;
22 const Def* lower_map_reduce_aff(const App*);
23 const Def* lower_broadcast(const App*);
24 const Def* lower_pad(const App*);
25 const Def* lower_concat(const App*);
26 const Def* lower_buffer_constant(const App*);
27};
28
29} // namespace mim::plug::matrix::phase
Base class for all Defs.
Definition def.h:261
flags_t annex() const
Definition phase.h:81
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition phase.h:316
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:36
LowerAff(World &world, flags_t annex)
Definition lower_aff.h:17
const Def * rewrite_imm_App(const App *) override
Definition lower_aff.cpp:99
u64 flags_t
Definition types.h:39