Skip to content

Conversation

@Mousius
Copy link
Member

@Mousius Mousius commented Jul 18, 2022

This adds the target_parser as described in apache/tvm-rfcs#71, which parses an incoming TargetJSON and produces a new configuration for generating the final Target object from.

Marks set_attrs_preprocessor as deprecated and errors if both set_attrs_preprocessor and set_target_parser exist together.

This adds the `target_parser` as described in apache/tvm-rfcs#71, which parses an incoming `TargetJSON` and produces a new configuration for generating the final `Target` object from.

Marks `set_attrs_preprocessor` as deprecated and errors if both `set_attrs_preprocessor` and `set_target_parser` exist together.
static ObjectPtr<Object> FromConfigString(const String& config_str);
static ObjectPtr<Object> FromRawString(const String& target_str);
static ObjectPtr<Object> FromConfig(std::unordered_map<String, ObjectRef> config);
static ObjectPtr<Object> FromConfig(Map<String, ObjectRef> config);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this takes Map<> explicitly instead of TargetJSON, are there any conditions that a config map must meet before it can be considered a target JSON?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kparzysz-quic not that I know of, I made an internal assumption here that config is another name for the JSON - maybe @areusch or @junrushao1994 knows more?

Comment on lines +734 to +738
// Run JSON Parser over JSON input
if (target->kind->target_parser != nullptr) {
VLOG(9) << "TargetInternal::FromConfig - Running target_parser";
config = target->kind->target_parser(config);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be executed at the end, so that the parser "has the last word" on what the returned target will look like?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the parser goes from TargetJSON to TargetJSON it has to go first and produce a new config - the rest of this function unpacks the config values into a Target object but shouldn't change any of the values in config.

@kparzysz-quic kparzysz-quic merged commit d4309cf into apache:main Jul 18, 2022
@Mousius Mousius deleted the target-json-parser branch July 19, 2022 10:28
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
This adds the `target_parser` as described in apache/tvm-rfcs#71, which parses an incoming `TargetJSON` and produces a new configuration for generating the final `Target` object from.

Marks `set_attrs_preprocessor` as deprecated and errors if both `set_attrs_preprocessor` and `set_target_parser` exist together.
mikeseven pushed a commit to mikeseven/tvm that referenced this pull request Sep 27, 2023
This adds the `target_parser` as described in apache/tvm-rfcs#71, which parses an incoming `TargetJSON` and produces a new configuration for generating the final `Target` object from.

Marks `set_attrs_preprocessor` as deprecated and errors if both `set_attrs_preprocessor` and `set_target_parser` exist together.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants