shingjan commented on a change in pull request #8851:
URL: https://github.com/apache/tvm/pull/8851#discussion_r700600297
##########
File path: python/tvm/autotvm/measure/measure_methods.py
##########
@@ -114,53 +114,43 @@ 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(),
- )
- )
- else:
- # return BuildResult
- results.append(res)
+ )
+ except InstantiationError as ex:
Review comment:
done
--
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]