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});
50 auto& world = type->
world();
51 auto [mat, index] = arg->
projs<2>();
55 return world.extract(sizes, index);
71 for (
auto inp : inputs) {
72 auto [indices, mat] = inp->projs<2>();
73 auto indice_count =
Lit::isa(indices->arity());
74 if (!indice_count)
return -1;
75 for (
auto idx : indices->projs()) {
77 if (!idx_val)
return -1;
78 if (idx_val > max_idx) max_idx = idx_val.value();
auto projs(F f) const
Splits this Def via Def::projections into an Array (if A == std::dynamic_extent) or std::array (other...
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:
#define MIM_matrix_NORMALIZER_IMPL
Ref normalize_shape(Ref type, Ref callee, Ref arg)
Normalizer for transpose operations.
Ref normalize_transpose(Ref, Ref, Ref)
Ref normalize_prod(Ref, Ref, Ref)
Ref normalize_insert(Ref, Ref, Ref)
Normalizer for write operations TODO: implement.
u64 get_max_index(u64 init, Defs inputs)
Matrix normalizer for product on two-dimensional matrices.
Ref normalize_map_reduce(Ref, Ref, Ref)
map_reduce normalizers
Ref normalize_read(Ref type, Ref, Ref arg)
Normalizer for read opertions.