[Relay] Add Defunctionalization Pass - #6400
Merged
Merged
Conversation
yzhliu
reviewed
Sep 4, 2020
yzhliu
left a comment
Member
There was a problem hiding this comment.
Please also tag ppl for review.
| raise Exception('unknown mode') | ||
|
|
||
| def Defunctionalization(expr, mod): | ||
| """ |
Contributor
Author
|
cc: @wweic @MarisaKirisame @zhiics @icemelon9 @ZihengJiang @jroesch @tqchen |
| Function Specialize(const Function& f, const Array<Type> type_args) { | ||
| auto map = tvm::Map<TypeVar, Type>(); | ||
| for (size_t i = 0; i < type_args.size(); i++) { | ||
| map.Set(f->type_params[i], type_args[i]); |
| continue; | ||
| } | ||
|
|
||
| // we assume arg is either an identifier (var or globalvar) or a function |
Contributor
There was a problem hiding this comment.
refactor the stuff after continue into a function
hypercubestart
force-pushed
the
defunc
branch
from
September 9, 2020 22:52
4e26a9d to
d2d2f35
Compare
MarisaKirisame
left a comment
Contributor
There was a problem hiding this comment.
pretty good. one more small nit, and please fix the CI.
| continue; | ||
| } | ||
|
|
||
| args.push_back(EncodeArg(arg, type)); |
Contributor
There was a problem hiding this comment.
if else is a better style then continue.
Contributor
Author
There was a problem hiding this comment.
yep, looks like CI issue was caused by this: #6434
hypercubestart
force-pushed
the
defunc
branch
from
September 10, 2020 04:12
d2d2f35 to
a573c17
Compare
MarisaKirisame
approved these changes
Sep 10, 2020
Contributor
|
Thx @hypercubestart @yzhliu . |
kevinthesun
pushed a commit
to kevinthesun/tvm
that referenced
this pull request
Sep 17, 2020
* type args not automatically inferred... * working on type arg infer * fix type arg infer * WIP * wip * wip * revert type_infer * working * fix up test * fix * remove DeGlobal * lint * fix std move * comments * fix comments * review * style
kevinthesun
pushed a commit
to kevinthesun/tvm
that referenced
this pull request
Sep 18, 2020
* type args not automatically inferred... * working on type arg infer * fix type arg infer * WIP * wip * wip * revert type_infer * working * fix up test * fix * remove DeGlobal * lint * fix std move * comments * fix comments * review * style
trevor-m
pushed a commit
to neo-ai/tvm
that referenced
this pull request
Sep 18, 2020
* type args not automatically inferred... * working on type arg infer * fix type arg infer * WIP * wip * wip * revert type_infer * working * fix up test * fix * remove DeGlobal * lint * fix std move * comments * fix comments * review * style
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
introduces a defunctionalization pass based upon Type-Driven Defunctionalization, transforming a higher-order functional program into a first-order program.
currently it assumes a number of characteristics about the program, and will be extended upon in future work