MimIR
0.4-dev
MimIR is my Intermediate Representation
Toggle main menu visibility
Loading...
Searching...
No Matches
fuse.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
mim/phase.h
>
4
5
namespace
mim::plug::tensor::phase
{
6
7
class
Fuse
:
public
RWPhase
{
8
public
:
9
Fuse
(
World
&
world
,
flags_t
annex
)
10
:
RWPhase
(
world
,
annex
) {}
11
12
private
:
13
void
start
()
override
;
14
const
Def
*
rewrite_imm_App
(
const
App
*)
final
;
15
16
const
Def
* fuse_map_reduce(
const
App
*);
17
const
Def
* fuse_epilogue(
const
App
* callee,
const
Def
* arg);
18
const
Def
* fuse_read_through(
const
App
* callee,
const
Def
* arg);
19
bool
sole_consumer(
const
Def
*)
const
;
20
21
/// Old-world consumer count per `map_reduce_post` app (attributed through tuple wrappers), for
22
/// the epilogue direction's single-consumer guard.
23
DefMap<u64>
mr_consumers_;
24
/// New-world defs whose consumers were multiplied by bypassing a shared (or uncounted) read;
25
/// the old-world count cannot see this, so `sole_consumer` rejects them.
26
DefSet
shared_;
27
/// Rewritten/fused `map_reduce_post` app → the old-world app it replaces, to look up the
28
/// consumer count of new-world fusion candidates.
29
DefMap<const Def*>
new2old_;
30
};
31
32
}
// 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::Fuse::start
void start() override
Actual entry.
Definition
fuse.cpp:637
mim::plug::tensor::phase::Fuse::Fuse
Fuse(World &world, flags_t annex)
Definition
fuse.h:9
mim::plug::tensor::phase::Fuse::rewrite_imm_App
const Def * rewrite_imm_App(const App *) final
Definition
fuse.cpp:643
mim::plug::tensor::phase
Definition
constraints.h:5
mim::flags_t
u64 flags_t
Definition
types.h:39
mim::DefMap
GIDMap< const Def *, To > DefMap
Definition
def.h:88
mim::DefSet
GIDSet< const Def * > DefSet
Definition
def.h:89
phase.h
include
mim
plug
tensor
phase
fuse.h
Generated by
1.18.0