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 <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
using
RWPhase::RWPhase
;
16
17
private
:
18
const
Def
*
rewrite_imm_App
(
const
App
*)
final
;
19
20
const
Def
* lower_broadcast(
const
App
*);
21
const
Def
* lower_map_reduce(
const
App
*);
22
const
Def
* lower_generate(
const
App
*);
23
const
Def
* lower_pad(
const
App
*);
24
const
Def
* lower_concat(
const
App
*);
25
const
Def
* lower_gather(
const
App
*);
26
const
Def
* lower_scatter(
const
App
*);
27
28
/// Builds `ro` output loops over `So` and writes the element returned by `compute(out_iters, inputs)` at the
29
/// identity output coordinates. `out_iters` are the raw i64 loop counters. Used by the non-affine pointwise
30
/// lowerings (`pad`, `concat`) whose element value is chosen conditionally on the output coordinate.
31
const
Def
* build_pointwise(
const
Def
* inputs,
32
const
Def
* type,
33
const
Def
* So,
34
u64
ro,
35
std::function<
const
Def
*(
Defs
,
const
Def
*)> compute);
36
37
const
Def
* rec_broadcast(
const
Def
* s_in,
const
Def
* s_out,
const
Def
* input,
u64
r,
u64
i);
38
};
39
40
}
// namespace mim::plug::tensor::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::tensor::phase::LowerMapReduce
Lowers the low-level tensor axioms (map_reduce, generate, pad, concat, broadcast) directly to their u...
Definition
lower_map_reduce.h:13
mim::plug::tensor::phase::LowerMapReduce::rewrite_imm_App
const Def * rewrite_imm_App(const App *) final
Definition
lower_map_reduce.cpp:388
mim::plug::tensor::phase::LowerMapReduce::RWPhase
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition
phase.h:334
mim::plug::tensor::phase
Definition
constraints.h:5
mim::Defs
fe::View< const Def * > Defs
Definition
def.h:96
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