huajsj commented on a change in pull request #9108:
URL: https://github.com/apache/tvm/pull/9108#discussion_r718010902
##########
File path: python/tvm/contrib/pipeline_executor.py
##########
@@ -501,17 +537,18 @@ class PipelineExecutorFactoryModule(object):
"""
- def __init__(self, pipeline_mods, mods_config):
- mods, config = self.graph_executor_create(pipeline_mods, mods_config)
- assert (
- pipeline_executor_enabled()
- ), "Pipeline executor is not enabled. Please \
- re-build TVM with USE_PIPELINE_EXECUTOR=ON"
- pipeline_create = tvm._ffi.get_global_func(
+ def __init__(self, pipeline_libs=None, mods_config=None):
+ self.pipeline_libs = pipeline_libs
+ self.mods_config = mods_config
+ self.pipeline_create = tvm._ffi.get_global_func(
"tvm.pipeline_executor.create", allow_missing=False
)
- assert pipeline_create
- self.module = pipeline_create(mods, config)
+ self.module = None
+ # Only create pipeline executor when pipeline_libs, mods_config and
+ # self.pipeline_create are not None.
+ if pipeline_libs and mods_config and self.pipeline_create:
Review comment:
https://github.com/apache/tvm/blob/a1cd6d51b834e7b40b8222f61bc592264845ee39/python/tvm/_ffi/_ctypes/packed_func.py#L292
according the logic , once allow_missing get set into true, get_global_func
will return None instead of raise error, so for the said case we may still need
to do the None check, please correct me if my finding is 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]