MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
tensor.h File Reference
#include <optional>
#include <fe/worklist.h>
#include <mim/driver.h>
#include <mim/lam.h>
#include <mim/plugin.h>
#include <mim/tuple.h>
#include <mim/world.h>
#include "mim/plug/tensor/autogen.h"
Include dependency graph for tensor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mim::plug::tensor::PureRead
 A pure re-indexed read: the source tensor, the access map into it (over the read's output coordinates), and the source's element type/rank/shape. More...

Namespaces

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

Functions

bool mim::plug::tensor::is_identity_map (const Def *mapmap)
 Is map the identity access map λ x. x?
bool mim::plug::tensor::is_copy_comb (const Def *comb)
 Recognizes the (rebuilt) tensor_copy combiner (acc, ys) ↦ ys#0: the result is exactly the single input element, so a map_reduce built on it is a pure re-indexed read of that input.
bool mim::plug::tensor::is_identity_post (const Def *post)
 Is post the (rebuilt) CPS identity tensor.id, i.e.
std::optional< PureRead > mim::plug::tensor::is_pure_read (const Def *value)
 If value is a pure re-indexed read — a copy-combiner map_reduce without reduction loops that writes its full loop domain through the identity output map (reshape/transpose/slice/flip/repeat lower to these) — returns its single access map and source.
std::optional< fe::Vector< u64 > > mim::plug::tensor::lit_projs (const Def *def, u64 n)
 The literal values of def's n projections, or nothing if one of them is not a literal.
std::optional< fe::Vector< u64 > > mim::plug::tensor::lit_perm (const Def *perm)
 perm as literals, if it is literal.
std::optional< fe::Vector< u64 > > mim::plug::tensor::transpose_perm (const App *app)
 The permutation of a transpose app, if it is literal.
const Def * mim::plug::tensor::isa_transpose_2d (const Def *def)
 The input of a 2-D transpose transpose (1, 0), or nullptr.
DefMap< u64 > mim::plug::tensor::count_consumers (const World &world, std::predicate< const Def * > auto pred)
 Counts the consumers of every def of world matched by pred.

Class Documentation

◆ mim::plug::tensor::PureRead

struct mim::plug::tensor::PureRead

A pure re-indexed read: the source tensor, the access map into it (over the read's output coordinates), and the source's element type/rank/shape.

Definition at line 39 of file tensor.h.

Class Members
const Def * map = nullptr
const Def * R = nullptr
const Def * S = nullptr
const Def * src = nullptr
const Def * T = nullptr