Skip to content

Conversation

@Lunderberg
Copy link
Contributor

tir::StringImm can round-trip through TVMScript when used in a context that requires a PrimExpr, such as the arguments of a tir::Call. However, contexts that only require a ObjectRef, such as the AttrStmtNode::node, use the same TVMScript representation as "string_value", but are parsed tvm::String instances.

This commit updates MakePackedAPI to use String instead of StringImm in its default value for AttrStmtNode::node.

This is part of changes described in #14486, to improve round-trip failures that occur in lowering.

`tir::StringImm` can round-trip through TVMScript when used in a
context that requires a PrimExpr, such as the arguments of a
`tir::Call`.  However, contexts that only require a `ObjectRef`, such
as the `AttrStmtNode::node`, use the same TVMScript representation as
`"string_value"`, but are parsed `tvm::String` instances.

This commit updates `MakePackedAPI` to use `String` instead of
`StringImm` in its default value for `AttrStmtNode::node`.
@tvm-bot
Copy link
Collaborator

tvm-bot commented Apr 4, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

Generated by tvm-bot

@Lunderberg
Copy link
Contributor Author

The test added by this PR depends on the #14488. Should re-run CI after that one lands.

Copy link
Contributor

@kparzysz-quic kparzysz-quic left a comment

Choose a reason for hiding this comment

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

LGTM. Is this the only place where this happens?

@Lunderberg
Copy link
Contributor Author

While it's possible that other cases may exist, they aren't part of the usual lowering flow. This was the only instance of StringImm appearing in the tests in #14486, which checked that every transformation used in tvm.build would produce TIR that can correctly round-trip through TVMScript.

@kparzysz-quic kparzysz-quic merged commit 9fb9fd6 into apache:main Apr 11, 2023
@Lunderberg Lunderberg deleted the attrstmt_string_vs_stringimm branch April 11, 2023 21:19
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.

3 participants