diff --git a/api.go b/api.go new file mode 100644 index 0000000..a936a8b --- /dev/null +++ b/api.go @@ -0,0 +1,1504 @@ +// Code generated by cmd/gen. DO NOT EDIT. + +/* + * + * Copyright (C) 2026 Fumiama Minamoto + * + * SPDX-License-Identifier: MIT + * + * @file api.go + * + */ + +package gozel + +import ( + "fmt" + "os" + + "github.com/fumiama/gozel/internal/zecall" +) + +func init() { + + if err := zecall.Register("zeInit"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDriverGet"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeInitDrivers"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDriverGetApiVersion"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDriverGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDriverGetIpcProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDriverGetExtensionProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDriverGetExtensionFunctionAddress"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDriverGetLastErrorDescription"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDriverGetDefaultContext"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGet"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetRootDevice"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetSubDevices"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetComputeProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetModuleProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetCommandQueueGroupProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetMemoryProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetMemoryAccessProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetCacheProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetImageProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetExternalMemoryProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetP2PProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceCanAccessPeer"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetStatus"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetGlobalTimestamps"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceSynchronize"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetAggregatedCopyOffloadIncrementValue"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeContextCreate"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeContextCreateEx"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeContextDestroy"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeContextGetStatus"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandQueueCreate"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandQueueDestroy"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandQueueExecuteCommandLists"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandQueueSynchronize"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandQueueGetOrdinal"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandQueueGetIndex"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListCreate"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListCreateImmediate"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListDestroy"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListClose"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListReset"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendWriteGlobalTimestamp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListHostSynchronize"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListGetDeviceHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListGetContextHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListGetOrdinal"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListImmediateGetIndex"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListIsImmediate"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendBarrier"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendMemoryRangesBarrier"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeContextSystemBarrier"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendMemoryCopy"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendMemoryFill"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendMemoryCopyRegion"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendMemoryCopyFromContext"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendImageCopy"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendImageCopyRegion"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendImageCopyToMemory"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendImageCopyFromMemory"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendMemoryPrefetch"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendMemAdvise"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventPoolCreate"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventPoolDestroy"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventCreate"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventCounterBasedCreate"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventDestroy"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventPoolGetIpcHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventPoolPutIpcHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventPoolOpenIpcHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventPoolCloseIpcHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventCounterBasedGetIpcHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventCounterBasedOpenIpcHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventCounterBasedCloseIpcHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventCounterBasedGetDeviceAddress"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendSignalEvent"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendWaitOnEvents"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventHostSignal"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventHostSynchronize"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventQueryStatus"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendEventReset"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventHostReset"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventQueryKernelTimestamp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendQueryKernelTimestamps"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventGetEventPool"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventGetSignalScope"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventGetWaitScope"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventPoolGetContextHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventPoolGetFlags"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeFenceCreate"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeFenceDestroy"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeFenceHostSynchronize"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeFenceQueryStatus"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeFenceReset"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeImageGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeImageCreate"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeImageDestroy"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemAllocShared"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemAllocDevice"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemAllocHost"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemFree"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemGetAllocProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemGetAddressRange"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemGetIpcHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemGetIpcHandleFromFileDescriptorExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemGetFileDescriptorFromIpcHandleExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemPutIpcHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemOpenIpcHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemCloseIpcHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemSetAtomicAccessAttributeExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemGetAtomicAccessAttributeExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeModuleCreate"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeModuleDestroy"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeModuleDynamicLink"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeModuleBuildLogDestroy"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeModuleBuildLogGetString"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeModuleGetNativeBinary"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeModuleGetGlobalPointer"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeModuleGetKernelNames"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeModuleGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelCreate"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelDestroy"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeModuleGetFunctionPointer"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelSetGroupSize"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelSuggestGroupSize"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelSuggestMaxCooperativeGroupCount"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelSetArgumentValue"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelSetIndirectAccess"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelGetIndirectAccess"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelGetSourceAttributes"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelSetCacheConfig"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelGetName"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendLaunchKernel"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendLaunchKernelWithParameters"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendLaunchKernelWithArguments"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendLaunchCooperativeKernel"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendLaunchKernelIndirect"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendLaunchMultipleKernelsIndirect"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeContextMakeMemoryResident"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeContextEvictMemory"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeContextMakeImageResident"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeContextEvictImage"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeSamplerCreate"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeSamplerDestroy"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeVirtualMemReserve"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeVirtualMemFree"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeVirtualMemQueryPageSize"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zePhysicalMemGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zePhysicalMemCreate"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zePhysicalMemDestroy"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeVirtualMemMap"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeVirtualMemUnmap"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeVirtualMemSetAccessAttribute"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeVirtualMemGetAccessAttribute"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelSetGlobalOffsetExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelGetBinaryExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceImportExternalSemaphoreExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceReleaseExternalSemaphoreExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendSignalExternalSemaphoreExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendWaitExternalSemaphoreExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASBuilderCreateExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASBuilderGetBuildPropertiesExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDriverRTASFormatCompatibilityCheckExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASBuilderBuildExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASBuilderCommandListAppendCopyExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASBuilderDestroyExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASParallelOperationCreateExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASParallelOperationGetPropertiesExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASParallelOperationJoinExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASParallelOperationDestroyExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetVectorWidthPropertiesExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelGetAllocationPropertiesExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemGetIpcHandleWithProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceReserveCacheExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceSetCacheAdviceExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventQueryTimestampsExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeImageGetMemoryPropertiesExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeImageViewCreateExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeImageViewCreateExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeKernelSchedulingHintExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDevicePciGetPropertiesExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendImageCopyToMemoryExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListAppendImageCopyFromMemoryExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeImageGetAllocPropertiesExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeModuleInspectLinkageExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemFreeExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeFabricVertexGetExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeFabricVertexGetSubVerticesExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeFabricVertexGetPropertiesExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeFabricVertexGetDeviceExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDeviceGetFabricVertexExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeFabricEdgeGetExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeFabricEdgeGetVerticesExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeFabricEdgeGetPropertiesExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeEventQueryKernelTimestampsExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASBuilderCreateExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASBuilderGetBuildPropertiesExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeDriverRTASFormatCompatibilityCheckExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASBuilderBuildExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASBuilderDestroyExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASParallelOperationCreateExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASParallelOperationGetPropertiesExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASParallelOperationJoinExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeRTASParallelOperationDestroyExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeMemGetPitchFor2dImage"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeImageGetDeviceOffsetExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListCreateCloneExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListImmediateAppendCommandListsExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListGetNextCommandIdExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListGetNextCommandIdWithKernelsExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListUpdateMutableCommandsExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListUpdateMutableCommandSignalEventExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListUpdateMutableCommandWaitEventsExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zeCommandListUpdateMutableCommandKernelsExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zerGetLastErrorDescription"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zerTranslateDeviceHandleToIdentifier"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zerTranslateIdentifierToDeviceHandle"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zerGetDefaultContext"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesInit"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDriverGet"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDriverGetExtensionProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDriverGetExtensionFunctionAddress"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceGet"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceGetState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceReset"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceResetExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceProcessesGetState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDevicePciGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDevicePciGetState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDevicePciGetBars"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDevicePciGetStats"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceSetOverclockWaiver"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceGetOverclockDomains"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceGetOverclockControls"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceResetOverclockSettings"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceReadOverclockState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumOverclockDomains"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesOverclockGetDomainProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesOverclockGetDomainVFProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesOverclockGetDomainControlProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesOverclockGetControlCurrentValue"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesOverclockGetControlPendingValue"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesOverclockSetControlUserValue"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesOverclockGetControlState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesOverclockGetVFPointValues"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesOverclockSetVFPointValues"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumDiagnosticTestSuites"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDiagnosticsGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDiagnosticsGetTests"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDiagnosticsRunTests"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEccAvailable"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEccConfigurable"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceGetEccState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceSetEccState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumEngineGroups"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesEngineGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesEngineGetActivity"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEventRegister"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDriverEventListen"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDriverEventListenEx"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumFabricPorts"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFabricPortGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFabricPortGetLinkType"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFabricPortGetConfig"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFabricPortSetConfig"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFabricPortGetState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFabricPortGetThroughput"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFabricPortGetFabricErrorCounters"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFabricPortGetMultiPortThroughput"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumFans"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFanGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFanGetConfig"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFanSetDefaultMode"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFanSetFixedSpeedMode"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFanSetSpeedTableMode"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFanGetState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumFirmwares"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFirmwareGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFirmwareFlash"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFirmwareGetFlashProgress"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFirmwareGetConsoleLogs"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumFrequencyDomains"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyGetAvailableClocks"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyGetRange"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencySetRange"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyGetState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyGetThrottleTime"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyOcGetCapabilities"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyOcGetFrequencyTarget"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyOcSetFrequencyTarget"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyOcGetVoltageTarget"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyOcSetVoltageTarget"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyOcSetMode"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyOcGetMode"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyOcGetIccMax"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyOcSetIccMax"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyOcGetTjMax"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFrequencyOcSetTjMax"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumLeds"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesLedGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesLedGetState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesLedSetState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesLedSetColor"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumMemoryModules"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesMemoryGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesMemoryGetState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesMemoryGetBandwidth"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumPerformanceFactorDomains"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesPerformanceFactorGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesPerformanceFactorGetConfig"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesPerformanceFactorSetConfig"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumPowerDomains"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceGetCardPowerDomain"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesPowerGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesPowerGetEnergyCounter"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesPowerGetLimits"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesPowerSetLimits"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesPowerGetEnergyThreshold"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesPowerSetEnergyThreshold"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumPsus"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesPsuGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesPsuGetState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumRasErrorSets"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesRasGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesRasGetConfig"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesRasSetConfig"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesRasGetState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumSchedulers"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesSchedulerGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesSchedulerGetCurrentMode"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesSchedulerGetTimeoutModeProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesSchedulerGetTimesliceModeProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesSchedulerSetTimeoutMode"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesSchedulerSetTimesliceMode"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesSchedulerSetExclusiveMode"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesSchedulerSetComputeUnitDebugMode"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumStandbyDomains"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesStandbyGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesStandbyGetMode"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesStandbySetMode"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumTemperatureSensors"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesTemperatureGetProperties"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesTemperatureGetConfig"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesTemperatureSetConfig"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesTemperatureGetState"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDevicePciLinkSpeedUpdateExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesPowerGetLimitsExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesPowerSetLimitsExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesEngineGetActivityExt"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesRasGetStateExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesRasClearStateExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFirmwareGetSecurityVersionExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesFirmwareSetSecurityVersionExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceGetSubDevicePropertiesExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDriverGetDeviceByUuidExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumActiveVFExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesVFManagementGetVFPropertiesExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesVFManagementGetVFMemoryUtilizationExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesVFManagementGetVFEngineUtilizationExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesVFManagementSetVFTelemetryModeExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesVFManagementSetVFTelemetrySamplingIntervalExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesDeviceEnumEnabledVFExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesVFManagementGetVFCapabilitiesExp"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesVFManagementGetVFMemoryUtilizationExp2"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesVFManagementGetVFEngineUtilizationExp2"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + + if err := zecall.Register("zesVFManagementGetVFCapabilitiesExp2"); err != nil { + fmt.Fprintln(os.Stderr, "[gozel.warn]", err) + } + +} diff --git a/cmd/examples/gemm/main.go b/cmd/examples/gemm/main.go index b74931c..1fd19b4 100644 --- a/cmd/examples/gemm/main.go +++ b/cmd/examples/gemm/main.go @@ -3,14 +3,13 @@ package main import ( "fmt" - "github.com/fumiama/gozel" + "github.com/fumiama/gozel/ze" ) func main() { - err := gozel.InitZe() + hs, err := ze.InitGPUDrivers() if err != nil { panic(err) } - desc := gozel.GPGPUDriverTypeDesc() - fmt.Println(gozel.InitDrivers(&desc)) + fmt.Println(hs) } diff --git a/cmd/gen/api.go b/cmd/gen/api.go new file mode 100644 index 0000000..137777b --- /dev/null +++ b/cmd/gen/api.go @@ -0,0 +1,47 @@ +package main + +import "os" + +var apif *os.File + +func init() { + f, err := os.Create("api.go") + if err != nil { + panic(err) + } + apif = f + apif.WriteString(`// Code generated by cmd/gen. DO NOT EDIT. + +/* + * + * Copyright (C) 2026 Fumiama Minamoto + * + * SPDX-License-Identifier: MIT + * + * @file api.go + * + */ + +package gozel + +import ( + "fmt" + "os" + + "github.com/fumiama/gozel/internal/zecall" +) + +func init() { +`) +} + +func addAPI(name string) { + apif.WriteString("\n\tif err := zecall.Register(\"") + apif.WriteString(name) + apif.WriteString("\"); err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"[gozel.warn]\", err)\n\t}\n") +} + +func closeAPI() { + apif.WriteString("\n}\n") + apif.Close() +} diff --git a/cmd/gen/main.go b/cmd/gen/main.go index d7a1205..b5d6af4 100644 --- a/cmd/gen/main.go +++ b/cmd/gen/main.go @@ -42,6 +42,8 @@ func main() { specdir = os.DirFS(*spec) } + defer closeAPI() + fmt.Println("[main] parsing core APIs...") f, err := specdir.Open("include/level_zero/ze_api.h") if err != nil { diff --git a/cmd/gen/scan.go b/cmd/gen/scan.go index ce90c96..8e2a60c 100644 --- a/cmd/gen/scan.go +++ b/cmd/gen/scan.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "os" - "path" "strings" "unicode" ) @@ -42,42 +41,52 @@ var ( "int": "int32", "unsigned int": "uint32", - "float": "float32", - "double": "float64", + "float": "float32", + "double": "float64", + "float*": "*float32", + "double*": "*float64", } unsafeExcludeRegions = map[string]struct{}{ - "bfloat16conversions": {}, - "globaloffset": {}, - "linkonceodr": {}, - "subgroups": {}, + "core_bfloat16conversions": {}, + "core_globaloffset": {}, + "core_linkonceodr": {}, + "core_subgroups": {}, } zecallExcludeRegions = map[string]struct{}{ - "bandwidth": {}, - "bfloat16conversions": {}, - "CacheLineSize": {}, - "callbacks": {}, - "common": {}, - "counterbasedeventpool": {}, - "deviceipversion": {}, - "deviceLUID": {}, - "deviceusablememproperties": {}, - "driverDDIHandles": {}, - "EUCount": {}, - "externalMemMap": {}, - "floatAtomics": {}, - "imageFormatSupport": {}, - "imageviewplanar": {}, - "kernelMaxGroupSizeProperties": {}, - "linkonceodr": {}, - "memoryCompressionHints": {}, - "memoryProperties": {}, - "powersavinghint": {}, - "program": {}, - "raytracing": {}, - "relaxedAllocLimits": {}, - "SRGB": {}, - "subAllocationsProperties": {}, - "subgroups": {}, + "core_bandwidth": {}, + "core_bfloat16conversions": {}, + "core_CacheLineSize": {}, + "core_callbacks": {}, + "core_common": {}, + "core_counterbasedeventpool": {}, + "core_deviceipversion": {}, + "core_deviceLUID": {}, + "core_deviceusablememproperties": {}, + "core_driverDDIHandles": {}, + "core_EUCount": {}, + "core_externalMemMap": {}, + "core_floatAtomics": {}, + "core_imageFormatSupport": {}, + "core_imageviewplanar": {}, + "core_kernelMaxGroupSizeProperties": {}, + "core_linkonceodr": {}, + "core_memoryCompressionHints": {}, + "core_memoryProperties": {}, + "core_powersavinghint": {}, + "core_program": {}, + "core_raytracing": {}, + "core_relaxedAllocLimits": {}, + "core_SRGB": {}, + "core_subAllocationsProperties": {}, + "core_subgroups": {}, + + "sysm_common": {}, + "sysm_eccState": {}, + "sysm_memoryBwCounterValidBits": {}, + "sysm_memPageOfflineState": {}, + "sysm_powerDomainProperties": {}, + + "tols_common": {}, } ) @@ -95,18 +104,8 @@ func infh(name string) string { func scanHeader(name string, scan *bufio.Scanner) { ln := 0 var regionfile *os.File - symtab := symbolTable{ - "ZE_APICALL": &symbol{symbolTypeConst, symbolSubTypeDefine, "ZE_APICALL", []string{""}}, - "ZE_APIEXPORT": &symbol{symbolTypeConst, symbolSubTypeDefine, "ZE_APIEXPORT", []string{""}}, - "ZE_DLLEXPORT": &symbol{symbolTypeConst, symbolSubTypeDefine, "ZE_DLLEXPORT", []string{""}}, - } fileheadersb := strings.Builder{} region := "" - _ = os.RemoveAll(name) - err := os.MkdirAll(name, 0755) - if err != nil { - panic(fmt.Sprintf("%s L%d: cannot create region folder %s, err: %v", name, ln, region, err)) - } for scan.Scan() { ln++ t := scan.Text() @@ -122,24 +121,23 @@ func scanHeader(name string, scan *bufio.Scanner) { panic(fmt.Sprintf("%s L%d: unexpected empty region", name, ln)) } fmt.Println(infh(name), "scanning region", region) - f, err := os.Create(path.Join(name, region+".go")) + k := fmt.Sprint(name, "_", region) + f, err := os.Create(fmt.Sprint(k, ".go")) if err != nil { panic(fmt.Sprintf("%s L%d: cannot create region %s, err: %v", name, ln, region, err)) } f.WriteString("// Code generated by cmd/gen. DO NOT EDIT.\n\n") f.WriteString(fileheadersb.String()) f.WriteString("\n") - f.WriteString("package ") - f.WriteString(name) - f.WriteString("\n\n") + f.WriteString("package gozel\n\n") noimport := true sb := strings.Builder{} sb.WriteString("import (") - if _, ok := unsafeExcludeRegions[region]; !ok { + if _, ok := unsafeExcludeRegions[k]; !ok { sb.WriteString("\n\t\"unsafe\"\n") noimport = false } - if _, ok := zecallExcludeRegions[region]; !ok { + if _, ok := zecallExcludeRegions[k]; !ok { sb.WriteString("\n\t\"github.com/fumiama/gozel/internal/zecall\"\n") noimport = false } @@ -151,7 +149,7 @@ func scanHeader(name string, scan *bufio.Scanner) { // block barrier case strings.HasPrefix(t, "///////////////////////////////////////////////////////////////////////////////"): fmt.Println(" [scan] enter", region, "block") - ln = scanBlocks(name, scan, regionfile, ln, symtab) + ln = scanBlocks(name, scan, regionfile, ln) fmt.Println(" [scan] leave", region, "block") // pragma end case strings.HasPrefix(t, "#pragma endregion"): @@ -170,7 +168,7 @@ func scanHeader(name string, scan *bufio.Scanner) { } func checkSymbolName( - symtab symbolTable, ln int, name, sname, goname string, + ln int, name, sname, goname string, sb *strings.Builder, f *os.File, eq func() *symbol) bool { if _, ok := symtab[sname]; ok { panic(fmt.Sprintf("%s L%d: func #define %s has been defined", name, ln, sname)) @@ -195,7 +193,7 @@ func checkSymbolName( func scanBlocks( name string, scan *bufio.Scanner, f *os.File, - ln int, symtab symbolTable, + ln int, ) int { sb := strings.Builder{} ppskip2nextblk := false @@ -253,7 +251,7 @@ func scanBlocks( if !strings.Contains(argn, "(") { // is const define sname := strings.TrimSpace(argn) val := symtab.apply(strings.TrimSpace(argv)) - checkSymbolName(symtab, ln, name, sname, sname, &sb, f, func() *symbol { + checkSymbolName(ln, name, sname, sname, &sb, f, func() *symbol { return newSymbolConst(sname, val, symbolSubTypeDefine) }) f.WriteString("const ") @@ -274,7 +272,7 @@ func scanBlocks( sname = strings.TrimSpace(sname) args = strings.TrimSpace(args) eval := strings.TrimSpace(argseval[n+1:]) - checkSymbolName(symtab, ln, name, sname, sname, &sb, f, func() *symbol { + checkSymbolName(ln, name, sname, sname, &sb, f, func() *symbol { return newSymbolFunc(sname, args, eval, symbolSubTypeDefine) }) f.WriteString("func ") @@ -287,12 +285,45 @@ func scanBlocks( f.WriteString(eval) f.WriteString("\n}\n\n") case strings.HasPrefix(t, "typedef "): - ln = scanTypedef(name, scan, f, ln, symtab, t, &sb) + ln = scanTypedef(name, scan, f, ln, t, &sb) case strings.HasPrefix(t, "ZE_APIEXPORT "): if !strings.HasSuffix(t, " ZE_APICALL") { panic(fmt.Sprintf("%s L%d: unexpected func line %s", name, ln, t)) } - ln = scanFunc(name, scan, f, ln, symtab, t, &sb) + ln = scanFunc(name, scan, f, ln, t, &sb) + case strings.HasPrefix(t, "static const ") && strings.HasSuffix(t, "= {"): + t = strings.TrimSpace(t[13 : len(t)-3]) + i := strings.LastIndex(t, " ") + if i <= 0 { + panic(fmt.Sprintf("%s L%d: unexpected short var %s", name, ln, t)) + } + typ := symtab.apply(strings.TrimSpace(t[:i])) + rnam := []rune(strings.TrimSpace(t[i+1:])) + rnam[0] = unicode.ToUpper(rnam[0]) + nam := string(rnam) + f.WriteString(strings.Replace(sb.String(), "/ @brief", " "+nam, 1)) + sb.Reset() + f.WriteString("var ") + f.WriteString(nam) + f.WriteString(" = ") + f.WriteString(typ) + f.WriteString("{") + for { + f.WriteString("\n") + s, isfin := scanln(name, scan, &ln) + if isfin { + break + } + s = strings.TrimSpace(s) + f.WriteString("\t") + if strings.HasPrefix(s, "0,") && strings.Contains(s, "///< p") { + f.WriteString("nil,") + f.WriteString(s[2:]) + } else { + f.WriteString(s) + } + } + f.WriteString("}\n\n") default: panic(fmt.Sprintf("%s L%d: unexpected line %s", name, ln, t)) } @@ -302,7 +333,7 @@ func scanBlocks( func scanTypedef( name string, scan *bufio.Scanner, f *os.File, - ln int, symtab symbolTable, firstln string, sb *strings.Builder, + ln int, firstln string, sb *strings.Builder, ) int { s, newln := get1sentence(firstln, scan, ln) if newln < 0 { @@ -326,7 +357,7 @@ func scanTypedef( } goname := us2camel(fnname) fnname += "_t" - checkSymbolName(symtab, ln, name, fnname, goname, sb, f, func() *symbol { + checkSymbolName(ln, name, fnname, goname, sb, f, func() *symbol { return newSymbolConst(fnname, goname, symbolSubTypeFuncPtr) }) f.WriteString("// gozel warn: please use C function pointer loaded from C library!\n") @@ -510,7 +541,7 @@ func scanTypedef( } sname := strings.TrimSuffix(strings.TrimSpace(lines[0][1:]), ";") val := us2camel(strings.TrimSuffix(sname, "_t")) - checkSymbolName(symtab, ln, name, sname, val, sb, f, func() *symbol { + checkSymbolName(ln, name, sname, val, sb, f, func() *symbol { return newSymbolConst(sname, val, symbolSubTypeLargeStruct) }) f.WriteString("type ") @@ -563,7 +594,7 @@ func scanTypedef( } sname := strings.TrimSuffix(strings.TrimSpace(lines[0][1:]), ";") val := us2camel(strings.TrimSuffix(sname, "_t")) - redirect := checkSymbolName(symtab, ln, name, sname, val, sb, f, func() *symbol { + redirect := checkSymbolName(ln, name, sname, val, sb, f, func() *symbol { return newSymbolConst(sname, val, symbolSubTypeEnum) }) replaces := "" @@ -611,7 +642,7 @@ func scanTypedef( sname := strings.TrimSpace(strings.TrimSuffix(strings.TrimSpace(typs[1]), ";")) val := us2camel(strings.TrimSuffix(sname, "_t")) origtyp := strings.TrimSuffix(symtab.apply(strings.TrimSpace(typs[0])), "_t") - checkSymbolName(symtab, ln, name, sname, val, sb, f, func() *symbol { + checkSymbolName(ln, name, sname, val, sb, f, func() *symbol { return newSymbolConst(sname, val, symbolSubTypeEmptyStruct) }) f.WriteString("type ") @@ -624,11 +655,11 @@ func scanTypedef( func scanFunc( name string, scan *bufio.Scanner, f *os.File, - ln int, symtab symbolTable, firstln string, sb *strings.Builder, + ln int, firstln string, sb *strings.Builder, ) int { //TODO: register func rettyp := strings.TrimSpace(firstln[13 : len(firstln)-11]) - rettyp = symtab.apply(strings.TrimSpace(rettyp)) + rettyp = strings.TrimSuffix(symtab.apply(strings.TrimSpace(rettyp)), "_t") fnname, isfin := scanln(name, scan, &ln) if isfin { panic(fmt.Sprintf("%s L%d: unexpected early end func name line %s", name, ln, fnname)) @@ -661,6 +692,9 @@ func scanFunc( f.WriteString(argln[4:]) continue } + if argln == "void" { + continue + } argtypnam, argcomment, ok := strings.Cut(argln, "//") if !ok { panic(fmt.Sprintf("%s L%d: unexpected non-comment func arg line %s", name, ln, argln)) @@ -675,13 +709,17 @@ func scanFunc( argsb.WriteString(", uintptr(") argtyp := strings.TrimSpace(strings.ReplaceAll(argtypnam[:i], "const ", "")) isp := strings.HasSuffix(argtyp, "*") // is pointer + pmark := "*" + if strings.HasSuffix(argtyp, "**") { // is pointer's pointer + pmark = "**" + } convtyp, ok := typemap[argtyp] if ok { argtyp = convtyp } if isp { if !ok { - argtyp = "*" + argtyp[:len(argtyp)-1] + argtyp = pmark + argtyp[:len(argtyp)-len(pmark)] } argsb.WriteString("unsafe.Pointer(") } else { @@ -689,7 +727,7 @@ func scanFunc( if ok && sym.sstype == symbolSubTypeLargeStruct && !strings.HasPrefix(argnam, "p") { isp = true - argtyp = "*" + argtyp + argtyp = pmark + argtyp argcomment += " (gozel hack: converted to a hidden pointer from a struct value)" argsb.WriteString("unsafe.Pointer(") } @@ -716,5 +754,6 @@ func scanFunc( f.WriteString("\"") f.WriteString(argsb.String()) f.WriteString(")\n}\n\n") + addAPI(origfnname) return ln } diff --git a/cmd/gen/symbol.go b/cmd/gen/symbol.go index 66fb536..28df057 100644 --- a/cmd/gen/symbol.go +++ b/cmd/gen/symbol.go @@ -1,9 +1,12 @@ package main import ( + "bytes" "errors" + "regexp" "strconv" "strings" + "unicode" ) var ( @@ -11,6 +14,13 @@ var ( errNoSuchSymbol = errors.New("no such sybmol") ) +var symtab = symbolTable{ + "ZE_APICALL": &symbol{symbolTypeConst, symbolSubTypeDefine, "ZE_APICALL", []string{""}}, + "ZE_APIEXPORT": &symbol{symbolTypeConst, symbolSubTypeDefine, "ZE_APIEXPORT", []string{""}}, + "ZE_DLLEXPORT": &symbol{symbolTypeConst, symbolSubTypeDefine, "ZE_DLLEXPORT", []string{""}}, + "~(0ULL": &symbol{symbolTypeConst, symbolSubTypeDefine, "~(0ULL", []string{"(^uint64(0)"}}, +} + type symbolTable map[string]*symbol func (st symbolTable) apply(t string) string { @@ -96,7 +106,18 @@ func (s *symbol) extract1stFunc(txt string) (args []string, a, b int, err error) func (s *symbol) replace(txt string) string { switch s.stype { case symbolTypeConst: - return strings.ReplaceAll(txt, s.name, s.fields[0]) + escapes := regexp.QuoteMeta(s.name) + re := regexp.MustCompile(`(` + escapes + `[^\w_])|(` + escapes + `$)`) + return string(re.ReplaceAllFunc([]byte(txt), func(b []byte) []byte { + last := rune(b[len(b)-1]) + if unicode.IsLetter(last) || last == '_' { + return []byte(s.fields[0]) + } + buf := bytes.NewBuffer(make([]byte, 0, 128)) + buf.WriteString(s.fields[0]) + buf.WriteByte(b[len(b)-1]) + return buf.Bytes() + })) case symbolTypeFunc: paras := strings.Split(s.fields[0], ",") txts := []string{} diff --git a/core/CacheLineSize.go b/core_CacheLineSize.go similarity index 99% rename from core/CacheLineSize.go rename to core_CacheLineSize.go index cf29b16..c258e03 100644 --- a/core/CacheLineSize.go +++ b/core_CacheLineSize.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/EUCount.go b/core_EUCount.go similarity index 99% rename from core/EUCount.go rename to core_EUCount.go index b27011e..bd3917b 100644 --- a/core/EUCount.go +++ b/core_EUCount.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/PCIProperties.go b/core_PCIProperties.go similarity index 99% rename from core/PCIProperties.go rename to core_PCIProperties.go index 567f9c5..ecd184a 100644 --- a/core/PCIProperties.go +++ b/core_PCIProperties.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/RTAS.go b/core_RTAS.go similarity index 99% rename from core/RTAS.go rename to core_RTAS.go index 0257c22..294529c 100644 --- a/core/RTAS.go +++ b/core_RTAS.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/RTASBuilder.go b/core_RTASBuilder.go similarity index 99% rename from core/RTASBuilder.go rename to core_RTASBuilder.go index 2e3a4e4..d9fe533 100644 --- a/core/RTASBuilder.go +++ b/core_RTASBuilder.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/SRGB.go b/core_SRGB.go similarity index 99% rename from core/SRGB.go rename to core_SRGB.go index 215ee37..893b1ee 100644 --- a/core/SRGB.go +++ b/core_SRGB.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/bandwidth.go b/core_bandwidth.go similarity index 99% rename from core/bandwidth.go rename to core_bandwidth.go index 9ed6a72..d3d111c 100644 --- a/core/bandwidth.go +++ b/core_bandwidth.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/barrier.go b/core_barrier.go similarity index 99% rename from core/barrier.go rename to core_barrier.go index 85b621a..d1c2034 100644 --- a/core/barrier.go +++ b/core_barrier.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/bfloat16conversions.go b/core_bfloat16conversions.go similarity index 98% rename from core/bfloat16conversions.go rename to core_bfloat16conversions.go index 1459c45..58ef702 100644 --- a/core/bfloat16conversions.go +++ b/core_bfloat16conversions.go @@ -11,7 +11,7 @@ * */ -package core +package gozel // ZE_BFLOAT16_CONVERSIONS_EXT_NAME Bfloat16 Conversions Extension Name const ZE_BFLOAT16_CONVERSIONS_EXT_NAME = "ZE_extension_bfloat16_conversions" diff --git a/core/bindlessimages.go b/core_bindlessimages.go similarity index 99% rename from core/bindlessimages.go rename to core_bindlessimages.go index 4d36083..3f40744 100644 --- a/core/bindlessimages.go +++ b/core_bindlessimages.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/cacheReservation.go b/core_cacheReservation.go similarity index 99% rename from core/cacheReservation.go rename to core_cacheReservation.go index a235115..ad428e7 100644 --- a/core/cacheReservation.go +++ b/core_cacheReservation.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/callbacks.go b/core_callbacks.go similarity index 99% rename from core/callbacks.go rename to core_callbacks.go index af08405..c4e70e5 100644 --- a/core/callbacks.go +++ b/core_callbacks.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/cmdlist.go b/core_cmdlist.go similarity index 99% rename from core/cmdlist.go rename to core_cmdlist.go index b774823..bfc6219 100644 --- a/core/cmdlist.go +++ b/core_cmdlist.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/cmdqueue.go b/core_cmdqueue.go similarity index 99% rename from core/cmdqueue.go rename to core_cmdqueue.go index ecc0b27..c734517 100644 --- a/core/cmdqueue.go +++ b/core_cmdqueue.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/commandListClone.go b/core_commandListClone.go similarity index 99% rename from core/commandListClone.go rename to core_commandListClone.go index 92ea8a6..81e09d3 100644 --- a/core/commandListClone.go +++ b/core_commandListClone.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/common.go b/core_common.go similarity index 99% rename from core/common.go rename to core_common.go index 5afa78e..409af86 100644 --- a/core/common.go +++ b/core_common.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/context.go b/core_context.go similarity index 99% rename from core/context.go rename to core_context.go index fdb172c..bf452dd 100644 --- a/core/context.go +++ b/core_context.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/copy.go b/core_copy.go similarity index 99% rename from core/copy.go rename to core_copy.go index 91ddc80..c8fd996 100644 --- a/core/copy.go +++ b/core_copy.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/counterbasedeventpool.go b/core_counterbasedeventpool.go similarity index 99% rename from core/counterbasedeventpool.go rename to core_counterbasedeventpool.go index dd1d49b..de790c5 100644 --- a/core/counterbasedeventpool.go +++ b/core_counterbasedeventpool.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/device.go b/core_device.go similarity index 99% rename from core/device.go rename to core_device.go index 86e2100..04ad9d0 100644 --- a/core/device.go +++ b/core_device.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/deviceLUID.go b/core_deviceLUID.go similarity index 99% rename from core/deviceLUID.go rename to core_deviceLUID.go index 05967fb..923e3f6 100644 --- a/core/deviceLUID.go +++ b/core_deviceLUID.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/deviceVectorSizes.go b/core_deviceVectorSizes.go similarity index 99% rename from core/deviceVectorSizes.go rename to core_deviceVectorSizes.go index dd534eb..77507d4 100644 --- a/core/deviceVectorSizes.go +++ b/core_deviceVectorSizes.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/deviceipversion.go b/core_deviceipversion.go similarity index 99% rename from core/deviceipversion.go rename to core_deviceipversion.go index 02678d0..bb11efd 100644 --- a/core/deviceipversion.go +++ b/core_deviceipversion.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/deviceusablememproperties.go b/core_deviceusablememproperties.go similarity index 99% rename from core/deviceusablememproperties.go rename to core_deviceusablememproperties.go index 8948201..cb906d7 100644 --- a/core/deviceusablememproperties.go +++ b/core_deviceusablememproperties.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/driver.go b/core_driver.go similarity index 99% rename from core/driver.go rename to core_driver.go index 728a50c..6028d3b 100644 --- a/core/driver.go +++ b/core_driver.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/driverDDIHandles.go b/core_driverDDIHandles.go similarity index 99% rename from core/driverDDIHandles.go rename to core_driverDDIHandles.go index 259d756..26a33bd 100644 --- a/core/driverDDIHandles.go +++ b/core_driverDDIHandles.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/event.go b/core_event.go similarity index 99% rename from core/event.go rename to core_event.go index 0738a0a..7f446ee 100644 --- a/core/event.go +++ b/core_event.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/eventQueryKernelTimestamps.go b/core_eventQueryKernelTimestamps.go similarity index 99% rename from core/eventQueryKernelTimestamps.go rename to core_eventQueryKernelTimestamps.go index dfc3aa8..c38d03f 100644 --- a/core/eventQueryKernelTimestamps.go +++ b/core_eventQueryKernelTimestamps.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/eventquerytimestamps.go b/core_eventquerytimestamps.go similarity index 99% rename from core/eventquerytimestamps.go rename to core_eventquerytimestamps.go index aa4666f..c9610db 100644 --- a/core/eventquerytimestamps.go +++ b/core_eventquerytimestamps.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/externalMemMap.go b/core_externalMemMap.go similarity index 99% rename from core/externalMemMap.go rename to core_externalMemMap.go index ca3191e..f144b58 100644 --- a/core/externalMemMap.go +++ b/core_externalMemMap.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/externalSemaphores.go b/core_externalSemaphores.go similarity index 99% rename from core/externalSemaphores.go rename to core_externalSemaphores.go index 892384c..858486c 100644 --- a/core/externalSemaphores.go +++ b/core_externalSemaphores.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/fabric.go b/core_fabric.go similarity index 99% rename from core/fabric.go rename to core_fabric.go index debe1a7..b5e1f6e 100644 --- a/core/fabric.go +++ b/core_fabric.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/fence.go b/core_fence.go similarity index 99% rename from core/fence.go rename to core_fence.go index c78b941..0ddab61 100644 --- a/core/fence.go +++ b/core_fence.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/floatAtomics.go b/core_floatAtomics.go similarity index 99% rename from core/floatAtomics.go rename to core_floatAtomics.go index 5b9b89d..e7ab75d 100644 --- a/core/floatAtomics.go +++ b/core_floatAtomics.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/globaloffset.go b/core_globaloffset.go similarity index 99% rename from core/globaloffset.go rename to core_globaloffset.go index 80519f5..7a132c3 100644 --- a/core/globaloffset.go +++ b/core_globaloffset.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "github.com/fumiama/gozel/internal/zecall" diff --git a/core/image.go b/core_image.go similarity index 99% rename from core/image.go rename to core_image.go index fd0ba59..f82acd6 100644 --- a/core/image.go +++ b/core_image.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/imageCopy.go b/core_imageCopy.go similarity index 99% rename from core/imageCopy.go rename to core_imageCopy.go index 5b7374e..3f9b61e 100644 --- a/core/imageCopy.go +++ b/core_imageCopy.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/imageFormatSupport.go b/core_imageFormatSupport.go similarity index 99% rename from core/imageFormatSupport.go rename to core_imageFormatSupport.go index f566a25..3fd9cce 100644 --- a/core/imageFormatSupport.go +++ b/core_imageFormatSupport.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/imageQueryAllocProperties.go b/core_imageQueryAllocProperties.go similarity index 99% rename from core/imageQueryAllocProperties.go rename to core_imageQueryAllocProperties.go index 3a82278..173c359 100644 --- a/core/imageQueryAllocProperties.go +++ b/core_imageQueryAllocProperties.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/imagememoryproperties.go b/core_imagememoryproperties.go similarity index 99% rename from core/imagememoryproperties.go rename to core_imagememoryproperties.go index 961c2cc..2fff985 100644 --- a/core/imagememoryproperties.go +++ b/core_imagememoryproperties.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/imageview.go b/core_imageview.go similarity index 99% rename from core/imageview.go rename to core_imageview.go index 4e33c6d..1c1b7c0 100644 --- a/core/imageview.go +++ b/core_imageview.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/imageviewplanar.go b/core_imageviewplanar.go similarity index 99% rename from core/imageviewplanar.go rename to core_imageviewplanar.go index 33d9364..d125d95 100644 --- a/core/imageviewplanar.go +++ b/core_imageviewplanar.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/immediateCommandListAppend.go b/core_immediateCommandListAppend.go similarity index 99% rename from core/immediateCommandListAppend.go rename to core_immediateCommandListAppend.go index 31e18df..dd6fe3d 100644 --- a/core/immediateCommandListAppend.go +++ b/core_immediateCommandListAppend.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/ipcMemHandleType.go b/core_ipcMemHandleType.go similarity index 99% rename from core/ipcMemHandleType.go rename to core_ipcMemHandleType.go index cfa030d..f68d516 100644 --- a/core/ipcMemHandleType.go +++ b/core_ipcMemHandleType.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/kernelAllocationProperties.go b/core_kernelAllocationProperties.go similarity index 99% rename from core/kernelAllocationProperties.go rename to core_kernelAllocationProperties.go index 1f98a6a..bd2f6df 100644 --- a/core/kernelAllocationProperties.go +++ b/core_kernelAllocationProperties.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/kernelBinary.go b/core_kernelBinary.go similarity index 99% rename from core/kernelBinary.go rename to core_kernelBinary.go index 650cae6..0574e72 100644 --- a/core/kernelBinary.go +++ b/core_kernelBinary.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/kernelMaxGroupSizeProperties.go b/core_kernelMaxGroupSizeProperties.go similarity index 99% rename from core/kernelMaxGroupSizeProperties.go rename to core_kernelMaxGroupSizeProperties.go index f72e12e..79d08c6 100644 --- a/core/kernelMaxGroupSizeProperties.go +++ b/core_kernelMaxGroupSizeProperties.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/kernelSchedulingHints.go b/core_kernelSchedulingHints.go similarity index 99% rename from core/kernelSchedulingHints.go rename to core_kernelSchedulingHints.go index 04555d1..40dfc92 100644 --- a/core/kernelSchedulingHints.go +++ b/core_kernelSchedulingHints.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/linkageInspection.go b/core_linkageInspection.go similarity index 99% rename from core/linkageInspection.go rename to core_linkageInspection.go index d302494..7cb7ddd 100644 --- a/core/linkageInspection.go +++ b/core_linkageInspection.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/linkonceodr.go b/core_linkonceodr.go similarity index 98% rename from core/linkonceodr.go rename to core_linkonceodr.go index df4d65c..8f57e4a 100644 --- a/core/linkonceodr.go +++ b/core_linkonceodr.go @@ -11,7 +11,7 @@ * */ -package core +package gozel // ZE_LINKONCE_ODR_EXT_NAME Linkonce ODR Extension Name const ZE_LINKONCE_ODR_EXT_NAME = "ZE_extension_linkonce_odr" diff --git a/core/memory.go b/core_memory.go similarity index 99% rename from core/memory.go rename to core_memory.go index 86bbb48..a206617 100644 --- a/core/memory.go +++ b/core_memory.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/memoryCompressionHints.go b/core_memoryCompressionHints.go similarity index 99% rename from core/memoryCompressionHints.go rename to core_memoryCompressionHints.go index 14c7721..fe8c41c 100644 --- a/core/memoryCompressionHints.go +++ b/core_memoryCompressionHints.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/memoryFreePolicies.go b/core_memoryFreePolicies.go similarity index 99% rename from core/memoryFreePolicies.go rename to core_memoryFreePolicies.go index d325547..7428eba 100644 --- a/core/memoryFreePolicies.go +++ b/core_memoryFreePolicies.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/memoryProperties.go b/core_memoryProperties.go similarity index 99% rename from core/memoryProperties.go rename to core_memoryProperties.go index 01acf82..34d1246 100644 --- a/core/memoryProperties.go +++ b/core_memoryProperties.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/module.go b/core_module.go similarity index 99% rename from core/module.go rename to core_module.go index 1c02b31..6292ca8 100644 --- a/core/module.go +++ b/core_module.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/mutableCommandList.go b/core_mutableCommandList.go similarity index 99% rename from core/mutableCommandList.go rename to core_mutableCommandList.go index af10d87..b11577b 100644 --- a/core/mutableCommandList.go +++ b/core_mutableCommandList.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/powersavinghint.go b/core_powersavinghint.go similarity index 99% rename from core/powersavinghint.go rename to core_powersavinghint.go index 3ba0a45..eb06b44 100644 --- a/core/powersavinghint.go +++ b/core_powersavinghint.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/program.go b/core_program.go similarity index 99% rename from core/program.go rename to core_program.go index 0ab9c4c..d478e97 100644 --- a/core/program.go +++ b/core_program.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/raytracing.go b/core_raytracing.go similarity index 99% rename from core/raytracing.go rename to core_raytracing.go index 93dfbea..18d98f3 100644 --- a/core/raytracing.go +++ b/core_raytracing.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/relaxedAllocLimits.go b/core_relaxedAllocLimits.go similarity index 99% rename from core/relaxedAllocLimits.go rename to core_relaxedAllocLimits.go index af62862..e29d02f 100644 --- a/core/relaxedAllocLimits.go +++ b/core_relaxedAllocLimits.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/residency.go b/core_residency.go similarity index 99% rename from core/residency.go rename to core_residency.go index 6894c47..dba21b0 100644 --- a/core/residency.go +++ b/core_residency.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/sampler.go b/core_sampler.go similarity index 99% rename from core/sampler.go rename to core_sampler.go index 8988f24..a1fccfc 100644 --- a/core/sampler.go +++ b/core_sampler.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/subAllocationsProperties.go b/core_subAllocationsProperties.go similarity index 99% rename from core/subAllocationsProperties.go rename to core_subAllocationsProperties.go index 8292e4c..3bd577c 100644 --- a/core/subAllocationsProperties.go +++ b/core_subAllocationsProperties.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/core/subgroups.go b/core_subgroups.go similarity index 98% rename from core/subgroups.go rename to core_subgroups.go index f0849cf..0c95e91 100644 --- a/core/subgroups.go +++ b/core_subgroups.go @@ -11,7 +11,7 @@ * */ -package core +package gozel // ZE_SUBGROUPS_EXT_NAME Subgroups Extension Name const ZE_SUBGROUPS_EXT_NAME = "ZE_extension_subgroups" diff --git a/core/virtual.go b/core_virtual.go similarity index 99% rename from core/virtual.go rename to core_virtual.go index 0515498..9e383c1 100644 --- a/core/virtual.go +++ b/core_virtual.go @@ -11,7 +11,7 @@ * */ -package core +package gozel import ( "unsafe" diff --git a/init_windows.go b/init_windows.go deleted file mode 100644 index 63ee7aa..0000000 --- a/init_windows.go +++ /dev/null @@ -1,27 +0,0 @@ -package gozel - -import ( - "fmt" - "syscall" -) - -const ( - zeLibraryName = "ze_loader.dll" -) - -var ( - libZeLoader syscall.DLL -) - -func InitZe() error { - h, err := syscall.LoadLibrary(zeLibraryName) - if err != nil { - return err - } - libZeLoader = syscall.DLL{Handle: h, Name: zeLibraryName} - procZeInitDrivers, err = libZeLoader.FindProc("zeInitDrivers") - if err != nil { - return fmt.Errorf("zeInitDrivers not found in ze_loader.dll: %w", err) - } - return nil -} diff --git a/rntm_common.go b/rntm_common.go new file mode 100644 index 0000000..c2f0a05 --- /dev/null +++ b/rntm_common.go @@ -0,0 +1,141 @@ +// Code generated by cmd/gen. DO NOT EDIT. + +/* + * + * Copyright (C) 2019-2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + * @file zer_api.h + * @version v1.15-r1.15.31 + * + */ + +package gozel + +import ( + "unsafe" + + "github.com/fumiama/gozel/internal/zecall" +) + +// ZeDefaultGPUImmediateCommandQueueDesc Immediate Command List default descriptor for GPU devices +var ZeDefaultGPUImmediateCommandQueueDesc = ZeCommandQueueDesc{ + ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC, ///< stype + nil, ///< pNext + 0, ///< ordinal + 0, ///< index + ZE_COMMAND_QUEUE_FLAG_IN_ORDER | ZE_COMMAND_QUEUE_FLAG_COPY_OFFLOAD_HINT, ///< flags + ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS, ///< mode + ZE_COMMAND_QUEUE_PRIORITY_NORMAL, ///< priority +} + +// ZeDefaultGPUDeviceMemAllocDesc Device Unified Shared Memory Allocation default descriptor for GPU +/// devices +var ZeDefaultGPUDeviceMemAllocDesc = ZeDeviceMemAllocDesc{ + ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC, ///< stype + nil, ///< pNext + ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_CACHED, ///< flags + 0, ///< ordinal +} + +// ZeDefaultGPUHostMemAllocDesc Host Unified Shared Memory Allocation default descriptor for GPU +/// devices +var ZeDefaultGPUHostMemAllocDesc = ZeHostMemAllocDesc{ + ZE_STRUCTURE_TYPE_HOST_MEM_ALLOC_DESC, ///< stype + nil, ///< pNext + ZE_HOST_MEM_ALLOC_FLAG_BIAS_CACHED | ZE_HOST_MEM_ALLOC_FLAG_BIAS_INITIAL_PLACEMENT, ///< flags +} + +// ZerGetLastErrorDescription Retrieves a string describing the last error code returned by the +/// default driver in the current thread. +/// +/// @details +/// - String returned is thread local. +/// - String is only updated on calls returning an error, i.e., not on calls +/// returning ::ZE_RESULT_SUCCESS. +/// - String may be empty if driver considers error code is already explicit +/// enough to describe cause. +/// - Memory pointed to by ppString is owned by the default driver. +/// - String returned is null-terminated. +/// +/// @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_POINTER +/// + `nullptr == ppString` +func ZerGetLastErrorDescription( + ppString **byte, // ppString [in,out] pointer to a null-terminated array of characters describing cause of error. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zerGetLastErrorDescription", uintptr(unsafe.Pointer(ppString))) +} + +// ZerTranslateDeviceHandleToIdentifier Translates device handle to integer identifier. +/// +/// @details +/// - The implementation of this function should be lock-free. +/// - This function does not return error code, to get info about failure +/// user may use ::zerGetLastErrorDescription function. +/// - In case of failure, this function returns UINT32_MAX. +/// +/// @returns +/// - integer identifier for the device +/// - UINT32_MAX +func ZerTranslateDeviceHandleToIdentifier( + hDevice ZeDeviceHandle, // hDevice [in] handle of the device +) (uint32, error) { + return zecall.Call[uint32]("zerTranslateDeviceHandleToIdentifier", uintptr(hDevice)) +} + +// ZerTranslateIdentifierToDeviceHandle Translates to integer identifier to a device handle. +/// +/// @details +/// - The driver must be initialized before calling this function. +/// - The implementation of this function should be lock-free. +/// - This function does not return error code, to get info about failure +/// user may use ::zerGetLastErrorDescription function. +/// - In case of failure, this function returns null. +/// - Details on the error can be retrieved using +/// ::zerGetLastErrorDescription function. +/// +/// @returns +/// - handle of the device with the given identifier +/// - nullptr +func ZerTranslateIdentifierToDeviceHandle( + identifier uint32, // identifier [in] integer identifier of the device +) (ZeDeviceHandle, error) { + return zecall.Call[ZeDeviceHandle]("zerTranslateIdentifierToDeviceHandle", uintptr(identifier)) +} + +// ZerGetDefaultContext Retrieves handle to default context from the default driver. +/// +/// @details +/// - The driver must be initialized before calling this function. +/// - The implementation of this function should be lock-free. +/// - This returned context contains all the devices available in the +/// default driver. +/// - This function does not return error code, to get info about failure +/// user may use ::zerGetLastErrorDescription function. +/// - In case of failure, this function returns null. +/// - Details on the error can be retrieved using +/// ::zerGetLastErrorDescription function. +/// +/// @returns +/// - handle of the default context +/// - nullptr +func ZerGetDefaultContext( +) (ZeContextHandle, error) { + return zecall.Call[ZeContextHandle]("zerGetDefaultContext") +} + diff --git a/sysm/Overclock.go b/sysm/Overclock.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/Overclock.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/common.go b/sysm/common.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/common.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/device.go b/sysm/device.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/device.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/diagnostics.go b/sysm/diagnostics.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/diagnostics.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/driver.go b/sysm/driver.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/driver.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/ecc.go b/sysm/ecc.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/ecc.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/eccState.go b/sysm/eccState.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/eccState.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/engine.go b/sysm/engine.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/engine.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/engineActivity.go b/sysm/engineActivity.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/engineActivity.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/events.go b/sysm/events.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/events.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/fabric.go b/sysm/fabric.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/fabric.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/fan.go b/sysm/fan.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/fan.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/firmware.go b/sysm/firmware.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/firmware.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/firmwareSecurityVersion.go b/sysm/firmwareSecurityVersion.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/firmwareSecurityVersion.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/frequency.go b/sysm/frequency.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/frequency.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/led.go b/sysm/led.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/led.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/memPageOfflineState.go b/sysm/memPageOfflineState.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/memPageOfflineState.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/memory.go b/sysm/memory.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/memory.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/memoryBwCounterValidBits.go b/sysm/memoryBwCounterValidBits.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/memoryBwCounterValidBits.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/pciLinkSpeedDowngrade.go b/sysm/pciLinkSpeedDowngrade.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/pciLinkSpeedDowngrade.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/performance.go b/sysm/performance.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/performance.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/power.go b/sysm/power.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/power.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/powerDomainProperties.go b/sysm/powerDomainProperties.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/powerDomainProperties.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/powerLimits.go b/sysm/powerLimits.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/powerLimits.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/psu.go b/sysm/psu.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/psu.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/ras.go b/sysm/ras.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/ras.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/rasState.go b/sysm/rasState.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/rasState.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/scheduler.go b/sysm/scheduler.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/scheduler.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/standby.go b/sysm/standby.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/standby.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/sysmanDeviceMapping.go b/sysm/sysmanDeviceMapping.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/sysmanDeviceMapping.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/temperature.go b/sysm/temperature.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/temperature.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm/virtualFunctionManagement.go b/sysm/virtualFunctionManagement.go deleted file mode 100644 index f70dff4..0000000 --- a/sysm/virtualFunctionManagement.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package sysm diff --git a/sysm_Overclock.go b/sysm_Overclock.go new file mode 100644 index 0000000..f579562 --- /dev/null +++ b/sysm_Overclock.go @@ -0,0 +1,717 @@ +// 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" +) + +// ZesOverclockDomain (zes_overclock_domain_t) Overclock domains. +type ZesOverclockDomain uintptr +const ( + ZES_OVERCLOCK_DOMAIN_CARD ZesOverclockDomain = 1 // ZES_OVERCLOCK_DOMAIN_CARD Overclocking card level properties such as temperature limits. + ZES_OVERCLOCK_DOMAIN_PACKAGE ZesOverclockDomain = 2 // ZES_OVERCLOCK_DOMAIN_PACKAGE Overclocking package level properties such as power limits. + ZES_OVERCLOCK_DOMAIN_GPU_ALL ZesOverclockDomain = 4 // ZES_OVERCLOCK_DOMAIN_GPU_ALL Overclocking a GPU that has all accelerator assets on the same PLL/VR. + ZES_OVERCLOCK_DOMAIN_GPU_RENDER_COMPUTE ZesOverclockDomain = 8 // ZES_OVERCLOCK_DOMAIN_GPU_RENDER_COMPUTE Overclocking a GPU with render and compute assets on the same PLL/VR. + ZES_OVERCLOCK_DOMAIN_GPU_RENDER ZesOverclockDomain = 16 // ZES_OVERCLOCK_DOMAIN_GPU_RENDER Overclocking a GPU with render assets on its own PLL/VR. + ZES_OVERCLOCK_DOMAIN_GPU_COMPUTE ZesOverclockDomain = 32 // ZES_OVERCLOCK_DOMAIN_GPU_COMPUTE Overclocking a GPU with compute assets on its own PLL/VR. + ZES_OVERCLOCK_DOMAIN_GPU_MEDIA ZesOverclockDomain = 64 // ZES_OVERCLOCK_DOMAIN_GPU_MEDIA Overclocking a GPU with media assets on its own PLL/VR. + ZES_OVERCLOCK_DOMAIN_VRAM ZesOverclockDomain = 128 // ZES_OVERCLOCK_DOMAIN_VRAM Overclocking device local memory. + ZES_OVERCLOCK_DOMAIN_ADM ZesOverclockDomain = 256 // ZES_OVERCLOCK_DOMAIN_ADM Overclocking LLC/L4 cache. + ZES_OVERCLOCK_DOMAIN_FORCE_UINT32 ZesOverclockDomain = 0x7fffffff // ZES_OVERCLOCK_DOMAIN_FORCE_UINT32 Value marking end of ZES_OVERCLOCK_DOMAIN_* ENUMs + +) + +// ZesOverclockControl (zes_overclock_control_t) Overclock controls. +type ZesOverclockControl uintptr +const ( + ZES_OVERCLOCK_CONTROL_VF ZesOverclockControl = 1 // ZES_OVERCLOCK_CONTROL_VF This control permits setting a custom V-F curve. + ZES_OVERCLOCK_CONTROL_FREQ_OFFSET ZesOverclockControl = 2 // ZES_OVERCLOCK_CONTROL_FREQ_OFFSET The V-F curve of the overclock domain can be shifted up or down using + + ///< this control. + + ZES_OVERCLOCK_CONTROL_VMAX_OFFSET ZesOverclockControl = 4 // ZES_OVERCLOCK_CONTROL_VMAX_OFFSET This control is used to increase the permitted voltage above the + + ///< shipped voltage maximum. + + ZES_OVERCLOCK_CONTROL_FREQ ZesOverclockControl = 8 // ZES_OVERCLOCK_CONTROL_FREQ This control permits direct changes to the operating frequency. + ZES_OVERCLOCK_CONTROL_VOLT_LIMIT ZesOverclockControl = 16 // ZES_OVERCLOCK_CONTROL_VOLT_LIMIT This control prevents frequencies that would push the voltage above + + ///< this value, typically used by V-F scanners. + + ZES_OVERCLOCK_CONTROL_POWER_SUSTAINED_LIMIT ZesOverclockControl = 32 // ZES_OVERCLOCK_CONTROL_POWER_SUSTAINED_LIMIT This control changes the sustained power limit (PL1). + ZES_OVERCLOCK_CONTROL_POWER_BURST_LIMIT ZesOverclockControl = 64 // ZES_OVERCLOCK_CONTROL_POWER_BURST_LIMIT This control changes the burst power limit (PL2). + ZES_OVERCLOCK_CONTROL_POWER_PEAK_LIMIT ZesOverclockControl = 128 // ZES_OVERCLOCK_CONTROL_POWER_PEAK_LIMIT his control changes the peak power limit (PL4). + ZES_OVERCLOCK_CONTROL_ICCMAX_LIMIT ZesOverclockControl = 256 // ZES_OVERCLOCK_CONTROL_ICCMAX_LIMIT This control changes the value of IccMax.. + ZES_OVERCLOCK_CONTROL_TEMP_LIMIT ZesOverclockControl = 512 // ZES_OVERCLOCK_CONTROL_TEMP_LIMIT This control changes the value of TjMax. + ZES_OVERCLOCK_CONTROL_ITD_DISABLE ZesOverclockControl = 1024 // ZES_OVERCLOCK_CONTROL_ITD_DISABLE This control permits disabling the adaptive voltage feature ITD + ZES_OVERCLOCK_CONTROL_ACM_DISABLE ZesOverclockControl = 2048 // ZES_OVERCLOCK_CONTROL_ACM_DISABLE This control permits disabling the adaptive voltage feature ACM. + ZES_OVERCLOCK_CONTROL_FORCE_UINT32 ZesOverclockControl = 0x7fffffff // ZES_OVERCLOCK_CONTROL_FORCE_UINT32 Value marking end of ZES_OVERCLOCK_CONTROL_* ENUMs + +) + +// ZesOverclockMode (zes_overclock_mode_t) Overclock modes. +type ZesOverclockMode uintptr +const ( + ZES_OVERCLOCK_MODE_MODE_OFF ZesOverclockMode = 0 // ZES_OVERCLOCK_MODE_MODE_OFF Overclock mode is off + ZES_OVERCLOCK_MODE_MODE_STOCK ZesOverclockMode = 2 // ZES_OVERCLOCK_MODE_MODE_STOCK Stock (manufacturing settings) are being used. + ZES_OVERCLOCK_MODE_MODE_ON ZesOverclockMode = 3 // ZES_OVERCLOCK_MODE_MODE_ON Overclock mode is on. + ZES_OVERCLOCK_MODE_MODE_UNAVAILABLE ZesOverclockMode = 4 // ZES_OVERCLOCK_MODE_MODE_UNAVAILABLE Overclocking is unavailable at this time since the system is running + + ///< on battery. + + ZES_OVERCLOCK_MODE_MODE_DISABLED ZesOverclockMode = 5 // ZES_OVERCLOCK_MODE_MODE_DISABLED Overclock mode is disabled. + ZES_OVERCLOCK_MODE_FORCE_UINT32 ZesOverclockMode = 0x7fffffff // ZES_OVERCLOCK_MODE_FORCE_UINT32 Value marking end of ZES_OVERCLOCK_MODE_* ENUMs + +) + +// ZesControlState (zes_control_state_t) Overclock control states. +type ZesControlState uintptr +const ( + ZES_CONTROL_STATE_STATE_UNSET ZesControlState = 0 // ZES_CONTROL_STATE_STATE_UNSET No overclock control has not been changed by the driver since the last + + ///< boot/reset. + + ZES_CONTROL_STATE_STATE_ACTIVE ZesControlState = 2 // ZES_CONTROL_STATE_STATE_ACTIVE The overclock control has been set and it is active. + ZES_CONTROL_STATE_STATE_DISABLED ZesControlState = 3 // ZES_CONTROL_STATE_STATE_DISABLED The overclock control value has been disabled due to the current power + + ///< configuration (typically when running on DC). + + ZES_CONTROL_STATE_FORCE_UINT32 ZesControlState = 0x7fffffff // ZES_CONTROL_STATE_FORCE_UINT32 Value marking end of ZES_CONTROL_STATE_* ENUMs + +) + +// ZesPendingAction (zes_pending_action_t) Overclock pending actions. +type ZesPendingAction uintptr +const ( + ZES_PENDING_ACTION_PENDING_NONE ZesPendingAction = 0 // ZES_PENDING_ACTION_PENDING_NONE There no pending actions. . + ZES_PENDING_ACTION_PENDING_IMMINENT ZesPendingAction = 1 // ZES_PENDING_ACTION_PENDING_IMMINENT The requested change is in progress and should complete soon. + ZES_PENDING_ACTION_PENDING_COLD_RESET ZesPendingAction = 2 // ZES_PENDING_ACTION_PENDING_COLD_RESET The requested change requires a device cold reset (hotplug, system + + ///< boot). + + ZES_PENDING_ACTION_PENDING_WARM_RESET ZesPendingAction = 3 // ZES_PENDING_ACTION_PENDING_WARM_RESET The requested change requires a device warm reset (PCIe FLR). + ZES_PENDING_ACTION_FORCE_UINT32 ZesPendingAction = 0x7fffffff // ZES_PENDING_ACTION_FORCE_UINT32 Value marking end of ZES_PENDING_ACTION_* ENUMs + +) + +// ZesVfProgramType (zes_vf_program_type_t) Overclock V-F curve programing. +type ZesVfProgramType uintptr +const ( + ZES_VF_PROGRAM_TYPE_VF_ARBITRARY ZesVfProgramType = 0 // ZES_VF_PROGRAM_TYPE_VF_ARBITRARY Can program an arbitrary number of V-F points up to the maximum number + + ///< and each point can have arbitrary voltage and frequency values within + ///< the min/max/step limits + + ZES_VF_PROGRAM_TYPE_VF_FREQ_FIXED ZesVfProgramType = 1 // ZES_VF_PROGRAM_TYPE_VF_FREQ_FIXED Can only program the voltage for the V-F points that it reads back - + + ///< the frequency of those points cannot be changed + + ZES_VF_PROGRAM_TYPE_VF_VOLT_FIXED ZesVfProgramType = 2 // ZES_VF_PROGRAM_TYPE_VF_VOLT_FIXED Can only program the frequency for the V-F points that is reads back - + + ///< the voltage of each point cannot be changed. + + ZES_VF_PROGRAM_TYPE_FORCE_UINT32 ZesVfProgramType = 0x7fffffff // ZES_VF_PROGRAM_TYPE_FORCE_UINT32 Value marking end of ZES_VF_PROGRAM_TYPE_* ENUMs + +) + +// ZesVfType (zes_vf_type_t) VF type +type ZesVfType uintptr +const ( + ZES_VF_TYPE_VOLT ZesVfType = 0 // ZES_VF_TYPE_VOLT VF Voltage point + ZES_VF_TYPE_FREQ ZesVfType = 1 // ZES_VF_TYPE_FREQ VF Frequency point + ZES_VF_TYPE_FORCE_UINT32 ZesVfType = 0x7fffffff // ZES_VF_TYPE_FORCE_UINT32 Value marking end of ZES_VF_TYPE_* ENUMs + +) + +// ZesVfArrayType (zes_vf_array_type_t) VF type +type ZesVfArrayType uintptr +const ( + ZES_VF_ARRAY_TYPE_USER_VF_ARRAY ZesVfArrayType = 0 // ZES_VF_ARRAY_TYPE_USER_VF_ARRAY User V-F array + ZES_VF_ARRAY_TYPE_DEFAULT_VF_ARRAY ZesVfArrayType = 1 // ZES_VF_ARRAY_TYPE_DEFAULT_VF_ARRAY Default V-F array + ZES_VF_ARRAY_TYPE_LIVE_VF_ARRAY ZesVfArrayType = 2 // ZES_VF_ARRAY_TYPE_LIVE_VF_ARRAY Live V-F array + ZES_VF_ARRAY_TYPE_FORCE_UINT32 ZesVfArrayType = 0x7fffffff // ZES_VF_ARRAY_TYPE_FORCE_UINT32 Value marking end of ZES_VF_ARRAY_TYPE_* ENUMs + +) + +// ZesOverclockProperties (zes_overclock_properties_t) Overclock properties +/// +/// @details +/// - Information on the overclock domain type and all the contols that are +/// part of the domain. +type ZesOverclockProperties 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). + Domaintype ZesOverclockDomain // Domaintype [out] The hardware block that this overclock domain controls (GPU, VRAM, ...) + Availablecontrols uint32 // Availablecontrols [out] Returns the overclock controls that are supported (a bit for each of enum ::zes_overclock_control_t). If no bits are set, the domain doesn't support overclocking. + Vfprogramtype ZesVfProgramType // Vfprogramtype [out] Type of V-F curve programming that is permitted:. + Numberofvfpoints uint32 // Numberofvfpoints [out] Number of VF points that can be programmed - max_num_points + +} + +// ZesControlProperty (zes_control_property_t) Overclock Control properties +/// +/// @details +/// - Provides all the control capabilities supported by the device for the +/// overclock domain. +type ZesControlProperty struct { + Minvalue float64 // Minvalue [out] This provides information about the limits of the control value so that the driver can calculate the set of valid values. + Maxvalue float64 // Maxvalue [out] This provides information about the limits of the control value so that the driver can calculate the set of valid values. + Stepvalue float64 // Stepvalue [out] This provides information about the limits of the control value so that the driver can calculate the set of valid values. + Refvalue float64 // Refvalue [out] The reference value provides the anchor point, UIs can combine this with the user offset request to show the anticipated improvement. + Defaultvalue float64 // Defaultvalue [out] The shipped out-of-box position of this control. Driver can request this value at any time to return to the out-of-box behavior. + +} + +// ZesVfProperty (zes_vf_property_t) Overclock VF properties +/// +/// @details +/// - Provides all the VF capabilities supported by the device for the +/// overclock domain. +type ZesVfProperty struct { + Minfreq float64 // Minfreq [out] Read the minimum frequency that can be be programmed in the custom V-F point.. + Maxfreq float64 // Maxfreq [out] Read the maximum frequency that can be be programmed in the custom V-F point.. + Stepfreq float64 // Stepfreq [out] Read the frequency step that can be be programmed in the custom V-F point.. + Minvolt float64 // Minvolt [out] Read the minimum voltage that can be be programmed in the custom V-F point.. + Maxvolt float64 // Maxvolt [out] Read the maximum voltage that can be be programmed in the custom V-F point.. + Stepvolt float64 // Stepvolt [out] Read the voltage step that can be be programmed in the custom V-F point. + +} + +// ZesDeviceSetOverclockWaiver Set the overclock waiver.The overclock waiver setting is persistent +/// until the next pcode boot +/// +/// @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_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_UNSUPPORTED_FEATURE +/// + This product does not support overclocking +func ZesDeviceSetOverclockWaiver( + hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDeviceSetOverclockWaiver", uintptr(hDevice)) +} + +// ZesDeviceGetOverclockDomains Get the list of supported overclock domains for this 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_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 == pOverclockDomains` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this control domain +func ZesDeviceGetOverclockDomains( + hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device. + pOverclockDomains *uint32, // pOverclockDomains [in,out] Returns the overclock domains that are supported (a bit for each of enum ::zes_overclock_domain_t). If no bits are set, the device doesn't support overclocking. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDeviceGetOverclockDomains", uintptr(hDevice), uintptr(unsafe.Pointer(pOverclockDomains))) +} + +// ZesDeviceGetOverclockControls Get the list of supported overclock controls available for one of the +/// supported overclock domains on 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_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_ENUMERATION +/// + `::ZES_OVERCLOCK_DOMAIN_ADM < domainType` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pAvailableControls` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this control domain +func ZesDeviceGetOverclockControls( + hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device. + domainType ZesOverclockDomain, // domainType [in] Domain type. + pAvailableControls *uint32, // pAvailableControls [in,out] Returns the overclock controls that are supported for the specified overclock domain (a bit for each of enum ::zes_overclock_control_t). +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDeviceGetOverclockControls", uintptr(hDevice), uintptr(domainType), uintptr(unsafe.Pointer(pAvailableControls))) +} + +// ZesDeviceResetOverclockSettings Reset all overclock settings to default values (shipped = 1 or +/// manufacturing =0) +/// +/// @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_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_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this control domain +func ZesDeviceResetOverclockSettings( + hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device. + onShippedState ZeBool, // onShippedState [in] True will reset to shipped state; false will reset to manufacturing state +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDeviceResetOverclockSettings", uintptr(hDevice), uintptr(onShippedState)) +} + +// ZesDeviceReadOverclockState Determine the state of overclocking +/// +/// @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_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 == pOverclockMode` +/// + `nullptr == pWaiverSetting` +/// + `nullptr == pOverclockState` +/// + `nullptr == pPendingAction` +/// + `nullptr == pPendingReset` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this control domain +func ZesDeviceReadOverclockState( + hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device. + pOverclockMode *ZesOverclockMode, // pOverclockMode [out] One of overclock mode. + pWaiverSetting *ZeBool, // pWaiverSetting [out] Waiver setting: 0 = Waiver not set, 1 = waiver has been set. + pOverclockState *ZeBool, // pOverclockState [out] Current settings 0 =manufacturing state, 1= shipped state).. + pPendingAction *ZesPendingAction, // pPendingAction [out] This enum is returned when the driver attempts to set an overclock control or reset overclock settings. + pPendingReset *ZeBool, // pPendingReset [out] Pending reset 0 =manufacturing state, 1= shipped state).. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDeviceReadOverclockState", uintptr(hDevice), uintptr(unsafe.Pointer(pOverclockMode)), uintptr(unsafe.Pointer(pWaiverSetting)), uintptr(unsafe.Pointer(pOverclockState)), uintptr(unsafe.Pointer(pPendingAction)), uintptr(unsafe.Pointer(pPendingReset))) +} + +// ZesDeviceEnumOverclockDomains Get handle of overclock domains +/// +/// @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 ZesDeviceEnumOverclockDomains( + 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. + phDomainHandle *ZesOverclockHandle, // phDomainHandle [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]("zesDeviceEnumOverclockDomains", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phDomainHandle))) +} + +// ZesOverclockGetDomainProperties Get overclock domain control 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_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 == hDomainHandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pDomainProperties` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this control domain +func ZesOverclockGetDomainProperties( + hDomainHandle ZesOverclockHandle, // hDomainHandle [in] Handle for the component domain. + pDomainProperties *ZesOverclockProperties, // pDomainProperties [in,out] The overclock properties for the specified domain. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesOverclockGetDomainProperties", uintptr(hDomainHandle), uintptr(unsafe.Pointer(pDomainProperties))) +} + +// ZesOverclockGetDomainVFProperties Read overclock VF min,max and step values +/// +/// @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_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 == hDomainHandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pVFProperties` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this control domain +func ZesOverclockGetDomainVFProperties( + hDomainHandle ZesOverclockHandle, // hDomainHandle [in] Handle for the component domain. + pVFProperties *ZesVfProperty, // pVFProperties [in,out] The VF min,max,step for a specified domain. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesOverclockGetDomainVFProperties", uintptr(hDomainHandle), uintptr(unsafe.Pointer(pVFProperties))) +} + +// ZesOverclockGetDomainControlProperties Read overclock control values - min/max/step/default/ref +/// +/// @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_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 == hDomainHandle` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pControlProperties` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this control domain +func ZesOverclockGetDomainControlProperties( + hDomainHandle ZesOverclockHandle, // hDomainHandle [in] Handle for the component domain. + DomainControl ZesOverclockControl, // DomainControl [in] Handle for the component. + pControlProperties *ZesControlProperty, // pControlProperties [in,out] overclock control values. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesOverclockGetDomainControlProperties", uintptr(hDomainHandle), uintptr(DomainControl), uintptr(unsafe.Pointer(pControlProperties))) +} + +// ZesOverclockGetControlCurrentValue Read the current value for a given overclock control +/// +/// @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_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 == hDomainHandle` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pValue` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this control domain +func ZesOverclockGetControlCurrentValue( + hDomainHandle ZesOverclockHandle, // hDomainHandle [in] Handle for the component. + DomainControl ZesOverclockControl, // DomainControl [in] Overclock Control. + pValue *float64, // pValue [in,out] Getting overclock control value for the specified control. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesOverclockGetControlCurrentValue", uintptr(hDomainHandle), uintptr(DomainControl), uintptr(unsafe.Pointer(pValue))) +} + +// ZesOverclockGetControlPendingValue Read the the reset pending value for a given overclock control +/// +/// @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_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 == hDomainHandle` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pValue` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this control domain +func ZesOverclockGetControlPendingValue( + hDomainHandle ZesOverclockHandle, // hDomainHandle [in] Handle for the component domain. + DomainControl ZesOverclockControl, // DomainControl [in] Overclock Control. + pValue *float64, // pValue [out] Returns the pending value for a given control. The units and format of the value depend on the control type. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesOverclockGetControlPendingValue", uintptr(hDomainHandle), uintptr(DomainControl), uintptr(unsafe.Pointer(pValue))) +} + +// ZesOverclockSetControlUserValue Set the value for a given overclock control +/// +/// @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_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 == hDomainHandle` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pPendingAction` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this control domain +func ZesOverclockSetControlUserValue( + hDomainHandle ZesOverclockHandle, // hDomainHandle [in] Handle for the component domain. + DomainControl ZesOverclockControl, // DomainControl [in] Domain Control. + pValue float64, // pValue [in] The new value of the control. The units and format of the value depend on the control type. + pPendingAction *ZesPendingAction, // pPendingAction [out] Pending overclock setting. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesOverclockSetControlUserValue", uintptr(hDomainHandle), uintptr(DomainControl), uintptr(pValue), uintptr(unsafe.Pointer(pPendingAction))) +} + +// ZesOverclockGetControlState Determine the state of an overclock control +/// +/// @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_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 == hDomainHandle` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pControlState` +/// + `nullptr == pPendingAction` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this control domain +func ZesOverclockGetControlState( + hDomainHandle ZesOverclockHandle, // hDomainHandle [in] Handle for the component domain. + DomainControl ZesOverclockControl, // DomainControl [in] Domain Control. + pControlState *ZesControlState, // pControlState [out] Current overclock control state. + pPendingAction *ZesPendingAction, // pPendingAction [out] Pending overclock setting. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesOverclockGetControlState", uintptr(hDomainHandle), uintptr(DomainControl), uintptr(unsafe.Pointer(pControlState)), uintptr(unsafe.Pointer(pPendingAction))) +} + +// ZesOverclockGetVFPointValues Read the frequency or voltage of a V-F point from the default or +/// custom V-F curve. +/// +/// @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_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 == hDomainHandle` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZES_VF_TYPE_FREQ < VFType` +/// + `::ZES_VF_ARRAY_TYPE_LIVE_VF_ARRAY < VFArrayType` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == PointValue` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this control domain +func ZesOverclockGetVFPointValues( + hDomainHandle ZesOverclockHandle, // hDomainHandle [in] Handle for the component domain. + VFType ZesVfType, // VFType [in] Voltage or Freqency point to read. + VFArrayType ZesVfArrayType, // VFArrayType [in] User,Default or Live VF array to read from + PointIndex uint32, // PointIndex [in] Point index - number between (0, max_num_points - 1). + PointValue *uint32, // PointValue [out] Returns the frequency in 1kHz units or voltage in millivolt units from the custom V-F curve at the specified zero-based index +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesOverclockGetVFPointValues", uintptr(hDomainHandle), uintptr(VFType), uintptr(VFArrayType), uintptr(PointIndex), uintptr(unsafe.Pointer(PointValue))) +} + +// ZesOverclockSetVFPointValues Write the frequency or voltage of a V-F point to custom V-F curve. +/// +/// @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_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 == hDomainHandle` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZES_VF_TYPE_FREQ < VFType` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this control domain +func ZesOverclockSetVFPointValues( + hDomainHandle ZesOverclockHandle, // hDomainHandle [in] Handle for the component domain. + VFType ZesVfType, // VFType [in] Voltage or Freqency point to read. + PointIndex uint32, // PointIndex [in] Point index - number between (0, max_num_points - 1). + PointValue uint32, // PointValue [in] Writes frequency in 1kHz units or voltage in millivolt units to custom V-F curve at the specified zero-based index +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesOverclockSetVFPointValues", uintptr(hDomainHandle), uintptr(VFType), uintptr(PointIndex), uintptr(PointValue)) +} + diff --git a/sysm_common.go b/sysm_common.go new file mode 100644 index 0000000..920756b --- /dev/null +++ b/sysm_common.go @@ -0,0 +1,178 @@ +// 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" +) + +// ZesDriverHandle (zes_driver_handle_t) Handle to a driver instance +type ZesDriverHandle ZeDriverHandle + +// ZesDeviceHandle (zes_device_handle_t) Handle of device object +type ZesDeviceHandle ZeDeviceHandle + +// ZesSchedHandle (zes_sched_handle_t) Handle for a Sysman device scheduler queue +type ZesSchedHandle uintptr + +// ZesPerfHandle (zes_perf_handle_t) Handle for a Sysman device performance factors +type ZesPerfHandle uintptr + +// ZesPwrHandle (zes_pwr_handle_t) Handle for a Sysman device power domain +type ZesPwrHandle uintptr + +// ZesFreqHandle (zes_freq_handle_t) Handle for a Sysman device frequency domain +type ZesFreqHandle uintptr + +// ZesEngineHandle (zes_engine_handle_t) Handle for a Sysman device engine group +type ZesEngineHandle uintptr + +// ZesStandbyHandle (zes_standby_handle_t) Handle for a Sysman device standby control +type ZesStandbyHandle uintptr + +// ZesFirmwareHandle (zes_firmware_handle_t) Handle for a Sysman device firmware +type ZesFirmwareHandle uintptr + +// ZesMemHandle (zes_mem_handle_t) Handle for a Sysman device memory module +type ZesMemHandle uintptr + +// ZesFabricPortHandle (zes_fabric_port_handle_t) Handle for a Sysman fabric port +type ZesFabricPortHandle uintptr + +// ZesTempHandle (zes_temp_handle_t) Handle for a Sysman device temperature sensor +type ZesTempHandle uintptr + +// ZesPsuHandle (zes_psu_handle_t) Handle for a Sysman device power supply +type ZesPsuHandle uintptr + +// ZesFanHandle (zes_fan_handle_t) Handle for a Sysman device fan +type ZesFanHandle uintptr + +// ZesLedHandle (zes_led_handle_t) Handle for a Sysman device LED +type ZesLedHandle uintptr + +// ZesRasHandle (zes_ras_handle_t) Handle for a Sysman device RAS error set +type ZesRasHandle uintptr + +// ZesDiagHandle (zes_diag_handle_t) Handle for a Sysman device diagnostics test suite +type ZesDiagHandle uintptr + +// ZesOverclockHandle (zes_overclock_handle_t) Handle for a Sysman device overclock domain +type ZesOverclockHandle uintptr + +// ZesVfHandle (zes_vf_handle_t) Handle for a Sysman virtual function management domain +type ZesVfHandle uintptr + +// ZesStructureType (zes_structure_type_t) Defines structure types +type ZesStructureType uintptr +const ( + ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES ZesStructureType = 0x1 // ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES ::zes_device_properties_t + ZES_STRUCTURE_TYPE_PCI_PROPERTIES ZesStructureType = 0x2 // ZES_STRUCTURE_TYPE_PCI_PROPERTIES ::zes_pci_properties_t + ZES_STRUCTURE_TYPE_PCI_BAR_PROPERTIES ZesStructureType = 0x3 // ZES_STRUCTURE_TYPE_PCI_BAR_PROPERTIES ::zes_pci_bar_properties_t + ZES_STRUCTURE_TYPE_DIAG_PROPERTIES ZesStructureType = 0x4 // ZES_STRUCTURE_TYPE_DIAG_PROPERTIES ::zes_diag_properties_t + ZES_STRUCTURE_TYPE_ENGINE_PROPERTIES ZesStructureType = 0x5 // ZES_STRUCTURE_TYPE_ENGINE_PROPERTIES ::zes_engine_properties_t + ZES_STRUCTURE_TYPE_FABRIC_PORT_PROPERTIES ZesStructureType = 0x6 // ZES_STRUCTURE_TYPE_FABRIC_PORT_PROPERTIES ::zes_fabric_port_properties_t + ZES_STRUCTURE_TYPE_FAN_PROPERTIES ZesStructureType = 0x7 // ZES_STRUCTURE_TYPE_FAN_PROPERTIES ::zes_fan_properties_t + ZES_STRUCTURE_TYPE_FIRMWARE_PROPERTIES ZesStructureType = 0x8 // ZES_STRUCTURE_TYPE_FIRMWARE_PROPERTIES ::zes_firmware_properties_t + ZES_STRUCTURE_TYPE_FREQ_PROPERTIES ZesStructureType = 0x9 // ZES_STRUCTURE_TYPE_FREQ_PROPERTIES ::zes_freq_properties_t + ZES_STRUCTURE_TYPE_LED_PROPERTIES ZesStructureType = 0xa // ZES_STRUCTURE_TYPE_LED_PROPERTIES ::zes_led_properties_t + ZES_STRUCTURE_TYPE_MEM_PROPERTIES ZesStructureType = 0xb // ZES_STRUCTURE_TYPE_MEM_PROPERTIES ::zes_mem_properties_t + ZES_STRUCTURE_TYPE_PERF_PROPERTIES ZesStructureType = 0xc // ZES_STRUCTURE_TYPE_PERF_PROPERTIES ::zes_perf_properties_t + ZES_STRUCTURE_TYPE_POWER_PROPERTIES ZesStructureType = 0xd // ZES_STRUCTURE_TYPE_POWER_PROPERTIES ::zes_power_properties_t + ZES_STRUCTURE_TYPE_PSU_PROPERTIES ZesStructureType = 0xe // ZES_STRUCTURE_TYPE_PSU_PROPERTIES ::zes_psu_properties_t + ZES_STRUCTURE_TYPE_RAS_PROPERTIES ZesStructureType = 0xf // ZES_STRUCTURE_TYPE_RAS_PROPERTIES ::zes_ras_properties_t + ZES_STRUCTURE_TYPE_SCHED_PROPERTIES ZesStructureType = 0x10 // ZES_STRUCTURE_TYPE_SCHED_PROPERTIES ::zes_sched_properties_t + ZES_STRUCTURE_TYPE_SCHED_TIMEOUT_PROPERTIES ZesStructureType = 0x11 // ZES_STRUCTURE_TYPE_SCHED_TIMEOUT_PROPERTIES ::zes_sched_timeout_properties_t + ZES_STRUCTURE_TYPE_SCHED_TIMESLICE_PROPERTIES ZesStructureType = 0x12 // ZES_STRUCTURE_TYPE_SCHED_TIMESLICE_PROPERTIES ::zes_sched_timeslice_properties_t + ZES_STRUCTURE_TYPE_STANDBY_PROPERTIES ZesStructureType = 0x13 // ZES_STRUCTURE_TYPE_STANDBY_PROPERTIES ::zes_standby_properties_t + ZES_STRUCTURE_TYPE_TEMP_PROPERTIES ZesStructureType = 0x14 // ZES_STRUCTURE_TYPE_TEMP_PROPERTIES ::zes_temp_properties_t + ZES_STRUCTURE_TYPE_DEVICE_STATE ZesStructureType = 0x15 // ZES_STRUCTURE_TYPE_DEVICE_STATE ::zes_device_state_t + ZES_STRUCTURE_TYPE_PROCESS_STATE ZesStructureType = 0x16 // ZES_STRUCTURE_TYPE_PROCESS_STATE ::zes_process_state_t + ZES_STRUCTURE_TYPE_PCI_STATE ZesStructureType = 0x17 // ZES_STRUCTURE_TYPE_PCI_STATE ::zes_pci_state_t + ZES_STRUCTURE_TYPE_FABRIC_PORT_CONFIG ZesStructureType = 0x18 // ZES_STRUCTURE_TYPE_FABRIC_PORT_CONFIG ::zes_fabric_port_config_t + ZES_STRUCTURE_TYPE_FABRIC_PORT_STATE ZesStructureType = 0x19 // ZES_STRUCTURE_TYPE_FABRIC_PORT_STATE ::zes_fabric_port_state_t + ZES_STRUCTURE_TYPE_FAN_CONFIG ZesStructureType = 0x1a // ZES_STRUCTURE_TYPE_FAN_CONFIG ::zes_fan_config_t + ZES_STRUCTURE_TYPE_FREQ_STATE ZesStructureType = 0x1b // ZES_STRUCTURE_TYPE_FREQ_STATE ::zes_freq_state_t + ZES_STRUCTURE_TYPE_OC_CAPABILITIES ZesStructureType = 0x1c // ZES_STRUCTURE_TYPE_OC_CAPABILITIES ::zes_oc_capabilities_t + ZES_STRUCTURE_TYPE_LED_STATE ZesStructureType = 0x1d // ZES_STRUCTURE_TYPE_LED_STATE ::zes_led_state_t + ZES_STRUCTURE_TYPE_MEM_STATE ZesStructureType = 0x1e // ZES_STRUCTURE_TYPE_MEM_STATE ::zes_mem_state_t + ZES_STRUCTURE_TYPE_PSU_STATE ZesStructureType = 0x1f // ZES_STRUCTURE_TYPE_PSU_STATE ::zes_psu_state_t + ZES_STRUCTURE_TYPE_BASE_STATE ZesStructureType = 0x20 // ZES_STRUCTURE_TYPE_BASE_STATE ::zes_base_state_t + ZES_STRUCTURE_TYPE_RAS_CONFIG ZesStructureType = 0x21 // ZES_STRUCTURE_TYPE_RAS_CONFIG ::zes_ras_config_t + ZES_STRUCTURE_TYPE_RAS_STATE ZesStructureType = 0x22 // ZES_STRUCTURE_TYPE_RAS_STATE ::zes_ras_state_t + ZES_STRUCTURE_TYPE_TEMP_CONFIG ZesStructureType = 0x23 // ZES_STRUCTURE_TYPE_TEMP_CONFIG ::zes_temp_config_t + ZES_STRUCTURE_TYPE_PCI_BAR_PROPERTIES_1_2 ZesStructureType = 0x24 // ZES_STRUCTURE_TYPE_PCI_BAR_PROPERTIES_1_2 ::zes_pci_bar_properties_1_2_t + ZES_STRUCTURE_TYPE_DEVICE_ECC_DESC ZesStructureType = 0x25 // ZES_STRUCTURE_TYPE_DEVICE_ECC_DESC ::zes_device_ecc_desc_t + ZES_STRUCTURE_TYPE_DEVICE_ECC_PROPERTIES ZesStructureType = 0x26 // ZES_STRUCTURE_TYPE_DEVICE_ECC_PROPERTIES ::zes_device_ecc_properties_t + ZES_STRUCTURE_TYPE_POWER_LIMIT_EXT_DESC ZesStructureType = 0x27 // ZES_STRUCTURE_TYPE_POWER_LIMIT_EXT_DESC ::zes_power_limit_ext_desc_t + ZES_STRUCTURE_TYPE_POWER_EXT_PROPERTIES ZesStructureType = 0x28 // ZES_STRUCTURE_TYPE_POWER_EXT_PROPERTIES ::zes_power_ext_properties_t + ZES_STRUCTURE_TYPE_OVERCLOCK_PROPERTIES ZesStructureType = 0x29 // ZES_STRUCTURE_TYPE_OVERCLOCK_PROPERTIES ::zes_overclock_properties_t + ZES_STRUCTURE_TYPE_FABRIC_PORT_ERROR_COUNTERS ZesStructureType = 0x2a // ZES_STRUCTURE_TYPE_FABRIC_PORT_ERROR_COUNTERS ::zes_fabric_port_error_counters_t + ZES_STRUCTURE_TYPE_ENGINE_EXT_PROPERTIES ZesStructureType = 0x2b // ZES_STRUCTURE_TYPE_ENGINE_EXT_PROPERTIES ::zes_engine_ext_properties_t + ZES_STRUCTURE_TYPE_RESET_PROPERTIES ZesStructureType = 0x2c // ZES_STRUCTURE_TYPE_RESET_PROPERTIES ::zes_reset_properties_t + ZES_STRUCTURE_TYPE_DEVICE_EXT_PROPERTIES ZesStructureType = 0x2d // ZES_STRUCTURE_TYPE_DEVICE_EXT_PROPERTIES ::zes_device_ext_properties_t + ZES_STRUCTURE_TYPE_DEVICE_UUID ZesStructureType = 0x2e // ZES_STRUCTURE_TYPE_DEVICE_UUID ::zes_uuid_t + ZES_STRUCTURE_TYPE_POWER_DOMAIN_EXP_PROPERTIES ZesStructureType = 0x00020001 // ZES_STRUCTURE_TYPE_POWER_DOMAIN_EXP_PROPERTIES ::zes_power_domain_exp_properties_t + ZES_STRUCTURE_TYPE_MEM_BANDWIDTH_COUNTER_BITS_EXP_PROPERTIES ZesStructureType = 0x00020002 // ZES_STRUCTURE_TYPE_MEM_BANDWIDTH_COUNTER_BITS_EXP_PROPERTIES ::zes_mem_bandwidth_counter_bits_exp_properties_t + ZES_STRUCTURE_TYPE_MEMORY_PAGE_OFFLINE_STATE_EXP ZesStructureType = 0x00020003 // ZES_STRUCTURE_TYPE_MEMORY_PAGE_OFFLINE_STATE_EXP ::zes_mem_page_offline_state_exp_t + ZES_STRUCTURE_TYPE_SUBDEVICE_EXP_PROPERTIES ZesStructureType = 0x00020004 // ZES_STRUCTURE_TYPE_SUBDEVICE_EXP_PROPERTIES ::zes_subdevice_exp_properties_t + ZES_STRUCTURE_TYPE_VF_EXP_PROPERTIES ZesStructureType = 0x00020005 // ZES_STRUCTURE_TYPE_VF_EXP_PROPERTIES ::zes_vf_exp_properties_t + ZES_STRUCTURE_TYPE_VF_UTIL_MEM_EXP ZesStructureType = 0x00020006 // ZES_STRUCTURE_TYPE_VF_UTIL_MEM_EXP ::zes_vf_util_mem_exp_t + ZES_STRUCTURE_TYPE_VF_UTIL_ENGINE_EXP ZesStructureType = 0x00020007 // ZES_STRUCTURE_TYPE_VF_UTIL_ENGINE_EXP ::zes_vf_util_engine_exp_t + ZES_STRUCTURE_TYPE_VF_EXP_CAPABILITIES ZesStructureType = 0x00020008 // ZES_STRUCTURE_TYPE_VF_EXP_CAPABILITIES ::zes_vf_exp_capabilities_t + ZES_STRUCTURE_TYPE_VF_UTIL_MEM_EXP2 ZesStructureType = 0x00020009 // ZES_STRUCTURE_TYPE_VF_UTIL_MEM_EXP2 ::zes_vf_util_mem_exp2_t + ZES_STRUCTURE_TYPE_VF_UTIL_ENGINE_EXP2 ZesStructureType = 0x00020010 // ZES_STRUCTURE_TYPE_VF_UTIL_ENGINE_EXP2 ::zes_vf_util_engine_exp2_t + ZES_STRUCTURE_TYPE_VF_EXP2_CAPABILITIES ZesStructureType = 0x00020011 // ZES_STRUCTURE_TYPE_VF_EXP2_CAPABILITIES ::zes_vf_exp2_capabilities_t + ZES_STRUCTURE_TYPE_DEVICE_ECC_DEFAULT_PROPERTIES_EXT ZesStructureType = 0x00020012 // ZES_STRUCTURE_TYPE_DEVICE_ECC_DEFAULT_PROPERTIES_EXT ::zes_device_ecc_default_properties_ext_t + ZES_STRUCTURE_TYPE_PCI_LINK_SPEED_DOWNGRADE_EXT_STATE ZesStructureType = 0x00020013 // ZES_STRUCTURE_TYPE_PCI_LINK_SPEED_DOWNGRADE_EXT_STATE ::zes_pci_link_speed_downgrade_ext_state_t + ZES_STRUCTURE_TYPE_PCI_LINK_SPEED_DOWNGRADE_EXT_PROPERTIES ZesStructureType = 0x00020014 // ZES_STRUCTURE_TYPE_PCI_LINK_SPEED_DOWNGRADE_EXT_PROPERTIES ::zes_pci_link_speed_downgrade_ext_properties_t + ZES_STRUCTURE_TYPE_FORCE_UINT32 ZesStructureType = 0x7fffffff // ZES_STRUCTURE_TYPE_FORCE_UINT32 Value marking end of ZES_STRUCTURE_TYPE_* ENUMs + +) + +// ZesBaseProperties (zes_base_properties_t) Base for all properties types +type ZesBaseProperties 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). + +} + +// ZesBaseDesc (zes_base_desc_t) Base for all descriptor types +type ZesBaseDesc 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). + +} + +// ZesBaseState (zes_base_state_t) Base for all state types +type ZesBaseState 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). + +} + +// ZesBaseConfig (zes_base_config_t) Base for all config types +type ZesBaseConfig 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). + +} + +// ZesBaseCapability (zes_base_capability_t) Base for all capability types +type ZesBaseCapability 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). + +} + diff --git a/sysm_device.go b/sysm_device.go new file mode 100644 index 0000000..de9ed55 --- /dev/null +++ b/sysm_device.go @@ -0,0 +1,634 @@ +// 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))) +} + diff --git a/sysm_diagnostics.go b/sysm_diagnostics.go new file mode 100644 index 0000000..811a86d --- /dev/null +++ b/sysm_diagnostics.go @@ -0,0 +1,201 @@ +// 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" +) + +// ZesDiagResult (zes_diag_result_t) Diagnostic results +type ZesDiagResult uintptr +const ( + ZES_DIAG_RESULT_NO_ERRORS ZesDiagResult = 0 // ZES_DIAG_RESULT_NO_ERRORS Diagnostic completed without finding errors to repair + ZES_DIAG_RESULT_ABORT ZesDiagResult = 1 // ZES_DIAG_RESULT_ABORT Diagnostic had problems running tests + ZES_DIAG_RESULT_FAIL_CANT_REPAIR ZesDiagResult = 2 // ZES_DIAG_RESULT_FAIL_CANT_REPAIR Diagnostic had problems setting up repairs + ZES_DIAG_RESULT_REBOOT_FOR_REPAIR ZesDiagResult = 3 // ZES_DIAG_RESULT_REBOOT_FOR_REPAIR Diagnostics found errors, setup for repair and reboot is required to + + ///< complete the process + + ZES_DIAG_RESULT_FORCE_UINT32 ZesDiagResult = 0x7fffffff // ZES_DIAG_RESULT_FORCE_UINT32 Value marking end of ZES_DIAG_RESULT_* ENUMs + +) + +// ZES_DIAG_FIRST_TEST_INDEX Diagnostic test index to use for the very first test. +const ZES_DIAG_FIRST_TEST_INDEX = 0x0 + +// ZES_DIAG_LAST_TEST_INDEX Diagnostic test index to use for the very last test. +const ZES_DIAG_LAST_TEST_INDEX = 0xFFFFFFFF + +// ZesDiagTest (zes_diag_test_t) Diagnostic test +type ZesDiagTest struct { + Index uint32 // Index [out] Index of the test + Name [ZES_STRING_PROPERTY_SIZE]byte // Name [out] Name of the test + +} + +// ZesDiagProperties (zes_diag_properties_t) Diagnostics test suite properties +type ZesDiagProperties 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). + Onsubdevice ZeBool // Onsubdevice [out] True if the 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 + Name [ZES_STRING_PROPERTY_SIZE]byte // Name [out] Name of the diagnostics test suite + Havetests ZeBool // Havetests [out] Indicates if this test suite has individual tests which can be run separately (use the function ::zesDiagnosticsGetTests() to get the list of these tests) + +} + +// ZesDeviceEnumDiagnosticTestSuites Get handle of diagnostics test suites +/// +/// @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 ZesDeviceEnumDiagnosticTestSuites( + 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. + phDiagnostics *ZesDiagHandle, // phDiagnostics [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]("zesDeviceEnumDiagnosticTestSuites", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phDiagnostics))) +} + +// ZesDiagnosticsGetProperties Get properties of a diagnostics test suite +/// +/// @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 == hDiagnostics` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesDiagnosticsGetProperties( + hDiagnostics ZesDiagHandle, // hDiagnostics [in] Handle for the component. + pProperties *ZesDiagProperties, // pProperties [in,out] Structure describing the properties of a diagnostics test suite +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDiagnosticsGetProperties", uintptr(hDiagnostics), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesDiagnosticsGetTests Get individual tests that can be run separately. Not all test suites +/// permit running individual tests, check the `haveTests` member of +/// ::zes_diag_properties_t. +/// +/// @details +/// - The list of available tests is returned in order of increasing test +/// index (see the `index` member of ::zes_diag_test_t). +/// - 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 == hDiagnostics` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +func ZesDiagnosticsGetTests( + hDiagnostics ZesDiagHandle, // hDiagnostics [in] Handle for the component. + pCount *uint32, // pCount [in,out] pointer to the number of tests. if count is zero, then the driver shall update the value with the total number of tests that are available. if count is greater than the number of tests that are available, then the driver shall update the value with the correct number of tests. + pTests *ZesDiagTest, // pTests [in,out][optional][range(0, *pCount)] array of information about individual tests sorted by increasing value of the `index` member of ::zes_diag_test_t. if count is less than the number of tests that are available, then the driver shall only retrieve that number of tests. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDiagnosticsGetTests", uintptr(hDiagnostics), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pTests))) +} + +// ZesDiagnosticsRunTests Run a diagnostics test suite, either all tests or a subset of tests. +/// +/// @details +/// - WARNING: Running diagnostics may destroy current device state +/// information. Gracefully close any running workloads before initiating. +/// - To run all tests in a test suite, set start = +/// ::ZES_DIAG_FIRST_TEST_INDEX and end = ::ZES_DIAG_LAST_TEST_INDEX. +/// - If the test suite permits running individual tests, the `haveTests` +/// member of ::zes_diag_properties_t will be true. In this case, the +/// function ::zesDiagnosticsGetTests() can be called to get the list of +/// tests and corresponding indices that can be supplied to the arguments +/// start and end in this function. +/// - This function will block until the diagnostics have completed and +/// force reset based on result +/// +/// @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 == hDiagnostics` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pResult` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to perform diagnostics. +func ZesDiagnosticsRunTests( + hDiagnostics ZesDiagHandle, // hDiagnostics [in] Handle for the component. + startIndex uint32, // startIndex [in] The index of the first test to run. Set to ::ZES_DIAG_FIRST_TEST_INDEX to start from the beginning. + endIndex uint32, // endIndex [in] The index of the last test to run. Set to ::ZES_DIAG_LAST_TEST_INDEX to complete all tests after the start test. + pResult *ZesDiagResult, // pResult [in,out] The result of the diagnostics +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDiagnosticsRunTests", uintptr(hDiagnostics), uintptr(startIndex), uintptr(endIndex), uintptr(unsafe.Pointer(pResult))) +} + diff --git a/sysm_driver.go b/sysm_driver.go new file mode 100644 index 0000000..5951bbc --- /dev/null +++ b/sysm_driver.go @@ -0,0 +1,181 @@ +// 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" +) + +// ZesInitFlags (zes_init_flags_t) Supported sysman initialization flags +type ZesInitFlags uint32 +const ( + ZES_INIT_FLAG_PLACEHOLDER ZesInitFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZES_INIT_FLAG_PLACEHOLDER placeholder for future use + ZES_INIT_FLAG_FORCE_UINT32 ZesInitFlags = 0x7fffffff // ZES_INIT_FLAG_FORCE_UINT32 Value marking end of ZES_INIT_FLAG_* ENUMs + +) + +// ZesInit Initialize 'oneAPI' System Resource Management (sysman) +/// +/// @details +/// - The application must call this function or ::zeInit with the +/// `ZES_ENABLE_SYSMAN` environment variable set before calling any other +/// sysman function. +/// - If this function is not called then all other sysman functions will +/// return ::ZE_RESULT_ERROR_UNINITIALIZED. +/// - This function will only initialize sysman. To initialize other +/// functions, call ::zeInit. +/// - There is no requirement to call this function before or after +/// ::zeInit. +/// - Only one instance of sysman will be initialized per process. +/// - The application must call this function after forking new processes. +/// Each forked process must call this function. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe for scenarios +/// where multiple libraries may initialize sysman simultaneously. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::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_ENUMERATION +/// + `0x1 < flags` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +func ZesInit( + flags ZesInitFlags, // flags [in] initialization flags. currently unused, must be 0 (default). +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesInit", uintptr(flags)) +} + +// ZesDriverGet Retrieves sysman driver instances +/// +/// @details +/// - A sysman driver represents a collection of physical devices. +/// - Multiple calls to this function will return identical sysman driver +/// handles, in the same order. +/// - The application may pass nullptr for pDrivers when only querying the +/// number of sysman drivers. +/// - 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_POINTER +/// + `nullptr == pCount` +func ZesDriverGet( + pCount *uint32, // pCount [in,out] pointer to the number of sysman driver instances. if count is zero, then the loader shall update the value with the total number of sysman drivers available. if count is greater than the number of sysman drivers available, then the loader shall update the value with the correct number of sysman drivers available. + phDrivers *ZesDriverHandle, // phDrivers [in,out][optional][range(0, *pCount)] array of sysman driver instance handles. if count is less than the number of sysman drivers available, then the loader shall only retrieve that number of sysman drivers. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDriverGet", uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phDrivers))) +} + +// ZES_MAX_EXTENSION_NAME Maximum extension name string size +const ZES_MAX_EXTENSION_NAME = 256 + +// ZesDriverExtensionProperties (zes_driver_extension_properties_t) Extension properties queried using ::zesDriverGetExtensionProperties +type ZesDriverExtensionProperties struct { + Name [ZES_MAX_EXTENSION_NAME]byte // Name [out] extension name + Version uint32 // Version [out] extension version using ::ZE_MAKE_VERSION + +} + +// ZesDriverGetExtensionProperties Retrieves extension 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 == hDriver` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +func ZesDriverGetExtensionProperties( + hDriver ZesDriverHandle, // hDriver [in] handle of the driver instance + pCount *uint32, // pCount [in,out] pointer to the number of extension properties. if count is zero, then the driver shall update the value with the total number of extension properties available. if count is greater than the number of extension properties available, then the driver shall update the value with the correct number of extension properties available. + pExtensionProperties *ZesDriverExtensionProperties, // pExtensionProperties [in,out][optional][range(0, *pCount)] array of query results for extension properties. if count is less than the number of extension properties available, then driver shall only retrieve that number of extension properties. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDriverGetExtensionProperties", uintptr(hDriver), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pExtensionProperties))) +} + +// ZesDriverGetExtensionFunctionAddress Retrieves function pointer for vendor-specific or experimental +/// extensions +/// +/// @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 == hDriver` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == name` +/// + `nullptr == ppFunctionAddress` +func ZesDriverGetExtensionFunctionAddress( + hDriver ZesDriverHandle, // hDriver [in] handle of the driver instance + name *byte, // name [in] extension function name + ppFunctionAddress *unsafe.Pointer, // ppFunctionAddress [out] pointer to function pointer +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDriverGetExtensionFunctionAddress", uintptr(hDriver), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(ppFunctionAddress))) +} + diff --git a/sysm_ecc.go b/sysm_ecc.go new file mode 100644 index 0000000..0ec0cc6 --- /dev/null +++ b/sysm_ecc.go @@ -0,0 +1,193 @@ +// 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" +) + +// ZesDeviceEccState (zes_device_ecc_state_t) ECC State +type ZesDeviceEccState uintptr +const ( + ZES_DEVICE_ECC_STATE_UNAVAILABLE ZesDeviceEccState = 0 // ZES_DEVICE_ECC_STATE_UNAVAILABLE None + ZES_DEVICE_ECC_STATE_ENABLED ZesDeviceEccState = 1 // ZES_DEVICE_ECC_STATE_ENABLED ECC enabled. + ZES_DEVICE_ECC_STATE_DISABLED ZesDeviceEccState = 2 // ZES_DEVICE_ECC_STATE_DISABLED ECC disabled. + ZES_DEVICE_ECC_STATE_FORCE_UINT32 ZesDeviceEccState = 0x7fffffff // ZES_DEVICE_ECC_STATE_FORCE_UINT32 Value marking end of ZES_DEVICE_ECC_STATE_* ENUMs + +) + +// ZesDeviceAction (zes_device_action_t) State Change Requirements +type ZesDeviceAction uintptr +const ( + ZES_DEVICE_ACTION_NONE ZesDeviceAction = 0 // ZES_DEVICE_ACTION_NONE No action. + ZES_DEVICE_ACTION_WARM_CARD_RESET ZesDeviceAction = 1 // ZES_DEVICE_ACTION_WARM_CARD_RESET Warm reset of the card. + ZES_DEVICE_ACTION_COLD_CARD_RESET ZesDeviceAction = 2 // ZES_DEVICE_ACTION_COLD_CARD_RESET Cold reset of the card. + ZES_DEVICE_ACTION_COLD_SYSTEM_REBOOT ZesDeviceAction = 3 // ZES_DEVICE_ACTION_COLD_SYSTEM_REBOOT Cold reboot of the system. + ZES_DEVICE_ACTION_FORCE_UINT32 ZesDeviceAction = 0x7fffffff // ZES_DEVICE_ACTION_FORCE_UINT32 Value marking end of ZES_DEVICE_ACTION_* ENUMs + +) + +// ZesDeviceEccDesc (zes_device_ecc_desc_t) ECC State Descriptor +type ZesDeviceEccDesc 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). + State ZesDeviceEccState // State [out] ECC state + +} + +// ZesDeviceEccProperties (zes_device_ecc_properties_t) ECC State +type ZesDeviceEccProperties 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). + Currentstate ZesDeviceEccState // Currentstate [out] Current ECC state + Pendingstate ZesDeviceEccState // Pendingstate [out] Pending ECC state + Pendingaction ZesDeviceAction // Pendingaction [out] Pending action + +} + +// ZesDeviceEccAvailable Is ECC functionality available - true or false? +/// +/// @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 == pAvailable` +func ZesDeviceEccAvailable( + hDevice ZesDeviceHandle, // hDevice [in] Handle for the component. + pAvailable *ZeBool, // pAvailable [out] ECC functionality is available (true)/unavailable (false). +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDeviceEccAvailable", uintptr(hDevice), uintptr(unsafe.Pointer(pAvailable))) +} + +// ZesDeviceEccConfigurable Is ECC support configurable - true or false? +/// +/// @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 == pConfigurable` +func ZesDeviceEccConfigurable( + hDevice ZesDeviceHandle, // hDevice [in] Handle for the component. + pConfigurable *ZeBool, // pConfigurable [out] ECC can be enabled/disabled (true)/enabled/disabled (false). +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDeviceEccConfigurable", uintptr(hDevice), uintptr(unsafe.Pointer(pConfigurable))) +} + +// ZesDeviceGetEccState Get current ECC state, pending state, and pending action +/// +/// @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 ZesDeviceGetEccState( + hDevice ZesDeviceHandle, // hDevice [in] Handle for the component. + pState *ZesDeviceEccProperties, // pState [out] ECC state, pending state, and pending action for state change. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDeviceGetEccState", uintptr(hDevice), uintptr(unsafe.Pointer(pState))) +} + +// ZesDeviceSetEccState Set new ECC state +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - ::zesDeviceGetState should be called to determine pending action +/// required to implement state change. +/// +/// @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 == newState` +/// + `nullptr == pState` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZES_DEVICE_ECC_STATE_DISABLED < newState->state` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// - ::ZE_RESULT_WARNING_ACTION_REQUIRED +/// + User must look at the pendingAction attribute of pState & perform the action required to complete the ECC state change. +func ZesDeviceSetEccState( + hDevice ZesDeviceHandle, // hDevice [in] Handle for the component. + newState *ZesDeviceEccDesc, // newState [in] Pointer to desired ECC state. + pState *ZesDeviceEccProperties, // pState [out] ECC state, pending state, and pending action for state change. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDeviceSetEccState", uintptr(hDevice), uintptr(unsafe.Pointer(newState)), uintptr(unsafe.Pointer(pState))) +} + diff --git a/sysm_eccState.go b/sysm_eccState.go new file mode 100644 index 0000000..34c7ce0 --- /dev/null +++ b/sysm_eccState.go @@ -0,0 +1,40 @@ +// 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" +) + +// ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_NAME Device ECC default properties Extension Name +const ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_NAME = "ZES_extension_device_ecc_default_properties" + +// ZesDeviceEccDefaultPropertiesExtVersion (zes_device_ecc_default_properties_ext_version_t) Device ECC default properties Extension Version(s) +type ZesDeviceEccDefaultPropertiesExtVersion uintptr +const ( + ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_VERSION_1_0 ZesDeviceEccDefaultPropertiesExtVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_VERSION_1_0 version 1.0 + ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_VERSION_CURRENT ZesDeviceEccDefaultPropertiesExtVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_VERSION_CURRENT latest known version + ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_VERSION_FORCE_UINT32 ZesDeviceEccDefaultPropertiesExtVersion = 0x7fffffff // ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_VERSION_FORCE_UINT32 Value marking end of ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_VERSION_* ENUMs + +) + +// ZesDeviceEccDefaultPropertiesExt (zes_device_ecc_default_properties_ext_t) This structure may be passed to ::zesDeviceGetEccState as pNext member +/// of ::zes_device_ecc_properties_t. +type ZesDeviceEccDefaultPropertiesExt 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). + Defaultstate ZesDeviceEccState // Defaultstate [out] Default ECC state + +} + diff --git a/sysm_engine.go b/sysm_engine.go new file mode 100644 index 0000000..1369f1e --- /dev/null +++ b/sysm_engine.go @@ -0,0 +1,211 @@ +// 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" +) + +// ZesEngineGroup (zes_engine_group_t) Accelerator engine groups +type ZesEngineGroup uintptr +const ( + ZES_ENGINE_GROUP_ALL ZesEngineGroup = 0 // ZES_ENGINE_GROUP_ALL Access information about all engines combined. + ZES_ENGINE_GROUP_COMPUTE_ALL ZesEngineGroup = 1 // ZES_ENGINE_GROUP_COMPUTE_ALL Access information about all compute engines combined. Compute engines + + ///< can only process compute kernels (no 3D content). + + ZES_ENGINE_GROUP_MEDIA_ALL ZesEngineGroup = 2 // ZES_ENGINE_GROUP_MEDIA_ALL Access information about all media engines combined. + ZES_ENGINE_GROUP_COPY_ALL ZesEngineGroup = 3 // ZES_ENGINE_GROUP_COPY_ALL Access information about all copy (blitter) engines combined. + ZES_ENGINE_GROUP_COMPUTE_SINGLE ZesEngineGroup = 4 // ZES_ENGINE_GROUP_COMPUTE_SINGLE Access information about a single compute engine - this is an engine + + ///< that can process compute kernels. Note that single engines may share + ///< the same underlying accelerator resources as other engines so activity + ///< of such an engine may not be indicative of the underlying resource + ///< utilization - use ::ZES_ENGINE_GROUP_3D_RENDER_COMPUTE_ALL for that. + + ZES_ENGINE_GROUP_RENDER_SINGLE ZesEngineGroup = 5 // ZES_ENGINE_GROUP_RENDER_SINGLE Access information about a single render engine - this is an engine + + ///< that can process both 3D content and compute kernels. Note that single + ///< engines may share the same underlying accelerator resources as other + ///< engines so activity of such an engine may not be indicative of the + ///< underlying resource utilization - use + ///< ::ZES_ENGINE_GROUP_3D_RENDER_COMPUTE_ALL for that. + + ZES_ENGINE_GROUP_MEDIA_DECODE_SINGLE ZesEngineGroup = 6 // ZES_ENGINE_GROUP_MEDIA_DECODE_SINGLE [DEPRECATED] No longer supported. + ZES_ENGINE_GROUP_MEDIA_ENCODE_SINGLE ZesEngineGroup = 7 // ZES_ENGINE_GROUP_MEDIA_ENCODE_SINGLE [DEPRECATED] No longer supported. + ZES_ENGINE_GROUP_COPY_SINGLE ZesEngineGroup = 8 // ZES_ENGINE_GROUP_COPY_SINGLE Access information about a single media encode engine. Note that + + ///< single engines may share the same underlying accelerator resources as + ///< other engines so activity of such an engine may not be indicative of + ///< the underlying resource utilization - use ::ZES_ENGINE_GROUP_COPY_ALL + ///< for that. + + ZES_ENGINE_GROUP_MEDIA_ENHANCEMENT_SINGLE ZesEngineGroup = 9 // ZES_ENGINE_GROUP_MEDIA_ENHANCEMENT_SINGLE Access information about a single media enhancement engine. Note that + + ///< single engines may share the same underlying accelerator resources as + ///< other engines so activity of such an engine may not be indicative of + ///< the underlying resource utilization - use ::ZES_ENGINE_GROUP_MEDIA_ALL + ///< for that. + + ZES_ENGINE_GROUP_3D_SINGLE ZesEngineGroup = 10 // ZES_ENGINE_GROUP_3D_SINGLE [DEPRECATED] No longer supported. + ZES_ENGINE_GROUP_3D_RENDER_COMPUTE_ALL ZesEngineGroup = 11 // ZES_ENGINE_GROUP_3D_RENDER_COMPUTE_ALL [DEPRECATED] No longer supported. + ZES_ENGINE_GROUP_RENDER_ALL ZesEngineGroup = 12 // ZES_ENGINE_GROUP_RENDER_ALL Access information about all render engines combined. Render engines + + ///< are those than process both 3D content and compute kernels. + + ZES_ENGINE_GROUP_3D_ALL ZesEngineGroup = 13 // ZES_ENGINE_GROUP_3D_ALL [DEPRECATED] No longer supported. + ZES_ENGINE_GROUP_MEDIA_CODEC_SINGLE ZesEngineGroup = 14 // ZES_ENGINE_GROUP_MEDIA_CODEC_SINGLE Access information about a single media engine. Note that single + + ///< engines may share the same underlying accelerator resources as other + ///< engines so activity of such an engine may not be indicative of the + ///< underlying resource utilization - use ::ZES_ENGINE_GROUP_MEDIA_ALL for + ///< that. + + ZES_ENGINE_GROUP_FORCE_UINT32 ZesEngineGroup = 0x7fffffff // ZES_ENGINE_GROUP_FORCE_UINT32 Value marking end of ZES_ENGINE_GROUP_* ENUMs + +) + +// ZesEngineProperties (zes_engine_properties_t) Engine group properties +type ZesEngineProperties 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 ZesEngineGroup // Type [out] The engine group + 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 + +} + +// ZesEngineStats (zes_engine_stats_t) Engine activity counters +/// +/// @details +/// - Percent utilization is calculated by taking two snapshots (s1, s2) and +/// using the equation: %util = (s2.activeTime - s1.activeTime) / +/// (s2.timestamp - s1.timestamp) +/// - The `activeTime` time units are implementation-specific since the +/// value is only intended to be used for calculating utilization +/// percentage. +/// - The `timestamp` should only be used to calculate delta between +/// snapshots of this structure. +/// - The application should never take the delta of `timestamp` with the +/// timestamp from a different structure since they are not guaranteed to +/// have the same base. +/// - When taking the delta, the difference between `timestamp` samples +/// could be `0`, if the frequency of sampling the snapshots is higher +/// than the frequency of the timestamp update. +/// - The absolute value of `timestamp` is only valid during within the +/// application and may be different on the next execution. +type ZesEngineStats struct { + Activetime uint64 // Activetime [out] Monotonic counter where the resource is actively running workloads. + Timestamp uint64 // Timestamp [out] Monotonic counter when activeTime counter was sampled. + +} + +// ZesDeviceEnumEngineGroups Get handle of engine groups +/// +/// @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 ZesDeviceEnumEngineGroups( + 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. + phEngine *ZesEngineHandle, // phEngine [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]("zesDeviceEnumEngineGroups", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phEngine))) +} + +// ZesEngineGetProperties Get engine group 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 == hEngine` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesEngineGetProperties( + hEngine ZesEngineHandle, // hEngine [in] Handle for the component. + pProperties *ZesEngineProperties, // pProperties [in,out] The properties for the specified engine group. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesEngineGetProperties", uintptr(hEngine), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesEngineGetActivity Get the activity stats for an engine group. +/// +/// @details +/// - This function also returns the engine activity inside a Virtual +/// Machine (VM), in the presence of hardware virtualization (SRIOV) +/// - 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 == hEngine` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pStats` +func ZesEngineGetActivity( + hEngine ZesEngineHandle, // hEngine [in] Handle for the component. + pStats *ZesEngineStats, // pStats [in,out] Will contain a snapshot of the engine group activity counters. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesEngineGetActivity", uintptr(hEngine), uintptr(unsafe.Pointer(pStats))) +} + diff --git a/sysm_engineActivity.go b/sysm_engineActivity.go new file mode 100644 index 0000000..2ebffbb --- /dev/null +++ b/sysm_engineActivity.go @@ -0,0 +1,81 @@ +// 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" +) + +// ZES_ENGINE_ACTIVITY_EXT_NAME Engine Activity Extension Name +const ZES_ENGINE_ACTIVITY_EXT_NAME = "ZES_extension_engine_activity" + +// ZesEngineActivityExtVersion (zes_engine_activity_ext_version_t) Engine Activity Extension Version(s) +type ZesEngineActivityExtVersion uintptr +const ( + ZES_ENGINE_ACTIVITY_EXT_VERSION_1_0 ZesEngineActivityExtVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_ENGINE_ACTIVITY_EXT_VERSION_1_0 version 1.0 + ZES_ENGINE_ACTIVITY_EXT_VERSION_CURRENT ZesEngineActivityExtVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_ENGINE_ACTIVITY_EXT_VERSION_CURRENT latest known version + ZES_ENGINE_ACTIVITY_EXT_VERSION_FORCE_UINT32 ZesEngineActivityExtVersion = 0x7fffffff // ZES_ENGINE_ACTIVITY_EXT_VERSION_FORCE_UINT32 Value marking end of ZES_ENGINE_ACTIVITY_EXT_VERSION_* ENUMs + +) + +// ZesEngineExtProperties (zes_engine_ext_properties_t) Extension properties related to Engine Groups +/// +/// @details +/// - This structure may be passed to ::zesEngineGetProperties by having the +/// pNext member of ::zes_engine_properties_t point at this struct. +/// - Used for SRIOV per Virtual Function device utilization by +/// ::zes_engine_group_t +type ZesEngineExtProperties 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). + Countofvirtualfunctioninstance uint32 // Countofvirtualfunctioninstance [out] Number of Virtual Function(VF) instances associated with engine to monitor the utilization of hardware across all Virtual Function from a Physical Function (PF) instance. These VF-by-VF views should provide engine group and individual engine level granularity. This count represents the number of VF instances that are actively using the resource represented by the engine handle. + +} + +// ZesEngineGetActivityExt Get activity stats for Physical Function (PF) and each Virtual +/// Function (VF) associated with engine group. +/// +/// @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 == hEngine` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE - "Engine activity extension is not supported in the environment." +func ZesEngineGetActivityExt( + hEngine ZesEngineHandle, // hEngine [in] Handle for the component. + pCount *uint32, // pCount [in,out] Pointer to the number of VF engine stats descriptors. - if count is zero, the driver shall update the value with the total number of engine stats available. - if count is greater than the total number of engine stats available, the driver shall update the value with the correct number of engine stats available. - The count returned is the sum of number of VF instances currently available and the PF instance. + pStats *ZesEngineStats, // pStats [in,out][optional][range(0, *pCount)] array of engine group activity counters. - if count is less than the total number of engine stats available, then driver shall only retrieve that number of stats. - the implementation shall populate the vector with engine stat for PF at index 0 of the vector followed by user provided pCount-1 number of VF engine stats. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesEngineGetActivityExt", uintptr(hEngine), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pStats))) +} + diff --git a/sysm_events.go b/sysm_events.go new file mode 100644 index 0000000..0e20106 --- /dev/null +++ b/sysm_events.go @@ -0,0 +1,186 @@ +// 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" +) + +// ZesEventTypeFlags (zes_event_type_flags_t) Event types +type ZesEventTypeFlags uint32 +const ( + ZES_EVENT_TYPE_FLAG_DEVICE_DETACH ZesEventTypeFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZES_EVENT_TYPE_FLAG_DEVICE_DETACH Event is triggered when the device is no longer available (due to a + + ///< reset or being disabled). + + ZES_EVENT_TYPE_FLAG_DEVICE_ATTACH ZesEventTypeFlags = /* ZE_BIT(1) */(( 1 << 1 )) // ZES_EVENT_TYPE_FLAG_DEVICE_ATTACH Event is triggered after the device is available again. + ZES_EVENT_TYPE_FLAG_DEVICE_SLEEP_STATE_ENTER ZesEventTypeFlags = /* ZE_BIT(2) */(( 1 << 2 )) // ZES_EVENT_TYPE_FLAG_DEVICE_SLEEP_STATE_ENTER Event is triggered when the driver is about to put the device into a + + ///< deep sleep state + + ZES_EVENT_TYPE_FLAG_DEVICE_SLEEP_STATE_EXIT ZesEventTypeFlags = /* ZE_BIT(3) */(( 1 << 3 )) // ZES_EVENT_TYPE_FLAG_DEVICE_SLEEP_STATE_EXIT Event is triggered when the driver is waking the device up from a deep + + ///< sleep state + + ZES_EVENT_TYPE_FLAG_FREQ_THROTTLED ZesEventTypeFlags = /* ZE_BIT(4) */(( 1 << 4 )) // ZES_EVENT_TYPE_FLAG_FREQ_THROTTLED Event is triggered when the frequency starts being throttled + ZES_EVENT_TYPE_FLAG_ENERGY_THRESHOLD_CROSSED ZesEventTypeFlags = /* ZE_BIT(5) */(( 1 << 5 )) // ZES_EVENT_TYPE_FLAG_ENERGY_THRESHOLD_CROSSED Event is triggered when the energy consumption threshold is reached + + ///< (use ::zesPowerSetEnergyThreshold() to configure). + + ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL ZesEventTypeFlags = /* ZE_BIT(6) */(( 1 << 6 )) // ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL Event is triggered when the critical temperature is reached (use + + ///< ::zesTemperatureSetConfig() to configure - disabled by default). + + ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 ZesEventTypeFlags = /* ZE_BIT(7) */(( 1 << 7 )) // ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 Event is triggered when the temperature crosses threshold 1 (use + + ///< ::zesTemperatureSetConfig() to configure - disabled by default). + + ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 ZesEventTypeFlags = /* ZE_BIT(8) */(( 1 << 8 )) // ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 Event is triggered when the temperature crosses threshold 2 (use + + ///< ::zesTemperatureSetConfig() to configure - disabled by default). + + ZES_EVENT_TYPE_FLAG_MEM_HEALTH ZesEventTypeFlags = /* ZE_BIT(9) */(( 1 << 9 )) // ZES_EVENT_TYPE_FLAG_MEM_HEALTH Event is triggered when the health of device memory changes. + ZES_EVENT_TYPE_FLAG_FABRIC_PORT_HEALTH ZesEventTypeFlags = /* ZE_BIT(10) */(( 1 << 10 )) // ZES_EVENT_TYPE_FLAG_FABRIC_PORT_HEALTH Event is triggered when the health of fabric ports change. + ZES_EVENT_TYPE_FLAG_PCI_LINK_HEALTH ZesEventTypeFlags = /* ZE_BIT(11) */(( 1 << 11 )) // ZES_EVENT_TYPE_FLAG_PCI_LINK_HEALTH Event is triggered when the health of the PCI link changes. + ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS ZesEventTypeFlags = /* ZE_BIT(12) */(( 1 << 12 )) // ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS Event is triggered when accelerator RAS correctable errors cross + + ///< thresholds (use ::zesRasSetConfig() to configure - disabled by + ///< default). + + ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS ZesEventTypeFlags = /* ZE_BIT(13) */(( 1 << 13 )) // ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS Event is triggered when accelerator RAS uncorrectable errors cross + + ///< thresholds (use ::zesRasSetConfig() to configure - disabled by + ///< default). + + ZES_EVENT_TYPE_FLAG_DEVICE_RESET_REQUIRED ZesEventTypeFlags = /* ZE_BIT(14) */(( 1 << 14 )) // ZES_EVENT_TYPE_FLAG_DEVICE_RESET_REQUIRED Event is triggered when the device needs to be reset (use + + ///< ::zesDeviceGetState() to determine the reasons for the reset). + + ZES_EVENT_TYPE_FLAG_SURVIVABILITY_MODE_DETECTED ZesEventTypeFlags = /* ZE_BIT(15) */(( 1 << 15 )) // ZES_EVENT_TYPE_FLAG_SURVIVABILITY_MODE_DETECTED Event is triggered when graphics driver encounter an error condition. + ZES_EVENT_TYPE_FLAG_FORCE_UINT32 ZesEventTypeFlags = 0x7fffffff // ZES_EVENT_TYPE_FLAG_FORCE_UINT32 Value marking end of ZES_EVENT_TYPE_FLAG_* ENUMs + +) + +// ZesDeviceEventRegister Specify the list of events to listen to for a given 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_ENUMERATION +/// + `0xffff < events` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +func ZesDeviceEventRegister( + hDevice ZesDeviceHandle, // hDevice [in] The device handle. + events ZesEventTypeFlags, // events [in] List of events to listen to. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDeviceEventRegister", uintptr(hDevice), uintptr(events)) +} + +// ZesDriverEventListen Wait for events to be received from a one or more devices. +/// +/// @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_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 == hDriver` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == phDevices` +/// + `nullptr == pNumDeviceEvents` +/// + `nullptr == pEvents` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to listen to events. +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// + One or more of the supplied device handles belongs to a different driver. +func ZesDriverEventListen( + hDriver ZeDriverHandle, // hDriver [in] handle of the driver instance + timeout uint32, // timeout [in] if non-zero, then indicates the maximum time (in milliseconds) to yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; if zero, then will check status and return immediately; if `UINT32_MAX`, then function will not return until events arrive. + count uint32, // count [in] Number of device handles in phDevices. + phDevices *ZesDeviceHandle, // phDevices [in][range(0, count)] Device handles to listen to for events. Only devices from the provided driver handle can be specified in this list. + pNumDeviceEvents *uint32, // pNumDeviceEvents [in,out] Will contain the actual number of devices in phDevices that generated events. If non-zero, check pEvents to determine the devices and events that were received. + pEvents *ZesEventTypeFlags, // pEvents [in,out] An array that will continue the list of events for each device listened in phDevices. This array must be at least as big as count. For every device handle in phDevices, this will provide the events that occurred for that device at the same position in this array. If no event was received for a given device, the corresponding array entry will be zero. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDriverEventListen", uintptr(hDriver), uintptr(timeout), uintptr(count), uintptr(unsafe.Pointer(phDevices)), uintptr(unsafe.Pointer(pNumDeviceEvents)), uintptr(unsafe.Pointer(pEvents))) +} + +// ZesDriverEventListenEx Wait for events to be received from a one or more devices. +/// +/// @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_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 == hDriver` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == phDevices` +/// + `nullptr == pNumDeviceEvents` +/// + `nullptr == pEvents` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to listen to events. +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// + One or more of the supplied device handles belongs to a different driver. +func ZesDriverEventListenEx( + hDriver ZeDriverHandle, // hDriver [in] handle of the driver instance + timeout uint64, // timeout [in] if non-zero, then indicates the maximum time (in milliseconds) to yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; if zero, then will check status and return immediately; if `UINT64_MAX`, then function will not return until events arrive. + count uint32, // count [in] Number of device handles in phDevices. + phDevices *ZesDeviceHandle, // phDevices [in][range(0, count)] Device handles to listen to for events. Only devices from the provided driver handle can be specified in this list. + pNumDeviceEvents *uint32, // pNumDeviceEvents [in,out] Will contain the actual number of devices in phDevices that generated events. If non-zero, check pEvents to determine the devices and events that were received. + pEvents *ZesEventTypeFlags, // pEvents [in,out] An array that will continue the list of events for each device listened in phDevices. This array must be at least as big as count. For every device handle in phDevices, this will provide the events that occurred for that device at the same position in this array. If no event was received for a given device, the corresponding array entry will be zero. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDriverEventListenEx", uintptr(hDriver), uintptr(timeout), uintptr(count), uintptr(unsafe.Pointer(phDevices)), uintptr(unsafe.Pointer(pNumDeviceEvents)), uintptr(unsafe.Pointer(pEvents))) +} + diff --git a/sysm_fabric.go b/sysm_fabric.go new file mode 100644 index 0000000..b5523fe --- /dev/null +++ b/sysm_fabric.go @@ -0,0 +1,451 @@ +// 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" +) + +// ZES_MAX_FABRIC_PORT_MODEL_SIZE Maximum Fabric port model string size +const ZES_MAX_FABRIC_PORT_MODEL_SIZE = 256 + +// ZES_MAX_FABRIC_LINK_TYPE_SIZE Maximum size of the buffer that will return information about link +/// types +const ZES_MAX_FABRIC_LINK_TYPE_SIZE = 256 + +// ZesFabricPortStatus (zes_fabric_port_status_t) Fabric port status +type ZesFabricPortStatus uintptr +const ( + ZES_FABRIC_PORT_STATUS_UNKNOWN ZesFabricPortStatus = 0 // ZES_FABRIC_PORT_STATUS_UNKNOWN The port status cannot be determined + ZES_FABRIC_PORT_STATUS_HEALTHY ZesFabricPortStatus = 1 // ZES_FABRIC_PORT_STATUS_HEALTHY The port is up and operating as expected + ZES_FABRIC_PORT_STATUS_DEGRADED ZesFabricPortStatus = 2 // ZES_FABRIC_PORT_STATUS_DEGRADED The port is up but has quality and/or speed degradation + ZES_FABRIC_PORT_STATUS_FAILED ZesFabricPortStatus = 3 // ZES_FABRIC_PORT_STATUS_FAILED Port connection instabilities are preventing workloads making forward + + ///< progress + + ZES_FABRIC_PORT_STATUS_DISABLED ZesFabricPortStatus = 4 // ZES_FABRIC_PORT_STATUS_DISABLED The port is configured down + ZES_FABRIC_PORT_STATUS_FORCE_UINT32 ZesFabricPortStatus = 0x7fffffff // ZES_FABRIC_PORT_STATUS_FORCE_UINT32 Value marking end of ZES_FABRIC_PORT_STATUS_* ENUMs + +) + +// ZesFabricPortQualIssueFlags (zes_fabric_port_qual_issue_flags_t) Fabric port quality degradation reasons +type ZesFabricPortQualIssueFlags uint32 +const ( + ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_LINK_ERRORS ZesFabricPortQualIssueFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_LINK_ERRORS Excessive link errors are occurring + ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_SPEED ZesFabricPortQualIssueFlags = /* ZE_BIT(1) */(( 1 << 1 )) // ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_SPEED There is a degradation in the bitrate and/or width of the link + ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_FORCE_UINT32 ZesFabricPortQualIssueFlags = 0x7fffffff // ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_FORCE_UINT32 Value marking end of ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_* ENUMs + +) + +// ZesFabricPortFailureFlags (zes_fabric_port_failure_flags_t) Fabric port failure reasons +type ZesFabricPortFailureFlags uint32 +const ( + ZES_FABRIC_PORT_FAILURE_FLAG_FAILED ZesFabricPortFailureFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZES_FABRIC_PORT_FAILURE_FLAG_FAILED A previously operating link has failed. Hardware will automatically + + ///< retrain this port. This state will persist until either the physical + ///< connection is removed or the link trains successfully. + + ZES_FABRIC_PORT_FAILURE_FLAG_TRAINING_TIMEOUT ZesFabricPortFailureFlags = /* ZE_BIT(1) */(( 1 << 1 )) // ZES_FABRIC_PORT_FAILURE_FLAG_TRAINING_TIMEOUT A connection has not been established within an expected time. + + ///< Hardware will continue to attempt port training. This status will + ///< persist until either the physical connection is removed or the link + ///< successfully trains. + + ZES_FABRIC_PORT_FAILURE_FLAG_FLAPPING ZesFabricPortFailureFlags = /* ZE_BIT(2) */(( 1 << 2 )) // ZES_FABRIC_PORT_FAILURE_FLAG_FLAPPING Port has excessively trained and then transitioned down for some + + ///< period of time. Driver will allow port to continue to train, but will + ///< not enable the port for use until the port has been disabled and + ///< subsequently re-enabled using ::zesFabricPortSetConfig(). + + ZES_FABRIC_PORT_FAILURE_FLAG_FORCE_UINT32 ZesFabricPortFailureFlags = 0x7fffffff // ZES_FABRIC_PORT_FAILURE_FLAG_FORCE_UINT32 Value marking end of ZES_FABRIC_PORT_FAILURE_FLAG_* ENUMs + +) + +// ZesFabricPortId (zes_fabric_port_id_t) Unique identifier for a fabric port +/// +/// @details +/// - This not a universal identifier. The identified is garanteed to be +/// unique for the current hardware configuration of the system. Changes +/// in the hardware may result in a different identifier for a given port. +/// - The main purpose of this identifier to build up an instantaneous +/// topology map of system connectivity. An application should enumerate +/// all fabric ports and match the `remotePortId` member of +/// ::zes_fabric_port_state_t to the `portId` member of +/// ::zes_fabric_port_properties_t. +type ZesFabricPortId struct { + Fabricid uint32 // Fabricid [out] Unique identifier for the fabric end-point + Attachid uint32 // Attachid [out] Unique identifier for the device attachment point + Portnumber uint8 // Portnumber [out] The logical port number (this is typically marked somewhere on the physical device) + +} + +// ZesFabricPortSpeed (zes_fabric_port_speed_t) Fabric port speed in one direction +type ZesFabricPortSpeed struct { + Bitrate int64 // Bitrate [out] Bits/sec that the link is operating at. 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. + +} + +// ZesFabricPortProperties (zes_fabric_port_properties_t) Fabric port properties +type ZesFabricPortProperties 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). + Model [ZES_MAX_FABRIC_PORT_MODEL_SIZE]byte // Model [out] Description of port technology. Will be set to the string "unkown" if this cannot be determined for this port. + Onsubdevice ZeBool // Onsubdevice [out] True if the port is located on a sub-device; false means that the port 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 + Portid ZesFabricPortId // Portid [out] The unique port identifier + Maxrxspeed ZesFabricPortSpeed // Maxrxspeed [out] Maximum speed supported by the receive side of the port (sum of all lanes) + Maxtxspeed ZesFabricPortSpeed // Maxtxspeed [out] Maximum speed supported by the transmit side of the port (sum of all lanes) + +} + +// ZesFabricLinkType (zes_fabric_link_type_t) Provides information about the fabric link attached to a port +type ZesFabricLinkType struct { + Desc [ZES_MAX_FABRIC_LINK_TYPE_SIZE]byte // Desc [out] Description of link technology. Will be set to the string "unkown" if this cannot be determined for this link. + +} + +// ZesFabricPortConfig (zes_fabric_port_config_t) Fabric port configuration +type ZesFabricPortConfig 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). + Enabled ZeBool // Enabled [in,out] Port is configured up/down + Beaconing ZeBool // Beaconing [in,out] Beaconing is configured on/off + +} + +// ZesFabricPortState (zes_fabric_port_state_t) Fabric port state +type ZesFabricPortState 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 ZesFabricPortStatus // Status [out] The current status of the port + Qualityissues ZesFabricPortQualIssueFlags // Qualityissues [out] If status is ::ZES_FABRIC_PORT_STATUS_DEGRADED, then this gives a combination of ::zes_fabric_port_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. + Failurereasons ZesFabricPortFailureFlags // Failurereasons [out] If status is ::ZES_FABRIC_PORT_STATUS_FAILED, then this gives a combination of ::zes_fabric_port_failure_flag_t for reasons for the connection instability; otherwise, 0 indicates there are no connection stability issues at this time. + Remoteportid ZesFabricPortId // Remoteportid [out] The unique port identifier for the remote connection point if status is ::ZES_FABRIC_PORT_STATUS_HEALTHY, ::ZES_FABRIC_PORT_STATUS_DEGRADED or ::ZES_FABRIC_PORT_STATUS_FAILED + Rxspeed ZesFabricPortSpeed // Rxspeed [out] Current maximum receive speed (sum of all lanes) + Txspeed ZesFabricPortSpeed // Txspeed [out] Current maximum transmit speed (sum of all lanes) + +} + +// ZesFabricPortThroughput (zes_fabric_port_throughput_t) Fabric port throughput. +type ZesFabricPortThroughput 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. + Rxcounter uint64 // Rxcounter [out] Monotonic counter for the number of bytes received (sum of all lanes). This includes all protocol overhead, not only the GPU traffic. + Txcounter uint64 // Txcounter [out] Monotonic counter for the number of bytes transmitted (sum of all lanes). This includes all protocol overhead, not only the GPU traffic. + +} + +// ZesFabricPortErrorCounters (zes_fabric_port_error_counters_t) Fabric Port Error Counters +type ZesFabricPortErrorCounters 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). + Linkfailurecount uint64 // Linkfailurecount [out] Link Failure Error Count reported per port + Fwcommerrorcount uint64 // Fwcommerrorcount [out] Firmware Communication Error Count reported per device + Fwerrorcount uint64 // Fwerrorcount [out] Firmware reported Error Count reported per device + Linkdegradecount uint64 // Linkdegradecount [out] Link Degrade Error Count reported per port + +} + +// ZesDeviceEnumFabricPorts Get handle of Fabric ports in a 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 == pCount` +func ZesDeviceEnumFabricPorts( + 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. + phPort *ZesFabricPortHandle, // phPort [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]("zesDeviceEnumFabricPorts", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phPort))) +} + +// ZesFabricPortGetProperties Get Fabric port 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 == hPort` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesFabricPortGetProperties( + hPort ZesFabricPortHandle, // hPort [in] Handle for the component. + pProperties *ZesFabricPortProperties, // pProperties [in,out] Will contain properties of the Fabric Port. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFabricPortGetProperties", uintptr(hPort), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesFabricPortGetLinkType Get Fabric port link type +/// +/// @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 == hPort` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pLinkType` +func ZesFabricPortGetLinkType( + hPort ZesFabricPortHandle, // hPort [in] Handle for the component. + pLinkType *ZesFabricLinkType, // pLinkType [in,out] Will contain details about the link attached to the Fabric port. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFabricPortGetLinkType", uintptr(hPort), uintptr(unsafe.Pointer(pLinkType))) +} + +// ZesFabricPortGetConfig Get Fabric port configuration +/// +/// @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 == hPort` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pConfig` +func ZesFabricPortGetConfig( + hPort ZesFabricPortHandle, // hPort [in] Handle for the component. + pConfig *ZesFabricPortConfig, // pConfig [in,out] Will contain configuration of the Fabric Port. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFabricPortGetConfig", uintptr(hPort), uintptr(unsafe.Pointer(pConfig))) +} + +// ZesFabricPortSetConfig Set Fabric port configuration +/// +/// @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 == hPort` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pConfig` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +func ZesFabricPortSetConfig( + hPort ZesFabricPortHandle, // hPort [in] Handle for the component. + pConfig *ZesFabricPortConfig, // pConfig [in] Contains new configuration of the Fabric Port. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFabricPortSetConfig", uintptr(hPort), uintptr(unsafe.Pointer(pConfig))) +} + +// ZesFabricPortGetState Get Fabric port state - status (health/degraded/failed/disabled), +/// reasons for link degradation or instability, current rx/tx 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 == hPort` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pState` +func ZesFabricPortGetState( + hPort ZesFabricPortHandle, // hPort [in] Handle for the component. + pState *ZesFabricPortState, // pState [in,out] Will contain the current state of the Fabric Port +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFabricPortGetState", uintptr(hPort), uintptr(unsafe.Pointer(pState))) +} + +// ZesFabricPortGetThroughput Get Fabric port throughput +/// +/// @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 == hPort` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pThroughput` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to query this telemetry. +func ZesFabricPortGetThroughput( + hPort ZesFabricPortHandle, // hPort [in] Handle for the component. + pThroughput *ZesFabricPortThroughput, // pThroughput [in,out] Will contain the Fabric port throughput counters. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFabricPortGetThroughput", uintptr(hPort), uintptr(unsafe.Pointer(pThroughput))) +} + +// ZesFabricPortGetFabricErrorCounters Get Fabric Port Error Counters +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - The memory backing the arrays for phPorts and ppThroughputs must be +/// allocated in system memory by the user who is also responsible for +/// releasing them when they are no longer needed. +/// +/// @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 == hPort` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pErrors` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to query this telemetry. +func ZesFabricPortGetFabricErrorCounters( + hPort ZesFabricPortHandle, // hPort [in] Handle for the component. + pErrors *ZesFabricPortErrorCounters, // pErrors [in,out] Will contain the Fabric port Error counters. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFabricPortGetFabricErrorCounters", uintptr(hPort), uintptr(unsafe.Pointer(pErrors))) +} + +// ZesFabricPortGetMultiPortThroughput Get Fabric port throughput from multiple ports in a single call +/// +/// @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 == phPort` +/// + `nullptr == pThroughput` +func ZesFabricPortGetMultiPortThroughput( + hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device. + numPorts uint32, // numPorts [in] Number of ports enumerated in function ::zesDeviceEnumFabricPorts + phPort *ZesFabricPortHandle, // phPort [in][range(0, numPorts)] array of fabric port handles provided by user to gather throughput values. + pThroughput **ZesFabricPortThroughput, // pThroughput [out][range(0, numPorts)] array of fabric port throughput counters from multiple ports of type ::zes_fabric_port_throughput_t. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFabricPortGetMultiPortThroughput", uintptr(hDevice), uintptr(numPorts), uintptr(unsafe.Pointer(phPort)), uintptr(unsafe.Pointer(pThroughput))) +} + diff --git a/sysm_fan.go b/sysm_fan.go new file mode 100644 index 0000000..d06be3d --- /dev/null +++ b/sysm_fan.go @@ -0,0 +1,321 @@ +// 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" +) + +// ZesFanSpeedMode (zes_fan_speed_mode_t) Fan resource speed mode +type ZesFanSpeedMode uintptr +const ( + ZES_FAN_SPEED_MODE_DEFAULT ZesFanSpeedMode = 0 // ZES_FAN_SPEED_MODE_DEFAULT The fan speed is operating using the hardware default settings + ZES_FAN_SPEED_MODE_FIXED ZesFanSpeedMode = 1 // ZES_FAN_SPEED_MODE_FIXED The fan speed is currently set to a fixed value + ZES_FAN_SPEED_MODE_TABLE ZesFanSpeedMode = 2 // ZES_FAN_SPEED_MODE_TABLE The fan speed is currently controlled dynamically by hardware based on + + ///< a temp/speed table + + ZES_FAN_SPEED_MODE_FORCE_UINT32 ZesFanSpeedMode = 0x7fffffff // ZES_FAN_SPEED_MODE_FORCE_UINT32 Value marking end of ZES_FAN_SPEED_MODE_* ENUMs + +) + +// ZesFanSpeedUnits (zes_fan_speed_units_t) Fan speed units +type ZesFanSpeedUnits uintptr +const ( + ZES_FAN_SPEED_UNITS_RPM ZesFanSpeedUnits = 0 // ZES_FAN_SPEED_UNITS_RPM The fan speed is in units of revolutions per minute (rpm) + ZES_FAN_SPEED_UNITS_PERCENT ZesFanSpeedUnits = 1 // ZES_FAN_SPEED_UNITS_PERCENT The fan speed is a percentage of the maximum speed of the fan + ZES_FAN_SPEED_UNITS_FORCE_UINT32 ZesFanSpeedUnits = 0x7fffffff // ZES_FAN_SPEED_UNITS_FORCE_UINT32 Value marking end of ZES_FAN_SPEED_UNITS_* ENUMs + +) + +// ZesFanSpeed (zes_fan_speed_t) Fan speed +type ZesFanSpeed struct { + Speed int32 // Speed [in,out] The speed of the fan. On output, a value of -1 indicates that there is no fixed fan speed setting. + Units ZesFanSpeedUnits // Units [in,out] The units that the fan speed is expressed in. On output, if fan speed is -1 then units should be ignored. + +} + +// ZesFanTempSpeed (zes_fan_temp_speed_t) Fan temperature/speed pair +type ZesFanTempSpeed struct { + Temperature uint32 // Temperature [in,out] Temperature in degrees Celsius. + Speed ZesFanSpeed // Speed [in,out] The speed of the fan + +} + +// ZES_FAN_TEMP_SPEED_PAIR_COUNT Maximum number of fan temperature/speed pairs in the fan speed table. +const ZES_FAN_TEMP_SPEED_PAIR_COUNT = 32 + +// ZesFanSpeedTable (zes_fan_speed_table_t) Fan speed table +type ZesFanSpeedTable struct { + Numpoints int32 // Numpoints [in,out] The number of valid points in the fan speed table. 0 means that there is no fan speed table configured. -1 means that a fan speed table is not supported by the hardware. + Table [ZES_FAN_TEMP_SPEED_PAIR_COUNT]ZesFanTempSpeed // Table [in,out] Array of temperature/fan speed pairs. The table is ordered based on temperature from lowest to highest. + +} + +// ZesFanProperties (zes_fan_properties_t) Fan properties +type ZesFanProperties 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). + Onsubdevice ZeBool // Onsubdevice [out] True if the 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 + Cancontrol ZeBool // Cancontrol [out] Indicates if software can control the fan speed assuming the user has permissions + Supportedmodes uint32 // Supportedmodes [out] Bitfield of supported fan configuration modes (1<<::zes_fan_speed_mode_t) + Supportedunits uint32 // Supportedunits [out] Bitfield of supported fan speed units (1<<::zes_fan_speed_units_t) + Maxrpm int32 // Maxrpm [out] The maximum RPM of the fan. A value of -1 means that this property is unknown. + Maxpoints int32 // Maxpoints [out] The maximum number of points in the fan temp/speed table. A value of -1 means that this fan doesn't support providing a temp/speed table. + +} + +// ZesFanConfig (zes_fan_config_t) Fan configuration +type ZesFanConfig 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). + Mode ZesFanSpeedMode // Mode [in,out] The fan speed mode (fixed, temp-speed table) + Speedfixed ZesFanSpeed // Speedfixed [in,out] The current fixed fan speed setting + Speedtable ZesFanSpeedTable // Speedtable [out] A table containing temperature/speed pairs + +} + +// ZesDeviceEnumFans Get handle of fans +/// +/// @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 ZesDeviceEnumFans( + 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. + phFan *ZesFanHandle, // phFan [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]("zesDeviceEnumFans", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phFan))) +} + +// ZesFanGetProperties Get fan 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 == hFan` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesFanGetProperties( + hFan ZesFanHandle, // hFan [in] Handle for the component. + pProperties *ZesFanProperties, // pProperties [in,out] Will contain the properties of the fan. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFanGetProperties", uintptr(hFan), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesFanGetConfig Get fan configurations and the current fan speed mode (default, fixed, +/// temp-speed table) +/// +/// @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 == hFan` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pConfig` +func ZesFanGetConfig( + hFan ZesFanHandle, // hFan [in] Handle for the component. + pConfig *ZesFanConfig, // pConfig [in,out] Will contain the current configuration of the fan. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFanGetConfig", uintptr(hFan), uintptr(unsafe.Pointer(pConfig))) +} + +// ZesFanSetDefaultMode Configure the fan to run with hardware factory settings (set mode to +/// ::ZES_FAN_SPEED_MODE_DEFAULT) +/// +/// @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 == hFan` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +func ZesFanSetDefaultMode( + hFan ZesFanHandle, // hFan [in] Handle for the component. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFanSetDefaultMode", uintptr(hFan)) +} + +// ZesFanSetFixedSpeedMode Configure the fan to rotate at a fixed speed (set mode to +/// ::ZES_FAN_SPEED_MODE_FIXED) +/// +/// @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_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 == hFan` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == speed` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Fixing the fan speed not supported by the hardware or the fan speed units are not supported. See the `supportedModes` and `supportedUnits` members of ::zes_fan_properties_t. +func ZesFanSetFixedSpeedMode( + hFan ZesFanHandle, // hFan [in] Handle for the component. + speed *ZesFanSpeed, // speed [in] The fixed fan speed setting +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFanSetFixedSpeedMode", uintptr(hFan), uintptr(unsafe.Pointer(speed))) +} + +// ZesFanSetSpeedTableMode Configure the fan to adjust speed based on a temperature/speed table +/// (set mode to ::ZES_FAN_SPEED_MODE_TABLE) +/// +/// @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_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 == hFan` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == speedTable` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// + The temperature/speed pairs in the array are not sorted on temperature from lowest to highest. +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Fan speed table not supported by the hardware or the fan speed units are not supported. See the `supportedModes` and `supportedUnits` members of ::zes_fan_properties_t. +func ZesFanSetSpeedTableMode( + hFan ZesFanHandle, // hFan [in] Handle for the component. + speedTable *ZesFanSpeedTable, // speedTable [in] A table containing temperature/speed pairs. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFanSetSpeedTableMode", uintptr(hFan), uintptr(unsafe.Pointer(speedTable))) +} + +// ZesFanGetState Get current state of a fan - current mode and 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_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 == hFan` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZES_FAN_SPEED_UNITS_PERCENT < units` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pSpeed` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + The requested fan speed units are not supported. See the `supportedUnits` member of ::zes_fan_properties_t. +func ZesFanGetState( + hFan ZesFanHandle, // hFan [in] Handle for the component. + units ZesFanSpeedUnits, // units [in] The units in which the fan speed should be returned. + pSpeed *int32, // pSpeed [in,out] Will contain the current speed of the fan in the units requested. A value of -1 indicates that the fan speed cannot be measured. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFanGetState", uintptr(hFan), uintptr(units), uintptr(unsafe.Pointer(pSpeed))) +} + diff --git a/sysm_firmware.go b/sysm_firmware.go new file mode 100644 index 0000000..3a9c51b --- /dev/null +++ b/sysm_firmware.go @@ -0,0 +1,199 @@ +// 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" +) + +// ZesFirmwareProperties (zes_firmware_properties_t) Firmware properties +type ZesFirmwareProperties 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). + Onsubdevice ZeBool // Onsubdevice [out] True if the 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 + Cancontrol ZeBool // Cancontrol [out] Indicates if software can flash the firmware assuming the user has permissions + Name [ZES_STRING_PROPERTY_SIZE]byte // Name [out] NULL terminated string value. The string "unknown" will be returned if this property cannot be determined. + Version [ZES_STRING_PROPERTY_SIZE]byte // Version [out] NULL terminated string value. The string "unknown" will be returned if this property cannot be determined. + +} + +// ZesDeviceEnumFirmwares Get handle of firmwares +/// +/// @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 ZesDeviceEnumFirmwares( + 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. + phFirmware *ZesFirmwareHandle, // phFirmware [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]("zesDeviceEnumFirmwares", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phFirmware))) +} + +// ZesFirmwareGetProperties Get firmware 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 == hFirmware` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesFirmwareGetProperties( + hFirmware ZesFirmwareHandle, // hFirmware [in] Handle for the component. + pProperties *ZesFirmwareProperties, // pProperties [in,out] Pointer to an array that will hold the properties of the firmware +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFirmwareGetProperties", uintptr(hFirmware), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesFirmwareFlash Flash a new firmware image +/// +/// @details +/// - Any running workload must be gracefully closed before invoking this +/// function. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - This is a non-blocking call. Application may call +/// ::zesFirmwareGetFlashProgress to get completion status. +/// +/// @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 == hFirmware` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pImage` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to perform this operation. +func ZesFirmwareFlash( + hFirmware ZesFirmwareHandle, // hFirmware [in] Handle for the component. + pImage unsafe.Pointer, // pImage [in] Image of the new firmware to flash. + size uint32, // size [in] Size of the flash image. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFirmwareFlash", uintptr(hFirmware), uintptr(unsafe.Pointer(pImage)), uintptr(size)) +} + +// ZesFirmwareGetFlashProgress Get Firmware Flash Progress +/// +/// @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 == hFirmware` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCompletionPercent` +func ZesFirmwareGetFlashProgress( + hFirmware ZesFirmwareHandle, // hFirmware [in] Handle for the component. + pCompletionPercent *uint32, // pCompletionPercent [in,out] Pointer to the Completion Percentage of Firmware Update +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFirmwareGetFlashProgress", uintptr(hFirmware), uintptr(unsafe.Pointer(pCompletionPercent))) +} + +// ZesFirmwareGetConsoleLogs Get Firmware Console Logs +/// +/// @details +/// - The caller may pass nullptr for pFirmwareLog and set pSize to zero +/// when querying only for size. +/// - The caller must provide memory for Firmware log. +/// - 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 == hFirmware` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pSize` +func ZesFirmwareGetConsoleLogs( + hFirmware ZesFirmwareHandle, // hFirmware [in] Handle for the component. + pSize *uintptr, // pSize [in,out] size of firmware log + pFirmwareLog *byte, // pFirmwareLog [in,out][optional] pointer to null-terminated string of the log. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFirmwareGetConsoleLogs", uintptr(hFirmware), uintptr(unsafe.Pointer(pSize)), uintptr(unsafe.Pointer(pFirmwareLog))) +} + diff --git a/sysm_firmwareSecurityVersion.go b/sysm_firmwareSecurityVersion.go new file mode 100644 index 0000000..5cf60a6 --- /dev/null +++ b/sysm_firmwareSecurityVersion.go @@ -0,0 +1,96 @@ +// 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" +) + +// ZES_FIRMWARE_SECURITY_VERSION_EXP_NAME Firmware security version +const ZES_FIRMWARE_SECURITY_VERSION_EXP_NAME = "ZES_experimental_firmware_security_version" + +// ZesFirmwareSecurityExpVersion (zes_firmware_security_exp_version_t) Firmware security version Extension Version(s) +type ZesFirmwareSecurityExpVersion uintptr +const ( + ZES_FIRMWARE_SECURITY_EXP_VERSION_1_0 ZesFirmwareSecurityExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_FIRMWARE_SECURITY_EXP_VERSION_1_0 version 1.0 + ZES_FIRMWARE_SECURITY_EXP_VERSION_CURRENT ZesFirmwareSecurityExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_FIRMWARE_SECURITY_EXP_VERSION_CURRENT latest known version + ZES_FIRMWARE_SECURITY_EXP_VERSION_FORCE_UINT32 ZesFirmwareSecurityExpVersion = 0x7fffffff // ZES_FIRMWARE_SECURITY_EXP_VERSION_FORCE_UINT32 Value marking end of ZES_FIRMWARE_SECURITY_EXP_VERSION_* ENUMs + +) + +// ZesFirmwareGetSecurityVersionExp Get the firmware security version number of the currently running +/// firmware +/// +/// @details +/// - The application should create a character array of size +/// ::ZES_STRING_PROPERTY_SIZE and reference it for the `pVersion` +/// parameter. +/// - 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 == hFirmware` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pVersion` +func ZesFirmwareGetSecurityVersionExp( + hFirmware ZesFirmwareHandle, // hFirmware [in] Handle for the component. + pVersion *byte, // pVersion [in,out] NULL terminated string value. The string "unknown" will be returned if this property cannot be determined. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFirmwareGetSecurityVersionExp", uintptr(hFirmware), uintptr(unsafe.Pointer(pVersion))) +} + +// ZesFirmwareSetSecurityVersionExp Set the firmware security version number +/// +/// @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 == hFirmware` +func ZesFirmwareSetSecurityVersionExp( + hFirmware ZesFirmwareHandle, // hFirmware [in] Handle for the component. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFirmwareSetSecurityVersionExp", uintptr(hFirmware)) +} + diff --git a/sysm_frequency.go b/sysm_frequency.go new file mode 100644 index 0000000..50e927e --- /dev/null +++ b/sysm_frequency.go @@ -0,0 +1,793 @@ +// 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" +) + +// ZesFreqDomain (zes_freq_domain_t) Frequency domains. +type ZesFreqDomain uintptr +const ( + ZES_FREQ_DOMAIN_GPU ZesFreqDomain = 0 // ZES_FREQ_DOMAIN_GPU GPU Core Domain. + ZES_FREQ_DOMAIN_MEMORY ZesFreqDomain = 1 // ZES_FREQ_DOMAIN_MEMORY Local Memory Domain. + ZES_FREQ_DOMAIN_MEDIA ZesFreqDomain = 2 // ZES_FREQ_DOMAIN_MEDIA GPU Media Domain. + ZES_FREQ_DOMAIN_FORCE_UINT32 ZesFreqDomain = 0x7fffffff // ZES_FREQ_DOMAIN_FORCE_UINT32 Value marking end of ZES_FREQ_DOMAIN_* ENUMs + +) + +// ZesFreqProperties (zes_freq_properties_t) Frequency properties +/// +/// @details +/// - Indicates if this frequency domain can be overclocked (if true, +/// functions such as ::zesFrequencyOcSetFrequencyTarget() are supported). +/// - The min/max hardware frequencies are specified for non-overclock +/// configurations. For overclock configurations, use +/// ::zesFrequencyOcGetFrequencyTarget() to determine the maximum +/// frequency that can be requested. +type ZesFreqProperties 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 ZesFreqDomain // Type [out] The hardware block that this frequency domain controls (GPU, memory, ...) + 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 + Cancontrol ZeBool // Cancontrol [out] Indicates if software can control the frequency of this domain assuming the user has permissions + Isthrottleeventsupported ZeBool // Isthrottleeventsupported [out] Indicates if software can register to receive event ::ZES_EVENT_TYPE_FLAG_FREQ_THROTTLED + Min float64 // Min [out] The minimum hardware clock frequency in units of MHz. + Max float64 // Max [out] The maximum non-overclock hardware clock frequency in units of MHz. + +} + +// ZesFreqRange (zes_freq_range_t) Frequency range between which the hardware can operate. +/// +/// @details +/// - When setting limits, they will be clamped to the hardware limits. +/// - When setting limits, ensure that the max frequency is greater than or +/// equal to the min frequency specified. +/// - When setting limits to return to factory settings, specify -1 for both +/// the min and max limit. +type ZesFreqRange struct { + Min float64 // Min [in,out] The min frequency in MHz below which hardware frequency management will not request frequencies. On input, setting to 0 will permit the frequency to go down to the hardware minimum while setting to -1 will return the min frequency limit to the factory value (can be larger than the hardware min). On output, a negative value indicates that no external minimum frequency limit is in effect. + Max float64 // Max [in,out] The max frequency in MHz above which hardware frequency management will not request frequencies. On input, setting to 0 or a very big number will permit the frequency to go all the way up to the hardware maximum while setting to -1 will return the max frequency to the factory value (which can be less than the hardware max). On output, a negative number indicates that no external maximum frequency limit is in effect. + +} + +// ZesFreqThrottleReasonFlags (zes_freq_throttle_reason_flags_t) Frequency throttle reasons +type ZesFreqThrottleReasonFlags uint32 +const ( + ZES_FREQ_THROTTLE_REASON_FLAG_AVE_PWR_CAP ZesFreqThrottleReasonFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZES_FREQ_THROTTLE_REASON_FLAG_AVE_PWR_CAP frequency throttled due to average power excursion (PL1) + ZES_FREQ_THROTTLE_REASON_FLAG_BURST_PWR_CAP ZesFreqThrottleReasonFlags = /* ZE_BIT(1) */(( 1 << 1 )) // ZES_FREQ_THROTTLE_REASON_FLAG_BURST_PWR_CAP frequency throttled due to burst power excursion (PL2) + ZES_FREQ_THROTTLE_REASON_FLAG_CURRENT_LIMIT ZesFreqThrottleReasonFlags = /* ZE_BIT(2) */(( 1 << 2 )) // ZES_FREQ_THROTTLE_REASON_FLAG_CURRENT_LIMIT frequency throttled due to current excursion (PL4) + ZES_FREQ_THROTTLE_REASON_FLAG_THERMAL_LIMIT ZesFreqThrottleReasonFlags = /* ZE_BIT(3) */(( 1 << 3 )) // ZES_FREQ_THROTTLE_REASON_FLAG_THERMAL_LIMIT frequency throttled due to thermal excursion (T > TjMax) + ZES_FREQ_THROTTLE_REASON_FLAG_PSU_ALERT ZesFreqThrottleReasonFlags = /* ZE_BIT(4) */(( 1 << 4 )) // ZES_FREQ_THROTTLE_REASON_FLAG_PSU_ALERT frequency throttled due to power supply assertion + ZES_FREQ_THROTTLE_REASON_FLAG_SW_RANGE ZesFreqThrottleReasonFlags = /* ZE_BIT(5) */(( 1 << 5 )) // ZES_FREQ_THROTTLE_REASON_FLAG_SW_RANGE frequency throttled due to software supplied frequency range + ZES_FREQ_THROTTLE_REASON_FLAG_HW_RANGE ZesFreqThrottleReasonFlags = /* ZE_BIT(6) */(( 1 << 6 )) // ZES_FREQ_THROTTLE_REASON_FLAG_HW_RANGE frequency throttled due to a sub block that has a lower frequency + + ///< range when it receives clocks + + ZES_FREQ_THROTTLE_REASON_FLAG_VOLTAGE ZesFreqThrottleReasonFlags = /* ZE_BIT(7) */(( 1 << 7 )) // ZES_FREQ_THROTTLE_REASON_FLAG_VOLTAGE frequency throttled due to voltage excursion + ZES_FREQ_THROTTLE_REASON_FLAG_THERMAL ZesFreqThrottleReasonFlags = /* ZE_BIT(8) */(( 1 << 8 )) // ZES_FREQ_THROTTLE_REASON_FLAG_THERMAL frequency throttled due to thermal conditions + ZES_FREQ_THROTTLE_REASON_FLAG_POWER ZesFreqThrottleReasonFlags = /* ZE_BIT(9) */(( 1 << 9 )) // ZES_FREQ_THROTTLE_REASON_FLAG_POWER frequency throttled due to power constraints + ZES_FREQ_THROTTLE_REASON_FLAG_FORCE_UINT32 ZesFreqThrottleReasonFlags = 0x7fffffff // ZES_FREQ_THROTTLE_REASON_FLAG_FORCE_UINT32 Value marking end of ZES_FREQ_THROTTLE_REASON_FLAG_* ENUMs + +) + +// ZesFreqState (zes_freq_state_t) Frequency state +type ZesFreqState 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). + Currentvoltage float64 // Currentvoltage [out] Current voltage in Volts. A negative value indicates that this property is not known. + Request float64 // Request [out] The current frequency request in MHz. A negative value indicates that this property is not known. + Tdp float64 // Tdp [out] The maximum frequency in MHz supported under the current TDP conditions. This fluctuates dynamically based on the power and thermal limits of the part. A negative value indicates that this property is not known. + Efficient float64 // Efficient [out] The efficient minimum frequency in MHz. A negative value indicates that this property is not known. + Actual float64 // Actual [out] The resolved frequency in MHz. A negative value indicates that this property is not known. + Throttlereasons ZesFreqThrottleReasonFlags // Throttlereasons [out] The reasons that the frequency is being limited by the hardware. Returns 0 (frequency not throttled) or a combination of ::zes_freq_throttle_reason_flag_t. + +} + +// ZesFreqThrottleTime (zes_freq_throttle_time_t) Frequency throttle time snapshot +/// +/// @details +/// - Percent time throttled is calculated by taking two snapshots (s1, s2) +/// and using the equation: %throttled = (s2.throttleTime - +/// s1.throttleTime) / (s2.timestamp - s1.timestamp) +type ZesFreqThrottleTime struct { + Throttletime uint64 // Throttletime [out] The monotonic counter of time in microseconds that the frequency has been limited by the hardware. + Timestamp uint64 // Timestamp [out] Microsecond timestamp when throttleTime was captured. 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. + +} + +// ZesOcMode (zes_oc_mode_t) Overclocking modes +/// +/// @details +/// - [DEPRECATED] No longer supported. +type ZesOcMode uintptr +const ( + ZES_OC_MODE_OFF ZesOcMode = 0 // ZES_OC_MODE_OFF Overclocking if off - hardware is running using factory default + + ///< voltages/frequencies. + + ZES_OC_MODE_OVERRIDE ZesOcMode = 1 // ZES_OC_MODE_OVERRIDE Overclock override mode - In this mode, a fixed user-supplied voltage + + ///< is applied independent of the frequency request. The maximum permitted + ///< frequency can also be increased. This mode disables INTERPOLATIVE and + ///< FIXED modes. + + ZES_OC_MODE_INTERPOLATIVE ZesOcMode = 2 // ZES_OC_MODE_INTERPOLATIVE Overclock interpolative mode - In this mode, the voltage/frequency + + ///< curve can be extended with a new voltage/frequency point that will be + ///< interpolated. The existing voltage/frequency points can also be offset + ///< (up or down) by a fixed voltage. This mode disables FIXED and OVERRIDE + ///< modes. + + ZES_OC_MODE_FIXED ZesOcMode = 3 // ZES_OC_MODE_FIXED Overclocking fixed Mode - In this mode, hardware will disable most + + ///< frequency throttling and lock the frequency and voltage at the + ///< specified overclock values. This mode disables OVERRIDE and + ///< INTERPOLATIVE modes. This mode can damage the part, most of the + ///< protections are disabled on this mode. + + ZES_OC_MODE_FORCE_UINT32 ZesOcMode = 0x7fffffff // ZES_OC_MODE_FORCE_UINT32 Value marking end of ZES_OC_MODE_* ENUMs + +) + +// ZesOcCapabilities (zes_oc_capabilities_t) Overclocking properties +/// +/// @details +/// - Provides all the overclocking capabilities and properties supported by +/// the device for the frequency domain. +/// - [DEPRECATED] No longer supported. +type ZesOcCapabilities 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). + Isocsupported ZeBool // Isocsupported [out] Indicates if any overclocking features are supported on this frequency domain. + Maxfactorydefaultfrequency float64 // Maxfactorydefaultfrequency [out] Factory default non-overclock maximum frequency in Mhz. + Maxfactorydefaultvoltage float64 // Maxfactorydefaultvoltage [out] Factory default voltage used for the non-overclock maximum frequency in MHz. + Maxocfrequency float64 // Maxocfrequency [out] Maximum hardware overclocking frequency limit in Mhz. + Minocvoltageoffset float64 // Minocvoltageoffset [out] The minimum voltage offset that can be applied to the voltage/frequency curve. Note that this number can be negative. + Maxocvoltageoffset float64 // Maxocvoltageoffset [out] The maximum voltage offset that can be applied to the voltage/frequency curve. + Maxocvoltage float64 // Maxocvoltage [out] The maximum overclock voltage that hardware supports. + Istjmaxsupported ZeBool // Istjmaxsupported [out] Indicates if the maximum temperature limit (TjMax) can be changed for this frequency domain. + Isiccmaxsupported ZeBool // Isiccmaxsupported [out] Indicates if the maximum current (IccMax) can be changed for this frequency domain. + Ishighvoltmodecapable ZeBool // Ishighvoltmodecapable [out] Indicates if this frequency domains supports a feature to set very high voltages. + Ishighvoltmodeenabled ZeBool // Ishighvoltmodeenabled [out] Indicates if very high voltages are permitted on this frequency domain. + Isextendedmodesupported ZeBool // Isextendedmodesupported [out] Indicates if the extended overclocking features are supported. If this is supported, increments are on 1 Mhz basis. + Isfixedmodesupported ZeBool // Isfixedmodesupported [out] Indicates if the fixed mode is supported. In this mode, hardware will disable most frequency throttling and lock the frequency and voltage at the specified overclock values. + +} + +// ZesDeviceEnumFrequencyDomains Get handle of frequency domains +/// +/// @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 ZesDeviceEnumFrequencyDomains( + 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. + phFrequency *ZesFreqHandle, // phFrequency [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]("zesDeviceEnumFrequencyDomains", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phFrequency))) +} + +// ZesFrequencyGetProperties Get frequency properties - available frequencies +/// +/// @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 == hFrequency` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesFrequencyGetProperties( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + pProperties *ZesFreqProperties, // pProperties [in,out] The frequency properties for the specified domain. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyGetProperties", uintptr(hFrequency), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesFrequencyGetAvailableClocks Get available non-overclocked hardware clock frequencies for the +/// frequency domain +/// +/// @details +/// - The list of available frequencies is returned in order of slowest to +/// fastest. +/// - 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 == hFrequency` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +func ZesFrequencyGetAvailableClocks( + hFrequency ZesFreqHandle, // hFrequency [in] Sysman handle of the device. + pCount *uint32, // pCount [in,out] pointer to the number of frequencies. if count is zero, then the driver shall update the value with the total number of frequencies that are available. if count is greater than the number of frequencies that are available, then the driver shall update the value with the correct number of frequencies. + phFrequency *float64, // phFrequency [in,out][optional][range(0, *pCount)] array of frequencies in units of MHz and sorted from slowest to fastest. if count is less than the number of frequencies that are available, then the driver shall only retrieve that number of frequencies. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyGetAvailableClocks", uintptr(hFrequency), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phFrequency))) +} + +// ZesFrequencyGetRange Get current frequency limits +/// +/// @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 == hFrequency` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pLimits` +func ZesFrequencyGetRange( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + pLimits *ZesFreqRange, // pLimits [in,out] The range between which the hardware can operate for the specified domain. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyGetRange", uintptr(hFrequency), uintptr(unsafe.Pointer(pLimits))) +} + +// ZesFrequencySetRange Set frequency range between which the hardware can operate. +/// +/// @details +/// - The application may call this function with the frequency range min +/// and max values set to `-1` to request the frequency be (re)set to the +/// default values. +/// - 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 == hFrequency` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pLimits` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +func ZesFrequencySetRange( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + pLimits *ZesFreqRange, // pLimits [in] The limits between which the hardware can operate for the specified domain. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencySetRange", uintptr(hFrequency), uintptr(unsafe.Pointer(pLimits))) +} + +// ZesFrequencyGetState Get current frequency state - frequency request, actual frequency, TDP +/// limits +/// +/// @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 == hFrequency` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pState` +func ZesFrequencyGetState( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + pState *ZesFreqState, // pState [in,out] Frequency state for the specified domain. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyGetState", uintptr(hFrequency), uintptr(unsafe.Pointer(pState))) +} + +// ZesFrequencyGetThrottleTime Get frequency throttle time +/// +/// @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 == hFrequency` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pThrottleTime` +func ZesFrequencyGetThrottleTime( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + pThrottleTime *ZesFreqThrottleTime, // pThrottleTime [in,out] Will contain a snapshot of the throttle time counters for the specified domain. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyGetThrottleTime", uintptr(hFrequency), uintptr(unsafe.Pointer(pThrottleTime))) +} + +// ZesFrequencyOcGetCapabilities Get the overclocking capabilities. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] No longer supported. +/// +/// @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 == hFrequency` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pOcCapabilities` +func ZesFrequencyOcGetCapabilities( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + pOcCapabilities *ZesOcCapabilities, // pOcCapabilities [in,out] Pointer to the capabilities structure. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyOcGetCapabilities", uintptr(hFrequency), uintptr(unsafe.Pointer(pOcCapabilities))) +} + +// ZesFrequencyOcGetFrequencyTarget Get the current overclocking frequency target, if extended moded is +/// supported, will returned in 1 Mhz granularity. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] No longer supported. +/// +/// @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_DEPENDENCY_UNAVAILABLE +/// - ::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 == hFrequency` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCurrentOcFrequency` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). +/// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). +/// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// + Overclocking feature is locked on this frequency domain. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +func ZesFrequencyOcGetFrequencyTarget( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + pCurrentOcFrequency *float64, // pCurrentOcFrequency [out] Overclocking Frequency in MHz, if extended moded is supported, will returned in 1 Mhz granularity, else, in multiples of 50 Mhz. This cannot be greater than the `maxOcFrequency` member of ::zes_oc_capabilities_t. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyOcGetFrequencyTarget", uintptr(hFrequency), uintptr(unsafe.Pointer(pCurrentOcFrequency))) +} + +// ZesFrequencyOcSetFrequencyTarget Set the current overclocking frequency target, if extended moded is +/// supported, can be set in 1 Mhz granularity. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] No longer supported. +/// +/// @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_DEPENDENCY_UNAVAILABLE +/// - ::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 == hFrequency` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). +/// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). +/// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// + Overclocking feature is locked on this frequency domain. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +func ZesFrequencyOcSetFrequencyTarget( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + CurrentOcFrequency float64, // CurrentOcFrequency [in] Overclocking Frequency in MHz, if extended moded is supported, it could be set in 1 Mhz granularity, else, in multiples of 50 Mhz. This cannot be greater than the `maxOcFrequency` member of ::zes_oc_capabilities_t. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyOcSetFrequencyTarget", uintptr(hFrequency), uintptr(CurrentOcFrequency)) +} + +// ZesFrequencyOcGetVoltageTarget Get the current overclocking voltage settings. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] No longer supported. +/// +/// @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_DEPENDENCY_UNAVAILABLE +/// - ::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 == hFrequency` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCurrentVoltageTarget` +/// + `nullptr == pCurrentVoltageOffset` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). +/// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). +/// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// + Overclocking feature is locked on this frequency domain. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +func ZesFrequencyOcGetVoltageTarget( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + pCurrentVoltageTarget *float64, // pCurrentVoltageTarget [out] Overclock voltage in Volts. This cannot be greater than the `maxOcVoltage` member of ::zes_oc_capabilities_t. + pCurrentVoltageOffset *float64, // pCurrentVoltageOffset [out] This voltage offset is applied to all points on the voltage/frequency curve, including the new overclock voltageTarget. Valid range is between the `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyOcGetVoltageTarget", uintptr(hFrequency), uintptr(unsafe.Pointer(pCurrentVoltageTarget)), uintptr(unsafe.Pointer(pCurrentVoltageOffset))) +} + +// ZesFrequencyOcSetVoltageTarget Set the current overclocking voltage settings. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] No longer supported. +/// +/// @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_DEPENDENCY_UNAVAILABLE +/// - ::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 == hFrequency` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). +/// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). +/// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// + Overclocking feature is locked on this frequency domain. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +func ZesFrequencyOcSetVoltageTarget( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + CurrentVoltageTarget float64, // CurrentVoltageTarget [in] Overclock voltage in Volts. This cannot be greater than the `maxOcVoltage` member of ::zes_oc_capabilities_t. + CurrentVoltageOffset float64, // CurrentVoltageOffset [in] This voltage offset is applied to all points on the voltage/frequency curve, include the new overclock voltageTarget. Valid range is between the `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyOcSetVoltageTarget", uintptr(hFrequency), uintptr(CurrentVoltageTarget), uintptr(CurrentVoltageOffset)) +} + +// ZesFrequencyOcSetMode Set the current overclocking mode. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] No longer supported. +/// +/// @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_DEPENDENCY_UNAVAILABLE +/// - ::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 == hFrequency` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZES_OC_MODE_FIXED < CurrentOcMode` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). +/// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). +/// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// + Overclocking feature is locked on this frequency domain. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +func ZesFrequencyOcSetMode( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + CurrentOcMode ZesOcMode, // CurrentOcMode [in] Current Overclocking Mode ::zes_oc_mode_t. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyOcSetMode", uintptr(hFrequency), uintptr(CurrentOcMode)) +} + +// ZesFrequencyOcGetMode Get the current overclocking mode. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] No longer supported. +/// +/// @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_DEPENDENCY_UNAVAILABLE +/// - ::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 == hFrequency` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCurrentOcMode` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). +/// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). +/// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// + Overclocking feature is locked on this frequency domain. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +func ZesFrequencyOcGetMode( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + pCurrentOcMode *ZesOcMode, // pCurrentOcMode [out] Current Overclocking Mode ::zes_oc_mode_t. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyOcGetMode", uintptr(hFrequency), uintptr(unsafe.Pointer(pCurrentOcMode))) +} + +// ZesFrequencyOcGetIccMax Get the maximum current limit setting. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] No longer supported. +/// +/// @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_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 == hFrequency` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pOcIccMax` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). +/// + Capability the `isIccMaxSupported` member of ::zes_oc_capabilities_t is false for this frequency domain. +func ZesFrequencyOcGetIccMax( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + pOcIccMax *float64, // pOcIccMax [in,out] Will contain the maximum current limit in Amperes on successful return. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyOcGetIccMax", uintptr(hFrequency), uintptr(unsafe.Pointer(pOcIccMax))) +} + +// ZesFrequencyOcSetIccMax Change the maximum current limit setting. +/// +/// @details +/// - Setting ocIccMax to 0.0 will return the value to the factory default. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] No longer supported. +/// +/// @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_DEPENDENCY_UNAVAILABLE +/// - ::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 == hFrequency` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). +/// + The `isIccMaxSupported` member of ::zes_oc_capabilities_t is false for this frequency domain. +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// + Overclocking feature is locked on this frequency domain. +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// + The specified current limit is too low or too high. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +func ZesFrequencyOcSetIccMax( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + ocIccMax float64, // ocIccMax [in] The new maximum current limit in Amperes. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyOcSetIccMax", uintptr(hFrequency), uintptr(ocIccMax)) +} + +// ZesFrequencyOcGetTjMax Get the maximum temperature limit setting. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] No longer supported. +/// +/// @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_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 == hFrequency` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pOcTjMax` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). +func ZesFrequencyOcGetTjMax( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + pOcTjMax *float64, // pOcTjMax [in,out] Will contain the maximum temperature limit in degrees Celsius on successful return. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyOcGetTjMax", uintptr(hFrequency), uintptr(unsafe.Pointer(pOcTjMax))) +} + +// ZesFrequencyOcSetTjMax Change the maximum temperature limit setting. +/// +/// @details +/// - Setting ocTjMax to 0.0 will return the value to the factory default. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] No longer supported. +/// +/// @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_DEPENDENCY_UNAVAILABLE +/// - ::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 == hFrequency` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). +/// + The `isTjMaxSupported` member of ::zes_oc_capabilities_t is false for this frequency domain. +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// + Overclocking feature is locked on this frequency domain. +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// + The specified temperature limit is too high. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +func ZesFrequencyOcSetTjMax( + hFrequency ZesFreqHandle, // hFrequency [in] Handle for the component. + ocTjMax float64, // ocTjMax [in] The new maximum temperature limit in degrees Celsius. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesFrequencyOcSetTjMax", uintptr(hFrequency), uintptr(ocTjMax)) +} + diff --git a/sysm_led.go b/sysm_led.go new file mode 100644 index 0000000..dbf1622 --- /dev/null +++ b/sysm_led.go @@ -0,0 +1,206 @@ +// 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" +) + +// ZesLedProperties (zes_led_properties_t) LED properties +type ZesLedProperties 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). + Onsubdevice ZeBool // Onsubdevice [out] True if the 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 + Cancontrol ZeBool // Cancontrol [out] Indicates if software can control the LED assuming the user has permissions + Havergb ZeBool // Havergb [out] Indicates if the LED is RGB capable + +} + +// ZesLedColor (zes_led_color_t) LED color +type ZesLedColor struct { + Red float64 // Red [in,out][range(0.0, 1.0)] The LED red value. On output, a value less than 0.0 indicates that the color is not known. + Green float64 // Green [in,out][range(0.0, 1.0)] The LED green value. On output, a value less than 0.0 indicates that the color is not known. + Blue float64 // Blue [in,out][range(0.0, 1.0)] The LED blue value. On output, a value less than 0.0 indicates that the color is not known. + +} + +// ZesLedState (zes_led_state_t) LED state +type ZesLedState 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). + Ison ZeBool // Ison [out] Indicates if the LED is on or off + Color ZesLedColor // Color [out] Color of the LED + +} + +// ZesDeviceEnumLeds Get handle of LEDs +/// +/// @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 ZesDeviceEnumLeds( + 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. + phLed *ZesLedHandle, // phLed [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]("zesDeviceEnumLeds", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phLed))) +} + +// ZesLedGetProperties Get LED 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 == hLed` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesLedGetProperties( + hLed ZesLedHandle, // hLed [in] Handle for the component. + pProperties *ZesLedProperties, // pProperties [in,out] Will contain the properties of the LED. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesLedGetProperties", uintptr(hLed), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesLedGetState Get current state of a LED - on/off, color +/// +/// @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 == hLed` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pState` +func ZesLedGetState( + hLed ZesLedHandle, // hLed [in] Handle for the component. + pState *ZesLedState, // pState [in,out] Will contain the current state of the LED. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesLedGetState", uintptr(hLed), uintptr(unsafe.Pointer(pState))) +} + +// ZesLedSetState Turn the LED on/off +/// +/// @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 == hLed` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +func ZesLedSetState( + hLed ZesLedHandle, // hLed [in] Handle for the component. + enable ZeBool, // enable [in] Set to TRUE to turn the LED on, FALSE to turn off. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesLedSetState", uintptr(hLed), uintptr(enable)) +} + +// ZesLedSetColor Set the color of the LED +/// +/// @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_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 == hLed` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pColor` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + This LED doesn't not support color changes. See the `haveRGB` member of ::zes_led_properties_t. +func ZesLedSetColor( + hLed ZesLedHandle, // hLed [in] Handle for the component. + pColor *ZesLedColor, // pColor [in] New color of the LED. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesLedSetColor", uintptr(hLed), uintptr(unsafe.Pointer(pColor))) +} + diff --git a/sysm_memPageOfflineState.go b/sysm_memPageOfflineState.go new file mode 100644 index 0000000..e23cf57 --- /dev/null +++ b/sysm_memPageOfflineState.go @@ -0,0 +1,45 @@ +// 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" +) + +// ZES_MEM_PAGE_OFFLINE_STATE_EXP_NAME Memory State Extension Name +const ZES_MEM_PAGE_OFFLINE_STATE_EXP_NAME = "ZES_extension_mem_state" + +// ZesMemPageOfflineStateExpVersion (zes_mem_page_offline_state_exp_version_t) Memory State Extension Version(s) +type ZesMemPageOfflineStateExpVersion uintptr +const ( + ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_1_0 ZesMemPageOfflineStateExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_1_0 version 1.0 + ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_CURRENT ZesMemPageOfflineStateExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_CURRENT latest known version + ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_FORCE_UINT32 ZesMemPageOfflineStateExpVersion = 0x7fffffff // ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_FORCE_UINT32 Value marking end of ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_* ENUMs + +) + +// ZesMemPageOfflineStateExp (zes_mem_page_offline_state_exp_t) Extension properties for Memory State +/// +/// @details +/// - This structure may be returned from ::zesMemoryGetState via the +/// `pNext` member of ::zes_mem_state_t +/// - These additional parameters get Memory Page Offline Metrics +type ZesMemPageOfflineStateExp 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). + Memorypageoffline uint32 // Memorypageoffline [out] Returns the number of Memory Pages Offline + Maxmemorypageoffline uint32 // Maxmemorypageoffline [out] Returns the Allowed Memory Pages Offline + +} + diff --git a/sysm_memory.go b/sysm_memory.go new file mode 100644 index 0000000..dbeff79 --- /dev/null +++ b/sysm_memory.go @@ -0,0 +1,259 @@ +// 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))) +} + diff --git a/sysm_memoryBwCounterValidBits.go b/sysm_memoryBwCounterValidBits.go new file mode 100644 index 0000000..86a54af --- /dev/null +++ b/sysm_memoryBwCounterValidBits.go @@ -0,0 +1,47 @@ +// 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" +) + +// ZES_MEMORY_BANDWIDTH_COUNTER_BITS_EXP_PROPERTIES_NAME Memory Bandwidth Counter Valid Bits Extension Name +const ZES_MEMORY_BANDWIDTH_COUNTER_BITS_EXP_PROPERTIES_NAME = "ZES_extension_mem_bandwidth_counter_bits_properties" + +// ZesMemBandwidthCounterBitsExpVersion (zes_mem_bandwidth_counter_bits_exp_version_t) Memory Bandwidth Counter Valid Bits Extension Version(s) +type ZesMemBandwidthCounterBitsExpVersion uintptr +const ( + ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_1_0 ZesMemBandwidthCounterBitsExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_1_0 version 1.0 + ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_CURRENT ZesMemBandwidthCounterBitsExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_CURRENT latest known version + ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_FORCE_UINT32 ZesMemBandwidthCounterBitsExpVersion = 0x7fffffff // ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_FORCE_UINT32 Value marking end of ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_* ENUMs + +) + +// ZesMemBandwidthCounterBitsExpProperties (zes_mem_bandwidth_counter_bits_exp_properties_t) Extension properties for reporting valid bit count for memory +/// bandwidth counter value +/// +/// @details +/// - Number of valid read and write counter bits of memory bandwidth +/// - This structure may be returned from ::zesMemoryGetProperties via the +/// `pNext` member of ::zes_mem_properties_t. +/// - Used for denoting number of valid bits in the counter value returned +/// in ::zes_mem_bandwidth_t. +type ZesMemBandwidthCounterBitsExpProperties 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). + Validbitscount uint32 // Validbitscount [out] Returns the number of valid bits in the counter values + +} + diff --git a/sysm_pciLinkSpeedDowngrade.go b/sysm_pciLinkSpeedDowngrade.go new file mode 100644 index 0000000..c477304 --- /dev/null +++ b/sysm_pciLinkSpeedDowngrade.go @@ -0,0 +1,90 @@ +// 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" +) + +// ZES_PCI_LINK_SPEED_DOWNGRADE_EXT_NAME PCI Link Speed Downgrade Extension Name +const ZES_PCI_LINK_SPEED_DOWNGRADE_EXT_NAME = "ZES_extension_pci_link_speed_downgrade" + +// ZesPciLinkSpeedDowngradeExtVersion (zes_pci_link_speed_downgrade_ext_version_t) PCI Link Speed Downgrade Extension Version(s) +type ZesPciLinkSpeedDowngradeExtVersion uintptr +const ( + ZES_PCI_LINK_SPEED_DOWNGRADE_EXT_VERSION_1_0 ZesPciLinkSpeedDowngradeExtVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_PCI_LINK_SPEED_DOWNGRADE_EXT_VERSION_1_0 version 1.0 + ZES_PCI_LINK_SPEED_DOWNGRADE_EXT_VERSION_CURRENT ZesPciLinkSpeedDowngradeExtVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_PCI_LINK_SPEED_DOWNGRADE_EXT_VERSION_CURRENT latest known version + ZES_PCI_LINK_SPEED_DOWNGRADE_EXT_VERSION_FORCE_UINT32 ZesPciLinkSpeedDowngradeExtVersion = 0x7fffffff // ZES_PCI_LINK_SPEED_DOWNGRADE_EXT_VERSION_FORCE_UINT32 Value marking end of ZES_PCI_LINK_SPEED_DOWNGRADE_EXT_VERSION_* ENUMs + +) + +// ZesPciLinkSpeedDowngradeExtState (zes_pci_link_speed_downgrade_ext_state_t) Query PCIe downgrade status. +/// +/// @details +/// - This structure can be passed in the 'pNext' of ::zes_pci_state_t +type ZesPciLinkSpeedDowngradeExtState 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). + Pcilinkspeeddowngradestatus ZeBool // Pcilinkspeeddowngradestatus [out] Returns the current PCIe downgrade status. + +} + +// ZesPciLinkSpeedDowngradeExtProperties (zes_pci_link_speed_downgrade_ext_properties_t) Query PCIe downgrade capability. +/// +/// @details +/// - This structure can be passed in the 'pNext' of ::zes_pci_properties_t +type ZesPciLinkSpeedDowngradeExtProperties 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). + Pcilinkspeedupdatecapable ZeBool // Pcilinkspeedupdatecapable [out] Returns if PCIe downgrade capability is available. + Maxpcigensupported int32 // Maxpcigensupported [out] Returns the max supported PCIe generation of the device. -1 indicates the information is not available + +} + +// ZesDevicePciLinkSpeedUpdateExt Update PCI Link Speed (Downgrade or Upgrade (restore to its default +/// speed)) +/// +/// @details +/// - This function allows updating the PCI link speed to downgrade or +/// upgrade (restore to its default speed) the connection. +/// +/// @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 == pendingAction` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to perform this operation. +func ZesDevicePciLinkSpeedUpdateExt( + hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device. + shouldDowngrade ZeBool, // shouldDowngrade [in] boolean value to decide whether to perform PCIe downgrade(true) or set to default speed(false) + pendingAction *ZesDeviceAction, // pendingAction [out] Pending action +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDevicePciLinkSpeedUpdateExt", uintptr(hDevice), uintptr(shouldDowngrade), uintptr(unsafe.Pointer(pendingAction))) +} + diff --git a/sysm_performance.go b/sysm_performance.go new file mode 100644 index 0000000..676bd88 --- /dev/null +++ b/sysm_performance.go @@ -0,0 +1,161 @@ +// 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" +) + +// ZesPerfProperties (zes_perf_properties_t) Static information about a Performance Factor domain +type ZesPerfProperties 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). + Onsubdevice ZeBool // Onsubdevice [out] True if this Performance Factor affects accelerators located on a sub-device + Subdeviceid uint32 // Subdeviceid [out] If onSubdevice is true, this gives the ID of the sub-device + Engines ZesEngineTypeFlags // Engines [out] Bitfield of accelerator engine types that are affected by this Performance Factor. + +} + +// ZesDeviceEnumPerformanceFactorDomains Get handles to accelerator domains whose performance can be optimized +/// via a Performance Factor +/// +/// @details +/// - A Performance Factor should be tuned for each workload. +/// - 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 ZesDeviceEnumPerformanceFactorDomains( + 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. + phPerf *ZesPerfHandle, // phPerf [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]("zesDeviceEnumPerformanceFactorDomains", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phPerf))) +} + +// ZesPerformanceFactorGetProperties Get properties about a Performance Factor domain +/// +/// @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 == hPerf` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesPerformanceFactorGetProperties( + hPerf ZesPerfHandle, // hPerf [in] Handle for the Performance Factor domain. + pProperties *ZesPerfProperties, // pProperties [in,out] Will contain information about the specified Performance Factor domain. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesPerformanceFactorGetProperties", uintptr(hPerf), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesPerformanceFactorGetConfig Get current Performance Factor for a given domain +/// +/// @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 == hPerf` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pFactor` +func ZesPerformanceFactorGetConfig( + hPerf ZesPerfHandle, // hPerf [in] Handle for the Performance Factor domain. + pFactor *float64, // pFactor [in,out] Will contain the actual Performance Factor being used by the hardware (may not be the same as the requested Performance Factor). +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesPerformanceFactorGetConfig", uintptr(hPerf), uintptr(unsafe.Pointer(pFactor))) +} + +// ZesPerformanceFactorSetConfig Change the performance factor for a domain +/// +/// @details +/// - The Performance Factor is a number between 0 and 100. +/// - A Performance Factor is a hint to the hardware. Depending on the +/// hardware, the request may not be granted. Follow up this function with +/// a call to ::zesPerformanceFactorGetConfig() to determine the actual +/// factor being used by the hardware. +/// - 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 == hPerf` +func ZesPerformanceFactorSetConfig( + hPerf ZesPerfHandle, // hPerf [in] Handle for the Performance Factor domain. + factor float64, // factor [in] The new Performance Factor. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesPerformanceFactorSetConfig", uintptr(hPerf), uintptr(factor)) +} + diff --git a/sysm_power.go b/sysm_power.go new file mode 100644 index 0000000..34c5ee0 --- /dev/null +++ b/sysm_power.go @@ -0,0 +1,441 @@ +// 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" +) + +// ZesPowerDomain (zes_power_domain_t) Power Domain +type ZesPowerDomain uintptr +const ( + ZES_POWER_DOMAIN_UNKNOWN ZesPowerDomain = 0 // ZES_POWER_DOMAIN_UNKNOWN The PUnit power domain level cannot be determined. + ZES_POWER_DOMAIN_CARD ZesPowerDomain = 1 // ZES_POWER_DOMAIN_CARD The PUnit power domain is a card-level power domain. + ZES_POWER_DOMAIN_PACKAGE ZesPowerDomain = 2 // ZES_POWER_DOMAIN_PACKAGE The PUnit power domain is a package-level power domain. + ZES_POWER_DOMAIN_STACK ZesPowerDomain = 3 // ZES_POWER_DOMAIN_STACK The PUnit power domain is a stack-level power domain. + ZES_POWER_DOMAIN_MEMORY ZesPowerDomain = 4 // ZES_POWER_DOMAIN_MEMORY The PUnit power domain is a memory-level power domain. + ZES_POWER_DOMAIN_GPU ZesPowerDomain = 5 // ZES_POWER_DOMAIN_GPU The PUnit power domain is a GPU-level power domain. + ZES_POWER_DOMAIN_FORCE_UINT32 ZesPowerDomain = 0x7fffffff // ZES_POWER_DOMAIN_FORCE_UINT32 Value marking end of ZES_POWER_DOMAIN_* ENUMs + +) + +// ZesPowerLevel (zes_power_level_t) Power Level Type +type ZesPowerLevel uintptr +const ( + ZES_POWER_LEVEL_UNKNOWN ZesPowerLevel = 0 // ZES_POWER_LEVEL_UNKNOWN The PUnit power monitoring duration cannot be determined. + ZES_POWER_LEVEL_SUSTAINED ZesPowerLevel = 1 // ZES_POWER_LEVEL_SUSTAINED The PUnit determines effective power draw by computing a moving + + ///< average of the actual power draw over a time interval (longer than + ///< BURST). + + ZES_POWER_LEVEL_BURST ZesPowerLevel = 2 // ZES_POWER_LEVEL_BURST The PUnit determines effective power draw by computing a moving + + ///< average of the actual power draw over a time interval (longer than + ///< PEAK). + + ZES_POWER_LEVEL_PEAK ZesPowerLevel = 3 // ZES_POWER_LEVEL_PEAK The PUnit determines effective power draw by computing a moving + + ///< average of the actual power draw over a very short time interval. + + ZES_POWER_LEVEL_INSTANTANEOUS ZesPowerLevel = 4 // ZES_POWER_LEVEL_INSTANTANEOUS The PUnit predicts effective power draw using the current device + + ///< configuration (frequency, voltage, etc...) & throttles proactively to + ///< stay within the specified limit. + + ZES_POWER_LEVEL_FORCE_UINT32 ZesPowerLevel = 0x7fffffff // ZES_POWER_LEVEL_FORCE_UINT32 Value marking end of ZES_POWER_LEVEL_* ENUMs + +) + +// ZesPowerSource (zes_power_source_t) Power Source Type +type ZesPowerSource uintptr +const ( + ZES_POWER_SOURCE_ANY ZesPowerSource = 0 // ZES_POWER_SOURCE_ANY Limit active no matter whether the power source is mains powered or + + ///< battery powered. + + ZES_POWER_SOURCE_MAINS ZesPowerSource = 1 // ZES_POWER_SOURCE_MAINS Limit active only when the device is mains powered. + ZES_POWER_SOURCE_BATTERY ZesPowerSource = 2 // ZES_POWER_SOURCE_BATTERY Limit active only when the device is battery powered. + ZES_POWER_SOURCE_FORCE_UINT32 ZesPowerSource = 0x7fffffff // ZES_POWER_SOURCE_FORCE_UINT32 Value marking end of ZES_POWER_SOURCE_* ENUMs + +) + +// ZesLimitUnit (zes_limit_unit_t) Limit Unit +type ZesLimitUnit uintptr +const ( + ZES_LIMIT_UNIT_UNKNOWN ZesLimitUnit = 0 // ZES_LIMIT_UNIT_UNKNOWN The PUnit power monitoring unit cannot be determined. + ZES_LIMIT_UNIT_CURRENT ZesLimitUnit = 1 // ZES_LIMIT_UNIT_CURRENT The limit is specified in milliamperes of current drawn. + ZES_LIMIT_UNIT_POWER ZesLimitUnit = 2 // ZES_LIMIT_UNIT_POWER The limit is specified in milliwatts of power generated. + ZES_LIMIT_UNIT_FORCE_UINT32 ZesLimitUnit = 0x7fffffff // ZES_LIMIT_UNIT_FORCE_UINT32 Value marking end of ZES_LIMIT_UNIT_* ENUMs + +) + +// ZesPowerProperties (zes_power_properties_t) Properties related to device power settings +type ZesPowerProperties 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). + 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 + Cancontrol ZeBool // Cancontrol [out] Software can change the power limits of this domain assuming the user has permissions. + Isenergythresholdsupported ZeBool // Isenergythresholdsupported [out] Indicates if this power domain supports the energy threshold event (::ZES_EVENT_TYPE_FLAG_ENERGY_THRESHOLD_CROSSED). + Defaultlimit int32 // Defaultlimit [out] (Deprecated) The factory default TDP power limit of the part in milliwatts. A value of -1 means that this is not known. + Minlimit int32 // Minlimit [out] (Deprecated) The minimum power limit in milliwatts that can be requested. A value of -1 means that this is not known. + Maxlimit int32 // Maxlimit [out] (Deprecated) The maximum power limit in milliwatts that can be requested. A value of -1 means that this is not known. + +} + +// ZesPowerEnergyCounter (zes_power_energy_counter_t) Energy counter snapshot +/// +/// @details +/// - Average power is calculated by taking two snapshots (s1, s2) and using +/// the equation: PowerWatts = (s2.energy - s1.energy) / (s2.timestamp - +/// s1.timestamp) +type ZesPowerEnergyCounter struct { + Energy uint64 // Energy [out] The monotonic energy counter in microjoules. + Timestamp uint64 // Timestamp [out] Microsecond timestamp when energy was captured. 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. + +} + +// ZesPowerSustainedLimit (zes_power_sustained_limit_t) Sustained power limits +/// +/// @details +/// - The power controller (Punit) will throttle the operating frequency if +/// the power averaged over a window (typically seconds) exceeds this +/// limit. +/// - [DEPRECATED] No longer supported. +type ZesPowerSustainedLimit struct { + Enabled ZeBool // Enabled [in,out] indicates if the limit is enabled (true) or ignored (false) + Power int32 // Power [in,out] power limit in milliwatts + Interval int32 // Interval [in,out] power averaging window (Tau) in milliseconds + +} + +// ZesPowerBurstLimit (zes_power_burst_limit_t) Burst power limit +/// +/// @details +/// - The power controller (Punit) will throttle the operating frequency of +/// the device if the power averaged over a few milliseconds exceeds a +/// limit known as PL2. Typically PL2 > PL1 so that it permits the +/// frequency to burst higher for short periods than would be otherwise +/// permitted by PL1. +/// - [DEPRECATED] No longer supported. +type ZesPowerBurstLimit struct { + Enabled ZeBool // Enabled [in,out] indicates if the limit is enabled (true) or ignored (false) + Power int32 // Power [in,out] power limit in milliwatts + +} + +// ZesPowerPeakLimit (zes_power_peak_limit_t) Peak power limit +/// +/// @details +/// - The power controller (Punit) will reactively/proactively throttle the +/// operating frequency of the device when the instantaneous/100usec power +/// exceeds this limit. The limit is known as PL4 or Psys. It expresses +/// the maximum power that can be drawn from the power supply. +/// - If this power limit is removed or set too high, the power supply will +/// generate an interrupt when it detects an overcurrent condition and the +/// power controller will throttle the device frequencies down to min. It +/// is thus better to tune the PL4 value in order to avoid such +/// excursions. +/// - [DEPRECATED] No longer supported. +type ZesPowerPeakLimit struct { + Powerac int32 // Powerac [in,out] power limit in milliwatts for the AC power source. + Powerdc int32 // Powerdc [in,out] power limit in milliwatts for the DC power source. On input, this is ignored if the product does not have a battery. On output, this will be -1 if the product does not have a battery. + +} + +// ZesEnergyThreshold (zes_energy_threshold_t) Energy threshold +/// +/// @details +/// - . +type ZesEnergyThreshold struct { + Enable ZeBool // Enable [in,out] Indicates if the energy threshold is enabled. + Threshold float64 // Threshold [in,out] The energy threshold in Joules. Will be 0.0 if no threshold has been set. + Processid uint32 // Processid [in,out] The host process ID that set the energy threshold. Will be 0xFFFFFFFF if no threshold has been set. + +} + +// ZesDeviceEnumPowerDomains Get handle of power domains +/// +/// @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 ZesDeviceEnumPowerDomains( + 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. + phPower *ZesPwrHandle, // phPower [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]("zesDeviceEnumPowerDomains", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phPower))) +} + +// ZesDeviceGetCardPowerDomain Get handle of the PCIe card-level power +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] No longer supported. +/// +/// @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_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 == phPower` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + The device does not provide access to card level power controls or telemetry. An invalid power domain handle will be returned in phPower. +func ZesDeviceGetCardPowerDomain( + hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device. + phPower *ZesPwrHandle, // phPower [in,out] power domain handle for the entire PCIe card. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDeviceGetCardPowerDomain", uintptr(hDevice), uintptr(unsafe.Pointer(phPower))) +} + +// ZesPowerGetProperties Get properties related to a power domain +/// +/// @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 == hPower` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesPowerGetProperties( + hPower ZesPwrHandle, // hPower [in] Handle for the component. + pProperties *ZesPowerProperties, // pProperties [in,out] Structure that will contain property data. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesPowerGetProperties", uintptr(hPower), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesPowerGetEnergyCounter Get energy counter +/// +/// @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 == hPower` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pEnergy` +func ZesPowerGetEnergyCounter( + hPower ZesPwrHandle, // hPower [in] Handle for the component. + pEnergy *ZesPowerEnergyCounter, // pEnergy [in,out] Will contain the latest snapshot of the energy counter and timestamp when the last counter value was measured. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesPowerGetEnergyCounter", uintptr(hPower), uintptr(unsafe.Pointer(pEnergy))) +} + +// ZesPowerGetLimits Get power limits +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] Use ::zesPowerGetLimitsExt. +/// +/// @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 == hPower` +func ZesPowerGetLimits( + hPower ZesPwrHandle, // hPower [in] Handle for the component. + pSustained *ZesPowerSustainedLimit, // pSustained [in,out][optional] The sustained power limit. If this is null, the current sustained power limits will not be returned. + pBurst *ZesPowerBurstLimit, // pBurst [in,out][optional] The burst power limit. If this is null, the current peak power limits will not be returned. + pPeak *ZesPowerPeakLimit, // pPeak [in,out][optional] The peak power limit. If this is null, the peak power limits will not be returned. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesPowerGetLimits", uintptr(hPower), uintptr(unsafe.Pointer(pSustained)), uintptr(unsafe.Pointer(pBurst)), uintptr(unsafe.Pointer(pPeak))) +} + +// ZesPowerSetLimits Set power limits +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] Use ::zesPowerSetLimitsExt. +/// +/// @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_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPower` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// + The device is in use, meaning that the GPU is under Over clocking, applying power limits under overclocking is not supported. +func ZesPowerSetLimits( + hPower ZesPwrHandle, // hPower [in] Handle for the component. + pSustained *ZesPowerSustainedLimit, // pSustained [in][optional] The sustained power limit. If this is null, no changes will be made to the sustained power limits. + pBurst *ZesPowerBurstLimit, // pBurst [in][optional] The burst power limit. If this is null, no changes will be made to the burst power limits. + pPeak *ZesPowerPeakLimit, // pPeak [in][optional] The peak power limit. If this is null, no changes will be made to the peak power limits. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesPowerSetLimits", uintptr(hPower), uintptr(unsafe.Pointer(pSustained)), uintptr(unsafe.Pointer(pBurst)), uintptr(unsafe.Pointer(pPeak))) +} + +// ZesPowerGetEnergyThreshold Get energy threshold +/// +/// @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_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 == hPower` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pThreshold` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Energy threshold not supported on this power domain (check the `isEnergyThresholdSupported` member of ::zes_power_properties_t). +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to request this feature. +func ZesPowerGetEnergyThreshold( + hPower ZesPwrHandle, // hPower [in] Handle for the component. + pThreshold *ZesEnergyThreshold, // pThreshold [in,out] Returns information about the energy threshold setting - enabled/energy threshold/process ID. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesPowerGetEnergyThreshold", uintptr(hPower), uintptr(unsafe.Pointer(pThreshold))) +} + +// ZesPowerSetEnergyThreshold Set energy threshold +/// +/// @details +/// - An event ::ZES_EVENT_TYPE_FLAG_ENERGY_THRESHOLD_CROSSED will be +/// generated when the delta energy consumed starting from this call +/// exceeds the specified threshold. Use the function +/// ::zesDeviceEventRegister() to start receiving the event. +/// - Only one running process can control the energy threshold at a given +/// time. If another process attempts to change the energy threshold, the +/// error ::ZE_RESULT_ERROR_NOT_AVAILABLE will be returned. The function +/// ::zesPowerGetEnergyThreshold() to determine the process ID currently +/// controlling this setting. +/// - Calling this function will remove any pending energy thresholds and +/// start counting from the time of this call. +/// - Once the energy threshold has been reached and the event generated, +/// the threshold is automatically removed. It is up to the application to +/// request a new threshold. +/// - 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_DEPENDENCY_UNAVAILABLE +/// - ::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 == hPower` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Energy threshold not supported on this power domain (check the `isEnergyThresholdSupported` member of ::zes_power_properties_t). +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to request this feature. +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// + Another running process has set the energy threshold. +func ZesPowerSetEnergyThreshold( + hPower ZesPwrHandle, // hPower [in] Handle for the component. + threshold float64, // threshold [in] The energy threshold to be set in joules. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesPowerSetEnergyThreshold", uintptr(hPower), uintptr(threshold)) +} + diff --git a/sysm_powerDomainProperties.go b/sysm_powerDomainProperties.go new file mode 100644 index 0000000..ece0f8e --- /dev/null +++ b/sysm_powerDomainProperties.go @@ -0,0 +1,45 @@ +// 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" +) + +// ZES_POWER_DOMAIN_PROPERTIES_EXP_NAME Power Domain Properties Name +const ZES_POWER_DOMAIN_PROPERTIES_EXP_NAME = "ZES_extension_power_domain_properties" + +// ZesPowerDomainPropertiesExpVersion (zes_power_domain_properties_exp_version_t) Power Domain Properties Extension Version(s) +type ZesPowerDomainPropertiesExpVersion uintptr +const ( + ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_1_0 ZesPowerDomainPropertiesExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_1_0 version 1.0 + ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_CURRENT ZesPowerDomainPropertiesExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_CURRENT latest known version + ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_FORCE_UINT32 ZesPowerDomainPropertiesExpVersion = 0x7fffffff // ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_FORCE_UINT32 Value marking end of ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_* ENUMs + +) + +// ZesPowerDomainExpProperties (zes_power_domain_exp_properties_t) Extension structure for providing power domain information associated +/// with a power handle +/// +/// @details +/// - This structure may be returned from ::zesPowerGetProperties via the +/// `pNext` member of ::zes_power_properties_t. +/// - Used for associating a power handle with a power domain. +type ZesPowerDomainExpProperties 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). + Powerdomain ZesPowerDomain // Powerdomain [out] Power domain associated with the power handle. + +} + diff --git a/sysm_powerLimits.go b/sysm_powerLimits.go new file mode 100644 index 0000000..b250aa2 --- /dev/null +++ b/sysm_powerLimits.go @@ -0,0 +1,142 @@ +// 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" +) + +// ZES_POWER_LIMITS_EXT_NAME Power Limits Extension Name +const ZES_POWER_LIMITS_EXT_NAME = "ZES_extension_power_limits" + +// ZesPowerLimitsExtVersion (zes_power_limits_ext_version_t) Power Limits Extension Version(s) +type ZesPowerLimitsExtVersion uintptr +const ( + ZES_POWER_LIMITS_EXT_VERSION_1_0 ZesPowerLimitsExtVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_POWER_LIMITS_EXT_VERSION_1_0 version 1.0 + ZES_POWER_LIMITS_EXT_VERSION_CURRENT ZesPowerLimitsExtVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_POWER_LIMITS_EXT_VERSION_CURRENT latest known version + ZES_POWER_LIMITS_EXT_VERSION_FORCE_UINT32 ZesPowerLimitsExtVersion = 0x7fffffff // ZES_POWER_LIMITS_EXT_VERSION_FORCE_UINT32 Value marking end of ZES_POWER_LIMITS_EXT_VERSION_* ENUMs + +) + +// ZesPowerLimitExtDesc (zes_power_limit_ext_desc_t) Device power/current limit descriptor. +type ZesPowerLimitExtDesc 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). + Level ZesPowerLevel // Level [in,out] duration type over which the power draw is measured, i.e. sustained, burst, peak, or critical. + Source ZesPowerSource // Source [out] source of power used by the system, i.e. AC or DC. + Limitunit ZesLimitUnit // Limitunit [out] unit used for specifying limit, i.e. current units (milliamps) or power units (milliwatts). + Enabledstatelocked ZeBool // Enabledstatelocked [out] indicates if the power limit state (enabled/ignored) can be set (false) or is locked (true). + Enabled ZeBool // Enabled [in,out] indicates if the limit is enabled (true) or ignored (false). If enabledStateIsLocked is True, this value is ignored. + Intervalvaluelocked ZeBool // Intervalvaluelocked [out] indicates if the interval can be modified (false) or is fixed (true). + Interval int32 // Interval [in,out] power averaging window in milliseconds. If intervalValueLocked is true, this value is ignored. + Limitvaluelocked ZeBool // Limitvaluelocked [out] indicates if the limit can be set (false) or if the limit is fixed (true). + Limit int32 // Limit [in,out] limit value. If limitValueLocked is true, this value is ignored. The value should be provided in the unit specified by limitUnit. + +} + +// ZesPowerExtProperties (zes_power_ext_properties_t) Extension properties related to device power settings +/// +/// @details +/// - This structure may be returned from ::zesPowerGetProperties via the +/// `pNext` member of ::zes_power_properties_t. +/// - This structure may also be returned from ::zesPowerGetProperties via +/// the `pNext` member of ::zes_power_ext_properties_t +/// - Used for determining the power domain level, i.e. card-level v/s +/// package-level v/s stack-level & the factory default power limits. +type ZesPowerExtProperties 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). + Domain ZesPowerDomain // Domain [out] domain that the power limit belongs to. + Defaultlimit *ZesPowerLimitExtDesc // Defaultlimit [out] the factory default limit of the part. + +} + +// ZesPowerGetLimitsExt Get power limits +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - This function returns all the power limits associated with the +/// supplied power domain. +/// +/// @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 == hPower` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +func ZesPowerGetLimitsExt( + hPower ZesPwrHandle, // hPower [in] Power domain handle instance. + pCount *uint32, // pCount [in,out] Pointer to the number of power limit descriptors. 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. + pSustained *ZesPowerLimitExtDesc, // pSustained [in,out][optional][range(0, *pCount)] Array of query results for power limit descriptors. If count is less than the number of components of this type that are available, then the driver shall only retrieve that number of components. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesPowerGetLimitsExt", uintptr(hPower), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pSustained))) +} + +// ZesPowerSetLimitsExt Set power limits +/// +/// @details +/// - The application can only modify unlocked members of the limit +/// descriptors returned by ::zesPowerGetLimitsExt. +/// - Not all the limits returned by ::zesPowerGetLimitsExt need to be +/// supplied to this function. +/// - Limits do not have to be supplied in the same order as returned by +/// ::zesPowerGetLimitsExt. +/// - The same limit can be supplied multiple times. Limits are applied in +/// the order in which they are supplied. +/// - 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_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPower` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// + The device is in use, meaning that the GPU is under Over clocking, applying power limits under overclocking is not supported. +func ZesPowerSetLimitsExt( + hPower ZesPwrHandle, // hPower [in] Handle for the component. + pCount *uint32, // pCount [in] Pointer to the number of power limit descriptors. + pSustained *ZesPowerLimitExtDesc, // pSustained [in][optional][range(0, *pCount)] Array of power limit descriptors. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesPowerSetLimitsExt", uintptr(hPower), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pSustained))) +} + diff --git a/sysm_psu.go b/sysm_psu.go new file mode 100644 index 0000000..42dad1e --- /dev/null +++ b/sysm_psu.go @@ -0,0 +1,151 @@ +// 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" +) + +// ZesPsuVoltageStatus (zes_psu_voltage_status_t) PSU voltage status +type ZesPsuVoltageStatus uintptr +const ( + ZES_PSU_VOLTAGE_STATUS_UNKNOWN ZesPsuVoltageStatus = 0 // ZES_PSU_VOLTAGE_STATUS_UNKNOWN The status of the power supply voltage controllers cannot be + + ///< determined + + ZES_PSU_VOLTAGE_STATUS_NORMAL ZesPsuVoltageStatus = 1 // ZES_PSU_VOLTAGE_STATUS_NORMAL No unusual voltages have been detected + ZES_PSU_VOLTAGE_STATUS_OVER ZesPsuVoltageStatus = 2 // ZES_PSU_VOLTAGE_STATUS_OVER Over-voltage has occurred + ZES_PSU_VOLTAGE_STATUS_UNDER ZesPsuVoltageStatus = 3 // ZES_PSU_VOLTAGE_STATUS_UNDER Under-voltage has occurred + ZES_PSU_VOLTAGE_STATUS_FORCE_UINT32 ZesPsuVoltageStatus = 0x7fffffff // ZES_PSU_VOLTAGE_STATUS_FORCE_UINT32 Value marking end of ZES_PSU_VOLTAGE_STATUS_* ENUMs + +) + +// ZesPsuProperties (zes_psu_properties_t) Static properties of the power supply +type ZesPsuProperties 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). + Onsubdevice ZeBool // Onsubdevice [out] True if the 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 + Havefan ZeBool // Havefan [out] True if the power supply has a fan + Amplimit int32 // Amplimit [out] The maximum electrical current in milliamperes that can be drawn. A value of -1 indicates that this property cannot be determined. + +} + +// ZesPsuState (zes_psu_state_t) Dynamic state of the power supply +type ZesPsuState 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). + Voltstatus ZesPsuVoltageStatus // Voltstatus [out] The current PSU voltage status + Fanfailed ZeBool // Fanfailed [out] Indicates if the fan has failed + Temperature int32 // Temperature [out] Read the current heatsink temperature in degrees Celsius. A value of -1 indicates that this property cannot be determined. + Current int32 // Current [out] The amps being drawn in milliamperes. A value of -1 indicates that this property cannot be determined. + +} + +// ZesDeviceEnumPsus Get handle of power supplies +/// +/// @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 ZesDeviceEnumPsus( + 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. + phPsu *ZesPsuHandle, // phPsu [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]("zesDeviceEnumPsus", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phPsu))) +} + +// ZesPsuGetProperties Get power supply 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 == hPsu` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesPsuGetProperties( + hPsu ZesPsuHandle, // hPsu [in] Handle for the component. + pProperties *ZesPsuProperties, // pProperties [in,out] Will contain the properties of the power supply. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesPsuGetProperties", uintptr(hPsu), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesPsuGetState Get current power supply state +/// +/// @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 == hPsu` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pState` +func ZesPsuGetState( + hPsu ZesPsuHandle, // hPsu [in] Handle for the component. + pState *ZesPsuState, // pState [in,out] Will contain the current state of the power supply. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesPsuGetState", uintptr(hPsu), uintptr(unsafe.Pointer(pState))) +} + diff --git a/sysm_ras.go b/sysm_ras.go new file mode 100644 index 0000000..41ecddd --- /dev/null +++ b/sysm_ras.go @@ -0,0 +1,294 @@ +// 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" +) + +// ZesRasErrorType (zes_ras_error_type_t) RAS error type +type ZesRasErrorType uintptr +const ( + ZES_RAS_ERROR_TYPE_CORRECTABLE ZesRasErrorType = 0 // ZES_RAS_ERROR_TYPE_CORRECTABLE Errors were corrected by hardware + ZES_RAS_ERROR_TYPE_UNCORRECTABLE ZesRasErrorType = 1 // ZES_RAS_ERROR_TYPE_UNCORRECTABLE Error were not corrected + ZES_RAS_ERROR_TYPE_FORCE_UINT32 ZesRasErrorType = 0x7fffffff // ZES_RAS_ERROR_TYPE_FORCE_UINT32 Value marking end of ZES_RAS_ERROR_TYPE_* ENUMs + +) + +// ZesRasErrorCat (zes_ras_error_cat_t) RAS error categories +type ZesRasErrorCat uintptr +const ( + ZES_RAS_ERROR_CAT_RESET ZesRasErrorCat = 0 // ZES_RAS_ERROR_CAT_RESET The number of accelerator engine resets attempted by the driver + ZES_RAS_ERROR_CAT_PROGRAMMING_ERRORS ZesRasErrorCat = 1 // ZES_RAS_ERROR_CAT_PROGRAMMING_ERRORS The number of hardware exceptions generated by the way workloads have + + ///< programmed the hardware + + ZES_RAS_ERROR_CAT_DRIVER_ERRORS ZesRasErrorCat = 2 // ZES_RAS_ERROR_CAT_DRIVER_ERRORS The number of low level driver communication errors have occurred + ZES_RAS_ERROR_CAT_COMPUTE_ERRORS ZesRasErrorCat = 3 // ZES_RAS_ERROR_CAT_COMPUTE_ERRORS The number of errors that have occurred in the compute accelerator + + ///< hardware + + ZES_RAS_ERROR_CAT_NON_COMPUTE_ERRORS ZesRasErrorCat = 4 // ZES_RAS_ERROR_CAT_NON_COMPUTE_ERRORS The number of errors that have occurred in the fixed-function + + ///< accelerator hardware + + ZES_RAS_ERROR_CAT_CACHE_ERRORS ZesRasErrorCat = 5 // ZES_RAS_ERROR_CAT_CACHE_ERRORS The number of errors that have occurred in caches (L1/L3/register + + ///< file/shared local memory/sampler) + + ZES_RAS_ERROR_CAT_DISPLAY_ERRORS ZesRasErrorCat = 6 // ZES_RAS_ERROR_CAT_DISPLAY_ERRORS The number of errors that have occurred in the display + ZES_RAS_ERROR_CAT_FORCE_UINT32 ZesRasErrorCat = 0x7fffffff // ZES_RAS_ERROR_CAT_FORCE_UINT32 Value marking end of ZES_RAS_ERROR_CAT_* ENUMs + +) + +// ZES_MAX_RAS_ERROR_CATEGORY_COUNT The maximum number of categories +const ZES_MAX_RAS_ERROR_CATEGORY_COUNT = 7 + +// ZesRasProperties (zes_ras_properties_t) RAS properties +type ZesRasProperties 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 ZesRasErrorType // Type [out] The type of RAS error + Onsubdevice ZeBool // Onsubdevice [out] True if the 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 + +} + +// ZesRasState (zes_ras_state_t) RAS error details +type ZesRasState 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). + Category [ZES_MAX_RAS_ERROR_CATEGORY_COUNT]uint64 // Category [in][out] Breakdown of error by category + +} + +// ZesRasConfig (zes_ras_config_t) RAS error configuration - thresholds used for triggering RAS events +/// (::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS, +/// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS) +/// +/// @details +/// - The driver maintains a total counter which is updated every time a +/// hardware block covered by the corresponding RAS error set notifies +/// that an error has occurred. When this total count goes above the +/// totalThreshold specified below, a RAS event is triggered. +/// - The driver also maintains a counter for each category of RAS error +/// (see ::zes_ras_state_t for a breakdown). Each time a hardware block of +/// that category notifies that an error has occurred, that corresponding +/// category counter is updated. When it goes above the threshold +/// specified in detailedThresholds, a RAS event is triggered. +type ZesRasConfig 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). + Totalthreshold uint64 // Totalthreshold [in,out] If the total RAS errors exceeds this threshold, the event will be triggered. A value of 0ULL disables triggering the event based on the total counter. + Detailedthresholds ZesRasState // Detailedthresholds [in,out] If the RAS errors for each category exceed the threshold for that category, the event will be triggered. A value of 0ULL will disable an event being triggered for that category. + +} + +// ZesDeviceEnumRasErrorSets Get handle of all RAS error sets on a device +/// +/// @details +/// - A RAS error set is a collection of RAS error counters of a given type +/// (correctable/uncorrectable) from hardware blocks contained within a +/// sub-device or within the device. +/// - A device without sub-devices will typically return two handles, one +/// for correctable errors sets and one for uncorrectable error sets. +/// - A device with sub-devices will return RAS error sets for each +/// sub-device and possibly RAS error sets for hardware blocks outside the +/// sub-devices. +/// - If the function completes successfully but pCount is set to 0, RAS +/// features are not available/enabled on this device. +/// - 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 ZesDeviceEnumRasErrorSets( + 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. + phRas *ZesRasHandle, // phRas [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]("zesDeviceEnumRasErrorSets", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phRas))) +} + +// ZesRasGetProperties Get RAS properties of a given RAS error set - this enables discovery +/// of the type of RAS error set (correctable/uncorrectable) and if +/// located on a sub-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 == hRas` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesRasGetProperties( + hRas ZesRasHandle, // hRas [in] Handle for the component. + pProperties *ZesRasProperties, // pProperties [in,out] Structure describing RAS properties +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesRasGetProperties", uintptr(hRas), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesRasGetConfig Get RAS error thresholds that control when RAS events are generated +/// +/// @details +/// - The driver maintains counters for all RAS error sets and error +/// categories. Events are generated when errors occur. The configuration +/// enables setting thresholds to limit when events are sent. +/// - When a particular RAS correctable error counter exceeds the configured +/// threshold, the event ::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS will +/// be triggered. +/// - When a particular RAS uncorrectable error counter exceeds the +/// configured threshold, the event +/// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS will be triggered. +/// - 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 == hRas` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pConfig` +func ZesRasGetConfig( + hRas ZesRasHandle, // hRas [in] Handle for the component. + pConfig *ZesRasConfig, // pConfig [in,out] Will be populed with the current RAS configuration - thresholds used to trigger events +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesRasGetConfig", uintptr(hRas), uintptr(unsafe.Pointer(pConfig))) +} + +// ZesRasSetConfig Set RAS error thresholds that control when RAS events are generated +/// +/// @details +/// - The driver maintains counters for all RAS error sets and error +/// categories. Events are generated when errors occur. The configuration +/// enables setting thresholds to limit when events are sent. +/// - When a particular RAS correctable error counter exceeds the specified +/// threshold, the event ::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS will +/// be generated. +/// - When a particular RAS uncorrectable error counter exceeds the +/// specified threshold, the event +/// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS will be generated. +/// - Call ::zesRasGetState() and set the clear flag to true to restart +/// event generation once counters have exceeded thresholds. +/// - 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_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hRas` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pConfig` +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// + Another running process is controlling these settings. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + Don't have permissions to set thresholds. +func ZesRasSetConfig( + hRas ZesRasHandle, // hRas [in] Handle for the component. + pConfig *ZesRasConfig, // pConfig [in] Change the RAS configuration - thresholds used to trigger events +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesRasSetConfig", uintptr(hRas), uintptr(unsafe.Pointer(pConfig))) +} + +// ZesRasGetState Get the current value of RAS error counters for a particular error set +/// +/// @details +/// - Clearing errors will affect other threads/applications - the counter +/// values will start from zero. +/// - Clearing errors requires write permissions. +/// - 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 == hRas` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pState` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + Don't have permissions to clear error counters. +func ZesRasGetState( + hRas ZesRasHandle, // hRas [in] Handle for the component. + clear ZeBool, // clear [in] Set to 1 to clear the counters of this type + pState *ZesRasState, // pState [in,out] Breakdown of where errors have occurred +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesRasGetState", uintptr(hRas), uintptr(clear), uintptr(unsafe.Pointer(pState))) +} + diff --git a/sysm_rasState.go b/sysm_rasState.go new file mode 100644 index 0000000..8a667cd --- /dev/null +++ b/sysm_rasState.go @@ -0,0 +1,142 @@ +// 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" +) + +// ZES_RAS_GET_STATE_EXP_NAME RAS Get State Extension Name +const ZES_RAS_GET_STATE_EXP_NAME = "ZES_extension_ras_state" + +// ZesRasStateExpVersion (zes_ras_state_exp_version_t) RAS Get State Extension Version(s) +type ZesRasStateExpVersion uintptr +const ( + ZES_RAS_STATE_EXP_VERSION_1_0 ZesRasStateExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_RAS_STATE_EXP_VERSION_1_0 version 1.0 + ZES_RAS_STATE_EXP_VERSION_CURRENT ZesRasStateExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_RAS_STATE_EXP_VERSION_CURRENT latest known version + ZES_RAS_STATE_EXP_VERSION_FORCE_UINT32 ZesRasStateExpVersion = 0x7fffffff // ZES_RAS_STATE_EXP_VERSION_FORCE_UINT32 Value marking end of ZES_RAS_STATE_EXP_VERSION_* ENUMs + +) + +// ZesRasErrorCategoryExp (zes_ras_error_category_exp_t) RAS error categories +type ZesRasErrorCategoryExp uintptr +const ( + ZES_RAS_ERROR_CATEGORY_EXP_RESET ZesRasErrorCategoryExp = 0 // ZES_RAS_ERROR_CATEGORY_EXP_RESET The number of accelerator engine resets attempted by the driver + ZES_RAS_ERROR_CATEGORY_EXP_PROGRAMMING_ERRORS ZesRasErrorCategoryExp = 1 // ZES_RAS_ERROR_CATEGORY_EXP_PROGRAMMING_ERRORS The number of hardware exceptions generated by the way workloads have + + ///< programmed the hardware + + ZES_RAS_ERROR_CATEGORY_EXP_DRIVER_ERRORS ZesRasErrorCategoryExp = 2 // ZES_RAS_ERROR_CATEGORY_EXP_DRIVER_ERRORS The number of low level driver communication errors have occurred + ZES_RAS_ERROR_CATEGORY_EXP_COMPUTE_ERRORS ZesRasErrorCategoryExp = 3 // ZES_RAS_ERROR_CATEGORY_EXP_COMPUTE_ERRORS The number of errors that have occurred in the compute accelerator + + ///< hardware + + ZES_RAS_ERROR_CATEGORY_EXP_NON_COMPUTE_ERRORS ZesRasErrorCategoryExp = 4 // ZES_RAS_ERROR_CATEGORY_EXP_NON_COMPUTE_ERRORS The number of errors that have occurred in the fixed-function + + ///< accelerator hardware + + ZES_RAS_ERROR_CATEGORY_EXP_CACHE_ERRORS ZesRasErrorCategoryExp = 5 // ZES_RAS_ERROR_CATEGORY_EXP_CACHE_ERRORS The number of errors that have occurred in caches (L1/L3/register + + ///< file/shared local memory/sampler) + + ZES_RAS_ERROR_CATEGORY_EXP_DISPLAY_ERRORS ZesRasErrorCategoryExp = 6 // ZES_RAS_ERROR_CATEGORY_EXP_DISPLAY_ERRORS The number of errors that have occurred in the display + ZES_RAS_ERROR_CATEGORY_EXP_MEMORY_ERRORS ZesRasErrorCategoryExp = 7 // ZES_RAS_ERROR_CATEGORY_EXP_MEMORY_ERRORS The number of errors that have occurred in Memory + ZES_RAS_ERROR_CATEGORY_EXP_SCALE_ERRORS ZesRasErrorCategoryExp = 8 // ZES_RAS_ERROR_CATEGORY_EXP_SCALE_ERRORS The number of errors that have occurred in Scale Fabric + ZES_RAS_ERROR_CATEGORY_EXP_L3FABRIC_ERRORS ZesRasErrorCategoryExp = 9 // ZES_RAS_ERROR_CATEGORY_EXP_L3FABRIC_ERRORS The number of errors that have occurred in L3 Fabric + ZES_RAS_ERROR_CATEGORY_EXP_FORCE_UINT32 ZesRasErrorCategoryExp = 0x7fffffff // ZES_RAS_ERROR_CATEGORY_EXP_FORCE_UINT32 Value marking end of ZES_RAS_ERROR_CATEGORY_EXP_* ENUMs + +) + +// ZesRasStateExp (zes_ras_state_exp_t) Extension structure for providing RAS error counters for different +/// error sets +type ZesRasStateExp struct { + Category ZesRasErrorCategoryExp // Category [out] category for which error counter is provided. + Errorcounter uint64 // Errorcounter [out] Current value of RAS counter for specific error category. + +} + +// ZesRasGetStateExp Ras Get State +/// +/// @details +/// - This function retrieves error counters for different RAS error +/// categories. +/// - 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 == hRas` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +func ZesRasGetStateExp( + hRas ZesRasHandle, // hRas [in] Handle for the component. + pCount *uint32, // pCount [in,out] pointer to the number of RAS state structures that can be retrieved. if count is zero, then the driver shall update the value with the total number of error categories for which state can be retrieved. if count is greater than the number of RAS states available, then the driver shall update the value with the correct number of RAS states available. + pState *ZesRasStateExp, // pState [in,out][optional][range(0, *pCount)] array of query results for RAS error states for different categories. if count is less than the number of RAS states available, then driver shall only retrieve that number of RAS states. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesRasGetStateExp", uintptr(hRas), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pState))) +} + +// ZesRasClearStateExp Ras Clear State +/// +/// @details +/// - This function clears error counters for a RAS error category. +/// - Clearing errors will affect other threads/applications - the counter +/// values will start from zero. +/// - Clearing errors requires write permissions. +/// - The application should not 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 == hRas` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZES_RAS_ERROR_CATEGORY_EXP_L3FABRIC_ERRORS < category` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + Don't have permissions to clear error counters. +func ZesRasClearStateExp( + hRas ZesRasHandle, // hRas [in] Handle for the component. + category ZesRasErrorCategoryExp, // category [in] category for which error counter is to be cleared. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesRasClearStateExp", uintptr(hRas), uintptr(category)) +} + diff --git a/sysm_scheduler.go b/sysm_scheduler.go new file mode 100644 index 0000000..5eb0acc --- /dev/null +++ b/sysm_scheduler.go @@ -0,0 +1,401 @@ +// 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" +) + +// ZesSchedMode (zes_sched_mode_t) Scheduler mode +type ZesSchedMode uintptr +const ( + ZES_SCHED_MODE_TIMEOUT ZesSchedMode = 0 // ZES_SCHED_MODE_TIMEOUT Multiple applications or contexts are submitting work to the hardware. + + ///< When higher priority work arrives, the scheduler attempts to pause the + ///< current executing work within some timeout interval, then submits the + ///< other work. + + ZES_SCHED_MODE_TIMESLICE ZesSchedMode = 1 // ZES_SCHED_MODE_TIMESLICE The scheduler attempts to fairly timeslice hardware execution time + + ///< between multiple contexts submitting work to the hardware + ///< concurrently. + + ZES_SCHED_MODE_EXCLUSIVE ZesSchedMode = 2 // ZES_SCHED_MODE_EXCLUSIVE Any application or context can run indefinitely on the hardware + + ///< without being preempted or terminated. All pending work for other + ///< contexts must wait until the running context completes with no further + ///< submitted work. + + ZES_SCHED_MODE_COMPUTE_UNIT_DEBUG ZesSchedMode = 3 // ZES_SCHED_MODE_COMPUTE_UNIT_DEBUG [DEPRECATED] No longer supported. + ZES_SCHED_MODE_FORCE_UINT32 ZesSchedMode = 0x7fffffff // ZES_SCHED_MODE_FORCE_UINT32 Value marking end of ZES_SCHED_MODE_* ENUMs + +) + +// ZesSchedProperties (zes_sched_properties_t) Properties related to scheduler component +type ZesSchedProperties 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). + 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 + Cancontrol ZeBool // Cancontrol [out] Software can change the scheduler component configuration assuming the user has permissions. + Engines ZesEngineTypeFlags // Engines [out] Bitfield of accelerator engine types that are managed by this scheduler component. Note that there can be more than one scheduler component for the same type of accelerator engine. + Supportedmodes uint32 // Supportedmodes [out] Bitfield of scheduler modes that can be configured for this scheduler component (bitfield of 1<<::zes_sched_mode_t). + +} + +// ZES_SCHED_WATCHDOG_DISABLE Disable forward progress guard timeout. +const ZES_SCHED_WATCHDOG_DISABLE = ((^uint64(0))) + +// ZesSchedTimeoutProperties (zes_sched_timeout_properties_t) Configuration for timeout scheduler mode (::ZES_SCHED_MODE_TIMEOUT) +type ZesSchedTimeoutProperties 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). + Watchdogtimeout uint64 // Watchdogtimeout [in,out] The maximum time in microseconds that the scheduler will wait for a batch of work submitted to a hardware engine to complete or to be preempted so as to run another context. If this time is exceeded, the hardware engine is reset and the context terminated. If set to ::ZES_SCHED_WATCHDOG_DISABLE, a running workload can run as long as it wants without being terminated, but preemption attempts to run other contexts are permitted but not enforced. + +} + +// ZesSchedTimesliceProperties (zes_sched_timeslice_properties_t) Configuration for timeslice scheduler mode +/// (::ZES_SCHED_MODE_TIMESLICE) +type ZesSchedTimesliceProperties 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). + Interval uint64 // Interval [in,out] The average interval in microseconds that a submission for a context will run on a hardware engine before being preempted out to run a pending submission for another context. + Yieldtimeout uint64 // Yieldtimeout [in,out] The maximum time in microseconds that the scheduler will wait to preempt a workload running on an engine before deciding to reset the hardware engine and terminating the associated context. + +} + +// ZesDeviceEnumSchedulers Returns handles to scheduler components. +/// +/// @details +/// - Each scheduler component manages the distribution of work across one +/// or more accelerator engines. +/// - If an application wishes to change the scheduler behavior for all +/// accelerator engines of a specific type (e.g. compute), it should +/// select all the handles where the `engines` member +/// ::zes_sched_properties_t contains that type. +/// - 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 ZesDeviceEnumSchedulers( + 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. + phScheduler *ZesSchedHandle, // phScheduler [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]("zesDeviceEnumSchedulers", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phScheduler))) +} + +// ZesSchedulerGetProperties Get properties related to a scheduler component +/// +/// @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 == hScheduler` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesSchedulerGetProperties( + hScheduler ZesSchedHandle, // hScheduler [in] Handle for the component. + pProperties *ZesSchedProperties, // pProperties [in,out] Structure that will contain property data. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesSchedulerGetProperties", uintptr(hScheduler), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesSchedulerGetCurrentMode Get current scheduling mode in effect on a scheduler component. +/// +/// @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_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 == hScheduler` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pMode` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + This scheduler component does not support scheduler modes. +func ZesSchedulerGetCurrentMode( + hScheduler ZesSchedHandle, // hScheduler [in] Sysman handle for the component. + pMode *ZesSchedMode, // pMode [in,out] Will contain the current scheduler mode. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesSchedulerGetCurrentMode", uintptr(hScheduler), uintptr(unsafe.Pointer(pMode))) +} + +// ZesSchedulerGetTimeoutModeProperties Get scheduler config for mode ::ZES_SCHED_MODE_TIMEOUT +/// +/// @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_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 == hScheduler` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pConfig` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + This scheduler component does not support scheduler modes. +func ZesSchedulerGetTimeoutModeProperties( + hScheduler ZesSchedHandle, // hScheduler [in] Sysman handle for the component. + getDefaults ZeBool, // getDefaults [in] If TRUE, the driver will return the system default properties for this mode, otherwise it will return the current properties. + pConfig *ZesSchedTimeoutProperties, // pConfig [in,out] Will contain the current parameters for this mode. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesSchedulerGetTimeoutModeProperties", uintptr(hScheduler), uintptr(getDefaults), uintptr(unsafe.Pointer(pConfig))) +} + +// ZesSchedulerGetTimesliceModeProperties Get scheduler config for mode ::ZES_SCHED_MODE_TIMESLICE +/// +/// @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_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 == hScheduler` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pConfig` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + This scheduler component does not support scheduler modes. +func ZesSchedulerGetTimesliceModeProperties( + hScheduler ZesSchedHandle, // hScheduler [in] Sysman handle for the component. + getDefaults ZeBool, // getDefaults [in] If TRUE, the driver will return the system default properties for this mode, otherwise it will return the current properties. + pConfig *ZesSchedTimesliceProperties, // pConfig [in,out] Will contain the current parameters for this mode. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesSchedulerGetTimesliceModeProperties", uintptr(hScheduler), uintptr(getDefaults), uintptr(unsafe.Pointer(pConfig))) +} + +// ZesSchedulerSetTimeoutMode Change scheduler mode to ::ZES_SCHED_MODE_TIMEOUT or update scheduler +/// mode parameters if already running in this mode. +/// +/// @details +/// - This mode is optimized for multiple applications or contexts +/// submitting work to the hardware. When higher priority work arrives, +/// the scheduler attempts to pause the current executing work within some +/// timeout interval, then submits the other work. +/// - 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_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 == hScheduler` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +/// + `nullptr == pNeedReload` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + This scheduler component does not support scheduler modes. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make this modification. +func ZesSchedulerSetTimeoutMode( + hScheduler ZesSchedHandle, // hScheduler [in] Sysman handle for the component. + pProperties *ZesSchedTimeoutProperties, // pProperties [in] The properties to use when configurating this mode. + pNeedReload *ZeBool, // pNeedReload [in,out] Will be set to TRUE if a device driver reload is needed to apply the new scheduler mode. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesSchedulerSetTimeoutMode", uintptr(hScheduler), uintptr(unsafe.Pointer(pProperties)), uintptr(unsafe.Pointer(pNeedReload))) +} + +// ZesSchedulerSetTimesliceMode Change scheduler mode to ::ZES_SCHED_MODE_TIMESLICE or update +/// scheduler mode parameters if already running in this mode. +/// +/// @details +/// - This mode is optimized to provide fair sharing of hardware execution +/// time between multiple contexts submitting work to the hardware +/// concurrently. +/// - 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_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 == hScheduler` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +/// + `nullptr == pNeedReload` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + This scheduler component does not support scheduler modes. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make this modification. +func ZesSchedulerSetTimesliceMode( + hScheduler ZesSchedHandle, // hScheduler [in] Sysman handle for the component. + pProperties *ZesSchedTimesliceProperties, // pProperties [in] The properties to use when configurating this mode. + pNeedReload *ZeBool, // pNeedReload [in,out] Will be set to TRUE if a device driver reload is needed to apply the new scheduler mode. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesSchedulerSetTimesliceMode", uintptr(hScheduler), uintptr(unsafe.Pointer(pProperties)), uintptr(unsafe.Pointer(pNeedReload))) +} + +// ZesSchedulerSetExclusiveMode Change scheduler mode to ::ZES_SCHED_MODE_EXCLUSIVE +/// +/// @details +/// - This mode is optimized for single application/context use-cases. It +/// permits a context to run indefinitely on the hardware without being +/// preempted or terminated. All pending work for other contexts must wait +/// until the running context completes with no further submitted work. +/// - 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_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 == hScheduler` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pNeedReload` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + This scheduler component does not support scheduler modes. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make this modification. +func ZesSchedulerSetExclusiveMode( + hScheduler ZesSchedHandle, // hScheduler [in] Sysman handle for the component. + pNeedReload *ZeBool, // pNeedReload [in,out] Will be set to TRUE if a device driver reload is needed to apply the new scheduler mode. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesSchedulerSetExclusiveMode", uintptr(hScheduler), uintptr(unsafe.Pointer(pNeedReload))) +} + +// ZesSchedulerSetComputeUnitDebugMode Change scheduler mode to ::ZES_SCHED_MODE_COMPUTE_UNIT_DEBUG +/// +/// @details +/// - This is a special mode that must ben enabled when debugging an +/// application that uses this device e.g. using the Level0 Debug API. +/// - It ensures that only one command queue can execute work on the +/// hardware at a given time. Work is permitted to run as long as needed +/// without enforcing any scheduler fairness policies. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - [DEPRECATED] No longer supported. +/// +/// @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_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 == hScheduler` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pNeedReload` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + This scheduler component does not support scheduler modes. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make this modification. +func ZesSchedulerSetComputeUnitDebugMode( + hScheduler ZesSchedHandle, // hScheduler [in] Sysman handle for the component. + pNeedReload *ZeBool, // pNeedReload [in,out] Will be set to TRUE if a device driver reload is needed to apply the new scheduler mode. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesSchedulerSetComputeUnitDebugMode", uintptr(hScheduler), uintptr(unsafe.Pointer(pNeedReload))) +} + diff --git a/sysm_standby.go b/sysm_standby.go new file mode 100644 index 0000000..8f008cf --- /dev/null +++ b/sysm_standby.go @@ -0,0 +1,178 @@ +// 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" +) + +// ZesStandbyType (zes_standby_type_t) Standby hardware components +type ZesStandbyType uintptr +const ( + ZES_STANDBY_TYPE_GLOBAL ZesStandbyType = 0 // ZES_STANDBY_TYPE_GLOBAL Control the overall standby policy of the device/sub-device + ZES_STANDBY_TYPE_FORCE_UINT32 ZesStandbyType = 0x7fffffff // ZES_STANDBY_TYPE_FORCE_UINT32 Value marking end of ZES_STANDBY_TYPE_* ENUMs + +) + +// ZesStandbyProperties (zes_standby_properties_t) Standby hardware component properties +type ZesStandbyProperties 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 ZesStandbyType // Type [out] Which standby hardware component this controls + Onsubdevice ZeBool // Onsubdevice [out] True if the 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 + +} + +// ZesStandbyPromoMode (zes_standby_promo_mode_t) Standby promotion modes +type ZesStandbyPromoMode uintptr +const ( + ZES_STANDBY_PROMO_MODE_DEFAULT ZesStandbyPromoMode = 0 // ZES_STANDBY_PROMO_MODE_DEFAULT Best compromise between performance and energy savings. + ZES_STANDBY_PROMO_MODE_NEVER ZesStandbyPromoMode = 1 // ZES_STANDBY_PROMO_MODE_NEVER The device/component will never shutdown. This can improve performance + + ///< but uses more energy. + + ZES_STANDBY_PROMO_MODE_FORCE_UINT32 ZesStandbyPromoMode = 0x7fffffff // ZES_STANDBY_PROMO_MODE_FORCE_UINT32 Value marking end of ZES_STANDBY_PROMO_MODE_* ENUMs + +) + +// ZesDeviceEnumStandbyDomains Get handle of standby controls +/// +/// @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 ZesDeviceEnumStandbyDomains( + 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. + phStandby *ZesStandbyHandle, // phStandby [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]("zesDeviceEnumStandbyDomains", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phStandby))) +} + +// ZesStandbyGetProperties Get standby hardware component 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 == hStandby` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesStandbyGetProperties( + hStandby ZesStandbyHandle, // hStandby [in] Handle for the component. + pProperties *ZesStandbyProperties, // pProperties [in,out] Will contain the standby hardware properties. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesStandbyGetProperties", uintptr(hStandby), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesStandbyGetMode Get the current standby promotion mode +/// +/// @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 == hStandby` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pMode` +func ZesStandbyGetMode( + hStandby ZesStandbyHandle, // hStandby [in] Handle for the component. + pMode *ZesStandbyPromoMode, // pMode [in,out] Will contain the current standby mode. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesStandbyGetMode", uintptr(hStandby), uintptr(unsafe.Pointer(pMode))) +} + +// ZesStandbySetMode Set standby promotion mode +/// +/// @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 == hStandby` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZES_STANDBY_PROMO_MODE_NEVER < mode` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +func ZesStandbySetMode( + hStandby ZesStandbyHandle, // hStandby [in] Handle for the component. + mode ZesStandbyPromoMode, // mode [in] New standby mode. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesStandbySetMode", uintptr(hStandby), uintptr(mode)) +} + diff --git a/sysm_sysmanDeviceMapping.go b/sysm_sysmanDeviceMapping.go new file mode 100644 index 0000000..a786b79 --- /dev/null +++ b/sysm_sysmanDeviceMapping.go @@ -0,0 +1,111 @@ +// 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" +) + +// ZES_SYSMAN_DEVICE_MAPPING_EXP_NAME Sysman Device Mapping Extension Name +const ZES_SYSMAN_DEVICE_MAPPING_EXP_NAME = "ZES_experimental_sysman_device_mapping" + +// ZesSysmanDeviceMappingExpVersion (zes_sysman_device_mapping_exp_version_t) Sysman Device Mapping Extension Version(s) +type ZesSysmanDeviceMappingExpVersion uintptr +const ( + ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_1_0 ZesSysmanDeviceMappingExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_1_0 version 1.0 + ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_CURRENT ZesSysmanDeviceMappingExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_CURRENT latest known version + ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_FORCE_UINT32 ZesSysmanDeviceMappingExpVersion = 0x7fffffff // ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_FORCE_UINT32 Value marking end of ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_* ENUMs + +) + +// ZesSubdeviceExpProperties (zes_subdevice_exp_properties_t) Sub Device Properties +type ZesSubdeviceExpProperties 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). + Subdeviceid uint32 // Subdeviceid [out] this gives the ID of the sub device + Uuid ZesUuid // Uuid [out] universal unique identifier of the sub device. + +} + +// ZesDeviceGetSubDevicePropertiesExp Retrieves sub device properties for the given sysman device handle +/// +/// @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 ZesDeviceGetSubDevicePropertiesExp( + hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device. + pCount *uint32, // pCount [in,out] pointer to the number of sub devices. if count is zero, then the driver shall update the value with the total number of sub devices currently attached to the device. if count is greater than the number of sub devices currently attached to the device, then the driver shall update the value with the correct number of sub devices. + pSubdeviceProps *ZesSubdeviceExpProperties, // pSubdeviceProps [in,out][optional][range(0, *pCount)] array of sub device property structures. if count is less than the number of sysman sub devices available, then the driver shall only retrieve that number of sub device property structures. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDeviceGetSubDevicePropertiesExp", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pSubdeviceProps))) +} + +// ZesDriverGetDeviceByUuidExp Retrieves sysman device and subdevice index for the given UUID and +/// sysman driver +/// +/// @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 == hDriver` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == phDevice` +/// + `nullptr == onSubdevice` +/// + `nullptr == subdeviceId` +func ZesDriverGetDeviceByUuidExp( + hDriver ZesDriverHandle, // hDriver [in] handle of the sysman driver instance + uuid *ZesUuid, // uuid [in] universal unique identifier. (gozel hack: converted to a hidden pointer from a struct value) + phDevice *ZesDeviceHandle, // phDevice [out] Sysman handle of the device. + onSubdevice *ZeBool, // onSubdevice [out] True if the UUID belongs to the sub-device; false means that UUID belongs to the root device. + subdeviceId *uint32, // subdeviceId [out] If onSubdevice is true, this gives the ID of the sub-device +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesDriverGetDeviceByUuidExp", uintptr(hDriver), uintptr(unsafe.Pointer(uuid)), uintptr(unsafe.Pointer(phDevice)), uintptr(unsafe.Pointer(onSubdevice)), uintptr(unsafe.Pointer(subdeviceId))) +} + diff --git a/sysm_temperature.go b/sysm_temperature.go new file mode 100644 index 0000000..52fd201 --- /dev/null +++ b/sysm_temperature.go @@ -0,0 +1,249 @@ +// 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" +) + +// ZesTempSensors (zes_temp_sensors_t) Temperature sensors +type ZesTempSensors uintptr +const ( + ZES_TEMP_SENSORS_GLOBAL ZesTempSensors = 0 // ZES_TEMP_SENSORS_GLOBAL The maximum temperature across all device sensors + ZES_TEMP_SENSORS_GPU ZesTempSensors = 1 // ZES_TEMP_SENSORS_GPU The maximum temperature across all sensors in the GPU + ZES_TEMP_SENSORS_MEMORY ZesTempSensors = 2 // ZES_TEMP_SENSORS_MEMORY The maximum temperature across all sensors in the local memory + ZES_TEMP_SENSORS_GLOBAL_MIN ZesTempSensors = 3 // ZES_TEMP_SENSORS_GLOBAL_MIN The minimum temperature across all device sensors + ZES_TEMP_SENSORS_GPU_MIN ZesTempSensors = 4 // ZES_TEMP_SENSORS_GPU_MIN The minimum temperature across all sensors in the GPU + ZES_TEMP_SENSORS_MEMORY_MIN ZesTempSensors = 5 // ZES_TEMP_SENSORS_MEMORY_MIN The minimum temperature across all sensors in the local device memory + ZES_TEMP_SENSORS_GPU_BOARD ZesTempSensors = 6 // ZES_TEMP_SENSORS_GPU_BOARD The maximum temperature across all sensors in the GPU Board + ZES_TEMP_SENSORS_GPU_BOARD_MIN ZesTempSensors = 7 // ZES_TEMP_SENSORS_GPU_BOARD_MIN The minimum temperature across all sensors in the GPU Board + ZES_TEMP_SENSORS_VOLTAGE_REGULATOR ZesTempSensors = 8 // ZES_TEMP_SENSORS_VOLTAGE_REGULATOR The maximum temperature across all sensors in the Voltage Regulator + ZES_TEMP_SENSORS_FORCE_UINT32 ZesTempSensors = 0x7fffffff // ZES_TEMP_SENSORS_FORCE_UINT32 Value marking end of ZES_TEMP_SENSORS_* ENUMs + +) + +// ZesTempProperties (zes_temp_properties_t) Temperature sensor properties +type ZesTempProperties 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 ZesTempSensors // Type [out] Which part of the device the temperature sensor measures + Onsubdevice ZeBool // Onsubdevice [out] True if the 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 + Maxtemperature float64 // Maxtemperature [out] Will contain the maximum temperature for the specific device in degrees Celsius. + Iscriticaltempsupported ZeBool // Iscriticaltempsupported [out] Indicates if the critical temperature event ::ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL is supported + Isthreshold1supported ZeBool // Isthreshold1supported [out] Indicates if the temperature threshold 1 event ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 is supported + Isthreshold2supported ZeBool // Isthreshold2supported [out] Indicates if the temperature threshold 2 event ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 is supported + +} + +// ZesTempThreshold (zes_temp_threshold_t) Temperature sensor threshold +type ZesTempThreshold struct { + Enablelowtohigh ZeBool // Enablelowtohigh [in,out] Trigger an event when the temperature crosses from below the threshold to above. + Enablehightolow ZeBool // Enablehightolow [in,out] Trigger an event when the temperature crosses from above the threshold to below. + Threshold float64 // Threshold [in,out] The threshold in degrees Celsius. + +} + +// ZesTempConfig (zes_temp_config_t) Temperature configuration - which events should be triggered and the +/// trigger conditions. +type ZesTempConfig 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). + Enablecritical ZeBool // Enablecritical [in,out] Indicates if event ::ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL should be triggered by the driver. + Threshold1 ZesTempThreshold // Threshold1 [in,out] Configuration controlling if and when event ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 should be triggered by the driver. + Threshold2 ZesTempThreshold // Threshold2 [in,out] Configuration controlling if and when event ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 should be triggered by the driver. + +} + +// ZesDeviceEnumTemperatureSensors Get handle of temperature sensors +/// +/// @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 ZesDeviceEnumTemperatureSensors( + 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. + phTemperature *ZesTempHandle, // phTemperature [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]("zesDeviceEnumTemperatureSensors", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phTemperature))) +} + +// ZesTemperatureGetProperties Get temperature sensor 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 == hTemperature` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesTemperatureGetProperties( + hTemperature ZesTempHandle, // hTemperature [in] Handle for the component. + pProperties *ZesTempProperties, // pProperties [in,out] Will contain the temperature sensor properties. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesTemperatureGetProperties", uintptr(hTemperature), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesTemperatureGetConfig Get temperature configuration for this sensor - which events are +/// triggered and the trigger conditions +/// +/// @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_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 == hTemperature` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pConfig` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Temperature thresholds are not supported on this temperature sensor. Generally this is only supported for temperature sensor ::ZES_TEMP_SENSORS_GLOBAL. +/// + One or both of the thresholds is not supported. Check the `isThreshold1Supported` and `isThreshold2Supported` members of ::zes_temp_properties_t. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to request this feature. +func ZesTemperatureGetConfig( + hTemperature ZesTempHandle, // hTemperature [in] Handle for the component. + pConfig *ZesTempConfig, // pConfig [in,out] Returns current configuration. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesTemperatureGetConfig", uintptr(hTemperature), uintptr(unsafe.Pointer(pConfig))) +} + +// ZesTemperatureSetConfig Set temperature configuration for this sensor - indicates which events +/// are triggered and the trigger conditions +/// +/// @details +/// - Events ::ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL will be triggered when +/// temperature reaches the critical range. Use the function +/// ::zesDeviceEventRegister() to start receiving this event. +/// - Events ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 and +/// ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 will be generated when +/// temperature cross the thresholds set using this function. Use the +/// function ::zesDeviceEventRegister() to start receiving these events. +/// - Only one running process can set the temperature configuration at a +/// time. If another process attempts to change the configuration, the +/// error ::ZE_RESULT_ERROR_NOT_AVAILABLE will be returned. The function +/// ::zesTemperatureGetConfig() will return the process ID currently +/// controlling these settings. +/// - 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_DEPENDENCY_UNAVAILABLE +/// - ::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 == hTemperature` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pConfig` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Temperature thresholds are not supported on this temperature sensor. Generally they are only supported for temperature sensor ::ZES_TEMP_SENSORS_GLOBAL. +/// + Enabling the critical temperature event is not supported. Check the `isCriticalTempSupported` member of ::zes_temp_properties_t. +/// + One or both of the thresholds is not supported. Check the `isThreshold1Supported` and `isThreshold2Supported` members of ::zes_temp_properties_t. +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to request this feature. +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// + Another running process is controlling these settings. +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// + One or both the thresholds is above TjMax (see ::zesFrequencyOcGetTjMax()). Temperature thresholds must be below this value. +func ZesTemperatureSetConfig( + hTemperature ZesTempHandle, // hTemperature [in] Handle for the component. + pConfig *ZesTempConfig, // pConfig [in] New configuration. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesTemperatureSetConfig", uintptr(hTemperature), uintptr(unsafe.Pointer(pConfig))) +} + +// ZesTemperatureGetState Get the temperature from a specified sensor +/// +/// @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 == hTemperature` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pTemperature` +func ZesTemperatureGetState( + hTemperature ZesTempHandle, // hTemperature [in] Handle for the component. + pTemperature *float64, // pTemperature [in,out] Will contain the temperature read from the specified sensor in degrees Celsius. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesTemperatureGetState", uintptr(hTemperature), uintptr(unsafe.Pointer(pTemperature))) +} + diff --git a/sysm_virtualFunctionManagement.go b/sysm_virtualFunctionManagement.go new file mode 100644 index 0000000..a66d0ee --- /dev/null +++ b/sysm_virtualFunctionManagement.go @@ -0,0 +1,502 @@ +// 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" +) + +// ZES_VIRTUAL_FUNCTION_MANAGEMENT_EXP_NAME Virtual Function Management Extension Name +const ZES_VIRTUAL_FUNCTION_MANAGEMENT_EXP_NAME = "ZES_experimental_virtual_function_management" + +// ZesVfManagementExpVersion (zes_vf_management_exp_version_t) Virtual Function Management Extension Version(s) +type ZesVfManagementExpVersion uintptr +const ( + ZES_VF_MANAGEMENT_EXP_VERSION_1_0 ZesVfManagementExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZES_VF_MANAGEMENT_EXP_VERSION_1_0 version 1.0 (deprecated) + ZES_VF_MANAGEMENT_EXP_VERSION_1_1 ZesVfManagementExpVersion = /* ZE_MAKE_VERSION( 1, 1 ) */((( 1 << 16 )|( 1 & 0x0000ffff))) // ZES_VF_MANAGEMENT_EXP_VERSION_1_1 version 1.1 (deprecated) + ZES_VF_MANAGEMENT_EXP_VERSION_1_2 ZesVfManagementExpVersion = /* ZE_MAKE_VERSION( 1, 2 ) */((( 1 << 16 )|( 2 & 0x0000ffff))) // ZES_VF_MANAGEMENT_EXP_VERSION_1_2 version 1.2 + ZES_VF_MANAGEMENT_EXP_VERSION_CURRENT ZesVfManagementExpVersion = /* ZE_MAKE_VERSION( 1, 2 ) */((( 1 << 16 )|( 2 & 0x0000ffff))) // ZES_VF_MANAGEMENT_EXP_VERSION_CURRENT latest known version + ZES_VF_MANAGEMENT_EXP_VERSION_FORCE_UINT32 ZesVfManagementExpVersion = 0x7fffffff // ZES_VF_MANAGEMENT_EXP_VERSION_FORCE_UINT32 Value marking end of ZES_VF_MANAGEMENT_EXP_VERSION_* ENUMs + +) + +// ZesVfInfoMemTypeExpFlags (zes_vf_info_mem_type_exp_flags_t) Virtual function memory types (deprecated) +type ZesVfInfoMemTypeExpFlags uint32 +const ( + ZES_VF_INFO_MEM_TYPE_EXP_FLAG_MEM_TYPE_SYSTEM ZesVfInfoMemTypeExpFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZES_VF_INFO_MEM_TYPE_EXP_FLAG_MEM_TYPE_SYSTEM System memory + ZES_VF_INFO_MEM_TYPE_EXP_FLAG_MEM_TYPE_DEVICE ZesVfInfoMemTypeExpFlags = /* ZE_BIT(1) */(( 1 << 1 )) // ZES_VF_INFO_MEM_TYPE_EXP_FLAG_MEM_TYPE_DEVICE Device local memory + ZES_VF_INFO_MEM_TYPE_EXP_FLAG_FORCE_UINT32 ZesVfInfoMemTypeExpFlags = 0x7fffffff // ZES_VF_INFO_MEM_TYPE_EXP_FLAG_FORCE_UINT32 Value marking end of ZES_VF_INFO_MEM_TYPE_EXP_FLAG_* ENUMs + +) + +// ZesVfInfoUtilExpFlags (zes_vf_info_util_exp_flags_t) Virtual function utilization flag bit fields (deprecated) +type ZesVfInfoUtilExpFlags uint32 +const ( + ZES_VF_INFO_UTIL_EXP_FLAG_INFO_NONE ZesVfInfoUtilExpFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZES_VF_INFO_UTIL_EXP_FLAG_INFO_NONE No info associated with virtual function + ZES_VF_INFO_UTIL_EXP_FLAG_INFO_MEM_CPU ZesVfInfoUtilExpFlags = /* ZE_BIT(1) */(( 1 << 1 )) // ZES_VF_INFO_UTIL_EXP_FLAG_INFO_MEM_CPU System memory utilization associated with virtual function + ZES_VF_INFO_UTIL_EXP_FLAG_INFO_MEM_GPU ZesVfInfoUtilExpFlags = /* ZE_BIT(2) */(( 1 << 2 )) // ZES_VF_INFO_UTIL_EXP_FLAG_INFO_MEM_GPU Device memory utilization associated with virtual function + ZES_VF_INFO_UTIL_EXP_FLAG_INFO_ENGINE ZesVfInfoUtilExpFlags = /* ZE_BIT(3) */(( 1 << 3 )) // ZES_VF_INFO_UTIL_EXP_FLAG_INFO_ENGINE Engine utilization associated with virtual function + ZES_VF_INFO_UTIL_EXP_FLAG_FORCE_UINT32 ZesVfInfoUtilExpFlags = 0x7fffffff // ZES_VF_INFO_UTIL_EXP_FLAG_FORCE_UINT32 Value marking end of ZES_VF_INFO_UTIL_EXP_FLAG_* ENUMs + +) + +// ZesVfExpProperties (zes_vf_exp_properties_t) Virtual function management properties (deprecated) +type ZesVfExpProperties 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] Virtual function BDF address + Uuid ZesUuid // Uuid [out] universal unique identifier of the device + Flags ZesVfInfoUtilExpFlags // Flags [out] utilization flags available. May be 0 or a valid combination of ::zes_vf_info_util_exp_flag_t. + +} + +// ZesVfUtilMemExp (zes_vf_util_mem_exp_t) Provides memory utilization values for a virtual function (deprecated) +type ZesVfUtilMemExp 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). + Memtypeflags ZesVfInfoMemTypeExpFlags // Memtypeflags [out] Memory type flags. + Free uint64 // Free [out] Free memory size in bytes. + Size uint64 // Size [out] Total allocatable memory in bytes. + Timestamp uint64 // Timestamp [out] Wall clock time from VF when value was sampled. + +} + +// ZesVfUtilEngineExp (zes_vf_util_engine_exp_t) Provides engine utilization values for a virtual function (deprecated) +type ZesVfUtilEngineExp 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). + Type ZesEngineGroup // Type [out] The engine group. + Activecountervalue uint64 // Activecountervalue [out] Represents active counter. + Samplingcountervalue uint64 // Samplingcountervalue [out] Represents counter value when activeCounterValue was sampled. + Timestamp uint64 // Timestamp [out] Wall clock time when the activeCounterValue was sampled. + +} + +// ZesVfExpCapabilities (zes_vf_exp_capabilities_t) Virtual function management capabilities (deprecated) +type ZesVfExpCapabilities 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] Virtual function BDF address + Vfdevicememsize uint32 // Vfdevicememsize [out] Virtual function memory size in kilo bytes + Vfid uint32 // Vfid [out] Virtual Function ID + +} + +// ZesVfExp2Capabilities (zes_vf_exp2_capabilities_t) Virtual function management capabilities +type ZesVfExp2Capabilities 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] Virtual function BDF address + Vfdevicememsize uint64 // Vfdevicememsize [out] Virtual function memory size in bytes + Vfid uint32 // Vfid [out] Virtual Function ID + +} + +// ZesVfUtilMemExp2 (zes_vf_util_mem_exp2_t) Provides memory utilization values for a virtual function +type ZesVfUtilMemExp2 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). + Vfmemlocation ZesMemLoc // Vfmemlocation [out] Location of this memory (system, device) + Vfmemutilized uint64 // Vfmemutilized [out] Utilized memory size in bytes. + +} + +// ZesVfUtilEngineExp2 (zes_vf_util_engine_exp2_t) Provides engine utilization values for a virtual function +/// +/// @details +/// - Percent utilization is calculated by taking two snapshots (s1, s2) and +/// using the equation: %util = (s2.activeCounterValue - +/// s1.activeCounterValue) / (s2.samplingCounterValue - +/// s1.samplingCounterValue) +type ZesVfUtilEngineExp2 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). + Vfenginetype ZesEngineGroup // Vfenginetype [out] The engine group. + Activecountervalue uint64 // Activecountervalue [out] Represents active counter. + Samplingcountervalue uint64 // Samplingcountervalue [out] Represents counter value when activeCounterValue was sampled. Refer to the formulae above for calculating the utilization percent + +} + +// ZesDeviceEnumActiveVFExp Get handle of virtual function modules +/// +/// @details +/// - [DEPRECATED] No longer supported. Use ::zesDeviceEnumEnabledVFExp. +/// - 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 ZesDeviceEnumActiveVFExp( + 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. + phVFhandle *ZesVfHandle, // phVFhandle [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]("zesDeviceEnumActiveVFExp", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phVFhandle))) +} + +// ZesVFManagementGetVFPropertiesExp Get virtual function management properties +/// +/// @details +/// - [DEPRECATED] No longer supported. Use +/// ::zesVFManagementGetVFCapabilitiesExp. +/// - 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 == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +func ZesVFManagementGetVFPropertiesExp( + hVFhandle ZesVfHandle, // hVFhandle [in] Sysman handle for the VF component. + pProperties *ZesVfExpProperties, // pProperties [in,out] Will contain VF properties. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesVFManagementGetVFPropertiesExp", uintptr(hVFhandle), uintptr(unsafe.Pointer(pProperties))) +} + +// ZesVFManagementGetVFMemoryUtilizationExp Get memory activity stats for each available memory types associated +/// with Virtual Function (VF) +/// +/// @details +/// - [DEPRECATED] No longer supported. Use +/// ::zesVFManagementGetVFMemoryUtilizationExp2. +/// - 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 == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +func ZesVFManagementGetVFMemoryUtilizationExp( + hVFhandle ZesVfHandle, // hVFhandle [in] Sysman handle for the component. + pCount *uint32, // pCount [in,out] Pointer to the number of VF memory stats descriptors. - if count is zero, the driver shall update the value with the total number of memory stats available. - if count is greater than the total number of memory stats available, the driver shall update the value with the correct number of memory stats available. - The count returned is the sum of number of VF instances currently available and the PF instance. + pMemUtil *ZesVfUtilMemExp, // pMemUtil [in,out][optional][range(0, *pCount)] array of memory group activity counters. - if count is less than the total number of memory stats available, then driver shall only retrieve that number of stats. - the implementation shall populate the vector pCount-1 number of VF memory stats. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesVFManagementGetVFMemoryUtilizationExp", uintptr(hVFhandle), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pMemUtil))) +} + +// ZesVFManagementGetVFEngineUtilizationExp Get engine activity stats for each available engine group associated +/// with Virtual Function (VF) +/// +/// @details +/// - [DEPRECATED] No longer supported. Use +/// ::zesVFManagementGetVFEngineUtilizationExp2. +/// - 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 == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +func ZesVFManagementGetVFEngineUtilizationExp( + hVFhandle ZesVfHandle, // hVFhandle [in] Sysman handle for the component. + pCount *uint32, // pCount [in,out] Pointer to the number of VF engine stats descriptors. - if count is zero, the driver shall update the value with the total number of engine stats available. - if count is greater than the total number of engine stats available, the driver shall update the value with the correct number of engine stats available. - The count returned is the sum of number of VF instances currently available and the PF instance. + pEngineUtil *ZesVfUtilEngineExp, // pEngineUtil [in,out][optional][range(0, *pCount)] array of engine group activity counters. - if count is less than the total number of engine stats available, then driver shall only retrieve that number of stats. - the implementation shall populate the vector pCount-1 number of VF engine stats. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesVFManagementGetVFEngineUtilizationExp", uintptr(hVFhandle), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pEngineUtil))) +} + +// ZesVFManagementSetVFTelemetryModeExp Configure utilization telemetry enabled or disabled associated with +/// Virtual Function (VF) +/// +/// @details +/// - [DEPRECATED] No longer supported. +/// - 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 == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `0xf < flags` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +func ZesVFManagementSetVFTelemetryModeExp( + hVFhandle ZesVfHandle, // hVFhandle [in] Sysman handle for the component. + flags ZesVfInfoUtilExpFlags, // flags [in] utilization flags to enable or disable. May be 0 or a valid combination of ::zes_vf_info_util_exp_flag_t. + enable ZeBool, // enable [in] Enable utilization telemetry. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesVFManagementSetVFTelemetryModeExp", uintptr(hVFhandle), uintptr(flags), uintptr(enable)) +} + +// ZesVFManagementSetVFTelemetrySamplingIntervalExp Set sampling interval to monitor for a particular utilization +/// telemetry associated with Virtual Function (VF) +/// +/// @details +/// - [DEPRECATED] No longer supported. +/// - 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 == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `0xf < flag` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION +func ZesVFManagementSetVFTelemetrySamplingIntervalExp( + hVFhandle ZesVfHandle, // hVFhandle [in] Sysman handle for the component. + flag ZesVfInfoUtilExpFlags, // flag [in] utilization flags to set sampling interval. May be 0 or a valid combination of ::zes_vf_info_util_exp_flag_t. + samplingInterval uint64, // samplingInterval [in] Sampling interval value. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesVFManagementSetVFTelemetrySamplingIntervalExp", uintptr(hVFhandle), uintptr(flag), uintptr(samplingInterval)) +} + +// ZesDeviceEnumEnabledVFExp Get handle of virtual function 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 ZesDeviceEnumEnabledVFExp( + 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. + phVFhandle *ZesVfHandle, // phVFhandle [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]("zesDeviceEnumEnabledVFExp", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phVFhandle))) +} + +// ZesVFManagementGetVFCapabilitiesExp Get virtual function management capabilities +/// +/// @details +/// - [DEPRECATED] No longer supported. Use +/// ::zesVFManagementGetVFCapabilitiesExp2. +/// - 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 == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCapability` +func ZesVFManagementGetVFCapabilitiesExp( + hVFhandle ZesVfHandle, // hVFhandle [in] Sysman handle for the VF component. + pCapability *ZesVfExpCapabilities, // pCapability [in,out] Will contain VF capability. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesVFManagementGetVFCapabilitiesExp", uintptr(hVFhandle), uintptr(unsafe.Pointer(pCapability))) +} + +// ZesVFManagementGetVFMemoryUtilizationExp2 Get memory activity stats for each available memory types associated +/// with Virtual Function (VF) +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - If VF is disable/pause/not active, utilization will give zero value. +/// +/// @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 == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +func ZesVFManagementGetVFMemoryUtilizationExp2( + hVFhandle ZesVfHandle, // hVFhandle [in] Sysman handle for the component. + pCount *uint32, // pCount [in,out] Pointer to the number of VF memory stats descriptors. - if count is zero, the driver shall update the value with the total number of memory stats available. - if count is greater than the total number of memory stats available, the driver shall update the value with the correct number of memory stats available. + pMemUtil *ZesVfUtilMemExp2, // pMemUtil [in,out][optional][range(0, *pCount)] array of memory group activity counters. - if count is less than the total number of memory stats available, then driver shall only retrieve that number of stats. - the implementation shall populate the vector pCount-1 number of VF memory stats. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesVFManagementGetVFMemoryUtilizationExp2", uintptr(hVFhandle), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pMemUtil))) +} + +// ZesVFManagementGetVFEngineUtilizationExp2 Get engine activity stats for each available engine group associated +/// with Virtual Function (VF) +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - If VF is disable/pause/not active, utilization will give zero value. +/// +/// @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 == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +func ZesVFManagementGetVFEngineUtilizationExp2( + hVFhandle ZesVfHandle, // hVFhandle [in] Sysman handle for the component. + pCount *uint32, // pCount [in,out] Pointer to the number of VF engine stats descriptors. - if count is zero, the driver shall update the value with the total number of engine stats available. - if count is greater than the total number of engine stats available, the driver shall update the value with the correct number of engine stats available. + pEngineUtil *ZesVfUtilEngineExp2, // pEngineUtil [in,out][optional][range(0, *pCount)] array of engine group activity counters. - if count is less than the total number of engine stats available, then driver shall only retrieve that number of stats. - the implementation shall populate the vector pCount-1 number of VF engine stats. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesVFManagementGetVFEngineUtilizationExp2", uintptr(hVFhandle), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pEngineUtil))) +} + +// ZesVFManagementGetVFCapabilitiesExp2 Get virtual function management capabilities +/// +/// @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 == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCapability` +func ZesVFManagementGetVFCapabilitiesExp2( + hVFhandle ZesVfHandle, // hVFhandle [in] Sysman handle for the VF component. + pCapability *ZesVfExp2Capabilities, // pCapability [in,out] Will contain VF capability. +) (ZeResult, error) { + return zecall.Call[ZeResult]("zesVFManagementGetVFCapabilitiesExp2", uintptr(hVFhandle), uintptr(unsafe.Pointer(pCapability))) +} + diff --git a/tols/GlobalTimestamps.go b/tols/GlobalTimestamps.go deleted file mode 100644 index fec065c..0000000 --- a/tols/GlobalTimestamps.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/cmdlist.go b/tols/cmdlist.go deleted file mode 100644 index fec065c..0000000 --- a/tols/cmdlist.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/common.go b/tols/common.go deleted file mode 100644 index fec065c..0000000 --- a/tols/common.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/concurrentMetricGroup.go b/tols/concurrentMetricGroup.go deleted file mode 100644 index fec065c..0000000 --- a/tols/concurrentMetricGroup.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/context.go b/tols/context.go deleted file mode 100644 index fec065c..0000000 --- a/tols/context.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/debug.go b/tols/debug.go deleted file mode 100644 index fec065c..0000000 --- a/tols/debug.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/device.go b/tols/device.go deleted file mode 100644 index fec065c..0000000 --- a/tols/device.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/metric.go b/tols/metric.go deleted file mode 100644 index fec065c..0000000 --- a/tols/metric.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/metricExportData.go b/tols/metricExportData.go deleted file mode 100644 index fec065c..0000000 --- a/tols/metricExportData.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/metricExportMemory.go b/tols/metricExportMemory.go deleted file mode 100644 index fec065c..0000000 --- a/tols/metricExportMemory.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/metricGroupMarker.go b/tols/metricGroupMarker.go deleted file mode 100644 index fec065c..0000000 --- a/tols/metricGroupMarker.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/metricProgrammable.go b/tols/metricProgrammable.go deleted file mode 100644 index fec065c..0000000 --- a/tols/metricProgrammable.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/metricRuntimeEnableDisable.go b/tols/metricRuntimeEnableDisable.go deleted file mode 100644 index fec065c..0000000 --- a/tols/metricRuntimeEnableDisable.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/metricTracer.go b/tols/metricTracer.go deleted file mode 100644 index fec065c..0000000 --- a/tols/metricTracer.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/module.go b/tols/module.go deleted file mode 100644 index fec065c..0000000 --- a/tols/module.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/multiMetricValues.go b/tols/multiMetricValues.go deleted file mode 100644 index fec065c..0000000 --- a/tols/multiMetricValues.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/pin.go b/tols/pin.go deleted file mode 100644 index fec065c..0000000 --- a/tols/pin.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols/tracing.go b/tols/tracing.go deleted file mode 100644 index fec065c..0000000 --- a/tols/tracing.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by gen. DO NOT EDIT. - -package tols diff --git a/tols_common.go b/tols_common.go new file mode 100644 index 0000000..5582b7e --- /dev/null +++ b/tols_common.go @@ -0,0 +1,120 @@ +// Code generated by cmd/gen. DO NOT EDIT. + +/* + * + * Copyright (C) 2019-2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + * @file zet_api.h + * @version v1.15-r1.15.31 + * + */ + +package gozel + +import ( + "unsafe" +) + +// ZetDriverHandle (zet_driver_handle_t) Handle to a driver instance +type ZetDriverHandle ZeDriverHandle + +// ZetDeviceHandle (zet_device_handle_t) Handle of device object +type ZetDeviceHandle ZeDeviceHandle + +// ZetContextHandle (zet_context_handle_t) Handle of context object +type ZetContextHandle ZeContextHandle + +// ZetCommandListHandle (zet_command_list_handle_t) Handle of command list object +type ZetCommandListHandle ZeCommandListHandle + +// ZetModuleHandle (zet_module_handle_t) Handle of module object +type ZetModuleHandle ZeModuleHandle + +// ZetKernelHandle (zet_kernel_handle_t) Handle of function object +type ZetKernelHandle ZeKernelHandle + +// ZetMetricGroupHandle (zet_metric_group_handle_t) Handle of metric group's object +type ZetMetricGroupHandle uintptr + +// ZetMetricHandle (zet_metric_handle_t) Handle of metric's object +type ZetMetricHandle uintptr + +// ZetMetricStreamerHandle (zet_metric_streamer_handle_t) Handle of metric streamer's object +type ZetMetricStreamerHandle uintptr + +// ZetMetricQueryPoolHandle (zet_metric_query_pool_handle_t) Handle of metric query pool's object +type ZetMetricQueryPoolHandle uintptr + +// ZetMetricQueryHandle (zet_metric_query_handle_t) Handle of metric query's object +type ZetMetricQueryHandle uintptr + +// ZetTracerExpHandle (zet_tracer_exp_handle_t) Handle of tracer object +type ZetTracerExpHandle uintptr + +// ZetDebugSessionHandle (zet_debug_session_handle_t) Debug session handle +type ZetDebugSessionHandle uintptr + +// ZetStructureType (zet_structure_type_t) Defines structure types +type ZetStructureType uintptr +const ( + ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES ZetStructureType = 0x1 // ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES ::zet_metric_group_properties_t + ZET_STRUCTURE_TYPE_METRIC_PROPERTIES ZetStructureType = 0x2 // ZET_STRUCTURE_TYPE_METRIC_PROPERTIES ::zet_metric_properties_t + ZET_STRUCTURE_TYPE_METRIC_STREAMER_DESC ZetStructureType = 0x3 // ZET_STRUCTURE_TYPE_METRIC_STREAMER_DESC ::zet_metric_streamer_desc_t + ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC ZetStructureType = 0x4 // ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC ::zet_metric_query_pool_desc_t + ZET_STRUCTURE_TYPE_PROFILE_PROPERTIES ZetStructureType = 0x5 // ZET_STRUCTURE_TYPE_PROFILE_PROPERTIES ::zet_profile_properties_t + ZET_STRUCTURE_TYPE_DEVICE_DEBUG_PROPERTIES ZetStructureType = 0x6 // ZET_STRUCTURE_TYPE_DEVICE_DEBUG_PROPERTIES ::zet_device_debug_properties_t + ZET_STRUCTURE_TYPE_DEBUG_MEMORY_SPACE_DESC ZetStructureType = 0x7 // ZET_STRUCTURE_TYPE_DEBUG_MEMORY_SPACE_DESC ::zet_debug_memory_space_desc_t + ZET_STRUCTURE_TYPE_DEBUG_REGSET_PROPERTIES ZetStructureType = 0x8 // ZET_STRUCTURE_TYPE_DEBUG_REGSET_PROPERTIES ::zet_debug_regset_properties_t + ZET_STRUCTURE_TYPE_GLOBAL_METRICS_TIMESTAMPS_EXP_PROPERTIES ZetStructureType = 0x9 // ZET_STRUCTURE_TYPE_GLOBAL_METRICS_TIMESTAMPS_EXP_PROPERTIES ::zet_metric_global_timestamps_resolution_exp_t. Deprecated, use + + ///< ::ZET_STRUCTURE_TYPE_METRIC_GLOBAL_TIMESTAMPS_RESOLUTION_EXP. + + ZET_STRUCTURE_TYPE_METRIC_GLOBAL_TIMESTAMPS_RESOLUTION_EXP ZetStructureType = 0x9 // ZET_STRUCTURE_TYPE_METRIC_GLOBAL_TIMESTAMPS_RESOLUTION_EXP ::zet_metric_global_timestamps_resolution_exp_t + ZET_STRUCTURE_TYPE_TRACER_EXP_DESC ZetStructureType = 0x00010001 // ZET_STRUCTURE_TYPE_TRACER_EXP_DESC ::zet_tracer_exp_desc_t + ZET_STRUCTURE_TYPE_METRICS_CALCULATE_EXP_DESC ZetStructureType = 0x00010002 // ZET_STRUCTURE_TYPE_METRICS_CALCULATE_EXP_DESC ::zet_metric_calculate_exp_desc_t. Deprecated, use + + ///< ::ZET_STRUCTURE_TYPE_METRIC_CALCULATE_EXP_DESC. + + ZET_STRUCTURE_TYPE_METRIC_CALCULATE_EXP_DESC ZetStructureType = 0x00010002 // ZET_STRUCTURE_TYPE_METRIC_CALCULATE_EXP_DESC ::zet_metric_calculate_exp_desc_t + ZET_STRUCTURE_TYPE_METRIC_PROGRAMMABLE_EXP_PROPERTIES ZetStructureType = 0x00010003 // ZET_STRUCTURE_TYPE_METRIC_PROGRAMMABLE_EXP_PROPERTIES ::zet_metric_programmable_exp_properties_t + ZET_STRUCTURE_TYPE_METRIC_PROGRAMMABLE_PARAM_INFO_EXP ZetStructureType = 0x00010004 // ZET_STRUCTURE_TYPE_METRIC_PROGRAMMABLE_PARAM_INFO_EXP ::zet_metric_programmable_param_info_exp_t + ZET_STRUCTURE_TYPE_METRIC_PROGRAMMABLE_PARAM_VALUE_INFO_EXP ZetStructureType = 0x00010005 // ZET_STRUCTURE_TYPE_METRIC_PROGRAMMABLE_PARAM_VALUE_INFO_EXP ::zet_metric_programmable_param_value_info_exp_t + ZET_STRUCTURE_TYPE_METRIC_GROUP_TYPE_EXP ZetStructureType = 0x00010006 // ZET_STRUCTURE_TYPE_METRIC_GROUP_TYPE_EXP ::zet_metric_group_type_exp_t + ZET_STRUCTURE_TYPE_EXPORT_DMA_EXP_PROPERTIES ZetStructureType = 0x00010007 // ZET_STRUCTURE_TYPE_EXPORT_DMA_EXP_PROPERTIES ::zet_export_dma_buf_exp_properties_t + ZET_STRUCTURE_TYPE_METRIC_TRACER_EXP_DESC ZetStructureType = 0x00010008 // ZET_STRUCTURE_TYPE_METRIC_TRACER_EXP_DESC ::zet_metric_tracer_exp_desc_t + ZET_STRUCTURE_TYPE_METRIC_SOURCE_ID_EXP ZetStructureType = 0x00010009 // ZET_STRUCTURE_TYPE_METRIC_SOURCE_ID_EXP ::zet_metric_source_id_exp_t + ZET_STRUCTURE_TYPE_FORCE_UINT32 ZetStructureType = 0x7fffffff // ZET_STRUCTURE_TYPE_FORCE_UINT32 Value marking end of ZET_STRUCTURE_TYPE_* ENUMs + +) + +// ZetBaseProperties (zet_base_properties_t) Base for all properties types +type ZetBaseProperties struct { + Stype ZetStructureType // 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). + +} + +// ZetBaseDesc (zet_base_desc_t) Base for all descriptor types +type ZetBaseDesc struct { + Stype ZetStructureType // 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). + +} + +// ZetValueType (zet_value_type_t) Supported value types +type ZetValueType uintptr +const ( + ZET_VALUE_TYPE_UINT32 ZetValueType = 0 // ZET_VALUE_TYPE_UINT32 32-bit unsigned-integer + ZET_VALUE_TYPE_UINT64 ZetValueType = 1 // ZET_VALUE_TYPE_UINT64 64-bit unsigned-integer + ZET_VALUE_TYPE_FLOAT32 ZetValueType = 2 // ZET_VALUE_TYPE_FLOAT32 32-bit floating-point + ZET_VALUE_TYPE_FLOAT64 ZetValueType = 3 // ZET_VALUE_TYPE_FLOAT64 64-bit floating-point + ZET_VALUE_TYPE_BOOL8 ZetValueType = 4 // ZET_VALUE_TYPE_BOOL8 8-bit boolean + ZET_VALUE_TYPE_STRING ZetValueType = 5 // ZET_VALUE_TYPE_STRING C string + ZET_VALUE_TYPE_UINT8 ZetValueType = 6 // ZET_VALUE_TYPE_UINT8 8-bit unsigned-integer + ZET_VALUE_TYPE_UINT16 ZetValueType = 7 // ZET_VALUE_TYPE_UINT16 16-bit unsigned-integer + ZET_VALUE_TYPE_FORCE_UINT32 ZetValueType = 0x7fffffff // ZET_VALUE_TYPE_FORCE_UINT32 Value marking end of ZET_VALUE_TYPE_* ENUMs + +) + diff --git a/types.go b/types.go deleted file mode 100644 index 9032b82..0000000 --- a/types.go +++ /dev/null @@ -1,74 +0,0 @@ -package gozel - -import "unsafe" - -// ZeResult maps to ze_result_t -type ZeResult uint32 - -const ( - ZeResultSuccess ZeResult = 0x00000000 - ZeResultNotReady ZeResult = 0x00000001 - ZeResultErrorUninitialized ZeResult = 0x78000001 - ZeResultErrorInvalidArgument ZeResult = 0x78000004 - ZeResultErrorOutOfHostMemory ZeResult = 0x78000006 - ZeResultErrorOutOfDeviceMemory ZeResult = 0x78000007 - ZeResultErrorUnsupported ZeResult = 0x78000009 -) - -func (r ZeResult) Error() string { - switch r { - case ZeResultSuccess: - return "ZE_RESULT_SUCCESS" - case ZeResultNotReady: - return "ZE_RESULT_NOT_READY" - case ZeResultErrorUninitialized: - return "ZE_RESULT_ERROR_UNINITIALIZED" - case ZeResultErrorInvalidArgument: - return "ZE_RESULT_ERROR_INVALID_ARGUMENT" - case ZeResultErrorOutOfHostMemory: - return "ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY" - case ZeResultErrorOutOfDeviceMemory: - return "ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY" - case ZeResultErrorUnsupported: - return "ZE_RESULT_ERROR_UNSUPPORTED_FEATURE" - default: - return "ZE_RESULT_UNKNOWN" - } -} - -// ZeDriverHandle maps to ze_driver_handle_t (opaque pointer) -type ZeDriverHandle uintptr - -// ZeStructureType maps to ze_structure_type_t (selected values) -type ZeStructureType uint32 - -const ( - // ZeStructureTypeInitDriverTypeDesc maps to ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC - ZeStructureTypeInitDriverTypeDesc ZeStructureType = 0x00020002 -) - -// ZeInitDriverTypeFlags maps to ze_init_driver_type_flag_t -type ZeInitDriverTypeFlags uint32 - -const ( - ZeInitDriverTypeGPU ZeInitDriverTypeFlags = 1 << 0 - ZeInitDriverTypeNPU ZeInitDriverTypeFlags = 1 << 1 - // ZeInitDriverTypeAll selects all driver types (GPU + NPU) - ZeInitDriverTypeAll ZeInitDriverTypeFlags = ZeInitDriverTypeGPU | ZeInitDriverTypeNPU -) - -// ZeInitDriverTypeDesc maps to ze_init_driver_type_desc_t -type ZeInitDriverTypeDesc struct { - Stype ZeStructureType - PNext unsafe.Pointer - Flags ZeInitDriverTypeFlags -} - -// GPGPUDriverTypeDesc returns a ZeInitDriverTypeDesc configured for GPGPU -// (GPU driver only, correct stype). -func GPGPUDriverTypeDesc() ZeInitDriverTypeDesc { - return ZeInitDriverTypeDesc{ - Stype: ZeStructureTypeInitDriverTypeDesc, - Flags: ZeInitDriverTypeGPU, - } -} diff --git a/ze/init.go b/ze/init.go new file mode 100644 index 0000000..04c075d --- /dev/null +++ b/ze/init.go @@ -0,0 +1,40 @@ +package ze + +import ( + "github.com/fumiama/gozel" +) + +func initDrivers(flags gozel.ZeInitDriverTypeFlags) ([]gozel.ZeDriverHandle, error) { + var count uint32 + desc := &gozel.ZeInitDriverTypeDesc{ + Stype: gozel.ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC, + Flags: flags, + } + _, err := gozel.ZeInitDrivers(&count, nil, desc) + if count == 0 { + return nil, nil + } + if err != nil { + return nil, err + } + handles := make([]gozel.ZeDriverHandle, count) + _, err = gozel.ZeInitDrivers(&count, &handles[0], desc) + if err != nil { + return nil, err + } + return handles, nil +} + +// InitGPUDrivers calls zeInitDrivers with ZE_INIT_DRIVER_TYPE_FLAG_GPU from ze_loader.dll. +// On success pCount contains the number of drivers and phDrivers (if non-nil) +// is filled with driver handles. +func InitGPUDrivers() ([]gozel.ZeDriverHandle, error) { + return initDrivers(gozel.ZE_INIT_DRIVER_TYPE_FLAG_GPU) +} + +// InitNPUDrivers calls zeInitDrivers with ZE_INIT_DRIVER_TYPE_FLAG_NPU from ze_loader.dll. +// On success pCount contains the number of drivers and phDrivers (if non-nil) +// is filled with driver handles. +func InitNPUDrivers() ([]gozel.ZeDriverHandle, error) { + return initDrivers(gozel.ZE_INIT_DRIVER_TYPE_FLAG_NPU) +} diff --git a/ze_core_driver_windows.go b/ze_core_driver_windows.go deleted file mode 100644 index f4ee2fe..0000000 --- a/ze_core_driver_windows.go +++ /dev/null @@ -1,37 +0,0 @@ -package gozel - -import ( - "syscall" - "unsafe" -) - -var procZeInitDrivers *syscall.Proc - -// InitDrivers calls zeInitDrivers from ze_loader.dll. -// On success pCount contains the number of drivers and phDrivers (if non-nil) -// is filled with driver handles. -func InitDrivers(desc *ZeInitDriverTypeDesc) ([]ZeDriverHandle, error) { - var count uint32 - r, _, _ := procZeInitDrivers.Call( - uintptr(unsafe.Pointer(&count)), - 0, - uintptr(unsafe.Pointer(desc)), - ) - if ZeResult(r) != ZeResultSuccess { - return nil, ZeResult(r) - } - if count == 0 { - return nil, nil - } - - handles := make([]ZeDriverHandle, count) - r, _, _ = procZeInitDrivers.Call( - uintptr(unsafe.Pointer(&count)), - uintptr(unsafe.Pointer(&handles[0])), - uintptr(unsafe.Pointer(desc)), - ) - if ZeResult(r) != ZeResultSuccess { - return nil, ZeResult(r) - } - return handles, nil -}