Improve schedule/as_matmul
matching on hybrid loop-libop code
#522
Labels
enhancement
New feature or request
schedule/as_matmul
matching on hybrid loop-libop code
#522
Current
schedule/as_matmul
can't match some basic cases when there are both loops andlibop
calls. Example:This code cannot be mapped to a
Matmul
node becauselibop
introduces intermediate local variables. The code is actually like this:In order to deal with this case, we need two following changes:
inline
on every variables inside the matching sub-tree. There will be no side-effect because the matching will fail otherwise. This will solve the problem oft
in this example.anti_inline
, that removes an intermediate variable an redirect allStore
s to it to the final destination. We can implementanti_inline
for only variables that are copied to another variable with modifications (likec[i] = u
). These will also be no side-effect because the matching will fail otherwise. This will solve the problem ofu
.After implementing the changes above,
schedule/as_matmul
is expected to match this code to aMatmul
, but still can't deal with its derivatives. In order to accept such a code in AD, will need one more change:Matmul
s in oneschedule/as_matmul
call, instead of relying on#! prefer_libs
to fission the loops.The text was updated successfully, but these errors were encountered: