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 <functional>
4
5
#include <
mim/phase.h
>
6
7
namespace
mim::plug::tensor::phase
{
8
9
/// Lowers the low-level tensor axioms (`map_reduce`, `generate`, `pad`, `concat`, `broadcast`)
10
/// directly to their underlying primitives (loops, `extract`, `insert`, `pack`, …).
11
/// High-level axioms (`transpose`, `conv`, `broadcast_in_dim`, …) are expected to have been desugared to
12
/// these low-level axioms by an earlier `Lower` phase.
13
class
LowerMapReduce
:
public
RWPhase
{
14
public
:
15
LowerMapReduce
(
World
&
world
,
flags_t
annex
)
16
:
RWPhase
(
world
,
annex
) {}
17
18
private
:
19
const
Def
*
rewrite_imm_App
(
const
App
*)
final
;
20
21
const
Def
* lower_broadcast(
const
App
*);
22
const
Def
*
lower_map_reduce
(
const
App
*);
23
const
Def
* lower_generate(
const
App
*);
24
const
Def
* lower_pad(
const
App
*);
25
const
Def
* lower_concat(
const
App
*);
26
const
Def
* lower_gather(
const
App
*);
27
const
Def
* lower_scatter(
const
App
*);
28
29
/// Builds `ro` output loops over `So` and writes the element returned by `compute(out_iters, inputs)` at the
30
/// identity output coordinates. `out_iters` are the raw i64 loop counters. Used by the non-affine pointwise
31
/// lowerings (`pad`, `concat`) whose element value is chosen conditionally on the output coordinate.
32
const
Def
* build_pointwise(
const
Def
* inputs,
33
const
Def
* type,
34
const
Def
* So,
35
u64
ro,
36
std::function<
const
Def
*(
Defs
,
const
Def
*)> compute);
37
38
const
Def
* rec_broadcast(
const
Def
* s_in,
const
Def
* s_out,
const
Def
* input,
u64
r,
u64
i);
39
};
40
41
}
// namespace mim::plug::tensor::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::tensor::phase::LowerMapReduce::rewrite_imm_App
const Def * rewrite_imm_App(const App *) final
Definition
lower_map_reduce.cpp:516
mim::plug::tensor::phase::LowerMapReduce::LowerMapReduce
LowerMapReduce(World &world, flags_t annex)
Definition
lower_map_reduce.h:15
mim::plug::tensor::phase
Definition
constraints.h:5
mim::plug::tensor::lower_map_reduce
lower_map_reduce
Definition
autogen.h:426
mim::flags_t
u64 flags_t
Definition
types.h:39
mim::Defs
fe::View< const Def * > Defs
Definition
def.h:91
mim::u64
uint64_t u64
Definition
types.h:27
phase.h
include
mim
plug
tensor
phase
lower_map_reduce.h
Generated by
1.18.0