MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
lower_map_reduce.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 (`btensor.map_reduce_post`, `btensor.broadcast`, `btensor.pad`,
9/// `btensor.concat`, `btensor.gather`, `btensor.scatter`) into `affine.For` loop nests over
10/// `buffer.read` / `buffer.write` / `buffer.alloc`, 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.lit` 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 LowerMapReduce : public RWPhase {
16public:
19
20private:
21 const Def* rewrite_imm_App(const App*) override;
22 const Def* lower_map_reduce_post(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_lit(const App*);
27 const Def* lower_gather(const App*);
28 const Def* lower_scatter(const App*);
29};
30
31} // namespace mim::plug::btensor::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
LowerMapReduce(World &world, flags_t annex)
const Def * rewrite_imm_App(const App *) override
u64 flags_t
Definition types.h:39