Namespaces | |
| namespace | phase |
Classes | |
| struct | 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... | |
Typedefs | |
| using | Ring = plug::btensor::Ring |
| using | Sched = plug::btensor::Sched |
| using | SchedT = plug::btensor::SchedT |
| using | mk_sched = plug::btensor::mk_sched |
| using | proj_map = plug::btensor::proj_map |
Enumerations | |
<tt>tensor.generate</tt> | |
| enum class | generate : flags_t |
<tt>tensor.splat</tt> | |
| enum class | splat : flags_t |
<tt>tensor.buf</tt> | |
| enum class | buf : flags_t |
<tt>tensor.id</tt> | |
| enum class | id : flags_t |
<tt>tensor.map_reduce_post</tt> | |
| enum class | map_reduce_post : flags_t |
<tt>tensor.map_reduce</tt> | |
| enum class | map_reduce : flags_t |
<tt>tensor.transpose_2d</tt> | |
| enum class | transpose_2d : flags_t |
<tt>tensor.binary</tt> | |
| enum class | binary : flags_t |
<tt>tensor.map</tt> | |
| enum class | map : flags_t |
<tt>tensor.select</tt> | |
| enum class | select : flags_t |
<tt>tensor.unary</tt> | |
| enum class | unary : flags_t |
<tt>tensor.bmm</tt> | |
| enum class | bmm : flags_t |
<tt>tensor.conv</tt> | |
| enum class | conv : flags_t |
<tt>tensor.conv_grouped</tt> | |
| enum class | conv_grouped : flags_t |
<tt>tensor.dot_product</tt> | |
| enum class | dot_product : flags_t |
<tt>tensor.pool</tt> | |
| enum class | pool : flags_t |
<tt>tensor.product_2d</tt> | |
| enum class | product_2d : flags_t |
<tt>tensor.gather</tt> | |
| enum class | gather : flags_t |
<tt>tensor.scatter</tt> | |
| enum class | scatter : flags_t |
<tt>tensor.interchange</tt> | |
| enum class | interchange : flags_t |
<tt>tensor.materialize</tt> | |
| enum class | materialize : flags_t |
<tt>tensor.mr_tileable</tt> | |
| enum class | mr_tileable : flags_t |
<tt>tensor.strip_mine_par</tt> | |
| enum class | strip_mine_par : flags_t |
<tt>tensor.strip_mine_red</tt> | |
| enum class | strip_mine_red : flags_t |
<tt>tensor.broadcast_in_dim_impl</tt> | |
| enum class | broadcast_in_dim_impl : flags_t |
<tt>tensor.flip_impl</tt> | |
| enum class | flip_impl : flags_t |
<tt>tensor.gather_pointwise_elem_impl</tt> | |
| enum class | gather_pointwise_elem_impl : flags_t |
<tt>tensor.map_impl</tt> | |
| enum class | map_impl : flags_t |
<tt>tensor.pool_impl</tt> | |
| enum class | pool_impl : flags_t |
<tt>tensor.repeat_impl</tt> | |
| enum class | repeat_impl : flags_t |
<tt>tensor.reshape_map</tt> | |
| enum class | reshape_map : flags_t |
<tt>tensor.reshape_impl</tt> | |
| enum class | reshape_impl : flags_t |
<tt>tensor.conv_impl</tt> | |
| enum class | conv_impl : flags_t |
<tt>tensor.conv_grouped_impl</tt> | |
| enum class | conv_grouped_impl : flags_t |
<tt>tensor.dot_product_impl</tt> | |
| enum class | dot_product_impl : flags_t |
<tt>tensor.bmm_impl</tt> | |
| enum class | bmm_impl : flags_t |
<tt>tensor.product_2d_impl</tt> | |
| enum class | product_2d_impl : flags_t |
<tt>tensor.scatter_step_impl</tt> | |
| enum class | scatter_step_impl : flags_t |
<tt>tensor.slice_impl</tt> | |
| enum class | slice_impl : flags_t |
<tt>tensor.transpose_impl</tt> | |
| enum class | transpose_impl : flags_t |
<tt>tensor.binary_impl</tt> | |
| enum class | binary_impl : flags_t |
<tt>tensor.select_impl</tt> | |
| enum class | select_impl : flags_t |
<tt>tensor.unary_impl</tt> | |
| enum class | unary_impl : flags_t |
<tt>tensor.reassoc</tt> | |
| enum class | reassoc : flags_t |
<tt>tensor.lower_tensor</tt> | |
| enum class | lower_tensor : flags_t |
<tt>tensor.lower_map_reduce</tt> | |
| enum class | lower_map_reduce : flags_t |
<tt>tensor.fuse_tensor</tt> | |
| enum class | fuse_tensor : flags_t |
<tt>tensor.lower_to_mem</tt> | |
| enum class | lower_to_mem : flags_t |
Functions | |
| bool | is_identity_map (const Def *mapmap) |
Is map the identity access map λ x. x? | |
| bool | 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 | is_identity_post (const Def *post) |
| Is post the (rebuilt) CPS identity tensor.id, i.e. | |
| std::optional< PureRead > | 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 > > | 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 > > | lit_perm (const Def *perm) |
perm as literals, if it is literal. | |
| std::optional< fe::Vector< u64 > > | transpose_perm (const App *app) |
| The permutation of a transpose app, if it is literal. | |
| const Def * | isa_transpose_2d (const Def *def) |
| The input of a 2-D transpose transpose (1, 0), or nullptr. | |
| DefMap< u64 > | count_consumers (const World &world, std::predicate< const Def * > auto pred) |
Counts the consumers of every def of world matched by pred. | |
| static void | reg_phases (Flags2Phases &phases) |
| void | register_normalizers (Normalizers &normalizers) |
Variables | |
| constexpr std::array | Vec_widths = {1_u64, 4_u64, 8_u64, 16_u64} |
| The vector widths -X tensor:vec-width accepts. | |
| static constexpr plugin_t | Plugin_Id = 0x5463d44130000000 |
<tt>tensor.shape</tt> | |
| enum class | shape : flags_t |
| const Def * | normalize_shape (const Def *, const Def *c, const Def *arg) |
<tt>tensor.broadcast</tt> | |
| enum class | broadcast : flags_t |
| const Def * | normalize_broadcast (const Def *type, const Def *c, const Def *arg) |
<tt>tensor.broadcast_in_dim</tt> | |
| enum class | broadcast_in_dim : flags_t |
| const Def * | normalize_broadcast_in_dim (const Def *, const Def *, const Def *) |
<tt>tensor.concat</tt> | |
| enum class | concat : flags_t |
| const Def * | normalize_concat (const Def *, const Def *, const Def *) |
<tt>tensor.flip</tt> | |
| enum class | flip : flags_t |
| const Def * | normalize_flip (const Def *, const Def *, const Def *) |
<tt>tensor.pad</tt> | |
| enum class | pad : flags_t |
| const Def * | normalize_pad (const Def *, const Def *c, const Def *arg) |
<tt>tensor.repeat</tt> | |
| enum class | repeat : flags_t |
| const Def * | normalize_repeat (const Def *type, const Def *c, const Def *arg) |
<tt>tensor.reshape</tt> | |
| enum class | reshape : flags_t |
| const Def * | normalize_reshape (const Def *type, const Def *c, const Def *arg) |
<tt>tensor.slice</tt> | |
| enum class | slice : flags_t |
| const Def * | normalize_slice (const Def *, const Def *c, const Def *arg) |
<tt>tensor.transpose</tt> | |
| enum class | transpose : flags_t |
| const Def * | normalize_transpose (const Def *, const Def *c, const Def *arg) |
<tt>tensor.fastest_axis</tt> | |
| enum class | fastest_axis : flags_t |
| const Def * | normalize_fastest_axis (const Def *, const Def *, const Def *arg) |
<tt>tensor.if_static</tt> | |
| enum class | if_static : flags_t |
| const Def * | normalize_if_static (const Def *, const Def *, const Def *arg) |
<tt>tensor.vec_width</tt> | |
| enum class | vec_width : flags_t |
| const Def * | normalize_vec_width (const Def *, const Def *, const Def *arg) |
| struct mim::plug::tensor::PureRead |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
| 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.
Tuples and packs are transparent argument wrappers, so a wrapped def is charged to the enclosing non-tuple consumer - a shared argument tuple charges each of its users, and a def used twice in one argument list counts twice. A phase whose world does not track uses needs this up front.
Definition at line 109 of file tensor.h.
References count_consumers(), mim::World::externals(), and mim::World::Externals::muts().
Referenced by count_consumers(), mim::plug::tensor::phase::Fuse::start(), and mim::plug::tensor::phase::Reassoc::start().
|
inline |
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.
Definition at line 25 of file tensor.h.
References mim::Def::as_mut(), is_copy_comb(), mim::Lam::isa_ret_arg(), and mim::Def::proj().
Referenced by is_copy_comb(), and is_pure_read().
|
inline |
Is map the identity access map λ x. x?
Definition at line 18 of file tensor.h.
References is_identity_map(), and mim::Def::is_set().
Referenced by is_identity_map(), and is_pure_read().
|
inline |
Is post the (rebuilt) CPS identity tensor.id, i.e.
a lam (x, extras) ↦ x that returns its first argument (and hence has no epilogue inputs)?
Definition at line 32 of file tensor.h.
References mim::Def::as_mut(), is_identity_post(), mim::Lam::isa_ret_arg(), and mim::Def::proj().
Referenced by is_identity_post(), and is_pure_read().
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.
fuse_tensor's read-through absorbs exactly these into the consuming op's access maps.
Definition at line 51 of file tensor.h.
References is_copy_comb(), is_identity_map(), is_identity_post(), is_pure_read(), mim::Axm::isa(), and mim::Lit::isa().
Referenced by is_pure_read(), normalize_fastest_axis(), mim::plug::tensor::phase::read_through(), and mim::plug::tensor::phase::Fuse::rewrite_imm_App().
The input of a 2-D transpose transpose (1, 0), or nullptr.
Definition at line 93 of file tensor.h.
References mim::Axm::isa(), mim::Lit::isa(), and isa_transpose_2d().
Referenced by isa_transpose_2d(), and mim::plug::tensor::phase::Reassoc::start().
perm as literals, if it is literal.
Definition at line 82 of file tensor.h.
References mim::Lit::isa(), lit_perm(), and lit_projs().
Referenced by lit_perm(), normalize_transpose(), and transpose_perm().
The literal values of def's n projections, or nothing if one of them is not a literal.
Definition at line 71 of file tensor.h.
References mim::Lit::isa(), lit_projs(), and mim::Def::proj().
Referenced by lit_perm(), and lit_projs().
| const Def * mim::plug::tensor::normalize_broadcast | ( | const Def * | type, |
| const Def * | c, | ||
| const Def * | arg ) |
Definition at line 18 of file normalizers.cpp.
References mim::App::args(), normalize_broadcast(), and mim::Def::projs().
Referenced by normalize_broadcast().
| const Def * mim::plug::tensor::normalize_broadcast_in_dim | ( | const Def * | , |
| const Def * | , | ||
| const Def * | ) |
Definition at line 32 of file normalizers.cpp.
References normalize_broadcast_in_dim().
Referenced by normalize_broadcast_in_dim().
Definition at line 99 of file normalizers.cpp.
References normalize_concat().
Referenced by normalize_concat().
| const Def * mim::plug::tensor::normalize_fastest_axis | ( | const Def * | , |
| const Def * | , | ||
| const Def * | arg ) |
Definition at line 110 of file normalizers.cpp.
References mim::Def::arity(), mim::Pi::codom(), mim::Pi::dom(), is_pure_read(), mim::Axm::isa(), mim::Lit::isa(), normalize_fastest_axis(), mim::Def::projs(), and mim::Def::world().
Referenced by normalize_fastest_axis().
Definition at line 83 of file normalizers.cpp.
References normalize_flip().
Referenced by normalize_flip().
Definition at line 101 of file normalizers.cpp.
References mim::Lit::isa(), normalize_if_static(), and mim::Def::projs().
Referenced by normalize_if_static().
Definition at line 85 of file normalizers.cpp.
References mim::Lit::isa(), normalize_pad(), and mim::Def::proj().
Referenced by normalize_pad().
| const Def * mim::plug::tensor::normalize_repeat | ( | const Def * | type, |
| const Def * | c, | ||
| const Def * | arg ) |
Definition at line 34 of file normalizers.cpp.
References normalize_repeat(), and mim::Def::type().
Referenced by normalize_repeat().
| const Def * mim::plug::tensor::normalize_reshape | ( | const Def * | type, |
| const Def * | c, | ||
| const Def * | arg ) |
Definition at line 42 of file normalizers.cpp.
References normalize_reshape(), and mim::Def::type().
Referenced by normalize_reshape().
Definition at line 155 of file normalizers.cpp.
References mim::App::arg(), mim::Lit::isa(), normalize_shape(), and mim::Def::type().
Referenced by normalize_shape().
Definition at line 68 of file normalizers.cpp.
References mim::Lit::isa(), and normalize_slice().
Referenced by normalize_slice().
Definition at line 50 of file normalizers.cpp.
References mim::Axm::isa(), lit_perm(), normalize_transpose(), and transpose_perm().
Referenced by normalize_transpose().
Definition at line 143 of file normalizers.cpp.
References normalize_vec_width(), Vec_widths, and mim::Def::world().
Referenced by normalize_vec_width().
|
static |
Definition at line 15 of file tensor.cpp.
References mim::Phase::hook(), and reg_phases().
Referenced by MIM_PLUGIN_ENTRY(), and reg_phases().
| void mim::plug::tensor::register_normalizers | ( | Normalizers & | normalizers | ) |
References register_normalizers().
Referenced by MIM_PLUGIN_ENTRY(), and register_normalizers().
The permutation of a transpose app, if it is literal.
Definition at line 88 of file tensor.h.
References mim::App::arg(), mim::App::decurry(), lit_perm(), and transpose_perm().
Referenced by normalize_transpose(), and transpose_perm().
|
staticconstexpr |
|
constexpr |
The vector widths -X tensor:vec-width accepts.
Definition at line 141 of file normalizers.cpp.
Referenced by normalize_vec_width().