1
0
mirror of https://github.com/fumiama/gozel.git synced 2026-06-05 00:10:24 +08:00
Files
gozel/core_virtual.go
2026-03-24 00:49:26 +08:00

470 lines
22 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"
)
// ZeMemoryAccessAttribute (ze_memory_access_attribute_t) Virtual memory page access attributes
type ZeMemoryAccessAttribute uintptr
const (
ZE_MEMORY_ACCESS_ATTRIBUTE_NONE ZeMemoryAccessAttribute = 0 // ZE_MEMORY_ACCESS_ATTRIBUTE_NONE Indicates the memory page is inaccessible.
ZE_MEMORY_ACCESS_ATTRIBUTE_READWRITE ZeMemoryAccessAttribute = 1 // ZE_MEMORY_ACCESS_ATTRIBUTE_READWRITE Indicates the memory page supports read write access.
ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY ZeMemoryAccessAttribute = 2 // ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY Indicates the memory page supports read-only access.
ZE_MEMORY_ACCESS_ATTRIBUTE_FORCE_UINT32 ZeMemoryAccessAttribute = 0x7fffffff // ZE_MEMORY_ACCESS_ATTRIBUTE_FORCE_UINT32 Value marking end of ZE_MEMORY_ACCESS_ATTRIBUTE_* ENUMs
)
// ZeVirtualMemReserve Reserves pages in virtual address space.
///
/// @details
/// - The application must only use the memory allocation on the context for
/// which it was created.
/// - The starting address and size must be page aligned. See
/// ::zeVirtualMemQueryPageSize.
/// - If pStart is not null then implementation will attempt to reserve
/// starting from that address. If not available then will find another
/// suitable starting address.
/// - The application may call this function from simultaneous threads.
/// - The access attributes will default to none to indicate reservation is
/// inaccessible.
/// - 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 == pptr`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE
/// + `0 == size`
func ZeVirtualMemReserve(
hContext ZeContextHandle, // hContext [in] handle of the context object
pStart unsafe.Pointer, // pStart [in][optional] pointer to start of region to reserve. If nullptr then implementation will choose a start address.
size uintptr, // size [in] size in bytes to reserve; must be page aligned.
pptr *unsafe.Pointer, // pptr [out] pointer to virtual reservation.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zeVirtualMemReserve", uintptr(hContext), uintptr(unsafe.Pointer(pStart)), uintptr(size), uintptr(unsafe.Pointer(pptr)))
}
// ZeVirtualMemFree Free pages in a reserved virtual address range.
///
/// @details
/// - Any existing virtual mappings for the range will be unmapped.
/// - Physical allocations objects that were mapped to this range will not
/// be destroyed. These need to be destroyed explicitly.
/// - 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 == hContext`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == ptr`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE
/// + `0 == size`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT
func ZeVirtualMemFree(
hContext ZeContextHandle, // hContext [in] handle of the context object
ptr unsafe.Pointer, // ptr [in] pointer to start of region to free.
size uintptr, // size [in] size in bytes to free; must be page aligned.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zeVirtualMemFree", uintptr(hContext), uintptr(unsafe.Pointer(ptr)), uintptr(size))
}
// ZeVirtualMemQueryPageSize Queries page size to use for aligning virtual memory reservations and
/// physical memory allocations.
///
/// @details
/// - 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 == hContext`
/// + `nullptr == hDevice`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pagesize`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE
/// + `0 == size`
func ZeVirtualMemQueryPageSize(
hContext ZeContextHandle, // hContext [in] handle of the context object
hDevice ZeDeviceHandle, // hDevice [in] handle of the device object
size uintptr, // size [in] unaligned allocation size in bytes
pagesize *uintptr, // pagesize [out] pointer to page size to use for start address and size alignments.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zeVirtualMemQueryPageSize", uintptr(hContext), uintptr(hDevice), uintptr(size), uintptr(unsafe.Pointer(pagesize)))
}
// ZePhysicalMemFlags (ze_physical_mem_flags_t) Supported physical memory creation flags
type ZePhysicalMemFlags uint32
const (
ZE_PHYSICAL_MEM_FLAG_ALLOCATE_ON_DEVICE ZePhysicalMemFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZE_PHYSICAL_MEM_FLAG_ALLOCATE_ON_DEVICE [default] allocate physical device memory.
ZE_PHYSICAL_MEM_FLAG_ALLOCATE_ON_HOST ZePhysicalMemFlags = /* ZE_BIT(1) */(( 1 << 1 )) // ZE_PHYSICAL_MEM_FLAG_ALLOCATE_ON_HOST Allocate physical host memory instead.
ZE_PHYSICAL_MEM_FLAG_FORCE_UINT32 ZePhysicalMemFlags = 0x7fffffff // ZE_PHYSICAL_MEM_FLAG_FORCE_UINT32 Value marking end of ZE_PHYSICAL_MEM_FLAG_* ENUMs
)
// ZePhysicalMemDesc (ze_physical_mem_desc_t) Physical memory descriptor
type ZePhysicalMemDesc 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 ZePhysicalMemFlags // Flags [in] creation flags. must be 0 (default) or a valid combination of ::ze_physical_mem_flag_t; default is to create physical device memory.
Size uintptr // Size [in] size in bytes to reserve; must be page aligned.
}
// ZePhysicalMemProperties (ze_physical_mem_properties_t) Physical memory properties queried using ::zePhysicalMemGetProperties
type ZePhysicalMemProperties 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).
Id uint64 // Id [out] unique identifier for the physical memory object
Size uint64 // Size [out] size of the physical memory object in bytes
}
// ZePhysicalMemGetProperties Retrieves memory properties of the physical memory object.
///
/// @details
/// - The application must only use the physical memory object on the
/// context for which it was created.
/// - 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 == hContext`
/// + `nullptr == hPhysicalMem`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pMemProperties`
func ZePhysicalMemGetProperties(
hContext ZeContextHandle, // hContext [in] handle of the context object
hPhysicalMem ZePhysicalMemHandle, // hPhysicalMem [in] handle of the physical memory object
pMemProperties *ZePhysicalMemProperties, // pMemProperties [in,out] pointer to physical memory properties structure.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zePhysicalMemGetProperties", uintptr(hContext), uintptr(hPhysicalMem), uintptr(unsafe.Pointer(pMemProperties)))
}
// ZePhysicalMemCreate Creates a physical memory object for the context.
///
/// @details
/// - The application must only use the physical memory object on the
/// context for which it was created.
/// - The size must be page aligned. For host memory, the operating system
/// page size should be used. For device memory, see
/// ::zeVirtualMemQueryPageSize.
/// - 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 == hContext`
/// + `nullptr == hDevice`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == desc`
/// + `nullptr == phPhysicalMemory`
/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
/// + `0x3 < desc->flags`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE
/// + `0 == desc->size`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT
func ZePhysicalMemCreate(
hContext ZeContextHandle, // hContext [in] handle of the context object
hDevice ZeDeviceHandle, // hDevice [in] handle of the device object, can be `nullptr` if creating physical host memory.
desc *ZePhysicalMemDesc, // desc [in] pointer to physical memory descriptor.
phPhysicalMemory *ZePhysicalMemHandle, // phPhysicalMemory [out] pointer to handle of physical memory object created
) (ZeResult, error) {
return zecall.Call[ZeResult]("zePhysicalMemCreate", uintptr(hContext), uintptr(hDevice), uintptr(unsafe.Pointer(desc)), uintptr(unsafe.Pointer(phPhysicalMemory)))
}
// ZePhysicalMemDestroy Destroys a physical memory object.
///
/// @details
/// - The application must ensure the device is not currently referencing
/// the physical memory object before it is deleted
/// - The application must **not** call this function from simultaneous
/// threads with the same physical memory 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`
/// + `nullptr == hPhysicalMemory`
/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE
func ZePhysicalMemDestroy(
hContext ZeContextHandle, // hContext [in] handle of the context object
hPhysicalMemory ZePhysicalMemHandle, // hPhysicalMemory [in][release] handle of physical memory object to destroy
) (ZeResult, error) {
return zecall.Call[ZeResult]("zePhysicalMemDestroy", uintptr(hContext), uintptr(hPhysicalMemory))
}
// ZeVirtualMemMap Maps pages in virtual address space to pages from physical memory
/// object.
///
/// @details
/// - The virtual address range must have been reserved using
/// ::zeVirtualMemReserve.
/// - The application must only use the mapped memory allocation on the
/// context for which it was created.
/// - The virtual start address and size must be page aligned. See
/// ::zeVirtualMemQueryPageSize.
/// - The application should use, for the starting address and size, the
/// same size alignment used for the physical allocation.
/// - 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 == hContext`
/// + `nullptr == hPhysicalMemory`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == ptr`
/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
/// + `::ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY < access`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE
/// + `0 == size`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT
func ZeVirtualMemMap(
hContext ZeContextHandle, // hContext [in] handle of the context object
ptr unsafe.Pointer, // ptr [in] pointer to start of virtual address range to map.
size uintptr, // size [in] size in bytes of virtual address range to map; must be page aligned.
hPhysicalMemory ZePhysicalMemHandle, // hPhysicalMemory [in] handle to physical memory object.
offset uintptr, // offset [in] offset into physical memory allocation object; must be page aligned.
access ZeMemoryAccessAttribute, // access [in] specifies page access attributes to apply to the virtual address range.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zeVirtualMemMap", uintptr(hContext), uintptr(unsafe.Pointer(ptr)), uintptr(size), uintptr(hPhysicalMemory), uintptr(offset), uintptr(access))
}
// ZeVirtualMemUnmap Unmaps pages in virtual address space from pages from a physical
/// memory object.
///
/// @details
/// - The page access attributes for virtual address range will revert back
/// to none.
/// - 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 == hContext`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == ptr`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT
/// + Address must be page aligned
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE
/// + `0 == size`
/// + Size must be page aligned
func ZeVirtualMemUnmap(
hContext ZeContextHandle, // hContext [in] handle of the context object
ptr unsafe.Pointer, // ptr [in] pointer to start of region to unmap.
size uintptr, // size [in] size in bytes to unmap; must be page aligned.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zeVirtualMemUnmap", uintptr(hContext), uintptr(unsafe.Pointer(ptr)), uintptr(size))
}
// ZeVirtualMemSetAccessAttribute Set memory access attributes for a virtual address range.
///
/// @details
/// - This function may be called from simultaneous threads with the same
/// function handle.
/// - 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 == hContext`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == ptr`
/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
/// + `::ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY < access`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT
/// + Address must be page aligned
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE
/// + `0 == size`
/// + Size must be page aligned
func ZeVirtualMemSetAccessAttribute(
hContext ZeContextHandle, // hContext [in] handle of the context object
ptr unsafe.Pointer, // ptr [in] pointer to start of reserved virtual address region.
size uintptr, // size [in] size in bytes; must be page aligned.
access ZeMemoryAccessAttribute, // access [in] specifies page access attributes to apply to the virtual address range.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zeVirtualMemSetAccessAttribute", uintptr(hContext), uintptr(unsafe.Pointer(ptr)), uintptr(size), uintptr(access))
}
// ZeVirtualMemGetAccessAttribute Get memory access attribute for a virtual address range.
///
/// @details
/// - If size and outSize are equal then the pages in the specified virtual
/// address range have the same access attributes.
/// - This function may be called from simultaneous threads with the same
/// function handle.
/// - 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 == hContext`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == ptr`
/// + `nullptr == access`
/// + `nullptr == outSize`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT
/// + Address must be page aligned
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE
/// + `0 == size`
/// + Size must be page aligned
func ZeVirtualMemGetAccessAttribute(
hContext ZeContextHandle, // hContext [in] handle of the context object
ptr unsafe.Pointer, // ptr [in] pointer to start of virtual address region for query.
size uintptr, // size [in] size in bytes; must be page aligned.
access *ZeMemoryAccessAttribute, // access [out] query result for page access attribute.
outSize *uintptr, // outSize [out] query result for size of virtual address range, starting at ptr, that shares same access attribute.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zeVirtualMemGetAccessAttribute", uintptr(hContext), uintptr(unsafe.Pointer(ptr)), uintptr(size), uintptr(unsafe.Pointer(access)), uintptr(unsafe.Pointer(outSize)))
}