Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Remove attributes of relax.print, assert and unique #443

Merged
merged 5 commits into from
Feb 23, 2023

Conversation

yongwww
Copy link
Collaborator

@yongwww yongwww commented Feb 15, 2023

the remaining effort of #405

src/relax/op/op.cc Outdated Show resolved Hide resolved
src/relax/op/op.cc Outdated Show resolved Hide resolved
src/relax/backend/vm/vm_builtin_lower.cc Outdated Show resolved Hide resolved
src/relax/backend/vm/vm_shape_lower.cc Outdated Show resolved Hide resolved
src/relax/op/op.cc Show resolved Hide resolved
src/relax/op/op_common.cc Outdated Show resolved Hide resolved
src/relax/op/tensor/set.cc Outdated Show resolved Hide resolved
Comment on lines 691 to 692
Call alloc_storage(
mem_alloc_storage,
{std::move(size), virtual_device_index, StringImm(storage_scope), DataTypeImm(dtype)},
Attrs());
Call alloc_storage(mem_alloc_storage, {std::move(size), virtual_device_index,
StringImm(storage_scope), DataTypeImm(dtype)});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto.

Comment on lines 82 to 87
if (const auto* call_node = expr.as<CallNode>()) {
static const Op& null_value_op_ = Op::Get("relax.null_value");
if (call_node->op == null_value_op_) {
return true;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I’m wondering about the purpose of this change. Could you elaborate a bit on this?

Copy link
Collaborator Author

@yongwww yongwww Feb 17, 2023

Choose a reason for hiding this comment

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

Since Call(null_value, {}) is used as None value for argument axis of Unique, it could be regarded as an empty node, and a leaf node

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should be very careful about changing the definition of leaf nodes. Is there a very compelling reason to leave null_value inside the call? If it gets normalized into a binding and, say, the FInferStructInfo for unique needs to check if an attr is null_value, it can use the blockbuilder context to see if the var's definition is a call to null_value (most of the time, it will, and if it's not, you treat it as unknown).

Copy link
Collaborator

Choose a reason for hiding this comment

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

null_value, though, might be important enough to make an exception for. That is worth thinking about further

Copy link
Collaborator Author

@yongwww yongwww Feb 23, 2023

Choose a reason for hiding this comment

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

removed Call(null_value, {}) in this pr, since the check will fail. I think it should be an issue in the normalizer. Have tried to use a varbinding, but ran into well-formness issue. So I decided not to use null_value in this pr.

@tqchen
Copy link
Contributor

tqchen commented Feb 18, 2023

note #453, this PR should be part of PRs to send to unity

@tqchen
Copy link
Contributor

tqchen commented Feb 22, 2023

@yongwww would be great to followup on the state of this pr

@yongwww
Copy link
Collaborator Author

yongwww commented Feb 23, 2023

@YuchenJin @MasterJH5574 @slyubomirsky I have fixed the comments you left, please take another look.

Copy link
Collaborator

@MasterJH5574 MasterJH5574 left a comment

Choose a reason for hiding this comment

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

Thanks for the effort! BTW, due to the migration, I think we can have this PR directly to the unity branch.

Comment on lines 63 to 64
# todo (yongwww): tracked in tlc-pack/relax issue 421
# _check(foo, bb.get()["foo"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you mention this test in that issue as well? On the other hand, I’m curious about the reason why the printed IR cannot be parsed back. R.prim_value(xxx) is already acceptable by the parser. As long as we make sure that the Python and FFI interface accept PrimValue, I assume there should be no parsing issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Enabled this test and that one mentioned in #421 in the latest push. Yeah, the issue disappeared after updating the python side to accept PrimValue.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Great. Thanks for confirming!

@tqchen tqchen merged commit b0c63b5 into tlc-pack:relax Feb 23, 2023
@tqchen
Copy link
Contributor

tqchen commented Feb 23, 2023

Let us send it to unity branch

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants