Skip to content

Commit f702ef3

Browse files
authored
Add e.what() in print when catch exception. (#877)
1 parent 30ddaa4 commit f702ef3

File tree

1 file changed

+37
-35
lines changed

1 file changed

+37
-35
lines changed

ODLA/platforms/odla_popart/odla_popart.cc

+37-35
Original file line numberDiff line numberDiff line change
@@ -37,41 +37,43 @@ _odla_computation* _odla_computation::instance_ = nullptr;
3737
std::mutex _odla_computation::comp_mutex_;
3838

3939
#define POPLAR_TRY try {
40-
#define POPLAR_CATCH \
41-
} \
42-
catch (poplar::application_runtime_error & e) { \
43-
popart::logging::err( \
44-
"Poplar exception application_runtime_error caught:"); \
45-
RETURN_ERROR(ODLA_INTERNAL_LOGIC_ERR) \
46-
} \
47-
catch (poplar::recoverable_runtime_error & e) { \
48-
popart::logging::err("Poplar recoverable_runtime_error exception caught"); \
49-
auto action = e.getRecoveryAction(); \
50-
popart::logging::err("need to take action:{}", action); \
51-
if (action == poplar::RecoveryAction::IPU_RESET) { \
52-
RETURN_ERROR(ODLA_RECOVERABLE_ERR) \
53-
} else if (action == poplar::RecoveryAction::PARTITION_RESET) { \
54-
RETURN_ERROR(ODLA_PARTITION_RESET) \
55-
} else if (action == poplar::RecoveryAction::FULL_RESET) { \
56-
RETURN_ERROR(ODLA_FULL_RESET) \
57-
} \
58-
} \
59-
catch (poplar::unrecoverable_runtime_error & e) { \
60-
popart::logging::err( \
61-
"Poplar unrecoverable_runtime_error exception caught"); \
62-
RETURN_ERROR(ODLA_UNRECOVERABLE_ERR) \
63-
} \
64-
catch (poplar::unknown_runtime_error & e) { \
65-
popart::logging::err("Poplar unknown runtime exception caught"); \
66-
RETURN_ERROR(ODLA_UNRECOVERABLE_ERR) \
67-
} \
68-
catch (std::exception & e) { \
69-
popart::logging::err("std::exception gotten: {}", e.what()); \
70-
RETURN_ERROR(ODLA_UNRECOVERABLE_ERR) \
71-
} \
72-
catch (...) { \
73-
popart::logging::err("Poplar unknown exception caught"); \
74-
RETURN_ERROR(ODLA_UNRECOVERABLE_ERR) \
40+
#define POPLAR_CATCH \
41+
} \
42+
catch (poplar::application_runtime_error & e) { \
43+
popart::logging::err( \
44+
"Poplar exception application_runtime_error caught: {}", e.what()); \
45+
RETURN_ERROR(ODLA_INTERNAL_LOGIC_ERR) \
46+
} \
47+
catch (poplar::recoverable_runtime_error & e) { \
48+
popart::logging::err( \
49+
"Poplar recoverable_runtime_error exception caught: {}", e.what()); \
50+
auto action = e.getRecoveryAction(); \
51+
popart::logging::err("need to take action:{}", action); \
52+
if (action == poplar::RecoveryAction::IPU_RESET) { \
53+
RETURN_ERROR(ODLA_RECOVERABLE_ERR) \
54+
} else if (action == poplar::RecoveryAction::PARTITION_RESET) { \
55+
RETURN_ERROR(ODLA_PARTITION_RESET) \
56+
} else if (action == poplar::RecoveryAction::FULL_RESET) { \
57+
RETURN_ERROR(ODLA_FULL_RESET) \
58+
} \
59+
} \
60+
catch (poplar::unrecoverable_runtime_error & e) { \
61+
popart::logging::err( \
62+
"Poplar unrecoverable_runtime_error exception caught: {}", e.what()); \
63+
RETURN_ERROR(ODLA_UNRECOVERABLE_ERR) \
64+
} \
65+
catch (poplar::unknown_runtime_error & e) { \
66+
popart::logging::err("Poplar unknown runtime exception caught: {}", \
67+
e.what()); \
68+
RETURN_ERROR(ODLA_UNRECOVERABLE_ERR) \
69+
} \
70+
catch (std::exception & e) { \
71+
popart::logging::err("std::exception gotten: {}", e.what()); \
72+
RETURN_ERROR(ODLA_UNRECOVERABLE_ERR) \
73+
} \
74+
catch (...) { \
75+
popart::logging::err("Poplar unknown exception caught"); \
76+
RETURN_ERROR(ODLA_UNRECOVERABLE_ERR) \
7577
}
7678

7779
#define RETURN_ERROR(ERR_CODE) (QManager::instance()->set_status(ERR_CODE));

0 commit comments

Comments
 (0)