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

183 lines
7.7 KiB
Go

// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file ze_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
"github.com/fumiama/gozel/internal/zecall"
)
// ZeContextFlags (ze_context_flags_t) Supported context creation flags
type ZeContextFlags uint32
const (
ZE_CONTEXT_FLAG_TBD ZeContextFlags = /* ZE_BIT(0) */ (1 << 0) // ZE_CONTEXT_FLAG_TBD reserved for future use
ZE_CONTEXT_FLAG_FORCE_UINT32 ZeContextFlags = 0x7fffffff // ZE_CONTEXT_FLAG_FORCE_UINT32 Value marking end of ZE_CONTEXT_FLAG_* ENUMs
)
// ZeContextDesc (ze_context_desc_t) Context descriptor
type ZeContextDesc struct {
Stype ZeStructureType // 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).
Flags ZeContextFlags // Flags [in] creation flags. must be 0 (default) or a valid combination of ::ze_context_flag_t; default behavior may use implicit driver-based heuristics.
}
// ZeContextCreate Creates a context for the driver.
// /
// / @details
// / - The application must only use the context for the driver which was
// / provided during creation.
// / - The application may call this function from simultaneous threads.
// / - The implementation of this function must be thread-safe.
// /
// / @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 == desc`
// / + `nullptr == phContext`
// / - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
// / + `0x1 < desc->flags`
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
func ZeContextCreate(
hDriver ZeDriverHandle, // hDriver [in] handle of the driver object
desc *ZeContextDesc, // desc [in] pointer to context descriptor
phContext *ZeContextHandle, // phContext [out] pointer to handle of context object created
) (ZeResult, error) {
return zecall.Call[ZeResult]("zeContextCreate", uintptr(hDriver), uintptr(unsafe.Pointer(desc)), uintptr(unsafe.Pointer(phContext)))
}
// ZeContextCreateEx Creates a context for the driver.
// /
// / @details
// / - The application must only use the context for the driver which was
// / provided during creation.
// / - The application may call this function from simultaneous threads.
// / - The implementation of this function must be thread-safe.
// /
// / @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 == desc`
// / + `nullptr == phContext`
// / - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
// / + `0x1 < desc->flags`
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
// / - ::ZE_RESULT_ERROR_INVALID_SIZE
// / + `(nullptr == phDevices) && (0 < numDevices)`
func ZeContextCreateEx(
hDriver ZeDriverHandle, // hDriver [in] handle of the driver object
desc *ZeContextDesc, // desc [in] pointer to context descriptor
numDevices uint32, // numDevices [in][optional] number of device handles; must be 0 if `nullptr == phDevices`
phDevices *ZeDeviceHandle, // phDevices [in][optional][range(0, numDevices)] array of device handles which context has visibility. if nullptr, then all devices and any sub-devices supported by the driver instance are visible to the context. otherwise, the context only has visibility to the devices and any sub-devices of the devices in this array.
phContext *ZeContextHandle, // phContext [out] pointer to handle of context object created
) (ZeResult, error) {
return zecall.Call[ZeResult]("zeContextCreateEx", uintptr(hDriver), uintptr(unsafe.Pointer(desc)), uintptr(numDevices), uintptr(unsafe.Pointer(phDevices)), uintptr(unsafe.Pointer(phContext)))
}
// ZeContextDestroy Destroys a context.
// /
// / @details
// / - The application must ensure the device is not currently referencing
// / the context before it is deleted.
// / - The implementation of this function may immediately free all Host and
// / Device allocations associated with this context.
// / - The application must **not** call this function from simultaneous
// / threads with the same context handle.
// / - The implementation of this function must be thread-safe.
// /
// / @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 == hContext`
// / - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE
func ZeContextDestroy(
hContext ZeContextHandle, // hContext [in][release] handle of context object to destroy
) (ZeResult, error) {
return zecall.Call[ZeResult]("zeContextDestroy", uintptr(hContext))
}
// ZeContextGetStatus Returns current status of the context.
// /
// / @details
// / - The application may call this function from simultaneous threads with
// / the same context handle.
// / - The implementation of this function should be lock-free.
// /
// / @returns
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
// / - ::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 == hContext`
// / - ::ZE_RESULT_SUCCESS
// / + Context is available for use.
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
// / + Context is invalid; due to device lost or reset.
func ZeContextGetStatus(
hContext ZeContextHandle, // hContext [in] handle of context object
) (ZeResult, error) {
return zecall.Call[ZeResult]("zeContextGetStatus", uintptr(hContext))
}