MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
fuse.cpp File Reference
#include "mim/plug/tensor/phase/fuse.h"
#include <optional>
#include <fe/bitset.h>
#include <mim/def.h>
#include <mim/lam.h>
#include <mim/tuple.h>
#include <mim/util/types.h>
#include <mim/plug/affine/affine.h>
#include <mim/plug/core/core.h>
#include <mim/plug/cps/cps.h>
#include "mim/plug/tensor/tensor.h"
Include dependency graph for fuse.cpp:

Go to the source code of this file.

Classes

struct  mim::plug::tensor::phase::Slots
 The five parallel per-slot lists of a map_reduce_post input group: element type, rank, shape, access map, and the tensor itself. More...

Namespaces

namespace  mim
namespace  mim::plug
namespace  mim::plug::tensor
 The tensor Plugin
namespace  mim::plug::tensor::phase

Functions

static std::optional< u64mim::plug::tensor::phase::injective_coord (const Def *var, const Def *e)
 If e reads coordinate var#i injectively, returns i: a plain extract, possibly strided (affine.semiop.mul by a non-zero literal) and/or shifted (affine.op.add/sub with a loop-invariant affine.lit on the other side).
static bool mim::plug::tensor::phase::reads_injectively (const Def *mapmap)
 Checks that map provably reads through every loop index of its domain: its body is the identity, or each result coordinate is an injective read of one loop index (see injective_coord) and together they cover all indices.
static const Defmim::plug::tensor::phase::compose_map (World &w, const Def *inner, const Def *outer)
 inner ∘ outer: feeds the outer op's read coordinates for one input into the inner op's access map.
static std::optional< PureReadmim::plug::tensor::phase::read_through (World &w, const Def *value, const Def *slot_map)
 If value is a pure re-indexed read — a copy-combiner map_reduce (reshape/transpose/slice/ flip/repeat lower to these) or a tensor.broadcast — returns its source and access map, to be composed behind the consuming slot's map.
static bool mim::plug::tensor::phase::is_unpack_read (World &w, const Def *mapmap, const Def *r_in, const Def *s_in, const Def *r_out, const Def *s_out)
 Is map the row-major reshape read tensor.reshape_map (s_in, s_out) — the map that reads a PACKED producer (its output strip-mined to s_in) at the unpacked coordinates s_out?