{
return std::make_tuple(engine_type, primitive.get_dependency(0).get_output_layout().data_type, primitive.get_dependency(0).get_output_layout().format);
}
+ type operator()(engine_types engine_type, const layout& proposed_layout)
+ {
+ return std::make_tuple(engine_type, proposed_layout.data_type, proposed_layout.format);
+ }
};
template<>
{
return engine_type;
}
+ type operator()(engine_types engine_type, const layout&)
+ {
+ return engine_type;
+ }
};
template<>
{
return engine_type;
}
+ type operator()(engine_types engine_type, const layout&)
+ {
+ return engine_type;
+ }
+
};
template<>
{
return engine_type;
}
+ type operator()(engine_types engine_type, const layout&)
+ {
+ return engine_type;
+ }
+
};
template<>
{
return engine_type;
}
+ type operator()(engine_types engine_type, const layout&)
+ {
+ return engine_type;
+ }
+
};
template<>
{
return engine_type;
}
+ type operator()(engine_types engine_type, const layout&)
+ {
+ return engine_type;
+ }
+
};
template<>
{
return engine_type;
}
+ type operator()(engine_types engine_type, const layout&)
+ {
+ return engine_type;
+ }
+
};
template<>
{
return engine_type;
}
+ type operator()(engine_types engine_type, const layout&)
+ {
+ return engine_type;
+ }
};
template<>
{
return engine_type;
}
+ type operator()(engine_types engine_type, const layout&)
+ {
+ return engine_type;
+ }
+
};
template<>
{
return engine_type;
}
+ type operator()(engine_types engine_type, const layout&)
+ {
+ return engine_type;
+ }
};
template<typename primitive_kind>
auto key = key_builder()(engine_type, primitive);
auto it = map_type::instance().find(key);
if (it == std::end(map_type::instance()))
- throw std::runtime_error(std::string("implementation_map for ")+typeid(primitive_kind).name() +" could not find any implementation to match key");
-
+ throw std::runtime_error(
+ std::string("implementation_map for ") + typeid(primitive_kind).name()
+ + " could not find any implementation to match key");
// create implementation & attach it to result
return it->second;
}
+ //check if for a given engine and type there exist an implementation
+ static bool check(engine_types engine_type, const typed_program_node<primitive_kind>& primitive)
+ {
+ auto key = key_builder()(engine_type, primitive);
+ auto it = map_type::instance().find(key);
+ if (it == std::end(map_type::instance()))
+ return false;
+ else
+ return true;
+ }
+
+ //check if there exists a kernel implementation of a primitive with output set it primitive's output layout
+ static bool check_io_eq(engine_types engine_type, const typed_program_node<primitive_kind>& primitive)
+ {
+ auto key = key_builder()(engine_type, primitive.get_output_layout());
+ auto it = map_type::instance().find(key);
+ if (it == std::end(map_type::instance()))
+ return false;
+ else
+ return true;
+ }
+
static void add(typename map_type::key_type key, factory_type factory) {
map_type::instance().insert({ key, factory });
}