20 auto& world = type->
world();
21 auto [
mem, mat, index] = arg->
projs<3>();
23 world.DLOG(
"normalizing read: mat: {}\n", mat);
25 if (
auto mex = mat->isa<
Extract>()) {
26 world.DLOG(
" extract: {}\n", mex);
27 auto ccall = mex->tuple();
28 world.DLOG(
" ex_mat: {}\n", ccall);
30 world.DLOG(
" const mat: {}\n", mcm);
31 auto [cmem, v] = mcm->arg()->projs<2>();
32 return world.tuple({
mem, v});
36 return world.raw_app(type, callee, arg);
42 auto& world = type->
world();
48 return world.
raw_app(type, callee, arg);
58 auto& world = type->
world();
59 auto [mat, index] = arg->
projs<2>();
63 return world.extract(sizes, index);
79 for (
auto inp : inputs) {
80 auto [indices, mat] = inp->projs<2>();
81 auto indice_count =
Lit::isa(indices->arity());
82 if (!indice_count)
return -1;
83 for (
auto idx : indices->projs()) {
85 if (!idx_val)
return -1;
86 if (idx_val > max_idx) max_idx = idx_val.value();
98 auto& world = type->
world();
101 return world.
raw_app(type, callee, arg);
105 auto& world = type->
world();
106 return world.
raw_app(type, callee, arg);
110 auto& world = type->
world();
111 return world.
raw_app(type, callee, arg);
auto projs(F f) const
Splits this Def via Def::projections into an Array (if A == -1_n) or std::array (otherwise).
static std::optional< T > isa(Ref def)
Helper class to retrieve Infer::arg if present.
This is a thin wrapper for std::span<T, N> with the following additional features:
Ref raw_app(Ref type, Ref callee, Ref arg)
#define MIM_matrix_NORMALIZER_IMPL
Ref normalize_shape(Ref type, Ref callee, Ref arg)
Normalizer for transpose operations.
Ref normalize_insert(Ref type, Ref callee, Ref arg)
Normalizer for write operations TODO: implement.
Ref normalize_prod(Ref type, Ref callee, Ref arg)
Ref normalize_map_reduce(Ref type, Ref callee, Ref arg)
map_reduce normalizers
Ref normalize_read(Ref type, Ref callee, Ref arg)
Normalizer for read opertions.
u64 get_max_index(u64 init, Defs inputs)
Matrix normalizer for product on two-dimensional matrices.
Ref normalize_transpose(Ref type, Ref callee, Ref arg)