mirror of
https://github.com/fumiama/gozel.git
synced 2026-06-06 00:40:23 +08:00
331 lines
15 KiB
Go
331 lines
15 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"
|
|
)
|
|
|
|
// ZeCommandQueueFlags (ze_command_queue_flags_t) Supported command queue flags
|
|
type ZeCommandQueueFlags uint32
|
|
const (
|
|
ZE_COMMAND_QUEUE_FLAG_EXPLICIT_ONLY ZeCommandQueueFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZE_COMMAND_QUEUE_FLAG_EXPLICIT_ONLY command queue should be optimized for submission to a single device engine.
|
|
|
|
///< driver **must** disable any implicit optimizations for distributing
|
|
///< work across multiple engines.
|
|
///< this flag should be used when applications want full control over
|
|
///< multi-engine submission and scheduling.
|
|
///< This flag is **DEPRECATED** as flag
|
|
///< ${X}_COMMAND_LIST_FLAG_EXPLICIT_ONLY is **DEPRECATED**.
|
|
|
|
ZE_COMMAND_QUEUE_FLAG_IN_ORDER ZeCommandQueueFlags = /* ZE_BIT(1) */(( 1 << 1 )) // ZE_COMMAND_QUEUE_FLAG_IN_ORDER To be used only when creating immediate command lists. Commands
|
|
|
|
///< appended to the immediate command
|
|
///< list are executed in-order, with driver implementation enforcing
|
|
///< dependencies between them.
|
|
///< Application is not required to have the signal event of a given
|
|
///< command being the wait event of
|
|
///< the next to define an in-order list, and application is allowed to
|
|
///< pass signal and wait events
|
|
///< to each appended command to implement more complex dependency graphs.
|
|
|
|
ZE_COMMAND_QUEUE_FLAG_COPY_OFFLOAD_HINT ZeCommandQueueFlags = /* ZE_BIT(2) */(( 1 << 2 )) // ZE_COMMAND_QUEUE_FLAG_COPY_OFFLOAD_HINT To be used only when creating immediate command lists and only for
|
|
|
|
///< compute queues.
|
|
///< Try to offload copy operations to different engines. This is only a hint.
|
|
///< Driver may ignore it per append call, based on platform capabilities
|
|
///< or internal heuristics.
|
|
|
|
ZE_COMMAND_QUEUE_FLAG_FORCE_UINT32 ZeCommandQueueFlags = 0x7fffffff // ZE_COMMAND_QUEUE_FLAG_FORCE_UINT32 Value marking end of ZE_COMMAND_QUEUE_FLAG_* ENUMs
|
|
|
|
)
|
|
|
|
// ZeCommandQueueMode (ze_command_queue_mode_t) Supported command queue modes
|
|
type ZeCommandQueueMode uintptr
|
|
const (
|
|
ZE_COMMAND_QUEUE_MODE_DEFAULT ZeCommandQueueMode = 0 // ZE_COMMAND_QUEUE_MODE_DEFAULT implicit default behavior; uses driver-based heuristics
|
|
ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS ZeCommandQueueMode = 1 // ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS Device execution always completes immediately on execute;
|
|
|
|
///< Host thread is blocked using wait on implicit synchronization object
|
|
|
|
ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS ZeCommandQueueMode = 2 // ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS Device execution is scheduled and will complete in future;
|
|
|
|
///< explicit synchronization object must be used to determine completeness
|
|
|
|
ZE_COMMAND_QUEUE_MODE_FORCE_UINT32 ZeCommandQueueMode = 0x7fffffff // ZE_COMMAND_QUEUE_MODE_FORCE_UINT32 Value marking end of ZE_COMMAND_QUEUE_MODE_* ENUMs
|
|
|
|
)
|
|
|
|
// ZeCommandQueuePriority (ze_command_queue_priority_t) Supported command queue priorities
|
|
type ZeCommandQueuePriority uintptr
|
|
const (
|
|
ZE_COMMAND_QUEUE_PRIORITY_NORMAL ZeCommandQueuePriority = 0 // ZE_COMMAND_QUEUE_PRIORITY_NORMAL [default] normal priority
|
|
ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW ZeCommandQueuePriority = 1 // ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW lower priority than normal
|
|
ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH ZeCommandQueuePriority = 2 // ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH higher priority than normal
|
|
ZE_COMMAND_QUEUE_PRIORITY_FORCE_UINT32 ZeCommandQueuePriority = 0x7fffffff // ZE_COMMAND_QUEUE_PRIORITY_FORCE_UINT32 Value marking end of ZE_COMMAND_QUEUE_PRIORITY_* ENUMs
|
|
|
|
)
|
|
|
|
// ZeCommandQueueDesc (ze_command_queue_desc_t) Command Queue descriptor
|
|
type ZeCommandQueueDesc 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).
|
|
Ordinal uint32 // Ordinal [in] command queue group ordinal
|
|
Index uint32 // Index [in] command queue index within the group; must be zero.
|
|
Flags ZeCommandQueueFlags // Flags [in] usage flags. must be 0 (default) or a valid combination of ::ze_command_queue_flag_t; default behavior may use implicit driver-based heuristics to balance latency and throughput.
|
|
Mode ZeCommandQueueMode // Mode [in] operation mode
|
|
Priority ZeCommandQueuePriority // Priority [in] priority
|
|
|
|
}
|
|
|
|
// ZeCommandQueueCreate Creates a command queue on the context.
|
|
///
|
|
/// @details
|
|
/// - A command queue represents a logical input stream to the device, tied
|
|
/// to a physical input stream.
|
|
/// - The application must only use the command queue for the device, or its
|
|
/// sub-devices, which was provided during creation.
|
|
/// - The application may call this function from simultaneous threads.
|
|
/// - The implementation of this function must be thread-safe.
|
|
///
|
|
/// @remarks
|
|
/// _Analogues_
|
|
/// - **clCreateCommandQueue**
|
|
///
|
|
/// @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`
|
|
/// + `nullptr == hDevice`
|
|
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
|
|
/// + `nullptr == desc`
|
|
/// + `nullptr == phCommandQueue`
|
|
/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
|
|
/// + `0x7 < desc->flags`
|
|
/// + `::ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS < desc->mode`
|
|
/// + `::ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH < desc->priority`
|
|
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
|
|
func ZeCommandQueueCreate(
|
|
hContext ZeContextHandle, // hContext [in] handle of the context object
|
|
hDevice ZeDeviceHandle, // hDevice [in] handle of the device object
|
|
desc *ZeCommandQueueDesc, // desc [in] pointer to command queue descriptor
|
|
phCommandQueue *ZeCommandQueueHandle, // phCommandQueue [out] pointer to handle of command queue object created
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zeCommandQueueCreate", uintptr(hContext), uintptr(hDevice), uintptr(unsafe.Pointer(desc)), uintptr(unsafe.Pointer(phCommandQueue)))
|
|
}
|
|
|
|
// ZeCommandQueueDestroy Destroys a command queue.
|
|
///
|
|
/// @details
|
|
/// - The application must destroy all fence handles created from the
|
|
/// command queue before destroying the command queue itself
|
|
/// - The application must ensure the device is not currently referencing
|
|
/// the command queue before it is deleted
|
|
/// - The implementation of this function may immediately free all Host and
|
|
/// Device allocations associated with this command queue
|
|
/// - The application must **not** call this function from simultaneous
|
|
/// threads with the same command queue handle.
|
|
/// - The implementation of this function must be thread-safe.
|
|
///
|
|
/// @remarks
|
|
/// _Analogues_
|
|
/// - **clReleaseCommandQueue**
|
|
///
|
|
/// @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 == hCommandQueue`
|
|
/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE
|
|
func ZeCommandQueueDestroy(
|
|
hCommandQueue ZeCommandQueueHandle, // hCommandQueue [in][release] handle of command queue object to destroy
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zeCommandQueueDestroy", uintptr(hCommandQueue))
|
|
}
|
|
|
|
// ZeCommandQueueExecuteCommandLists Executes a command list in a command queue.
|
|
///
|
|
/// @details
|
|
/// - The command lists are submitted to the device in the order they are
|
|
/// received, whether from multiple calls (on the same or different
|
|
/// threads) or a single call with multiple command lists.
|
|
/// - The application must ensure the command lists are accessible by the
|
|
/// device on which the command queue was created.
|
|
/// - The application must ensure the device is not currently referencing
|
|
/// the command list since the implementation is allowed to modify the
|
|
/// contents of the command list for submission.
|
|
/// - The application must only execute command lists created with an
|
|
/// identical command queue group ordinal to the command queue.
|
|
/// - The application must use a fence created using the same command queue.
|
|
/// - The application must ensure the command queue, command list and fence
|
|
/// were created on the same context.
|
|
/// - The application must ensure the command lists being executed are not
|
|
/// immediate command lists.
|
|
/// - The application may call this function from simultaneous threads.
|
|
/// - The implementation of this function should be lock-free.
|
|
///
|
|
/// @remarks
|
|
/// _Analogues_
|
|
/// - vkQueueSubmit
|
|
///
|
|
/// @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 == hCommandQueue`
|
|
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
|
|
/// + `nullptr == phCommandLists`
|
|
/// - ::ZE_RESULT_ERROR_INVALID_SIZE
|
|
/// + `0 == numCommandLists`
|
|
/// - ::ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE
|
|
/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT
|
|
func ZeCommandQueueExecuteCommandLists(
|
|
hCommandQueue ZeCommandQueueHandle, // hCommandQueue [in] handle of the command queue
|
|
numCommandLists uint32, // numCommandLists [in] number of command lists to execute
|
|
phCommandLists *ZeCommandListHandle, // phCommandLists [in][range(0, numCommandLists)] list of handles of the command lists to execute
|
|
hFence ZeFenceHandle, // hFence [in][optional] handle of the fence to signal on completion
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zeCommandQueueExecuteCommandLists", uintptr(hCommandQueue), uintptr(numCommandLists), uintptr(unsafe.Pointer(phCommandLists)), uintptr(hFence))
|
|
}
|
|
|
|
// ZeCommandQueueSynchronize Synchronizes a command queue by waiting on the host.
|
|
///
|
|
/// @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 == hCommandQueue`
|
|
/// - ::ZE_RESULT_NOT_READY
|
|
/// + timeout expired
|
|
func ZeCommandQueueSynchronize(
|
|
hCommandQueue ZeCommandQueueHandle, // hCommandQueue [in] handle of the command queue
|
|
timeout uint64, // timeout [in] if non-zero, then indicates the maximum time (in nanoseconds) to yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; if zero, then immediately returns the status of the command queue; if `UINT64_MAX`, then function will not return until complete or device is lost. Due to external dependencies, timeout may be rounded to the closest value allowed by the accuracy of those dependencies.
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zeCommandQueueSynchronize", uintptr(hCommandQueue), uintptr(timeout))
|
|
}
|
|
|
|
// ZeCommandQueueGetOrdinal Gets the command queue group ordinal.
|
|
///
|
|
/// @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 == hCommandQueue`
|
|
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
|
|
/// + `nullptr == pOrdinal`
|
|
func ZeCommandQueueGetOrdinal(
|
|
hCommandQueue ZeCommandQueueHandle, // hCommandQueue [in] handle of the command queue
|
|
pOrdinal *uint32, // pOrdinal [out] command queue group ordinal
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zeCommandQueueGetOrdinal", uintptr(hCommandQueue), uintptr(unsafe.Pointer(pOrdinal)))
|
|
}
|
|
|
|
// ZeCommandQueueGetIndex Gets the command queue index within the 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 == hCommandQueue`
|
|
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
|
|
/// + `nullptr == pIndex`
|
|
func ZeCommandQueueGetIndex(
|
|
hCommandQueue ZeCommandQueueHandle, // hCommandQueue [in] handle of the command queue
|
|
pIndex *uint32, // pIndex [out] command queue index within the group
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zeCommandQueueGetIndex", uintptr(hCommandQueue), uintptr(unsafe.Pointer(pIndex)))
|
|
}
|
|
|