Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Relay][VM] Fix code generation for packed functions + tuples #3287

Merged
merged 5 commits into from
Jun 5, 2019

Conversation

jroesch
Copy link
Member

@jroesch jroesch commented Jun 4, 2019

Disabling fusion for concat in #3268 uncovered a bug in the VM compiler, this fixes it.

We were previously not unpacking tuples, this changes code generation to unpack the tuples into registers before invoking the function.

cc @wweic @zhiics @icemelon9 @MarisaKirisame

Copy link
Contributor

@wweic wweic left a comment

Choose a reason for hiding this comment

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

lgtm.

@@ -292,7 +292,7 @@ RELAY_REGISTER_OP("concatenate")
.add_type_rel("Concatenate", ConcatenateRel)
.set_attr<FInferCorrectLayout>("FInferCorrectLayout", ConcatenateLayout)
.set_attr<FTVMCompute>("FTVMCompute", ConcatenateCompute)
.set_attr<TOpPattern>("TOpPattern", kInjective);
.set_attr<TOpPattern>("TOpPattern", kOpaque);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe leave this line out of the PR?

@tqchen
Copy link
Member

tqchen commented Jun 4, 2019

Please remove concat opaque property for now, and consider manually construct a function that needs to deal with such a case

@jroesch
Copy link
Member Author

jroesch commented Jun 4, 2019

I don't think it is possible to write such a function because anything that uses tuples gets fused currently.

Used stop_fusion all is good, check the latest commit.

} else if (auto tuple_ty = ty.as<TupleTypeNode>()) {
for (size_t f = 0; f < tuple_ty->fields.size(); f++) {
const auto& field = tuple_ty->fields[f];
CHECK(field.as<TensorTypeNode>())
Copy link
Contributor

Choose a reason for hiding this comment

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

can you extend it and allow recursive tuple? it is more uniform this way.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't really want to do it right now, recursive is a pain given the way the code generator is written right now. This is mostly to fix CI breakage, I would like to make some updates to compiler likely after FCRC tutorial.

@tqchen tqchen merged commit 95ab85d into apache:master Jun 5, 2019
@tqchen
Copy link
Member

tqchen commented Jun 5, 2019

Thanks, @jroesch @MarisaKirisame @wweic , this PR is now merged

@jroesch jroesch deleted the vm-invoke-packed-tuples branch February 4, 2021 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants