hipDNN frontend logging C++ API#

2026-03-31

3 min read time

Applies to Linux and Windows

Frontend logging configuration and log-level control.

Log verbosity is controlled by the HIPDNN_LOG_LEVEL environment variable. Valid values (case-insensitive):

Value

Effect

info

Informational messages and above

warn

Warnings and above

error

Errors and fatal messages only

fatal

Fatal messages only

off

Disable all logging (default)

Example: HIPDNN_LOG_LEVEL=warn

namespace hipdnn_frontend

Enums

enum class LogCallbackMode#

User log callback modes (sync vs async).

Values:

enumerator SYNC#

Callback invoked on logging thread (synchronous)

enumerator ASYNC#

Callback invoked on worker thread (asynchronous)

Functions

inline Error setUserLogCallback(hipdnnUserLogCallback_t callback, hipdnnSeverity_t minLevel, LogCallbackMode mode, hipdnnUserLogCallbackHandle_t userHandle)#

Set or update a user log callback.

This API allows registering multiple user callbacks with individual log levels and sync/async modes. Each callback is uniquely identified by the composite key (callback, userHandle).

Behavior:

  • If (callback, userHandle) already registered: UPDATES settings (level and/or mode)

  • If (callback, userHandle) new: ADDS new registration

  • If minLevel == SEV_OFF: REMOVES callback

  • userHandle must be non-null

Callback Removal (minLevel == SEV_OFF):

  • Callback will be atomically disabled and no further logs will be received

  • Any pending async logs for this callback will be abandoned

  • After this function returns, user can safely destroy data referenced by userHandle

Note

When a synchronous callback is registered, the synchronous callbacks will delay hipDNN until the callback returns, regardless of any async log callbacks also being registered.

Parameters:
  • callback – The callback function to invoke

  • minLevel – Minimum severity level (SEV_OFF removes the callback). Note that the logs produced on this callback will be limited by the global log level set either by the HIPDNN_LOG_LEVEL environment variable or the setGlobalLogLevel() API function.

  • mode – Sync or async invocation mode

  • userHandle – Non-null user data (also serves as unique callback ID)

Returns:

Error object indicating success or failure

inline Error setGlobalLogLevel(hipdnnSeverity_t level)#

Set the global log level.

This controls which log messages are output to console/file AND to the global backend log output callback. Updates BOTH frontend and backend log levels.

Parameters:

level – The severity level to set

Returns:

Error object indicating success or failure

inline Error getGlobalLogLevel(hipdnnSeverity_t &level)#

Get the global log level.

Parameters:

level[out] The current severity level

Returns:

Error object indicating success or failure