hipDNN frontend error C++ API#
2026-03-31
3 min read time
Error handling types and macros for the hipDNN Frontend API.
This file defines the error handling infrastructure used throughout the hipDNN frontend. It includes error codes, the Error struct for detailed error information, and helper macros for error checking and propagation.
Defines
-
HIPDNN_CHECK_ERROR(x)#
Check an Error return value and propagate if an error occurred.
This macro evaluates the expression and returns immediately if the result indicates an error (is_bad() returns true).
- Parameters:
x – Expression returning an Error object
-
HIPDNN_RETURN_IF_NE(x, y, error_status, message)#
-
HIPDNN_RETURN_IF_EQ(x, y, error_status, message)#
-
HIPDNN_RETURN_IF_TRUE(x, error_status, message)#
-
HIPDNN_RETURN_IF_FALSE(x, error_status, message)#
-
HIPDNN_RETURN_IF_NULL(x, error_status, message)#
-
HIPDNN_RETURN_IF_LT(x, y, error_status, message)#
-
HIPDNN_RETURN_IF_GE(x, y, error_status, message)#
-
HIPDNN_RETURN_IF_LE(x, y, error_status, message)#
-
namespace hipdnn_frontend#
Typedefs
Enums
-
enum class ErrorCode#
Error codes returned by hipDNN Frontend operations.
Values:
-
enumerator OK#
Operation completed successfully.
-
enumerator INVALID_VALUE#
An invalid value was provided.
-
enumerator HIPDNN_BACKEND_ERROR#
An error occurred in the hipDNN backend.
-
enumerator ATTRIBUTE_NOT_SET#
A required attribute was not set.
-
enumerator OK#
Functions
-
struct Error#
- #include <Error.hpp>
Represents an error with a code and descriptive message.
The Error struct is the primary mechanism for reporting errors in hipDNN Frontend operations. It combines an ErrorCode with a human-readable message describing what went wrong.
Error result = graph.build(handle); if(result.is_bad()) { std::cerr << "Build failed: " << result.get_message() << std::endl; }
Public Functions
-
inline Error()#
Default constructor, creates a success result.
-
inline Error(ErrorCode errorCode, std::string message)#
Construct an Error with a specific code and message.
- Parameters:
errorCode – The error code
message – Descriptive message about the error
-
inline std::string get_message() const#
Get the error message.
- Returns:
The error message string
-
inline bool is_good() const#
Check if the operation succeeded.
- Returns:
true if code == ErrorCode::OK, false otherwise
-
inline bool is_bad() const#
Check if the operation failed.
- Returns:
true if code != ErrorCode::OK, false otherwise
-
inline Error()#
-
enum class ErrorCode#