comaniac commented on a change in pull request #9721: URL: https://github.com/apache/tvm/pull/9721#discussion_r767983007
########## File path: python/tvm/relay/transform/transform.py ########## @@ -695,17 +695,23 @@ def LambdaLift(): return _ffi_api.LambdaLift() -def PartitionGraph(mod_name="default"): +def PartitionGraph(mod_name="default", bind_constants=True): """Partition a Relay program into regions that can be executed on different backends. + Parameters + ---------- + bind_constants: bool + Whether or not to bind constants in partitioned subgraphs. For C-source based codegen, + it is recommended to set this to False to avoid embedding large constants in + a C source file. Review comment: I made some changes to the description but please feel free to take any piece you prefer. Also could you also help adding the docstring for `mod_name`? It was missed somehow... ``` Parameters ---------- bind_constants: bool Whether or not to bind constants in partitioned subgraphs. Note that the codegen needs to maintain the bind constants; otherwise the constants will be maintained by the metadata module. So it is recommended for C-source based codegens to set bind_constants=False to avoid embedding large constants in a C source file. ``` ########## File path: src/relay/transforms/partition_graph.cc ########## @@ -601,9 +607,10 @@ Pass PartitionGraph(String mod_name) { {flatten_tuples_pass, remove_default_pass, partition_pass, name_mangling_pass, InferType()}); } -TVM_REGISTER_GLOBAL("relay._transform.PartitionGraph").set_body_typed([](String mod_name) { - return transform::PartitionGraph(mod_name); -}); +TVM_REGISTER_GLOBAL("relay._transform.PartitionGraph") + .set_body_typed([](String mod_name, bool bind_constants = false) { Review comment: Just double check, does `set_body_typed` support default argument value? I sort of remember that we have to use `.set_body` and manually check the size of `TVMArgs` to deal with default values, but I might be wrong. -- 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-unsubscr...@tvm.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org