mirror of
https://github.com/fumiama/gozel.git
synced 2026-06-05 00:10:24 +08:00
118 lines
5.9 KiB
Go
118 lines
5.9 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"
|
|
)
|
|
|
|
// ZE_MEMORY_FREE_POLICIES_EXT_NAME Memory Free Policies Extension Name
|
|
const ZE_MEMORY_FREE_POLICIES_EXT_NAME = "ZE_extension_memory_free_policies"
|
|
|
|
// ZeMemoryFreePoliciesExtVersion (ze_memory_free_policies_ext_version_t) Memory Free Policies Extension Version(s)
|
|
type ZeMemoryFreePoliciesExtVersion uintptr
|
|
|
|
const (
|
|
ZE_MEMORY_FREE_POLICIES_EXT_VERSION_1_0 ZeMemoryFreePoliciesExtVersion = /* ZE_MAKE_VERSION( 1, 0 ) */ ((1 << 16) | (0 & 0x0000ffff)) // ZE_MEMORY_FREE_POLICIES_EXT_VERSION_1_0 version 1.0
|
|
ZE_MEMORY_FREE_POLICIES_EXT_VERSION_CURRENT ZeMemoryFreePoliciesExtVersion = /* ZE_MAKE_VERSION( 1, 0 ) */ ((1 << 16) | (0 & 0x0000ffff)) // ZE_MEMORY_FREE_POLICIES_EXT_VERSION_CURRENT latest known version
|
|
ZE_MEMORY_FREE_POLICIES_EXT_VERSION_FORCE_UINT32 ZeMemoryFreePoliciesExtVersion = 0x7fffffff // ZE_MEMORY_FREE_POLICIES_EXT_VERSION_FORCE_UINT32 Value marking end of ZE_MEMORY_FREE_POLICIES_EXT_VERSION_* ENUMs
|
|
|
|
)
|
|
|
|
// ZeDriverMemoryFreePolicyExtFlags (ze_driver_memory_free_policy_ext_flags_t) Supported memory free policy capability flags
|
|
type ZeDriverMemoryFreePolicyExtFlags uint32
|
|
|
|
const (
|
|
ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_BLOCKING_FREE ZeDriverMemoryFreePolicyExtFlags = /* ZE_BIT(0) */ (1 << 0) // ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_BLOCKING_FREE Blocks until all commands using the memory are complete before
|
|
|
|
///< scheduling memory to be freed. Does not guarantee memory is freed upon
|
|
///< return, only that it is safe and is scheduled to be freed. Actual
|
|
///< freeing of memory is specific to user mode driver and kernel mode
|
|
///< driver implementation and may be done asynchronously.
|
|
|
|
ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_DEFER_FREE ZeDriverMemoryFreePolicyExtFlags = /* ZE_BIT(1) */ (1 << 1) // ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_DEFER_FREE Immediately schedules the memory to be freed and returns without
|
|
|
|
///< blocking. Memory may be freed after all commands using the memory are
|
|
///< complete. Actual freeing of memory is specific to user mode driver and
|
|
///< kernel mode driver implementation and may be done asynchronously.
|
|
|
|
ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_FORCE_UINT32 ZeDriverMemoryFreePolicyExtFlags = 0x7fffffff // ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_FORCE_UINT32 Value marking end of ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_* ENUMs
|
|
|
|
)
|
|
|
|
// ZeDriverMemoryFreeExtProperties (ze_driver_memory_free_ext_properties_t) Driver memory free properties queried using ::zeDriverGetProperties
|
|
// /
|
|
// / @details
|
|
// / - All drivers must support an immediate free policy, which is the
|
|
// / default free policy.
|
|
// / - This structure may be returned from ::zeDriverGetProperties, via the
|
|
// / `pNext` member of ::ze_driver_properties_t.
|
|
type ZeDriverMemoryFreeExtProperties struct {
|
|
Stype ZeStructureType // 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).
|
|
Freepolicies ZeDriverMemoryFreePolicyExtFlags // Freepolicies [out] Supported memory free policies. must be 0 or a combination of ::ze_driver_memory_free_policy_ext_flag_t.
|
|
|
|
}
|
|
|
|
// ZeMemoryFreeExtDesc (ze_memory_free_ext_desc_t) Memory free descriptor with free policy
|
|
type ZeMemoryFreeExtDesc 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).
|
|
Freepolicy ZeDriverMemoryFreePolicyExtFlags // Freepolicy [in] flags specifying the memory free policy. must be 0 (default) or a supported ::ze_driver_memory_free_policy_ext_flag_t; default behavior is to free immediately.
|
|
|
|
}
|
|
|
|
// ZeMemFreeExt Frees allocated host memory, device memory, or shared memory on the
|
|
// / context using the specified free policy.
|
|
// /
|
|
// / @details
|
|
// / - Similar to zeMemFree, with added parameter to choose the free policy.
|
|
// / - Does not gaurantee memory is freed upon return. See free policy
|
|
// / descriptions for details.
|
|
// / - The application must **not** call this function from simultaneous
|
|
// / threads with the same pointer.
|
|
// / - 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_INVALID_NULL_POINTER
|
|
// / + `nullptr == pMemFreeDesc`
|
|
// / + `nullptr == ptr`
|
|
// / - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
|
|
// / + `0x3 < pMemFreeDesc->freePolicy`
|
|
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
|
|
func ZeMemFreeExt(
|
|
hContext ZeContextHandle, // hContext [in] handle of the context object
|
|
pMemFreeDesc *ZeMemoryFreeExtDesc, // pMemFreeDesc [in] pointer to memory free descriptor
|
|
ptr unsafe.Pointer, // ptr [in][release] pointer to memory to free
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zeMemFreeExt", uintptr(hContext), uintptr(unsafe.Pointer(pMemFreeDesc)), uintptr(unsafe.Pointer(ptr)))
|
|
}
|