def do_plan(context, graph): """ Take the ATerm expression graph and do inner-most evaluation to generate a linear sequence of instructions from that together with the table of inputs and outputs, built kernels forms the execution plan. Example:: :: a + b * c :: vars %a %b %c %0 = Elemwise[np.mul,nogil](%b, %c) %0 = Elemwise[np.add,nogil,inplace](%a, %0) ret %0 """ context = dict(context) aterm_graph = context['aterm_graph'] igen = InstructionGen() igen.visit(aterm_graph) # effectful plan = igen.plan() context['plan'] = plan return context, graph