-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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]Create closure object for GlobalVar #3411
Conversation
self.id = self.mod["id"] | ||
self.compose = self.mod["compose"] | ||
self.id = self.mod.get_global_var("id") | ||
self.compose = self.mod.get_global_var("compose") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aah... why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mod["id"]
returns Function
. But the function name symbols need to be GlobalVar
, you can check other prelude functions. Otherwise it would cause errors like https://discuss.tvm.ai/t/relay-to-a-normal-form-fails-on-a-prelude-function/3031.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
auto it = this->context->global_map.find(var); | ||
CHECK(it != this->context->global_map.end()); | ||
// Allocate closure with zero free vars | ||
Emit(Instruction::AllocClosure(it->second, 0, {}, NewRegister())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should merge for now, but eta expand these in the future then optimize/lift.
For function like:
We should create a closure object for
lifted_name12481580008527263117
.cc @icemelon9 @jroesch @zhiics @MarisaKirisame @slyubomirsky