Skip to content

Adding runtime error conversion for Level0 backend#886

Merged
pvelesko merged 4 commits intomainfrom
runtime_error_conversion
Jul 24, 2024
Merged

Adding runtime error conversion for Level0 backend#886
pvelesko merged 4 commits intomainfrom
runtime_error_conversion

Conversation

@jjennychen
Copy link
Collaborator

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:

ze_hip_error_map_t myMap = {
    {SOME_ZE_RESULT_T, SOME_HIPERROR_T},
    {SOME_ZE_RESULT_T, SOME_HIPERROR_T}
};

(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.

@pvelesko pvelesko merged commit b1c10ba into main Jul 24, 2024
@pvelesko pvelesko deleted the runtime_error_conversion branch July 24, 2024 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants