1
0
mirror of https://github.com/fumiama/gozel.git synced 2026-06-05 16:30:24 +08:00
Files
gozel/sysm_device.go
github-actions[bot] 32abd8ea7c chore: run go generate
2026-03-26 00:49:32 +08:00

644 lines
36 KiB
Go

// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zes_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
"github.com/fumiama/gozel/internal/zecall"
)
// ZesDeviceGet Retrieves sysman devices within a sysman driver
// /
// / @details
// / - Multiple calls to this function will return identical sysman device
// / handles, in the same order.
// / - The number and order of handles returned from this function is NOT
// / affected by the `ZE_AFFINITY_MASK`, `ZE_ENABLE_PCI_ID_DEVICE_ORDER`,
// / or `ZE_FLAT_DEVICE_HIERARCHY` environment variables.
// / - The application may call this function from simultaneous threads.
// / - The implementation of this function should be lock-free.
// /
// / @returns
// / - ::ZE_RESULT_SUCCESS
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
// / - ::ZE_RESULT_ERROR_UNKNOWN
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
// / + `nullptr == hDriver`
// / - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
// / + `nullptr == pCount`
func ZesDeviceGet(
hDriver ZesDriverHandle, // hDriver [in] handle of the sysman driver instance
pCount *uint32, // pCount [in,out] pointer to the number of sysman devices. if count is zero, then the driver shall update the value with the total number of sysman devices available. if count is greater than the number of sysman devices available, then the driver shall update the value with the correct number of sysman devices available.
phDevices *ZesDeviceHandle, // phDevices [in,out][optional][range(0, *pCount)] array of handle of sysman devices. if count is less than the number of sysman devices available, then driver shall only retrieve that number of sysman devices.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zesDeviceGet", uintptr(hDriver), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phDevices)))
}
// ZES_STRING_PROPERTY_SIZE Maximum number of characters in string properties.
const ZES_STRING_PROPERTY_SIZE = 64
// ZES_MAX_UUID_SIZE Maximum device universal unique id (UUID) size in bytes.
const ZES_MAX_UUID_SIZE = 16
// ZesEngineTypeFlags (zes_engine_type_flags_t) Types of accelerator engines
type ZesEngineTypeFlags uint32
const (
ZES_ENGINE_TYPE_FLAG_OTHER ZesEngineTypeFlags = /* ZE_BIT(0) */ (1 << 0) // ZES_ENGINE_TYPE_FLAG_OTHER Undefined types of accelerators.
ZES_ENGINE_TYPE_FLAG_COMPUTE ZesEngineTypeFlags = /* ZE_BIT(1) */ (1 << 1) // ZES_ENGINE_TYPE_FLAG_COMPUTE Engines that process compute kernels only (no 3D content).
ZES_ENGINE_TYPE_FLAG_3D ZesEngineTypeFlags = /* ZE_BIT(2) */ (1 << 2) // ZES_ENGINE_TYPE_FLAG_3D Engines that process 3D content only (no compute kernels).
ZES_ENGINE_TYPE_FLAG_MEDIA ZesEngineTypeFlags = /* ZE_BIT(3) */ (1 << 3) // ZES_ENGINE_TYPE_FLAG_MEDIA Engines that process media workloads.
ZES_ENGINE_TYPE_FLAG_DMA ZesEngineTypeFlags = /* ZE_BIT(4) */ (1 << 4) // ZES_ENGINE_TYPE_FLAG_DMA Engines that copy blocks of data.
ZES_ENGINE_TYPE_FLAG_RENDER ZesEngineTypeFlags = /* ZE_BIT(5) */ (1 << 5) // ZES_ENGINE_TYPE_FLAG_RENDER Engines that can process both 3D content and compute kernels.
ZES_ENGINE_TYPE_FLAG_FORCE_UINT32 ZesEngineTypeFlags = 0x7fffffff // ZES_ENGINE_TYPE_FLAG_FORCE_UINT32 Value marking end of ZES_ENGINE_TYPE_FLAG_* ENUMs
)
// ZesRepairStatus (zes_repair_status_t) Device repair status
type ZesRepairStatus uintptr
const (
ZES_REPAIR_STATUS_UNSUPPORTED ZesRepairStatus = 0 // ZES_REPAIR_STATUS_UNSUPPORTED The device does not support in-field repairs.
ZES_REPAIR_STATUS_NOT_PERFORMED ZesRepairStatus = 1 // ZES_REPAIR_STATUS_NOT_PERFORMED The device has never been repaired.
ZES_REPAIR_STATUS_PERFORMED ZesRepairStatus = 2 // ZES_REPAIR_STATUS_PERFORMED The device has been repaired.
ZES_REPAIR_STATUS_FORCE_UINT32 ZesRepairStatus = 0x7fffffff // ZES_REPAIR_STATUS_FORCE_UINT32 Value marking end of ZES_REPAIR_STATUS_* ENUMs
)
// ZesResetReasonFlags (zes_reset_reason_flags_t) Device reset reasons
type ZesResetReasonFlags uint32
const (
ZES_RESET_REASON_FLAG_WEDGED ZesResetReasonFlags = /* ZE_BIT(0) */ (1 << 0) // ZES_RESET_REASON_FLAG_WEDGED The device needs to be reset because one or more parts of the hardware
///< is wedged
ZES_RESET_REASON_FLAG_REPAIR ZesResetReasonFlags = /* ZE_BIT(1) */ (1 << 1) // ZES_RESET_REASON_FLAG_REPAIR The device needs to be reset in order to complete in-field repairs
ZES_RESET_REASON_FLAG_FORCE_UINT32 ZesResetReasonFlags = 0x7fffffff // ZES_RESET_REASON_FLAG_FORCE_UINT32 Value marking end of ZES_RESET_REASON_FLAG_* ENUMs
)
// ZesResetType (zes_reset_type_t) Device reset type
type ZesResetType uintptr
const (
ZES_RESET_TYPE_WARM ZesResetType = 0 // ZES_RESET_TYPE_WARM Apply warm reset
ZES_RESET_TYPE_COLD ZesResetType = 1 // ZES_RESET_TYPE_COLD Apply cold reset
ZES_RESET_TYPE_FLR ZesResetType = 2 // ZES_RESET_TYPE_FLR Apply FLR reset
ZES_RESET_TYPE_FORCE_UINT32 ZesResetType = 0x7fffffff // ZES_RESET_TYPE_FORCE_UINT32 Value marking end of ZES_RESET_TYPE_* ENUMs
)
// ZesDeviceState (zes_device_state_t) Device state
type ZesDeviceState struct {
Stype ZesStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Reset ZesResetReasonFlags // Reset [out] Indicates if the device needs to be reset and for what reasons. returns 0 (none) or combination of ::zes_reset_reason_flag_t
Repaired ZesRepairStatus // Repaired [out] Indicates if the device has been repaired
}
// ZesResetProperties (zes_reset_properties_t) Device reset properties
type ZesResetProperties struct {
Stype ZesStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Force ZeBool // Force [in] If set to true, all applications that are currently using the device will be forcibly killed.
Resettype ZesResetType // Resettype [in] Type of reset needs to be performed
}
// ZesUuid (zes_uuid_t) Device universal unique id (UUID)
type ZesUuid struct {
Id [ZES_MAX_UUID_SIZE]uint8 // Id [out] opaque data representing a device UUID
}
// ZesDeviceType (zes_device_type_t) Supported device types
type ZesDeviceType uintptr
const (
ZES_DEVICE_TYPE_GPU ZesDeviceType = 1 // ZES_DEVICE_TYPE_GPU Graphics Processing Unit
ZES_DEVICE_TYPE_CPU ZesDeviceType = 2 // ZES_DEVICE_TYPE_CPU Central Processing Unit
ZES_DEVICE_TYPE_FPGA ZesDeviceType = 3 // ZES_DEVICE_TYPE_FPGA Field Programmable Gate Array
ZES_DEVICE_TYPE_MCA ZesDeviceType = 4 // ZES_DEVICE_TYPE_MCA Memory Copy Accelerator
ZES_DEVICE_TYPE_VPU ZesDeviceType = 5 // ZES_DEVICE_TYPE_VPU Vision Processing Unit
ZES_DEVICE_TYPE_FORCE_UINT32 ZesDeviceType = 0x7fffffff // ZES_DEVICE_TYPE_FORCE_UINT32 Value marking end of ZES_DEVICE_TYPE_* ENUMs
)
// ZesDevicePropertyFlags (zes_device_property_flags_t) Supported device property flags
type ZesDevicePropertyFlags uint32
const (
ZES_DEVICE_PROPERTY_FLAG_INTEGRATED ZesDevicePropertyFlags = /* ZE_BIT(0) */ (1 << 0) // ZES_DEVICE_PROPERTY_FLAG_INTEGRATED Device is integrated with the Host.
ZES_DEVICE_PROPERTY_FLAG_SUBDEVICE ZesDevicePropertyFlags = /* ZE_BIT(1) */ (1 << 1) // ZES_DEVICE_PROPERTY_FLAG_SUBDEVICE Device handle used for query represents a sub-device.
ZES_DEVICE_PROPERTY_FLAG_ECC ZesDevicePropertyFlags = /* ZE_BIT(2) */ (1 << 2) // ZES_DEVICE_PROPERTY_FLAG_ECC Device supports error correction memory access.
ZES_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING ZesDevicePropertyFlags = /* ZE_BIT(3) */ (1 << 3) // ZES_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING Device supports on-demand page-faulting.
ZES_DEVICE_PROPERTY_FLAG_FORCE_UINT32 ZesDevicePropertyFlags = 0x7fffffff // ZES_DEVICE_PROPERTY_FLAG_FORCE_UINT32 Value marking end of ZES_DEVICE_PROPERTY_FLAG_* ENUMs
)
// ZesDeviceProperties (zes_device_properties_t) Device properties
type ZesDeviceProperties struct {
Stype ZesStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Core ZeDeviceProperties // Core [out] (Deprecated, use ::zes_uuid_t in the extended structure) Core device properties
Numsubdevices uint32 // Numsubdevices [out] Number of sub-devices. A value of 0 indicates that this device doesn't have sub-devices.
Serialnumber [ZES_STRING_PROPERTY_SIZE]byte // Serialnumber [out] Manufacturing serial number (NULL terminated string value). This value is intended to reflect the Part ID/SoC ID assigned by manufacturer that is unique for a SoC. Will be set to the string "unknown" if this cannot be determined for the device.
Boardnumber [ZES_STRING_PROPERTY_SIZE]byte // Boardnumber [out] Manufacturing board number (NULL terminated string value). Alternatively "boardSerialNumber", this value is intended to reflect the string printed on board label by manufacturer. Will be set to the string "unknown" if this cannot be determined for the device.
Brandname [ZES_STRING_PROPERTY_SIZE]byte // Brandname [out] Brand name of the device (NULL terminated string value). Will be set to the string "unknown" if this cannot be determined for the device.
Modelname [ZES_STRING_PROPERTY_SIZE]byte // Modelname [out] Model name of the device (NULL terminated string value). Will be set to the string "unknown" if this cannot be determined for the device.
Vendorname [ZES_STRING_PROPERTY_SIZE]byte // Vendorname [out] Vendor name of the device (NULL terminated string value). Will be set to the string "unknown" if this cannot be determined for the device.
Driverversion [ZES_STRING_PROPERTY_SIZE]byte // Driverversion [out] Installed driver version (NULL terminated string value). Will be set to the string "unknown" if this cannot be determined for the device.
}
// ZesDeviceExtProperties (zes_device_ext_properties_t) Device properties
type ZesDeviceExtProperties struct {
Stype ZesStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Uuid ZesUuid // Uuid [out] universal unique identifier. Note: uuid obtained from Sysman API is the same as from core API. Subdevices will have their own uuid.
Type ZesDeviceType // Type [out] generic device type
Flags ZesDevicePropertyFlags // Flags [out] 0 (none) or a valid combination of ::zes_device_property_flag_t
}
// ZesDeviceGetProperties Get properties about the device
// /
// / @details
// / - The application may call this function from simultaneous threads.
// / - The implementation of this function should be lock-free.
// /
// / @returns
// / - ::ZE_RESULT_SUCCESS
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
// / - ::ZE_RESULT_ERROR_UNKNOWN
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
// / + `nullptr == hDevice`
// / - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
// / + `nullptr == pProperties`
func ZesDeviceGetProperties(
hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device.
pProperties *ZesDeviceProperties, // pProperties [in,out] Structure that will contain information about the device.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zesDeviceGetProperties", uintptr(hDevice), uintptr(unsafe.Pointer(pProperties)))
}
// ZesDeviceGetState Get information about the state of the device - if a reset is
// / required, reasons for the reset and if the device has been repaired
// /
// / @details
// / - The application may call this function from simultaneous threads.
// / - The implementation of this function should be lock-free.
// /
// / @returns
// / - ::ZE_RESULT_SUCCESS
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
// / - ::ZE_RESULT_ERROR_UNKNOWN
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
// / + `nullptr == hDevice`
// / - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
// / + `nullptr == pState`
func ZesDeviceGetState(
hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device.
pState *ZesDeviceState, // pState [in,out] Structure that will contain information about the device.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zesDeviceGetState", uintptr(hDevice), uintptr(unsafe.Pointer(pState)))
}
// ZesDeviceReset Reset device
// /
// / @details
// / - Performs a PCI bus reset of the device. This will result in all
// / current device state being lost.
// / - All applications using the device should be stopped before calling
// / this function.
// / - If the force argument is specified, all applications using the device
// / will be forcibly killed.
// / - The function will block until the device has restarted or an
// / implementation defined timeout occurred waiting for the reset to
// / complete.
// /
// / @returns
// / - ::ZE_RESULT_SUCCESS
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
// / + `nullptr == hDevice`
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
// / + User does not have permissions to perform this operation.
// / - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE
// / + Reset cannot be performed because applications are using this device.
// / - ::ZE_RESULT_ERROR_UNKNOWN
// / + There were problems unloading the device driver, performing a bus reset or reloading the device driver.
func ZesDeviceReset(
hDevice ZesDeviceHandle, // hDevice [in] Sysman handle for the device
force ZeBool, // force [in] If set to true, all applications that are currently using the device will be forcibly killed.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zesDeviceReset", uintptr(hDevice), uintptr(force))
}
// ZesDeviceResetExt Reset device extension
// /
// / @details
// / - Performs a PCI bus reset of the device. This will result in all
// / current device state being lost.
// / - Prior to calling this function, user is responsible for closing
// / applications using the device unless force argument is specified.
// / - If the force argument is specified, all applications using the device
// / will be forcibly killed.
// / - The function will block until the device has restarted or a
// / implementation specific timeout occurred waiting for the reset to
// / complete.
// /
// / @returns
// / - ::ZE_RESULT_SUCCESS
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
// / + `nullptr == hDevice`
// / - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
// / + `nullptr == pProperties`
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
// / + User does not have permissions to perform this operation.
// / - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE
// / + Reset cannot be performed because applications are using this device.
// / - ::ZE_RESULT_ERROR_UNKNOWN
// / + There were problems unloading the device driver, performing a bus reset or reloading the device driver.
func ZesDeviceResetExt(
hDevice ZesDeviceHandle, // hDevice [in] Sysman handle for the device
pProperties *ZesResetProperties, // pProperties [in] Device reset properties to apply
) (ZeResult, error) {
return zecall.Call[ZeResult]("zesDeviceResetExt", uintptr(hDevice), uintptr(unsafe.Pointer(pProperties)))
}
// ZesProcessState (zes_process_state_t) Contains information about a process that has an open connection with
// / this device
// /
// / @details
// / - The application can use the process ID to query the OS for the owner
// / and the path to the executable.
type ZesProcessState struct {
Stype ZesStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Processid uint32 // Processid [out] Host OS process ID.
Memsize uint64 // Memsize [out] Device memory size in bytes allocated by this process (may not necessarily be resident on the device at the time of reading).
Sharedsize uint64 // Sharedsize [out] The size of shared device memory mapped into this process (may not necessarily be resident on the device at the time of reading).
Engines ZesEngineTypeFlags // Engines [out] Bitfield of accelerator engine types being used by this process.
}
// ZesDeviceProcessesGetState Get information about host processes using the device
// /
// / @details
// / - The number of processes connected to the device is dynamic. This means
// / that between a call to determine the value of pCount and the
// / subsequent call, the number of processes may have increased or
// / decreased. It is recommended that a large array be passed in so as to
// / avoid receiving the error ::ZE_RESULT_ERROR_INVALID_SIZE. Also, always
// / check the returned value in pCount since it may be less than the
// / earlier call to get the required array size.
// / - The application may call this function from simultaneous threads.
// / - The implementation of this function should be lock-free.
// /
// / @returns
// / - ::ZE_RESULT_SUCCESS
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
// / - ::ZE_RESULT_ERROR_UNKNOWN
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
// / + `nullptr == hDevice`
// / - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
// / + `nullptr == pCount`
// / - ::ZE_RESULT_ERROR_INVALID_SIZE
// / + The provided value of pCount is not big enough to store information about all the processes currently attached to the device.
func ZesDeviceProcessesGetState(
hDevice ZesDeviceHandle, // hDevice [in] Sysman handle for the device
pCount *uint32, // pCount [in,out] pointer to the number of processes. if count is zero, then the driver shall update the value with the total number of processes currently attached to the device. if count is greater than the number of processes currently attached to the device, then the driver shall update the value with the correct number of processes.
pProcesses *ZesProcessState, // pProcesses [in,out][optional][range(0, *pCount)] array of process information. if count is less than the number of processes currently attached to the device, then the driver shall only retrieve information about that number of processes. In this case, the return code will ::ZE_RESULT_ERROR_INVALID_SIZE.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zesDeviceProcessesGetState", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pProcesses)))
}
// ZesPciAddress (zes_pci_address_t) PCI address
type ZesPciAddress struct {
Domain uint32 // Domain [out] BDF domain
Bus uint32 // Bus [out] BDF bus
Device uint32 // Device [out] BDF device
Function uint32 // Function [out] BDF function
}
// ZesPciSpeed (zes_pci_speed_t) PCI speed
type ZesPciSpeed struct {
Gen int32 // Gen [out] The link generation. A value of -1 means that this property is unknown.
Width int32 // Width [out] The number of lanes. A value of -1 means that this property is unknown.
Maxbandwidth int64 // Maxbandwidth [out] The maximum bandwidth in bytes/sec (sum of all lanes). A value of -1 means that this property is unknown.
}
// ZesPciProperties (zes_pci_properties_t) Static PCI properties
type ZesPciProperties struct {
Stype ZesStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Address ZesPciAddress // Address [out] The BDF address
Maxspeed ZesPciSpeed // Maxspeed [out] Fastest port configuration supported by the device (sum of all lanes)
Havebandwidthcounters ZeBool // Havebandwidthcounters [out] Indicates whether the `rxCounter` and `txCounter` members of ::zes_pci_stats_t will have valid values
Havepacketcounters ZeBool // Havepacketcounters [out] Indicates whether the `packetCounter` member of ::zes_pci_stats_t will have a valid value
Havereplaycounters ZeBool // Havereplaycounters [out] Indicates whether the `replayCounter` member of ::zes_pci_stats_t will have a valid value
}
// ZesPciLinkStatus (zes_pci_link_status_t) PCI link status
type ZesPciLinkStatus uintptr
const (
ZES_PCI_LINK_STATUS_UNKNOWN ZesPciLinkStatus = 0 // ZES_PCI_LINK_STATUS_UNKNOWN The link status could not be determined
ZES_PCI_LINK_STATUS_GOOD ZesPciLinkStatus = 1 // ZES_PCI_LINK_STATUS_GOOD The link is up and operating as expected
ZES_PCI_LINK_STATUS_QUALITY_ISSUES ZesPciLinkStatus = 2 // ZES_PCI_LINK_STATUS_QUALITY_ISSUES The link is up but has quality and/or bandwidth degradation
ZES_PCI_LINK_STATUS_STABILITY_ISSUES ZesPciLinkStatus = 3 // ZES_PCI_LINK_STATUS_STABILITY_ISSUES The link has stability issues and preventing workloads making forward
///< progress
ZES_PCI_LINK_STATUS_FORCE_UINT32 ZesPciLinkStatus = 0x7fffffff // ZES_PCI_LINK_STATUS_FORCE_UINT32 Value marking end of ZES_PCI_LINK_STATUS_* ENUMs
)
// ZesPciLinkQualIssueFlags (zes_pci_link_qual_issue_flags_t) PCI link quality degradation reasons
type ZesPciLinkQualIssueFlags uint32
const (
ZES_PCI_LINK_QUAL_ISSUE_FLAG_REPLAYS ZesPciLinkQualIssueFlags = /* ZE_BIT(0) */ (1 << 0) // ZES_PCI_LINK_QUAL_ISSUE_FLAG_REPLAYS A significant number of replays are occurring
ZES_PCI_LINK_QUAL_ISSUE_FLAG_SPEED ZesPciLinkQualIssueFlags = /* ZE_BIT(1) */ (1 << 1) // ZES_PCI_LINK_QUAL_ISSUE_FLAG_SPEED There is a degradation in the maximum bandwidth of the link
ZES_PCI_LINK_QUAL_ISSUE_FLAG_FORCE_UINT32 ZesPciLinkQualIssueFlags = 0x7fffffff // ZES_PCI_LINK_QUAL_ISSUE_FLAG_FORCE_UINT32 Value marking end of ZES_PCI_LINK_QUAL_ISSUE_FLAG_* ENUMs
)
// ZesPciLinkStabIssueFlags (zes_pci_link_stab_issue_flags_t) PCI link stability issues
type ZesPciLinkStabIssueFlags uint32
const (
ZES_PCI_LINK_STAB_ISSUE_FLAG_RETRAINING ZesPciLinkStabIssueFlags = /* ZE_BIT(0) */ (1 << 0) // ZES_PCI_LINK_STAB_ISSUE_FLAG_RETRAINING Link retraining has occurred to deal with quality issues
ZES_PCI_LINK_STAB_ISSUE_FLAG_FORCE_UINT32 ZesPciLinkStabIssueFlags = 0x7fffffff // ZES_PCI_LINK_STAB_ISSUE_FLAG_FORCE_UINT32 Value marking end of ZES_PCI_LINK_STAB_ISSUE_FLAG_* ENUMs
)
// ZesPciState (zes_pci_state_t) Dynamic PCI state
type ZesPciState struct {
Stype ZesStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Status ZesPciLinkStatus // Status [out] The current status of the port
Qualityissues ZesPciLinkQualIssueFlags // Qualityissues [out] If status is ::ZES_PCI_LINK_STATUS_QUALITY_ISSUES, then this gives a combination of ::zes_pci_link_qual_issue_flag_t for quality issues that have been detected; otherwise, 0 indicates there are no quality issues with the link at this time."
Stabilityissues ZesPciLinkStabIssueFlags // Stabilityissues [out] If status is ::ZES_PCI_LINK_STATUS_STABILITY_ISSUES, then this gives a combination of ::zes_pci_link_stab_issue_flag_t for reasons for the connection instability; otherwise, 0 indicates there are no connection stability issues at this time."
Speed ZesPciSpeed // Speed [out] The current port configure speed
}
// ZesPciBarType (zes_pci_bar_type_t) PCI bar types
type ZesPciBarType uintptr
const (
ZES_PCI_BAR_TYPE_MMIO ZesPciBarType = 0 // ZES_PCI_BAR_TYPE_MMIO MMIO registers
ZES_PCI_BAR_TYPE_ROM ZesPciBarType = 1 // ZES_PCI_BAR_TYPE_ROM ROM aperture
ZES_PCI_BAR_TYPE_MEM ZesPciBarType = 2 // ZES_PCI_BAR_TYPE_MEM Device memory
ZES_PCI_BAR_TYPE_FORCE_UINT32 ZesPciBarType = 0x7fffffff // ZES_PCI_BAR_TYPE_FORCE_UINT32 Value marking end of ZES_PCI_BAR_TYPE_* ENUMs
)
// ZesPciBarProperties (zes_pci_bar_properties_t) Properties of a pci bar
type ZesPciBarProperties struct {
Stype ZesStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Type ZesPciBarType // Type [out] The type of bar
Index uint32 // Index [out] The index of the bar
Base uint64 // Base [out] Base address of the bar.
Size uint64 // Size [out] Size of the bar.
}
// ZesPciBarProperties12 (zes_pci_bar_properties_1_2_t) Properties of a pci bar, including the resizable bar.
type ZesPciBarProperties12 struct {
Stype ZesStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Type ZesPciBarType // Type [out] The type of bar
Index uint32 // Index [out] The index of the bar
Base uint64 // Base [out] Base address of the bar.
Size uint64 // Size [out] Size of the bar.
Resizablebarsupported ZeBool // Resizablebarsupported [out] Support for Resizable Bar on this device.
Resizablebarenabled ZeBool // Resizablebarenabled [out] Resizable Bar enabled on this device
}
// ZesPciStats (zes_pci_stats_t) PCI stats counters
// /
// / @details
// / - Percent replays is calculated by taking two snapshots (s1, s2) and
// / using the equation: %replay = 10^6 * (s2.replayCounter -
// / s1.replayCounter) / (s2.maxBandwidth * (s2.timestamp - s1.timestamp))
// / - Percent throughput is calculated by taking two snapshots (s1, s2) and
// / using the equation: %bw = 10^6 * ((s2.rxCounter - s1.rxCounter) +
// / (s2.txCounter - s1.txCounter)) / (s2.maxBandwidth * (s2.timestamp -
// / s1.timestamp))
type ZesPciStats struct {
Timestamp uint64 // Timestamp [out] Monotonic timestamp counter in microseconds when the measurement was made. This timestamp should only be used to calculate delta time between snapshots of this structure. Never take the delta of this timestamp with the timestamp from a different structure since they are not guaranteed to have the same base. The absolute value of the timestamp is only valid during within the application and may be different on the next execution.
Replaycounter uint64 // Replaycounter [out] Monotonic counter for the number of replay packets (sum of all lanes). Will always be 0 when the `haveReplayCounters` member of ::zes_pci_properties_t is FALSE.
Packetcounter uint64 // Packetcounter [out] Monotonic counter for the number of packets (sum of all lanes). Will always be 0 when the `havePacketCounters` member of ::zes_pci_properties_t is FALSE.
Rxcounter uint64 // Rxcounter [out] Monotonic counter for the number of bytes received (sum of all lanes). Will always be 0 when the `haveBandwidthCounters` member of ::zes_pci_properties_t is FALSE.
Txcounter uint64 // Txcounter [out] Monotonic counter for the number of bytes transmitted (including replays) (sum of all lanes). Will always be 0 when the `haveBandwidthCounters` member of ::zes_pci_properties_t is FALSE.
Speed ZesPciSpeed // Speed [out] The current speed of the link (sum of all lanes)
}
// ZesDevicePciGetProperties Get PCI properties - address, max speed
// /
// / @details
// / - The application may call this function from simultaneous threads.
// / - The implementation of this function should be lock-free.
// /
// / @returns
// / - ::ZE_RESULT_SUCCESS
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
// / - ::ZE_RESULT_ERROR_UNKNOWN
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
// / + `nullptr == hDevice`
// / - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
// / + `nullptr == pProperties`
func ZesDevicePciGetProperties(
hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device.
pProperties *ZesPciProperties, // pProperties [in,out] Will contain the PCI properties.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zesDevicePciGetProperties", uintptr(hDevice), uintptr(unsafe.Pointer(pProperties)))
}
// ZesDevicePciGetState Get current PCI state - current speed
// /
// / @details
// / - The application may call this function from simultaneous threads.
// / - The implementation of this function should be lock-free.
// /
// / @returns
// / - ::ZE_RESULT_SUCCESS
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
// / - ::ZE_RESULT_ERROR_UNKNOWN
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
// / + `nullptr == hDevice`
// / - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
// / + `nullptr == pState`
func ZesDevicePciGetState(
hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device.
pState *ZesPciState, // pState [in,out] Will contain the PCI properties.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zesDevicePciGetState", uintptr(hDevice), uintptr(unsafe.Pointer(pState)))
}
// ZesDevicePciGetBars Get information about each configured bar
// /
// / @details
// / - The application may call this function from simultaneous threads.
// / - The implementation of this function should be lock-free.
// /
// / @returns
// / - ::ZE_RESULT_SUCCESS
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
// / - ::ZE_RESULT_ERROR_UNKNOWN
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
// / + `nullptr == hDevice`
// / - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
// / + `nullptr == pCount`
func ZesDevicePciGetBars(
hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device.
pCount *uint32, // pCount [in,out] pointer to the number of PCI bars. if count is zero, then the driver shall update the value with the total number of PCI bars that are setup. if count is greater than the number of PCI bars that are setup, then the driver shall update the value with the correct number of PCI bars.
pProperties *ZesPciBarProperties, // pProperties [in,out][optional][range(0, *pCount)] array of information about setup PCI bars. if count is less than the number of PCI bars that are setup, then the driver shall only retrieve information about that number of PCI bars.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zesDevicePciGetBars", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pProperties)))
}
// ZesDevicePciGetStats Get PCI stats - bandwidth, number of packets, number of replays
// /
// / @details
// / - The application may call this function from simultaneous threads.
// / - The implementation of this function should be lock-free.
// /
// / @returns
// / - ::ZE_RESULT_SUCCESS
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
// / - ::ZE_RESULT_ERROR_UNKNOWN
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
// / + `nullptr == hDevice`
// / - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
// / + `nullptr == pStats`
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
// / + User does not have permissions to query this telemetry.
func ZesDevicePciGetStats(
hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device.
pStats *ZesPciStats, // pStats [in,out] Will contain a snapshot of the latest stats.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zesDevicePciGetStats", uintptr(hDevice), uintptr(unsafe.Pointer(pStats)))
}