61 assert(!
Axm::isa<matrix::prod>(app) &&
"high level operations should have been lowered to for loops by now");
63 assert(!
Axm::isa<matrix::sum>(app) &&
"high level operations should have been lowered to for loops by now");
68 auto [_, S, T] = mat_ax->args<3>();
71 auto arr_ty = arr_ty_of_matrix_ty(S, T);
73 auto addr_space = w.lit_nat_0();
74 auto ptr_ty = w.call<
mem::Ptr>(
Defs{arr_ty, addr_space});
78 w.DLOG(
"init {} : {}", app, app->
type());
79 auto [_, S, T,
mem] = init_ax->args<4>();
80 w.DLOG(
" S T mem {} {} {}", S, T,
mem);
84 w.DLOG(
" S T mem {} {} {}", S, T,
mem);
85 auto arr_ty = arr_ty_of_matrix_ty(S, T);
87 auto res = w.tuple({mem2, ptr_mat});
88 w.DLOG(
" res {} : {}", res, res->type());
91 auto [
mem, mat, idx] = read_ax->args<3>();
92 w.DLOG(
"read_ax: {}", read_ax);
93 w.DLOG(
" mem: {} : {}",
mem,
mem->type());
94 w.DLOG(
" mat: {} : {}", mat, mat->type());
95 w.DLOG(
" idx: {} : {}", idx, idx->type());
99 w.DLOG(
"rewritten read");
100 w.DLOG(
" mem: {} : {}",
mem,
mem->type());
101 w.DLOG(
" mat: {} : {}", mat, mat->type());
102 w.DLOG(
" idx: {} : {}", idx, idx->type());
105 auto element_ptr = op_lea_tuple(ptr_mat, idx);
107 return w.tuple({mem2, val});
109 auto [
mem, mat, idx, val] = insert_ax->args<4>();
110 w.DLOG(
"insert_ax: {}", insert_ax);
111 w.DLOG(
" mem: {} : {}",
mem,
mem->type());
112 w.DLOG(
" mat: {} : {}", mat, mat->type());
113 w.DLOG(
" idx: {} : {}", idx, idx->type());
114 w.DLOG(
" val: {} : {}", val, val->type());
119 w.DLOG(
"rewritten insert");
120 w.DLOG(
" mem: {} : {}",
mem,
mem->type());
121 w.DLOG(
" mat: {} : {}", mat, mat->type());
122 w.DLOG(
" idx: {} : {}", idx, idx->type());
123 w.DLOG(
" val: {} : {}", val, val->type());
125 auto element_ptr = op_lea_tuple(ptr_mat, idx);
127 return w.tuple({mem2, ptr_mat});
129 auto [
mem, val] = const_ax->args<2>();
132 auto [n_def, S, T] = const_ax->callee()->as<
App>()->args<3>();
135 auto arr_ty = arr_ty_of_matrix_ty(S, T);
140 auto initial = op_pack_tuple(n, S, val);
144 return w.tuple({mem3, ptr_mat});
147 return Rewriter::rewrite_imm_App(app);