static void get(backend::source_generator &src, const temporary<T, Tag, Expr> &term, const backend::command_queue &queue, const std::string &prm_name, detail::kernel_generator_state_ptr state) { auto s = state->find("tmp_locinit"); if (s == state->end()) { s = state->insert(std::make_pair( std::string("tmp_locinit"), boost::any(std::set<size_t>()) )).first; } auto &pos = boost::any_cast< std::set<size_t>& >(s->second); auto p = pos.find(Tag); if (p == pos.end()) { pos.insert(Tag); detail::output_local_preamble init_ctx(src, queue, prm_name, state); boost::proto::eval(boost::proto::as_child(term.expr), init_ctx); src.new_line() << type_name<T>() << " temp_" << Tag << " = "; detail::vector_expr_context expr_ctx(src, queue, prm_name, state); boost::proto::eval(boost::proto::as_child(term.expr), expr_ctx); src << ";"; } }
static void get(backend::source_generator &src, const tagged_terminal<Tag, Term> &term, const backend::command_queue &queue, const std::string&/*prm_name*/, detail::kernel_generator_state_ptr state) { auto s = state->find("tag_pream"); if (s == state->end()) { s = state->insert(std::make_pair( std::string("tag_pream"), boost::any(std::set<size_t>()) )).first; } auto &pos = boost::any_cast< std::set<size_t>& >(s->second); auto p = pos.find(Tag); if (p == pos.end()) { pos.insert(Tag); std::ostringstream prm_name; prm_name << "prm_tag_" << Tag; detail::output_terminal_preamble termpream(src, queue, prm_name.str(), state); boost::proto::eval(boost::proto::as_child(term.term), termpream); } }
static void set(const temporary<T, Tag, Expr> &term, backend::kernel &kernel, unsigned part, size_t index_offset, detail::kernel_generator_state_ptr state) { auto s = state->find("tmp_args"); if (s == state->end()) { s = state->insert(std::make_pair( std::string("tmp_args"), boost::any(std::set<size_t>()) )).first; } auto &pos = boost::any_cast< std::set<size_t>& >(s->second); auto p = pos.find(Tag); if (p == pos.end()) { pos.insert(Tag); detail::set_expression_argument setarg(kernel, part, index_offset, state); detail::extract_terminals()( boost::proto::as_child(term.expr), setarg); } }
static void get(backend::source_generator &src, const temporary<T, Tag, Expr> &term, const backend::command_queue &queue, const std::string &prm_name, detail::kernel_generator_state_ptr state) { auto s = state->find("tmp_param"); if (s == state->end()) { s = state->insert(std::make_pair( std::string("tmp_param"), boost::any(std::set<size_t>()) )).first; } auto &pos = boost::any_cast< std::set<size_t>& >(s->second); auto p = pos.find(Tag); if (p == pos.end()) { pos.insert(Tag); detail::declare_expression_parameter declare(src, queue, prm_name, state); detail::extract_terminals()(boost::proto::as_child(term.expr), declare); } }