You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "Lunderberg (via GitHub)" <gi...@apache.org> on 2023/10/19 19:29:34 UTC
[PR] [Unity] Split DecomposeOpsForTraining into two steps [tvm]
Lunderberg opened a new pull request, #15954:
URL: https://github.com/apache/tvm/pull/15954
Prior to this commit, the `DecomposeOpsForTraining` transform directly replaced `relax.nn.batch_norm` into more primitive relax operations. This required the decomposed form of `relax.nn.batch_norm` to be duplicated with `DecomposeOpsForInference`. This commit refactors the pass to occur in two steps, first to apply training-specific mutations, and then to decompose.
Having a clear `DecomposeOps` pass also has a clear single location for operator decomposition, which may be migrated into the operator definition in the future, similar to `FLegalize`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Unity] Split DecomposeOpsForTraining into two steps [tvm]
Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg commented on PR #15954:
URL: https://github.com/apache/tvm/pull/15954#issuecomment-1771588343
@sunggg This is what I was referring to by a different decomposition being applied for training and for inference in https://github.com/apache/tvm/pull/15842. This PR extracts that difference out into a separate pass, such that both training and inference can then share the same underlying definition of `batch_norm`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Unity] Split DecomposeOpsForTraining into two steps [tvm]
Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg commented on PR #15954:
URL: https://github.com/apache/tvm/pull/15954#issuecomment-1856076405
> Sorry, for the late review
No problem, as I've been slow on responding as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Unity] Split DecomposeOpsForTraining into two steps [tvm]
Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg commented on code in PR #15954:
URL: https://github.com/apache/tvm/pull/15954#discussion_r1431805360
##########
src/ir/transform.cc:
##########
@@ -531,6 +531,23 @@ Pass CreateModulePass(const runtime::TypedPackedFunc<IRModule(IRModule, PassCont
return ModulePass(pass_func, pass_info);
}
+Pass ApplyPassToFunction(Pass pass, String func_name, bool error_if_function_missing) {
Review Comment:
And the more I think on it, the more I like the regex option. Implemented, and going through CI now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Unity] Split DecomposeOpsForTraining into two steps [tvm]
Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg commented on code in PR #15954:
URL: https://github.com/apache/tvm/pull/15954#discussion_r1426897693
##########
src/ir/transform.cc:
##########
@@ -531,6 +531,23 @@ Pass CreateModulePass(const runtime::TypedPackedFunc<IRModule(IRModule, PassCont
return ModulePass(pass_func, pass_info);
}
+Pass ApplyPassToFunction(Pass pass, String func_name, bool error_if_function_missing) {
Review Comment:
I think that would work, but only in the case where `error_if_function_missing = false`. If there's a `List[String]`, then it wouldn't be clear to a reader whether an error is raised when all of the listed functions are absent, or when any of the listed functions are absent.
I've been picturing this utility as being useful for hand-crafted optimization pipelines, where some optimizations should only be applied to specific functions. In those cases, raising an error when an expected function is missing would allow for earlier detection of an invalid optimization pipeline.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Unity] Split DecomposeOpsForTraining into two steps [tvm]
Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg merged PR #15954:
URL: https://github.com/apache/tvm/pull/15954
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Unity] Split DecomposeOpsForTraining into two steps [tvm]
Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen commented on PR #15954:
URL: https://github.com/apache/tvm/pull/15954#issuecomment-1894016440
Quick note. this PR depends on std::regex and we know that there can be a symbol issue with pytorch, see https://github.com/apache/tvm/pull/16249 we may need to revert the usage or change to prefix matching for now so we can unblock unity main transition.
For future usage of regex, let us consider simple pattern and prefix for now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Unity] Split DecomposeOpsForTraining into two steps [tvm]
Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg commented on code in PR #15954:
URL: https://github.com/apache/tvm/pull/15954#discussion_r1426900240
##########
src/ir/transform.cc:
##########
@@ -531,6 +531,23 @@ Pass CreateModulePass(const runtime::TypedPackedFunc<IRModule(IRModule, PassCont
return ModulePass(pass_func, pass_info);
}
+Pass ApplyPassToFunction(Pass pass, String func_name, bool error_if_function_missing) {
Review Comment:
As a third option, what if the `func_name` parameter is replaced with a `func_name_regex` parameter? That way, it could handle the cases of a single function and of a list of functions, and could clearly state when an error occurs by renaming the parameter to `error_if_no_function_matches_regex`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Unity] Split DecomposeOpsForTraining into two steps [tvm]
Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg commented on PR #15954:
URL: https://github.com/apache/tvm/pull/15954#issuecomment-1832481024
Rebased onto `unity` to re-run CI, as it has been long enough that discrepancies could have arisen since the previous run.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Unity] Split DecomposeOpsForTraining into two steps [tvm]
Posted by "sunggg (via GitHub)" <gi...@apache.org>.
sunggg commented on code in PR #15954:
URL: https://github.com/apache/tvm/pull/15954#discussion_r1412641600
##########
src/ir/transform.cc:
##########
@@ -531,6 +531,23 @@ Pass CreateModulePass(const runtime::TypedPackedFunc<IRModule(IRModule, PassCont
return ModulePass(pass_func, pass_info);
}
+Pass ApplyPassToFunction(Pass pass, String func_name, bool error_if_function_missing) {
Review Comment:
This function seems useful. Can we get the `List[String]` instead of single function name so that we can generalize a little further?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org