MimIR
0.5-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
using
RWPhase::RWPhase
;
10
11
private
:
12
void
start
()
override
;
13
const
Def
*
rewrite_imm_App
(
const
App
*)
final
;
14
15
const
Def
* fuse_map_reduce(
const
App
*);
16
const
Def
* fuse_epilogue(
const
App
* callee,
const
Def
* arg);
17
const
Def
* fuse_read_through(
const
App
* callee,
const
Def
* arg);
18
bool
sole_consumer(
const
Def
*)
const
;
19
20
/// Old-world consumer count per `map_reduce_post` app (attributed through tuple wrappers), for
21
/// the epilogue direction's single-consumer guard.
22
DefMap<u64>
mr_consumers_;
23
/// New-world defs whose consumers were multiplied by bypassing a shared (or uncounted) read;
24
/// the old-world count cannot see this, so `sole_consumer` rejects them.
25
DefSet
shared_;
26
/// Rewritten/fused `map_reduce_post` app → the old-world app it replaces, to look up the
27
/// consumer count of new-world fusion candidates.
28
DefMap<const Def*>
new2old_;
29
};
30
31
}
// 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::Fuse
Definition
fuse.h:7
mim::plug::tensor::phase::Fuse::start
void start() override
Actual entry.
Definition
fuse.cpp:600
mim::plug::tensor::phase::Fuse::RWPhase
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition
phase.h:334
mim::plug::tensor::phase::Fuse::rewrite_imm_App
const Def * rewrite_imm_App(const App *) final
Definition
fuse.cpp:606
mim::plug::tensor::phase
Definition
constraints.h:5
mim::DefMap
GIDMap< const Def *, To > DefMap
Definition
def.h:93
mim::DefSet
GIDSet< const Def * > DefSet
Definition
def.h:94
phase.h
include
mim
plug
tensor
phase
fuse.h
Generated by
1.18.0