mirror of
https://github.com/fumiama/gozel.git
synced 2026-06-05 00:10:24 +08:00
260 lines
13 KiB
Go
260 lines
13 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"
|
|
)
|
|
|
|
// ZesMemType (zes_mem_type_t) Memory module types
|
|
type ZesMemType uintptr
|
|
const (
|
|
ZES_MEM_TYPE_HBM ZesMemType = 0 // ZES_MEM_TYPE_HBM HBM memory
|
|
ZES_MEM_TYPE_DDR ZesMemType = 1 // ZES_MEM_TYPE_DDR DDR memory
|
|
ZES_MEM_TYPE_DDR3 ZesMemType = 2 // ZES_MEM_TYPE_DDR3 DDR3 memory
|
|
ZES_MEM_TYPE_DDR4 ZesMemType = 3 // ZES_MEM_TYPE_DDR4 DDR4 memory
|
|
ZES_MEM_TYPE_DDR5 ZesMemType = 4 // ZES_MEM_TYPE_DDR5 DDR5 memory
|
|
ZES_MEM_TYPE_LPDDR ZesMemType = 5 // ZES_MEM_TYPE_LPDDR LPDDR memory
|
|
ZES_MEM_TYPE_LPDDR3 ZesMemType = 6 // ZES_MEM_TYPE_LPDDR3 LPDDR3 memory
|
|
ZES_MEM_TYPE_LPDDR4 ZesMemType = 7 // ZES_MEM_TYPE_LPDDR4 LPDDR4 memory
|
|
ZES_MEM_TYPE_LPDDR5 ZesMemType = 8 // ZES_MEM_TYPE_LPDDR5 LPDDR5 memory
|
|
ZES_MEM_TYPE_SRAM ZesMemType = 9 // ZES_MEM_TYPE_SRAM SRAM memory
|
|
ZES_MEM_TYPE_L1 ZesMemType = 10 // ZES_MEM_TYPE_L1 L1 cache
|
|
ZES_MEM_TYPE_L3 ZesMemType = 11 // ZES_MEM_TYPE_L3 L3 cache
|
|
ZES_MEM_TYPE_GRF ZesMemType = 12 // ZES_MEM_TYPE_GRF Execution unit register file
|
|
ZES_MEM_TYPE_SLM ZesMemType = 13 // ZES_MEM_TYPE_SLM Execution unit shared local memory
|
|
ZES_MEM_TYPE_GDDR4 ZesMemType = 14 // ZES_MEM_TYPE_GDDR4 GDDR4 memory
|
|
ZES_MEM_TYPE_GDDR5 ZesMemType = 15 // ZES_MEM_TYPE_GDDR5 GDDR5 memory
|
|
ZES_MEM_TYPE_GDDR5X ZesMemType = 16 // ZES_MEM_TYPE_GDDR5X GDDR5X memory
|
|
ZES_MEM_TYPE_GDDR6 ZesMemType = 17 // ZES_MEM_TYPE_GDDR6 GDDR6 memory
|
|
ZES_MEM_TYPE_GDDR6X ZesMemType = 18 // ZES_MEM_TYPE_GDDR6X GDDR6X memory
|
|
ZES_MEM_TYPE_GDDR7 ZesMemType = 19 // ZES_MEM_TYPE_GDDR7 GDDR7 memory
|
|
ZES_MEM_TYPE_FORCE_UINT32 ZesMemType = 0x7fffffff // ZES_MEM_TYPE_FORCE_UINT32 Value marking end of ZES_MEM_TYPE_* ENUMs
|
|
|
|
)
|
|
|
|
// ZesMemLoc (zes_mem_loc_t) Memory module location
|
|
type ZesMemLoc uintptr
|
|
const (
|
|
ZES_MEM_LOC_SYSTEM ZesMemLoc = 0 // ZES_MEM_LOC_SYSTEM System memory
|
|
ZES_MEM_LOC_DEVICE ZesMemLoc = 1 // ZES_MEM_LOC_DEVICE On board local device memory
|
|
ZES_MEM_LOC_FORCE_UINT32 ZesMemLoc = 0x7fffffff // ZES_MEM_LOC_FORCE_UINT32 Value marking end of ZES_MEM_LOC_* ENUMs
|
|
|
|
)
|
|
|
|
// ZesMemHealth (zes_mem_health_t) Memory health
|
|
type ZesMemHealth uintptr
|
|
const (
|
|
ZES_MEM_HEALTH_UNKNOWN ZesMemHealth = 0 // ZES_MEM_HEALTH_UNKNOWN The memory health cannot be determined.
|
|
ZES_MEM_HEALTH_OK ZesMemHealth = 1 // ZES_MEM_HEALTH_OK All memory channels are healthy.
|
|
ZES_MEM_HEALTH_DEGRADED ZesMemHealth = 2 // ZES_MEM_HEALTH_DEGRADED Excessive correctable errors have been detected on one or more
|
|
|
|
///< channels. Device should be reset.
|
|
|
|
ZES_MEM_HEALTH_CRITICAL ZesMemHealth = 3 // ZES_MEM_HEALTH_CRITICAL Operating with reduced memory to cover banks with too many
|
|
|
|
///< uncorrectable errors.
|
|
|
|
ZES_MEM_HEALTH_REPLACE ZesMemHealth = 4 // ZES_MEM_HEALTH_REPLACE Device should be replaced due to excessive uncorrectable errors.
|
|
ZES_MEM_HEALTH_FORCE_UINT32 ZesMemHealth = 0x7fffffff // ZES_MEM_HEALTH_FORCE_UINT32 Value marking end of ZES_MEM_HEALTH_* ENUMs
|
|
|
|
)
|
|
|
|
// ZesMemProperties (zes_mem_properties_t) Memory properties
|
|
type ZesMemProperties 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 ZesMemType // Type [out] The memory type
|
|
Onsubdevice ZeBool // Onsubdevice [out] True if this resource is located on a sub-device; false means that the resource is on the device of the calling Sysman handle
|
|
Subdeviceid uint32 // Subdeviceid [out] If onSubdevice is true, this gives the ID of the sub-device
|
|
Location ZesMemLoc // Location [out] Location of this memory (system, device)
|
|
Physicalsize uint64 // Physicalsize [out] Physical memory capacity in bytes. A value of 0 indicates that this property is not known. However, a call to zesMemoryGetState() will return the available free physical memory.
|
|
Buswidth int32 // Buswidth [out] Width of the memory bus. A value of -1 means that this property is unknown.
|
|
Numchannels int32 // Numchannels [out] The number of memory channels. A value of -1 means that this property is unknown.
|
|
|
|
}
|
|
|
|
// ZesMemState (zes_mem_state_t) Memory state - health, allocated
|
|
///
|
|
/// @details
|
|
/// - Percent free is given by 100 * free / pysical mem size.
|
|
type ZesMemState 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).
|
|
Health ZesMemHealth // Health [out] Indicates the health of the memory
|
|
Free uint64 // Free [out] The free physical memory in bytes
|
|
Size uint64 // Size [out] The total allocatable memory in bytes (can be less than the `physicalSize` member of ::zes_mem_properties_t). *DEPRECATED* This member can no longer track the allocatable memory reliably. Clients depending on this information can use the zeDeviceGetMemoryProperties with ze_device_usablemem_size_ext_properties_t extention to get information of the available usable memory.
|
|
|
|
}
|
|
|
|
// ZesMemBandwidth (zes_mem_bandwidth_t) Memory bandwidth
|
|
///
|
|
/// @details
|
|
/// - Percent bandwidth is calculated by taking two snapshots (s1, s2) and
|
|
/// using the equation: %bw = 10^6 * ((s2.readCounter - s1.readCounter) +
|
|
/// (s2.writeCounter - s1.writeCounter)) / (s2.maxBandwidth *
|
|
/// (s2.timestamp - s1.timestamp))
|
|
/// - Counter can roll over and rollover needs to be handled by comparing
|
|
/// the current read against the previous read
|
|
/// - Counter is a 32 byte transaction count, which means the calculated
|
|
/// delta (delta = current_value - previous_value or delta = 2^32 -
|
|
/// previous_value + current_value in case of rollover) needs to be
|
|
/// multiplied by 32 to get delta between samples in actual byte count
|
|
type ZesMemBandwidth struct {
|
|
Readcounter uint64 // Readcounter [out] Total bytes read from memory
|
|
Writecounter uint64 // Writecounter [out] Total bytes written to memory
|
|
Maxbandwidth uint64 // Maxbandwidth [out] Current maximum bandwidth in units of bytes/sec
|
|
Timestamp uint64 // Timestamp [out] The timestamp in microseconds when these measurements were sampled. 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.
|
|
|
|
}
|
|
|
|
// ZesMemExtBandwidth (zes_mem_ext_bandwidth_t) Extension properties for Memory bandwidth
|
|
///
|
|
/// @details
|
|
/// - Number of counter bits
|
|
/// - [DEPRECATED] No longer supported.
|
|
type ZesMemExtBandwidth struct {
|
|
Memorytimestampvalidbits uint32 // Memorytimestampvalidbits [out] Returns the number of valid bits in the timestamp values
|
|
|
|
}
|
|
|
|
// ZesDeviceEnumMemoryModules Get handle of memory modules
|
|
///
|
|
/// @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 ZesDeviceEnumMemoryModules(
|
|
hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device.
|
|
pCount *uint32, // pCount [in,out] pointer to the number of components of this type. if count is zero, then the driver shall update the value with the total number of components of this type that are available. if count is greater than the number of components of this type that are available, then the driver shall update the value with the correct number of components.
|
|
phMemory *ZesMemHandle, // phMemory [in,out][optional][range(0, *pCount)] array of handle of components of this type. if count is less than the number of components of this type that are available, then the driver shall only retrieve that number of component handles.
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zesDeviceEnumMemoryModules", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phMemory)))
|
|
}
|
|
|
|
// ZesMemoryGetProperties Get memory properties
|
|
///
|
|
/// @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 == hMemory`
|
|
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
|
|
/// + `nullptr == pProperties`
|
|
func ZesMemoryGetProperties(
|
|
hMemory ZesMemHandle, // hMemory [in] Handle for the component.
|
|
pProperties *ZesMemProperties, // pProperties [in,out] Will contain memory properties.
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zesMemoryGetProperties", uintptr(hMemory), uintptr(unsafe.Pointer(pProperties)))
|
|
}
|
|
|
|
// ZesMemoryGetState Get memory state - health, allocated
|
|
///
|
|
/// @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 == hMemory`
|
|
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
|
|
/// + `nullptr == pState`
|
|
func ZesMemoryGetState(
|
|
hMemory ZesMemHandle, // hMemory [in] Handle for the component.
|
|
pState *ZesMemState, // pState [in,out] Will contain the current health and allocated memory.
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zesMemoryGetState", uintptr(hMemory), uintptr(unsafe.Pointer(pState)))
|
|
}
|
|
|
|
// ZesMemoryGetBandwidth Get memory bandwidth
|
|
///
|
|
/// @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 == hMemory`
|
|
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
|
|
/// + `nullptr == pBandwidth`
|
|
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
|
|
/// + User does not have permissions to query this telemetry.
|
|
func ZesMemoryGetBandwidth(
|
|
hMemory ZesMemHandle, // hMemory [in] Handle for the component.
|
|
pBandwidth *ZesMemBandwidth, // pBandwidth [in,out] Will contain the total number of bytes read from and written to memory, as well as the current maximum bandwidth.
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zesMemoryGetBandwidth", uintptr(hMemory), uintptr(unsafe.Pointer(pBandwidth)))
|
|
}
|
|
|