Device State Extension

Device State Extension#

Introduced in Level Zero version 1.17

API#

Device State#

This extension provides additional device state information beyond the basic reset and repair status available through the standard zesDeviceGetState API. The extension allows applications to query extended device states including wedged condition, survivability mode, flash override status, GPU lost condition, and kernel driver binding status.

The zes_device_ext_state_t structure can be passed via the pNext chain of zes_device_state_t to retrieve these additional state flags.

Multiple flags may be set simultaneously if the device is in multiple states.

Usage Example#

// Query basic device state
zes_device_state_t deviceState = {};
deviceState.stype = ZES_STRUCTURE_TYPE_DEVICE_STATE;
deviceState.pNext = nullptr;

// Add extended state structure to pNext chain
zes_device_ext_state_t extendedState = {};
extendedState.stype = ZES_STRUCTURE_TYPE_DEVICE_EXT_STATE;
extendedState.pNext = nullptr;
deviceState.pNext = &extendedState;

// Get device state including extended flags
zesDeviceGetState(hDevice, &deviceState);

// Check extended device state flags
if (extendedState.flags & ZES_DEVICE_STATE_EXT_FLAG_WEDGED) {
    // Device is wedged - recovery action needed
}

if (extendedState.flags & ZES_DEVICE_STATE_EXT_FLAG_SURVIVABILITY) {
    // Device is in survivability mode
}

if (extendedState.flags & ZES_DEVICE_STATE_EXT_FLAG_FLASH_OVERRIDE) {
    // Device has flash override enabled
}

if (extendedState.flags & ZES_DEVICE_STATE_EXT_FLAG_GPU_LOST) {
    // Device PCI path is inaccessible - the GPU is lost
}

if (extendedState.flags & ZES_DEVICE_STATE_EXT_FLAG_DRIVER_NOT_LOADED) {
    // No kernel driver is bound to the device
}