MimIR
0.4-dev
MimIR is my Intermediate Representation
Toggle main menu visibility
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
6
namespace
mim::plug::btensor::phase
{
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).
15
class
LowerMapReduce
:
public
RWPhase
{
16
public
:
17
LowerMapReduce
(
World
&
world
,
flags_t
annex
)
18
:
RWPhase
(
world
,
annex
) {}
19
20
private
:
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
mim::App
Definition
lam.h:224
mim::Def
Base class for all Defs.
Definition
def.h:273
mim::Phase::annex
flags_t annex() const
Definition
phase.h:81
mim::RWPhase::RWPhase
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition
phase.h:431
mim::RWPhase::world
World & world()=delete
Hides both and forbids direct access.
mim::World
The World represents the whole program and manages creation of MimIR nodes (Defs).
Definition
world.h:40
mim::plug::btensor::phase::LowerMapReduce::LowerMapReduce
LowerMapReduce(World &world, flags_t annex)
Definition
lower_map_reduce.h:17
mim::plug::btensor::phase::LowerMapReduce::rewrite_imm_App
const Def * rewrite_imm_App(const App *) override
Definition
lower_map_reduce.cpp:100
def.h
mim::plug::btensor::phase
Definition
lower_map_reduce.h:6
mim::flags_t
u64 flags_t
Definition
types.h:39
phase.h
include
mim
plug
btensor
phase
lower_map_reduce.h
Generated by
1.18.0