MimIR
0.5-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
using
RWPhase::RWPhase
;
18
19
private
:
20
const
Def
*
rewrite_imm_App
(
const
App
*)
override
;
21
const
Def
* lower_map_reduce_post(
const
App
*);
22
const
Def
* lower_broadcast(
const
App
*);
23
const
Def
* lower_pad(
const
App
*);
24
const
Def
* lower_concat(
const
App
*);
25
const
Def
* lower_buffer_lit(
const
App
*);
26
const
Def
* lower_gather(
const
App
*);
27
const
Def
* lower_scatter(
const
App
*);
28
};
29
30
}
// namespace mim::plug::btensor::phase
mim::App
Definition
lam.h:215
mim::Def
Base class for all Defs.
Definition
def.h:289
mim::RWPhase::RWPhase
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition
phase.h:334
mim::plug::btensor::phase::LowerMapReduce
Lowers the buffer-world operations (btensor.map_reduce_post, btensor.broadcast, btensor....
Definition
lower_map_reduce.h:15
mim::plug::btensor::phase::LowerMapReduce::rewrite_imm_App
const Def * rewrite_imm_App(const App *) override
Definition
lower_map_reduce.cpp:17
mim::plug::btensor::phase::LowerMapReduce::RWPhase
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition
phase.h:334
def.h
mim::plug::btensor::phase
Definition
lower_map_reduce.h:6
phase.h
include
mim
plug
btensor
phase
lower_map_reduce.h
Generated by
1.18.0