Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions extension/aten_util/aten_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ torch::executor::ScalarType torch_to_executorch_scalar_type(
case c10::ScalarType::QUInt8:
return torch::executor::ScalarType::QUInt8;
default:
ET_ASSERT_UNREACHABLE();
ET_ASSERT_UNREACHABLE_MSG(
"Unrecognized dtype: %hhd",
static_cast<int8_t>(c10::typeMetaToScalarType(type)));
}
}

Expand Down Expand Up @@ -122,7 +124,8 @@ c10::ScalarType executorch_to_torch_scalar_type(
case torch::executor::ScalarType::QUInt8:
return c10::ScalarType::QUInt8;
default:
ET_ASSERT_UNREACHABLE();
ET_ASSERT_UNREACHABLE_MSG(
"Unrecognized dtype: %hhd", static_cast<int8_t>(type));
}
}

Expand Down
3 changes: 1 addition & 2 deletions extension/pybindings/pybindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,7 @@ struct PyModule final {
} else if (py::isinstance<py::int_>(python_input)) {
cpp_inputs.push_back(EValue(py::cast<int64_t>(python_input)));
} else {
// Unsupported pytype
ET_ASSERT_UNREACHABLE_MSG(type_str.c_str());
ET_ASSERT_UNREACHABLE_MSG("Unsupported pytype: %s", type_str.c_str());
}
}

Expand Down
14 changes: 8 additions & 6 deletions runtime/platform/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@
*
* @param[in] _message Message on how to avoid this assertion error.
*/
#define ET_ASSERT_UNREACHABLE_MSG(_message) \
({ \
ET_CHECK_MSG( \
false, "Execution should not reach this point. %s", _message); \
ET_UNREACHABLE(); \
})
#define ET_ASSERT_UNREACHABLE_MSG(_format, ...) \
do { \
ET_CHECK_MSG( \
false, \
"Execution should not reach this point. " _format, \
##__VA_ARGS__); \
ET_UNREACHABLE(); \
} while (0)
Loading