Adding runtime error conversion for Level0 backend #886
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 conversions*** Notes ***
Only one mapping is added to the default map for now, but this is expected to be expanded as we discover more appropriate conversions.