The zeHipErrorConversion.hh header file was created to support ze_result_t to hipError_t runtime error conversion. The header file provides the following components:
(1) A type alias that defines ze_hip_error_map_t type as an unordered_map that maps ze_result_t to hipError_t
(2) A macro, CHIPERR_CHECK_LOG_AND_THROW_TABLE, that does exactly what CHIPERR_CHECK_LOG_AND_THROW does, but instead of taking a specific errtype to throw, CHIPERR_CHECK_LOG_AND_THROW_TABLE takes a map of type ze_hip_error_map_t and use it to convert ze_result_t to corresponding hipError_t. Either the default map (DEFAULT_ZE_HIP_ERROR_MAP) or a custom map can be used.
An example to create a custom map:
The zeHipErrorConversion.hh header file was created to support ze_result_t to hipError_t runtime error conversion. The header file provides the following components:
(1) A type alias that defines
ze_hip_error_map_t
type as an unordered_map that maps ze_result_t to hipError_t(2) A macro,
CHIPERR_CHECK_LOG_AND_THROW_TABLE
, that does exactly whatCHIPERR_CHECK_LOG_AND_THROW
does, but instead of taking a specific errtype to throw,CHIPERR_CHECK_LOG_AND_THROW_TABLE
takes a map of typeze_hip_error_map_t
and use it to convert ze_result_t to corresponding hipError_t. Either the default map (DEFAULT_ZE_HIP_ERROR_MAP
) or a custom map can be used. An example to create a custom map:(3) Functions used by the
CHIPERR_CHECK_LOG_AND_THROW_TABLE
macro to conduct actual conversionsNotes Only one mapping is added to the default map for now, but this is expected to be expanded as we discover more appropriate conversions.