Go to the documentation of this file.
31 virtual Mapping mapOpGraph(std::shared_ptr<OpGraph> opgraph,
int II,
const MRRG& mrrg, std::unordered_map<std::string, std::string> fix_port) = 0;
37 std::shared_ptr<CGRA>
cgra;
84 std::unique_ptr<Mapper>
createMapper(
const std::string& mapper_id, std::shared_ptr<CGRA> cgra,
int timelimit,
const ConfigStore& args)
const;
100 std::string mapper_id,
MapperMaker maker,
bool is_composite, std::string mapper_description,
102 std::vector<std::pair<std::string, std::string>> optional_arg_regexes_and_descriptions
138 return m_mapper_makers.at(mapper_id).is_composite ? mapper_id +
'.' :
"";
150 const auto matches_key = [&](
const auto& name_and_regex_and_doc) {
return regex_match(arg, name_and_regex_and_doc.second.first); };
206 std::string mapper_id,
MapperMaker maker,
bool is_composite, std::string mapper_description,
208 std::vector<std::pair<std::string, std::string>> optional_arg_regexes_and_descriptions
void printMapperList(std::ostream &os) const
Print a message with every mapper's id and description.
ConfigStore getAllRegisteredArgDefaults() const
Retrieve all registered default values for required arguments as a ConfigStore.
std::map< std::string, MakerAndDescription > m_mapper_makers
const std::string makeKeyPrefix(const std::string &mapper_id) const
ConfigStore registered_defaults
virtual Mapping mapOpGraph(std::shared_ptr< OpGraph > opgraph, int II, const MRRG &mrrg, std::unordered_map< std::string, std::string > fix_port)=0
Holds instances of mapper makers and creates mappers by ID, while resolving arguments.
Special helper for registering mappers to the default mapper registry.
Common interface for mappers.
auto findMatchingArg(const std::string &arg) const
void printHelpForMapper(const std::string &mapper_id, const ConfigStore &args, std::ostream &os) const
Print a detailed message about a mapper and the suggested args, including all required and optional a...
bool hasKey(const std::string &key) const
MapperRegistry & operator=(const MapperRegistry &)=default
void printDefaultsAsINI(std::ostream &os) const
Print an INI file with all registered defaults and some comments based on short descriptions.
Mapper(std::shared_ptr< CGRA > cgra, int timelimit)
std::map< std::string, std::pair< std::regex, std::string > > allowed_arg_regexes_and_documentation
static const MapperRegistry & getDefaultRegistry()
Public read-only access to the mapper registry that this class automatically adds mappers to.
std::shared_ptr< CGRA > cgra
static MapperRegistry & getDefaultMutableRegisty()
std::function< std::unique_ptr< Mapper >(std::shared_ptr< CGRA >, int, const ConfigStore &)> MapperMaker
Function type for registering mappers.
ConfigStore getMapperArgs(const std::string &mapper_id, const ConfigStore &args) const
Compute the arguments that would be passed when creating mapper mapper_id.
AutoRegisterMapper(std::string mapper_id, MapperMaker maker, bool is_composite, std::string mapper_description, std::vector< ImplicitTuple< std::string, ImplicitlyToString, std::string >> required_arg_names_defaults_and_descriptions, std::vector< std::pair< std::string, std::string >> optional_arg_regexes_and_descriptions)
Register a mapper with the default registry. See MapperRegistry::registerMapper for documentation.
void registerMapper(std::string mapper_id, MapperMaker maker, bool is_composite, std::string mapper_description, std::vector< ImplicitTuple< std::string, ImplicitlyToString, std::string >> required_arg_names_defaults_and_descriptions, std::vector< std::pair< std::string, std::string >> optional_arg_regexes_and_descriptions)
Register a new mapper under the name mapper_id.
bool hasMatchingArg(const std::string &arg) const
std::unique_ptr< Mapper > createMapper(const std::string &mapper_id, std::shared_ptr< CGRA > cgra, int timelimit, const ConfigStore &args) const
Given a mapper_id, create an instance of that mapper with the given arguments.
MapperRegistry(std::vector< ImplicitTuple< std::string, ImplicitlyToString, std::string >> common_defaults)
Initialize with some common defaults.