vinx13 commented on a change in pull request #8851:
URL: https://github.com/apache/tvm/pull/8851#discussion_r700608624
##########
File path: python/tvm/autotvm/measure/measure_methods.py
##########
@@ -114,53 +114,24 @@ def build(self, measure_inputs):
futures.append(ret)
for future in futures:
- res = future.get()
-
- if isinstance(res, Exception):
- # timeout or fleet error, return MeasureResult directly
+ try:
+ res = future.result()
+ results.append(res)
+ except TimeoutError as ex:
results.append(
MeasureResult(
- (res,), MeasureErrorNo.BUILD_TIMEOUT,
self.timeout, time.time()
+ (ex,), MeasureErrorNo.BUILD_TIMEOUT, self.timeout,
time.time()
)
)
- elif res.error is not None:
- # instantiation error
- if isinstance(res.error, InstantiationError):
- results.append(
- MeasureResult(
- (res.error,),
- MeasureErrorNo.INSTANTIATION_ERROR,
- res.time_cost,
- time.time(),
- )
+ except ChildProcessError as ex:
+ results.append(
+ MeasureResult(
+ (ex,),
+ MeasureErrorNo.RUNTIME_DEVICE,
+ self.timeout,
+ time.time(),
)
- else:
- if "InstantiationError" in str(res.error):
- msg = str(res.error)
- try:
- msg = msg.split("\n")[-2].split(": ")[1]
- except Exception: # pylint: disable=broad-except
- pass
- results.append(
- MeasureResult(
- (InstantiationError(msg),),
- MeasureErrorNo.INSTANTIATION_ERROR,
- res.time_cost,
- time.time(),
- )
- )
- else: # tvm error
- results.append(
- MeasureResult(
- (res.error,),
- MeasureErrorNo.COMPILE_HOST,
- res.time_cost,
- time.time(),
- )
- )
Review comment:
These error handling is still needed (although the exception was handled
inside the build_func, but the result to be appended is a bit different from
that was originally returned). It should be added before
https://github.com/apache/tvm/blob/14aa374973560ecddb14e667d6e449b1f847a698/python/tvm/autotvm/measure/measure_methods.py#L118
--
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]