diff --git a/doc/NOTES.md b/doc/NOTES.md index f3a1a0b..b0f58f7 100644 --- a/doc/NOTES.md +++ b/doc/NOTES.md @@ -54,3 +54,24 @@ PTX grammar ----------- * PTX grammar rules are atrocious, keywords can be freely reused as ids without escaping * Modifiers can be applied to instructions in any arbitrary order. We don't support it and hope we will never have to + + +Rust debugging +-------------- +* Nothing works 100% well on vscode/Windows: + * MSVC/lldb - always garbage (simple enums are fubar) + * MSVC/cppvsdbg - sometimes garbage (nested enums are fubar) + * GNU/lldb - mostly fine, but can't follow child processes + * GNU/gdb - always garbage (I don't have the patience to manually QA rust-gdb on Windows) and doesn't quite understand file paths for break points +* Neither on vscode/Linux: + * lldb - mostly fine, but can't follow child processes + * gdb - visualizes variables somewhat awkardly (shows all possible variants of an enum) +* CLion could be the solution, but intellij-rust can't load this project + +CUDA <-> L0 +----------- +* device ~= device +* stream ~= command queue +* context ~= context (1.0+) +* graph ~= command list +* module ~= module diff --git a/level_zero-sys/Cargo.toml b/level_zero-sys/Cargo.toml index c88db5d..7f8b497 100644 --- a/level_zero-sys/Cargo.toml +++ b/level_zero-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "level_zero-sys" -version = "0.91.0" +version = "1.0.4" authors = ["Andrzej Janik "] edition = "2018" links = "ze_loader" diff --git a/level_zero-sys/README b/level_zero-sys/README index 2534908..ff5978a 100644 --- a/level_zero-sys/README +++ b/level_zero-sys/README @@ -1 +1,4 @@ -bindgen --size_t-is-usize --default-enum-style=rust --whitelist-function ze.* /usr/include/level_zero/zex_api.h -o zex_api.rs -- -x c++ && sed -i 's/pub enum _ze_result_t/#[must_use]\npub enum _ze_result_t/g' zex_api.rs \ No newline at end of file +sed 's/^typedef uint32_t ze_.*flags_t;$//g' /usr/local/include/level_zero/ze_api.h > ze_api.h +sed -i -r 's/ze_(.*)_flag_t/ze_\1_flags_t/g' ze_api.h +bindgen --size_t-is-usize --default-enum-style=newtype --bitfield-enum ".*flags_t" --whitelist-function "ze.*" ze_api.h -o ze_api.rs +sed -i 's/pub struct _ze_result_t/#[must_use]\npub struct _ze_result_t/g' ze_api.rs \ No newline at end of file diff --git a/level_zero-sys/build.rs b/level_zero-sys/build.rs index 883ded0..4a638ec 100644 --- a/level_zero-sys/build.rs +++ b/level_zero-sys/build.rs @@ -1,7 +1,18 @@ +use env::VarError; +use std::{env, path::PathBuf}; -fn main() { +fn main() -> Result<(), VarError> { println!("cargo:rustc-link-lib=dylib=ze_loader"); - // TODO: make this windows-only - println!("cargo:rustc-link-search=native=C:\\Windows\\System32"); + if env::var("CARGO_CFG_WINDOWS").is_ok() { + let env = env::var("CARGO_CFG_TARGET_ENV")?; + if env == "gnu" { + println!("cargo:rustc-link-search=native=C:\\Windows\\System32"); + } else { + let mut path = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?); + path.push("src"); + println!("cargo:rustc-link-search=native={}", path.display()); + }; + } println!("cargo:rerun-if-changed=build.rs"); -} \ No newline at end of file + Ok(()) +} diff --git a/level_zero-sys/src/ze_api.rs b/level_zero-sys/src/ze_api.rs index 06c971c..e64988a 100644 --- a/level_zero-sys/src/ze_api.rs +++ b/level_zero-sys/src/ze_api.rs @@ -1,5 +1,8 @@ -/* automatically generated by rust-bindgen */ +/* automatically generated by rust-bindgen 0.54.1 */ +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __uint64_t = ::std::os::raw::c_ulong; #[doc = ""] #[doc = " @brief compiler-independent type"] pub type ze_bool_t = u8; @@ -21,6 +24,14 @@ pub struct _ze_device_handle_t { pub type ze_device_handle_t = *mut _ze_device_handle_t; #[repr(C)] #[derive(Debug, Copy, Clone)] +pub struct _ze_context_handle_t { + _unused: [u8; 0], +} +#[doc = ""] +#[doc = " @brief Handle of driver's context object"] +pub type ze_context_handle_t = *mut _ze_context_handle_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] pub struct _ze_command_queue_handle_t { _unused: [u8; 0], } @@ -99,12 +110,20 @@ pub struct _ze_sampler_handle_t { #[doc = ""] #[doc = " @brief Handle of driver's sampler object"] pub type ze_sampler_handle_t = *mut _ze_sampler_handle_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_physical_mem_handle_t { + _unused: [u8; 0], +} +#[doc = ""] +#[doc = " @brief Handle of physical memory object"] +pub type ze_physical_mem_handle_t = *mut _ze_physical_mem_handle_t; #[doc = ""] #[doc = " @brief IPC handle to a memory allocation"] #[repr(C)] #[derive(Copy, Clone)] pub struct _ze_ipc_mem_handle_t { - #[doc = "< Opaque data representing an IPC handle"] + #[doc = "< [out] Opaque data representing an IPC handle"] pub data: [::std::os::raw::c_char; 64usize], } #[test] @@ -138,7 +157,7 @@ pub type ze_ipc_mem_handle_t = _ze_ipc_mem_handle_t; #[repr(C)] #[derive(Copy, Clone)] pub struct _ze_ipc_event_pool_handle_t { - #[doc = "< Opaque data representing an IPC handle"] + #[doc = "< [out] Opaque data representing an IPC handle"] pub data: [::std::os::raw::c_char; 64usize], } #[test] @@ -169,90 +188,387 @@ fn bindgen_test_layout__ze_ipc_event_pool_handle_t() { #[doc = ""] #[doc = " @brief IPC handle to a event pool allocation"] pub type ze_ipc_event_pool_handle_t = _ze_ipc_event_pool_handle_t; -#[repr(i32)] +impl _ze_result_t { + #[doc = "< [Core] success"] + pub const ZE_RESULT_SUCCESS: _ze_result_t = _ze_result_t(0); +} +impl _ze_result_t { + #[doc = "< [Core] synchronization primitive not signaled"] + pub const ZE_RESULT_NOT_READY: _ze_result_t = _ze_result_t(1); +} +impl _ze_result_t { + #[doc = "< [Core] device hung, reset, was removed, or driver update occurred"] + pub const ZE_RESULT_ERROR_DEVICE_LOST: _ze_result_t = _ze_result_t(1879048193); +} +impl _ze_result_t { + #[doc = "< [Core] insufficient host memory to satisfy call"] + pub const ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY: _ze_result_t = _ze_result_t(1879048194); +} +impl _ze_result_t { + #[doc = "< [Core] insufficient device memory to satisfy call"] + pub const ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY: _ze_result_t = _ze_result_t(1879048195); +} +impl _ze_result_t { + #[doc = "< [Core] error occurred when building module, see build log for details"] + pub const ZE_RESULT_ERROR_MODULE_BUILD_FAILURE: _ze_result_t = _ze_result_t(1879048196); +} +impl _ze_result_t { + #[doc = "< [Core] error occurred when linking modules, see build log for details"] + pub const ZE_RESULT_ERROR_MODULE_LINK_FAILURE: _ze_result_t = _ze_result_t(1879048197); +} +impl _ze_result_t { + #[doc = "< [Sysman] access denied due to permission level"] + pub const ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS: _ze_result_t = _ze_result_t(1879113728); +} +impl _ze_result_t { + #[doc = "< [Sysman] resource already in use and simultaneous access not allowed"] + #[doc = "< or resource was removed"] + pub const ZE_RESULT_ERROR_NOT_AVAILABLE: _ze_result_t = _ze_result_t(1879113729); +} +impl _ze_result_t { + #[doc = "< [Tools] external required dependency is unavailable or missing"] + pub const ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE: _ze_result_t = _ze_result_t(1879179264); +} +impl _ze_result_t { + #[doc = "< [Validation] driver is not initialized"] + pub const ZE_RESULT_ERROR_UNINITIALIZED: _ze_result_t = _ze_result_t(2013265921); +} +impl _ze_result_t { + #[doc = "< [Validation] generic error code for unsupported versions"] + pub const ZE_RESULT_ERROR_UNSUPPORTED_VERSION: _ze_result_t = _ze_result_t(2013265922); +} +impl _ze_result_t { + #[doc = "< [Validation] generic error code for unsupported features"] + pub const ZE_RESULT_ERROR_UNSUPPORTED_FEATURE: _ze_result_t = _ze_result_t(2013265923); +} +impl _ze_result_t { + #[doc = "< [Validation] generic error code for invalid arguments"] + pub const ZE_RESULT_ERROR_INVALID_ARGUMENT: _ze_result_t = _ze_result_t(2013265924); +} +impl _ze_result_t { + #[doc = "< [Validation] handle argument is not valid"] + pub const ZE_RESULT_ERROR_INVALID_NULL_HANDLE: _ze_result_t = _ze_result_t(2013265925); +} +impl _ze_result_t { + #[doc = "< [Validation] object pointed to by handle still in-use by device"] + pub const ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE: _ze_result_t = _ze_result_t(2013265926); +} +impl _ze_result_t { + #[doc = "< [Validation] pointer argument may not be nullptr"] + pub const ZE_RESULT_ERROR_INVALID_NULL_POINTER: _ze_result_t = _ze_result_t(2013265927); +} +impl _ze_result_t { + #[doc = "< [Validation] size argument is invalid (e.g., must not be zero)"] + pub const ZE_RESULT_ERROR_INVALID_SIZE: _ze_result_t = _ze_result_t(2013265928); +} +impl _ze_result_t { + #[doc = "< [Validation] size argument is not supported by the device (e.g., too"] + #[doc = "< large)"] + pub const ZE_RESULT_ERROR_UNSUPPORTED_SIZE: _ze_result_t = _ze_result_t(2013265929); +} +impl _ze_result_t { + #[doc = "< [Validation] alignment argument is not supported by the device (e.g.,"] + #[doc = "< too small)"] + pub const ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT: _ze_result_t = _ze_result_t(2013265930); +} +impl _ze_result_t { + #[doc = "< [Validation] synchronization object in invalid state"] + pub const ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT: _ze_result_t = + _ze_result_t(2013265931); +} +impl _ze_result_t { + #[doc = "< [Validation] enumerator argument is not valid"] + pub const ZE_RESULT_ERROR_INVALID_ENUMERATION: _ze_result_t = _ze_result_t(2013265932); +} +impl _ze_result_t { + #[doc = "< [Validation] enumerator argument is not supported by the device"] + pub const ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION: _ze_result_t = _ze_result_t(2013265933); +} +impl _ze_result_t { + #[doc = "< [Validation] image format is not supported by the device"] + pub const ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT: _ze_result_t = _ze_result_t(2013265934); +} +impl _ze_result_t { + #[doc = "< [Validation] native binary is not supported by the device"] + pub const ZE_RESULT_ERROR_INVALID_NATIVE_BINARY: _ze_result_t = _ze_result_t(2013265935); +} +impl _ze_result_t { + #[doc = "< [Validation] global variable is not found in the module"] + pub const ZE_RESULT_ERROR_INVALID_GLOBAL_NAME: _ze_result_t = _ze_result_t(2013265936); +} +impl _ze_result_t { + #[doc = "< [Validation] kernel name is not found in the module"] + pub const ZE_RESULT_ERROR_INVALID_KERNEL_NAME: _ze_result_t = _ze_result_t(2013265937); +} +impl _ze_result_t { + #[doc = "< [Validation] function name is not found in the module"] + pub const ZE_RESULT_ERROR_INVALID_FUNCTION_NAME: _ze_result_t = _ze_result_t(2013265938); +} +impl _ze_result_t { + #[doc = "< [Validation] group size dimension is not valid for the kernel or"] + #[doc = "< device"] + pub const ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION: _ze_result_t = _ze_result_t(2013265939); +} +impl _ze_result_t { + #[doc = "< [Validation] global width dimension is not valid for the kernel or"] + #[doc = "< device"] + pub const ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION: _ze_result_t = + _ze_result_t(2013265940); +} +impl _ze_result_t { + #[doc = "< [Validation] kernel argument index is not valid for kernel"] + pub const ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX: _ze_result_t = + _ze_result_t(2013265941); +} +impl _ze_result_t { + #[doc = "< [Validation] kernel argument size does not match kernel"] + pub const ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE: _ze_result_t = _ze_result_t(2013265942); +} +impl _ze_result_t { + #[doc = "< [Validation] value of kernel attribute is not valid for the kernel or"] + #[doc = "< device"] + pub const ZE_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE: _ze_result_t = + _ze_result_t(2013265943); +} +impl _ze_result_t { + #[doc = "< [Validation] module with imports needs to be linked before kernels can"] + #[doc = "< be created from it."] + pub const ZE_RESULT_ERROR_INVALID_MODULE_UNLINKED: _ze_result_t = _ze_result_t(2013265944); +} +impl _ze_result_t { + #[doc = "< [Validation] command list type does not match command queue type"] + pub const ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE: _ze_result_t = _ze_result_t(2013265945); +} +impl _ze_result_t { + #[doc = "< [Validation] copy operations do not support overlapping regions of"] + #[doc = "< memory"] + pub const ZE_RESULT_ERROR_OVERLAPPING_REGIONS: _ze_result_t = _ze_result_t(2013265946); +} +impl _ze_result_t { + #[doc = "< [Core] unknown or internal error"] + pub const ZE_RESULT_ERROR_UNKNOWN: _ze_result_t = _ze_result_t(2147483646); +} +impl _ze_result_t { + pub const ZE_RESULT_FORCE_UINT32: _ze_result_t = _ze_result_t(2147483647); +} +#[repr(transparent)] #[doc = ""] #[doc = " @brief Defines Return/Error codes"] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] #[must_use] -pub enum _ze_result_t { - #[doc = "< [Core] success"] - ZE_RESULT_SUCCESS = 0, - #[doc = "< [Core] synchronization primitive not signaled"] - ZE_RESULT_NOT_READY = 1, - #[doc = "< [Core] device hung, reset, was removed, or driver update occurred"] - ZE_RESULT_ERROR_DEVICE_LOST = 1879048193, - #[doc = "< [Core] insufficient host memory to satisfy call"] - ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY = 1879048194, - #[doc = "< [Core] insufficient device memory to satisfy call"] - ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY = 1879048195, - #[doc = "< [Core] error occurred when building module, see build log for details"] - ZE_RESULT_ERROR_MODULE_BUILD_FAILURE = 1879048196, - #[doc = "< [Tools] access denied due to permission level"] - ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS = 1879113728, - #[doc = "< [Tools] resource already in use and simultaneous access not allowed"] - ZE_RESULT_ERROR_NOT_AVAILABLE = 1879113729, - #[doc = "< [Validation] driver is not initialized"] - ZE_RESULT_ERROR_UNINITIALIZED = 2013265921, - #[doc = "< [Validation] generic error code for unsupported versions"] - ZE_RESULT_ERROR_UNSUPPORTED_VERSION = 2013265922, - #[doc = "< [Validation] generic error code for unsupported features"] - ZE_RESULT_ERROR_UNSUPPORTED_FEATURE = 2013265923, - #[doc = "< [Validation] generic error code for invalid arguments"] - ZE_RESULT_ERROR_INVALID_ARGUMENT = 2013265924, - #[doc = "< [Validation] handle argument is not valid"] - ZE_RESULT_ERROR_INVALID_NULL_HANDLE = 2013265925, - #[doc = "< [Validation] object pointed to by handle still in-use by device"] - ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE = 2013265926, - #[doc = "< [Validation] pointer argument may not be nullptr"] - ZE_RESULT_ERROR_INVALID_NULL_POINTER = 2013265927, - #[doc = "< [Validation] size argument is invalid (e.g., must not be zero)"] - ZE_RESULT_ERROR_INVALID_SIZE = 2013265928, - #[doc = "< [Validation] size argument is not supported by the device (e.g., too"] - #[doc = "< large)"] - ZE_RESULT_ERROR_UNSUPPORTED_SIZE = 2013265929, - #[doc = "< [Validation] alignment argument is not supported by the device (e.g.,"] - #[doc = "< too small)"] - ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT = 2013265930, - #[doc = "< [Validation] synchronization object in invalid state"] - ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT = 2013265931, - #[doc = "< [Validation] enumerator argument is not valid"] - ZE_RESULT_ERROR_INVALID_ENUMERATION = 2013265932, - #[doc = "< [Validation] enumerator argument is not supported by the device"] - ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION = 2013265933, - #[doc = "< [Validation] image format is not supported by the device"] - ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT = 2013265934, - #[doc = "< [Validation] native binary is not supported by the device"] - ZE_RESULT_ERROR_INVALID_NATIVE_BINARY = 2013265935, - #[doc = "< [Validation] global variable is not found in the module"] - ZE_RESULT_ERROR_INVALID_GLOBAL_NAME = 2013265936, - #[doc = "< [Validation] kernel name is not found in the module"] - ZE_RESULT_ERROR_INVALID_KERNEL_NAME = 2013265937, - #[doc = "< [Validation] function name is not found in the module"] - ZE_RESULT_ERROR_INVALID_FUNCTION_NAME = 2013265938, - #[doc = "< [Validation] group size dimension is not valid for the kernel or"] - #[doc = "< device"] - ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION = 2013265939, - #[doc = "< [Validation] global width dimension is not valid for the kernel or"] - #[doc = "< device"] - ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION = 2013265940, - #[doc = "< [Validation] kernel argument index is not valid for kernel"] - ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX = 2013265941, - #[doc = "< [Validation] kernel argument size does not match kernel"] - ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE = 2013265942, - #[doc = "< [Validation] value of kernel attribute is not valid for the kernel or"] - #[doc = "< device"] - ZE_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE = 2013265943, - #[doc = "< [Validation] command list type does not match command queue type"] - ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE = 2013265944, - #[doc = "< [Validation] copy operations do not support overlapping regions of"] - #[doc = "< memory"] - ZE_RESULT_ERROR_OVERLAPPING_REGIONS = 2013265945, - #[doc = "< [Core] unknown or internal error"] - ZE_RESULT_ERROR_UNKNOWN = 2147483647, -} +pub struct _ze_result_t(pub u32); #[doc = ""] #[doc = " @brief Defines Return/Error codes"] pub use self::_ze_result_t as ze_result_t; +impl _ze_structure_type_t { + #[doc = "< ::ze_driver_properties_t"] + pub const ZE_STRUCTURE_TYPE_DRIVER_PROPERTIES: _ze_structure_type_t = _ze_structure_type_t(1); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_driver_ipc_properties_t"] + pub const ZE_STRUCTURE_TYPE_DRIVER_IPC_PROPERTIES: _ze_structure_type_t = + _ze_structure_type_t(2); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_device_properties_t"] + pub const ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES: _ze_structure_type_t = _ze_structure_type_t(3); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_device_compute_properties_t"] + pub const ZE_STRUCTURE_TYPE_DEVICE_COMPUTE_PROPERTIES: _ze_structure_type_t = + _ze_structure_type_t(4); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_device_module_properties_t"] + pub const ZE_STRUCTURE_TYPE_DEVICE_MODULE_PROPERTIES: _ze_structure_type_t = + _ze_structure_type_t(5); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_command_queue_group_properties_t"] + pub const ZE_STRUCTURE_TYPE_COMMAND_QUEUE_GROUP_PROPERTIES: _ze_structure_type_t = + _ze_structure_type_t(6); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_device_memory_properties_t"] + pub const ZE_STRUCTURE_TYPE_DEVICE_MEMORY_PROPERTIES: _ze_structure_type_t = + _ze_structure_type_t(7); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_device_memory_access_properties_t"] + pub const ZE_STRUCTURE_TYPE_DEVICE_MEMORY_ACCESS_PROPERTIES: _ze_structure_type_t = + _ze_structure_type_t(8); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_device_cache_properties_t"] + pub const ZE_STRUCTURE_TYPE_DEVICE_CACHE_PROPERTIES: _ze_structure_type_t = + _ze_structure_type_t(9); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_device_image_properties_t"] + pub const ZE_STRUCTURE_TYPE_DEVICE_IMAGE_PROPERTIES: _ze_structure_type_t = + _ze_structure_type_t(10); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_device_p2p_properties_t"] + pub const ZE_STRUCTURE_TYPE_DEVICE_P2P_PROPERTIES: _ze_structure_type_t = + _ze_structure_type_t(11); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_device_external_memory_properties_t"] + pub const ZE_STRUCTURE_TYPE_DEVICE_EXTERNAL_MEMORY_PROPERTIES: _ze_structure_type_t = + _ze_structure_type_t(12); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_context_desc_t"] + pub const ZE_STRUCTURE_TYPE_CONTEXT_DESC: _ze_structure_type_t = _ze_structure_type_t(13); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_command_queue_desc_t"] + pub const ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC: _ze_structure_type_t = _ze_structure_type_t(14); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_command_list_desc_t"] + pub const ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC: _ze_structure_type_t = _ze_structure_type_t(15); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_event_pool_desc_t"] + pub const ZE_STRUCTURE_TYPE_EVENT_POOL_DESC: _ze_structure_type_t = _ze_structure_type_t(16); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_event_desc_t"] + pub const ZE_STRUCTURE_TYPE_EVENT_DESC: _ze_structure_type_t = _ze_structure_type_t(17); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_fence_desc_t"] + pub const ZE_STRUCTURE_TYPE_FENCE_DESC: _ze_structure_type_t = _ze_structure_type_t(18); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_image_desc_t"] + pub const ZE_STRUCTURE_TYPE_IMAGE_DESC: _ze_structure_type_t = _ze_structure_type_t(19); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_image_properties_t"] + pub const ZE_STRUCTURE_TYPE_IMAGE_PROPERTIES: _ze_structure_type_t = _ze_structure_type_t(20); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_device_mem_alloc_desc_t"] + pub const ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC: _ze_structure_type_t = + _ze_structure_type_t(21); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_host_mem_alloc_desc_t"] + pub const ZE_STRUCTURE_TYPE_HOST_MEM_ALLOC_DESC: _ze_structure_type_t = + _ze_structure_type_t(22); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_memory_allocation_properties_t"] + pub const ZE_STRUCTURE_TYPE_MEMORY_ALLOCATION_PROPERTIES: _ze_structure_type_t = + _ze_structure_type_t(23); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_external_memory_export_desc_t"] + pub const ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_EXPORT_DESC: _ze_structure_type_t = + _ze_structure_type_t(24); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_external_memory_import_fd_t"] + pub const ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMPORT_FD: _ze_structure_type_t = + _ze_structure_type_t(25); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_external_memory_export_fd_t"] + pub const ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_EXPORT_FD: _ze_structure_type_t = + _ze_structure_type_t(26); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_module_desc_t"] + pub const ZE_STRUCTURE_TYPE_MODULE_DESC: _ze_structure_type_t = _ze_structure_type_t(27); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_module_properties_t"] + pub const ZE_STRUCTURE_TYPE_MODULE_PROPERTIES: _ze_structure_type_t = _ze_structure_type_t(28); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_kernel_desc_t"] + pub const ZE_STRUCTURE_TYPE_KERNEL_DESC: _ze_structure_type_t = _ze_structure_type_t(29); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_kernel_properties_t"] + pub const ZE_STRUCTURE_TYPE_KERNEL_PROPERTIES: _ze_structure_type_t = _ze_structure_type_t(30); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_sampler_desc_t"] + pub const ZE_STRUCTURE_TYPE_SAMPLER_DESC: _ze_structure_type_t = _ze_structure_type_t(31); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_physical_mem_desc_t"] + pub const ZE_STRUCTURE_TYPE_PHYSICAL_MEM_DESC: _ze_structure_type_t = _ze_structure_type_t(32); +} +impl _ze_structure_type_t { + #[doc = "< ::ze_raytracing_mem_alloc_ext_desc_t"] + pub const ZE_STRUCTURE_TYPE_RAYTRACING_MEM_ALLOC_EXT_DESC: _ze_structure_type_t = + _ze_structure_type_t(65537); +} +impl _ze_structure_type_t { + pub const ZE_STRUCTURE_TYPE_FORCE_UINT32: _ze_structure_type_t = + _ze_structure_type_t(2147483647); +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Defines structure types"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_structure_type_t(pub u32); +#[doc = ""] +#[doc = " @brief Defines structure types"] +pub use self::_ze_structure_type_t as ze_structure_type_t; +impl _ze_external_memory_type_flags_t { + #[doc = "< an opaque POSIX file descriptor handle"] + pub const ZE_EXTERNAL_MEMORY_TYPE_FLAG_OPAQUE_FD: _ze_external_memory_type_flags_t = + _ze_external_memory_type_flags_t(1); +} +impl _ze_external_memory_type_flags_t { + #[doc = "< a file descriptor handle for a Linux dma_buf"] + pub const ZE_EXTERNAL_MEMORY_TYPE_FLAG_DMA_BUF: _ze_external_memory_type_flags_t = + _ze_external_memory_type_flags_t(2); +} +impl _ze_external_memory_type_flags_t { + pub const ZE_EXTERNAL_MEMORY_TYPE_FLAG_FORCE_UINT32: _ze_external_memory_type_flags_t = + _ze_external_memory_type_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_external_memory_type_flags_t> for _ze_external_memory_type_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_external_memory_type_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_external_memory_type_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_external_memory_type_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_external_memory_type_flags_t> for _ze_external_memory_type_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_external_memory_type_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_external_memory_type_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_external_memory_type_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief External memory type flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_external_memory_type_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief External memory type flags"] +pub use self::_ze_external_memory_type_flags_t as ze_external_memory_type_flags_t; #[doc = ""] #[doc = " @brief Forward-declare ze_driver_uuid_t"] pub type ze_driver_uuid_t = _ze_driver_uuid_t; @@ -263,6 +579,9 @@ pub type ze_driver_properties_t = _ze_driver_properties_t; #[doc = " @brief Forward-declare ze_driver_ipc_properties_t"] pub type ze_driver_ipc_properties_t = _ze_driver_ipc_properties_t; #[doc = ""] +#[doc = " @brief Forward-declare ze_driver_extension_properties_t"] +pub type ze_driver_extension_properties_t = _ze_driver_extension_properties_t; +#[doc = ""] #[doc = " @brief Forward-declare ze_device_uuid_t"] pub type ze_device_uuid_t = _ze_device_uuid_t; #[doc = ""] @@ -275,8 +594,11 @@ pub type ze_device_compute_properties_t = _ze_device_compute_properties_t; #[doc = " @brief Forward-declare ze_native_kernel_uuid_t"] pub type ze_native_kernel_uuid_t = _ze_native_kernel_uuid_t; #[doc = ""] -#[doc = " @brief Forward-declare ze_device_kernel_properties_t"] -pub type ze_device_kernel_properties_t = _ze_device_kernel_properties_t; +#[doc = " @brief Forward-declare ze_device_module_properties_t"] +pub type ze_device_module_properties_t = _ze_device_module_properties_t; +#[doc = ""] +#[doc = " @brief Forward-declare ze_command_queue_group_properties_t"] +pub type ze_command_queue_group_properties_t = _ze_command_queue_group_properties_t; #[doc = ""] #[doc = " @brief Forward-declare ze_device_memory_properties_t"] pub type ze_device_memory_properties_t = _ze_device_memory_properties_t; @@ -290,38 +612,26 @@ pub type ze_device_cache_properties_t = _ze_device_cache_properties_t; #[doc = " @brief Forward-declare ze_device_image_properties_t"] pub type ze_device_image_properties_t = _ze_device_image_properties_t; #[doc = ""] +#[doc = " @brief Forward-declare ze_device_external_memory_properties_t"] +pub type ze_device_external_memory_properties_t = _ze_device_external_memory_properties_t; +#[doc = ""] #[doc = " @brief Forward-declare ze_device_p2p_properties_t"] pub type ze_device_p2p_properties_t = _ze_device_p2p_properties_t; #[doc = ""] +#[doc = " @brief Forward-declare ze_context_desc_t"] +pub type ze_context_desc_t = _ze_context_desc_t; +#[doc = ""] #[doc = " @brief Forward-declare ze_command_queue_desc_t"] pub type ze_command_queue_desc_t = _ze_command_queue_desc_t; #[doc = ""] #[doc = " @brief Forward-declare ze_command_list_desc_t"] pub type ze_command_list_desc_t = _ze_command_list_desc_t; #[doc = ""] -#[doc = " @brief Forward-declare ze_image_format_desc_t"] -pub type ze_image_format_desc_t = _ze_image_format_desc_t; +#[doc = " @brief Forward-declare ze_copy_region_t"] +pub type ze_copy_region_t = _ze_copy_region_t; #[doc = ""] -#[doc = " @brief Forward-declare ze_image_desc_t"] -pub type ze_image_desc_t = _ze_image_desc_t; -#[doc = ""] -#[doc = " @brief Forward-declare ze_image_properties_t"] -pub type ze_image_properties_t = _ze_image_properties_t; -#[doc = ""] -#[doc = " @brief Forward-declare ze_module_constants_t"] -pub type ze_module_constants_t = _ze_module_constants_t; -#[doc = ""] -#[doc = " @brief Forward-declare ze_module_desc_t"] -pub type ze_module_desc_t = _ze_module_desc_t; -#[doc = ""] -#[doc = " @brief Forward-declare ze_kernel_desc_t"] -pub type ze_kernel_desc_t = _ze_kernel_desc_t; -#[doc = ""] -#[doc = " @brief Forward-declare ze_kernel_properties_t"] -pub type ze_kernel_properties_t = _ze_kernel_properties_t; -#[doc = ""] -#[doc = " @brief Forward-declare ze_group_count_t"] -pub type ze_group_count_t = _ze_group_count_t; +#[doc = " @brief Forward-declare ze_image_region_t"] +pub type ze_image_region_t = _ze_image_region_t; #[doc = ""] #[doc = " @brief Forward-declare ze_event_pool_desc_t"] pub type ze_event_pool_desc_t = _ze_event_pool_desc_t; @@ -329,8 +639,23 @@ pub type ze_event_pool_desc_t = _ze_event_pool_desc_t; #[doc = " @brief Forward-declare ze_event_desc_t"] pub type ze_event_desc_t = _ze_event_desc_t; #[doc = ""] -#[doc = " @brief Forward-declare ze_sampler_desc_t"] -pub type ze_sampler_desc_t = _ze_sampler_desc_t; +#[doc = " @brief Forward-declare ze_kernel_timestamp_data_t"] +pub type ze_kernel_timestamp_data_t = _ze_kernel_timestamp_data_t; +#[doc = ""] +#[doc = " @brief Forward-declare ze_kernel_timestamp_result_t"] +pub type ze_kernel_timestamp_result_t = _ze_kernel_timestamp_result_t; +#[doc = ""] +#[doc = " @brief Forward-declare ze_fence_desc_t"] +pub type ze_fence_desc_t = _ze_fence_desc_t; +#[doc = ""] +#[doc = " @brief Forward-declare ze_image_format_t"] +pub type ze_image_format_t = _ze_image_format_t; +#[doc = ""] +#[doc = " @brief Forward-declare ze_image_desc_t"] +pub type ze_image_desc_t = _ze_image_desc_t; +#[doc = ""] +#[doc = " @brief Forward-declare ze_image_properties_t"] +pub type ze_image_properties_t = _ze_image_properties_t; #[doc = ""] #[doc = " @brief Forward-declare ze_device_mem_alloc_desc_t"] pub type ze_device_mem_alloc_desc_t = _ze_device_mem_alloc_desc_t; @@ -341,47 +666,93 @@ pub type ze_host_mem_alloc_desc_t = _ze_host_mem_alloc_desc_t; #[doc = " @brief Forward-declare ze_memory_allocation_properties_t"] pub type ze_memory_allocation_properties_t = _ze_memory_allocation_properties_t; #[doc = ""] -#[doc = " @brief Forward-declare ze_fence_desc_t"] -pub type ze_fence_desc_t = _ze_fence_desc_t; +#[doc = " @brief Forward-declare ze_module_constants_t"] +pub type ze_module_constants_t = _ze_module_constants_t; #[doc = ""] -#[doc = " @brief Forward-declare ze_copy_region_t"] -pub type ze_copy_region_t = _ze_copy_region_t; +#[doc = " @brief Forward-declare ze_module_desc_t"] +pub type ze_module_desc_t = _ze_module_desc_t; #[doc = ""] -#[doc = " @brief Forward-declare ze_image_region_t"] -pub type ze_image_region_t = _ze_image_region_t; -#[repr(i32)] +#[doc = " @brief Forward-declare ze_module_properties_t"] +pub type ze_module_properties_t = _ze_module_properties_t; +#[doc = ""] +#[doc = " @brief Forward-declare ze_kernel_desc_t"] +pub type ze_kernel_desc_t = _ze_kernel_desc_t; +#[doc = ""] +#[doc = " @brief Forward-declare ze_kernel_uuid_t"] +pub type ze_kernel_uuid_t = _ze_kernel_uuid_t; +#[doc = ""] +#[doc = " @brief Forward-declare ze_kernel_properties_t"] +pub type ze_kernel_properties_t = _ze_kernel_properties_t; +#[doc = ""] +#[doc = " @brief Forward-declare ze_group_count_t"] +pub type ze_group_count_t = _ze_group_count_t; +#[doc = ""] +#[doc = " @brief Forward-declare ze_sampler_desc_t"] +pub type ze_sampler_desc_t = _ze_sampler_desc_t; +#[doc = ""] +#[doc = " @brief Forward-declare ze_physical_mem_desc_t"] +pub type ze_physical_mem_desc_t = _ze_physical_mem_desc_t; +impl _ze_init_flags_t { + #[doc = "< only initialize GPU drivers"] + pub const ZE_INIT_FLAG_GPU_ONLY: _ze_init_flags_t = _ze_init_flags_t(1); +} +impl _ze_init_flags_t { + pub const ZE_INIT_FLAG_FORCE_UINT32: _ze_init_flags_t = _ze_init_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_init_flags_t> for _ze_init_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_init_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_init_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_init_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_init_flags_t> for _ze_init_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_init_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_init_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_init_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] #[doc = ""] #[doc = " @brief Supported initialization flags"] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_init_flag_t { - #[doc = "< default behavior"] - ZE_INIT_FLAG_NONE = 0, - #[doc = "< only initialize GPU drivers"] - ZE_INIT_FLAG_GPU_ONLY = 1, -} +pub struct _ze_init_flags_t(pub u32); #[doc = ""] #[doc = " @brief Supported initialization flags"] -pub use self::_ze_init_flag_t as ze_init_flag_t; +pub use self::_ze_init_flags_t as ze_init_flags_t; extern "C" { #[doc = ""] - #[doc = " @brief Initialize the 'One API' driver and must be called before any other"] - #[doc = " API function"] + #[doc = " @brief Initialize the 'oneAPI' driver(s)"] #[doc = ""] #[doc = " @details"] + #[doc = " - This function must be called before any other API function."] #[doc = " - If this function is not called then all other functions will return"] #[doc = " ::ZE_RESULT_ERROR_UNINITIALIZED."] - #[doc = " - Only one instance of a driver per process will be initialized."] + #[doc = " - Only one instance of each driver will be initialized per process."] #[doc = " - This function is thread-safe for scenarios where multiple libraries"] - #[doc = " may initialize the driver simultaneously."] + #[doc = " may initialize the driver(s) simultaneously."] #[doc = ""] #[doc = " @returns"] #[doc = " - ::ZE_RESULT_SUCCESS"] #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + flags"] + #[doc = " + `0x1 < flags`"] #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] - pub fn zeInit(flags: ze_init_flag_t) -> ze_result_t; + pub fn zeInit(flags: ze_init_flags_t) -> ze_result_t; } extern "C" { #[doc = ""] @@ -389,6 +760,8 @@ extern "C" { #[doc = ""] #[doc = " @details"] #[doc = " - A driver represents a collection of physical devices."] + #[doc = " - Multiple calls to this function will return identical driver handles,"] + #[doc = " in the same order."] #[doc = " - The application may pass nullptr for pDrivers when only querying the"] #[doc = " number of drivers."] #[doc = " - The application may call this function from simultaneous threads."] @@ -406,7 +779,18 @@ extern "C" { #[doc = " + `nullptr == pCount`"] pub fn zeDriverGet(pCount: *mut u32, phDrivers: *mut ze_driver_handle_t) -> ze_result_t; } -#[repr(i32)] +impl _ze_api_version_t { + #[doc = "< version 1.0"] + pub const ZE_API_VERSION_1_0: _ze_api_version_t = _ze_api_version_t(65536); +} +impl _ze_api_version_t { + #[doc = "< latest known version"] + pub const ZE_API_VERSION_CURRENT: _ze_api_version_t = _ze_api_version_t(65536); +} +impl _ze_api_version_t { + pub const ZE_API_VERSION_FORCE_UINT32: _ze_api_version_t = _ze_api_version_t(2147483647); +} +#[repr(transparent)] #[doc = ""] #[doc = " @brief Supported API versions"] #[doc = ""] @@ -414,10 +798,7 @@ extern "C" { #[doc = " - API versions contain major and minor attributes, use"] #[doc = " ::ZE_MAJOR_VERSION and ::ZE_MINOR_VERSION"] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_api_version_t { - #[doc = "< 0.91"] - ZE_API_VERSION_1_0 = 91, -} +pub struct _ze_api_version_t(pub u32); #[doc = ""] #[doc = " @brief Supported API versions"] #[doc = ""] @@ -446,23 +827,12 @@ extern "C" { version: *mut ze_api_version_t, ) -> ze_result_t; } -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_driver_properties_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_driver_properties_version_t { - #[doc = "< version 0.91"] - ZE_DRIVER_PROPERTIES_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_driver_properties_t"] -pub use self::_ze_driver_properties_version_t as ze_driver_properties_version_t; #[doc = ""] #[doc = " @brief Driver universal unique id (UUID)"] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct _ze_driver_uuid_t { - #[doc = "< Opaque data representing a driver UUID"] + #[doc = "< [out] opaque data representing a driver UUID"] pub id: [u8; 16usize], } #[test] @@ -493,8 +863,10 @@ fn bindgen_test_layout__ze_driver_uuid_t() { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct _ze_driver_properties_t { - #[doc = "< [in] ::ZE_DRIVER_PROPERTIES_VERSION_CURRENT"] - pub version: ze_driver_properties_version_t, + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, #[doc = "< [out] universal unique identifier."] pub uuid: ze_driver_uuid_t, #[doc = "< [out] driver version"] @@ -506,27 +878,37 @@ pub struct _ze_driver_properties_t { fn bindgen_test_layout__ze_driver_properties_t() { assert_eq!( ::std::mem::size_of::<_ze_driver_properties_t>(), - 24usize, + 40usize, concat!("Size of: ", stringify!(_ze_driver_properties_t)) ); assert_eq!( ::std::mem::align_of::<_ze_driver_properties_t>(), - 4usize, + 8usize, concat!("Alignment of ", stringify!(_ze_driver_properties_t)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_driver_properties_t>())).version as *const _ as usize }, + unsafe { &(*(::std::ptr::null::<_ze_driver_properties_t>())).stype as *const _ as usize }, 0usize, concat!( "Offset of field: ", stringify!(_ze_driver_properties_t), "::", - stringify!(version) + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_driver_properties_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_driver_properties_t), + "::", + stringify!(pNext) ) ); assert_eq!( unsafe { &(*(::std::ptr::null::<_ze_driver_properties_t>())).uuid as *const _ as usize }, - 4usize, + 16usize, concat!( "Offset of field: ", stringify!(_ze_driver_properties_t), @@ -538,7 +920,7 @@ fn bindgen_test_layout__ze_driver_properties_t() { unsafe { &(*(::std::ptr::null::<_ze_driver_properties_t>())).driverVersion as *const _ as usize }, - 20usize, + 32usize, concat!( "Offset of field: ", stringify!(_ze_driver_properties_t), @@ -572,79 +954,113 @@ extern "C" { pDriverProperties: *mut ze_driver_properties_t, ) -> ze_result_t; } -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_driver_ipc_properties_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_driver_ipc_properties_version_t { - #[doc = "< version 0.91"] - ZE_DRIVER_IPC_PROPERTIES_VERSION_CURRENT = 91, +impl _ze_ipc_property_flags_t { + #[doc = "< Supports passing memory allocations between processes. See"] + #[doc = "< ::zeMemGetIpcHandle."] + pub const ZE_IPC_PROPERTY_FLAG_MEMORY: _ze_ipc_property_flags_t = _ze_ipc_property_flags_t(1); } +impl _ze_ipc_property_flags_t { + #[doc = "< Supports passing event pools between processes. See"] + #[doc = "< ::zeEventPoolGetIpcHandle."] + pub const ZE_IPC_PROPERTY_FLAG_EVENT_POOL: _ze_ipc_property_flags_t = + _ze_ipc_property_flags_t(2); +} +impl _ze_ipc_property_flags_t { + pub const ZE_IPC_PROPERTY_FLAG_FORCE_UINT32: _ze_ipc_property_flags_t = + _ze_ipc_property_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_ipc_property_flags_t> for _ze_ipc_property_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_ipc_property_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_ipc_property_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_ipc_property_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_ipc_property_flags_t> for _ze_ipc_property_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_ipc_property_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_ipc_property_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_ipc_property_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] #[doc = ""] -#[doc = " @brief API version of ::ze_driver_ipc_properties_t"] -pub use self::_ze_driver_ipc_properties_version_t as ze_driver_ipc_properties_version_t; +#[doc = " @brief Supported IPC property flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_ipc_property_flags_t(pub u32); #[doc = ""] -#[doc = " @brief IPC properties queried using ::zeDriverGetIPCProperties"] +#[doc = " @brief Supported IPC property flags"] +pub use self::_ze_ipc_property_flags_t as ze_ipc_property_flags_t; +#[doc = ""] +#[doc = " @brief IPC properties queried using ::zeDriverGetIpcProperties"] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct _ze_driver_ipc_properties_t { - #[doc = "< [in] ::ZE_DRIVER_IPC_PROPERTIES_VERSION_CURRENT"] - pub version: ze_driver_ipc_properties_version_t, - #[doc = "< [out] Supports passing memory allocations between processes. See"] - #[doc = "< ::::zeDriverGetMemIpcHandle."] - pub memsSupported: ze_bool_t, - #[doc = "< [out] Supports passing events between processes. See"] - #[doc = "< ::::zeEventPoolGetIpcHandle."] - pub eventsSupported: ze_bool_t, + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, + #[doc = "< [out] 0 (none) or a valid combination of ::ze_ipc_property_flags_t"] + pub flags: ze_ipc_property_flags_t, } #[test] fn bindgen_test_layout__ze_driver_ipc_properties_t() { assert_eq!( ::std::mem::size_of::<_ze_driver_ipc_properties_t>(), - 8usize, + 24usize, concat!("Size of: ", stringify!(_ze_driver_ipc_properties_t)) ); assert_eq!( ::std::mem::align_of::<_ze_driver_ipc_properties_t>(), - 4usize, + 8usize, concat!("Alignment of ", stringify!(_ze_driver_ipc_properties_t)) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_driver_ipc_properties_t>())).version as *const _ as usize + &(*(::std::ptr::null::<_ze_driver_ipc_properties_t>())).stype as *const _ as usize }, 0usize, concat!( "Offset of field: ", stringify!(_ze_driver_ipc_properties_t), "::", - stringify!(version) + stringify!(stype) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_driver_ipc_properties_t>())).memsSupported as *const _ - as usize + &(*(::std::ptr::null::<_ze_driver_ipc_properties_t>())).pNext as *const _ as usize }, - 4usize, + 8usize, concat!( "Offset of field: ", stringify!(_ze_driver_ipc_properties_t), "::", - stringify!(memsSupported) + stringify!(pNext) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_driver_ipc_properties_t>())).eventsSupported as *const _ - as usize + &(*(::std::ptr::null::<_ze_driver_ipc_properties_t>())).flags as *const _ as usize }, - 5usize, + 16usize, concat!( "Offset of field: ", stringify!(_ze_driver_ipc_properties_t), "::", - stringify!(eventsSupported) + stringify!(flags) ) ); } @@ -663,15 +1079,66 @@ extern "C" { #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] #[doc = " + `nullptr == hDriver`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pIPCProperties`"] - pub fn zeDriverGetIPCProperties( + #[doc = " + `nullptr == pIpcProperties`"] + pub fn zeDriverGetIpcProperties( hDriver: ze_driver_handle_t, - pIPCProperties: *mut ze_driver_ipc_properties_t, + pIpcProperties: *mut ze_driver_ipc_properties_t, ) -> ze_result_t; } +#[doc = ""] +#[doc = " @brief Extension properties queried using ::zeDriverGetExtensionProperties"] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _ze_driver_extension_properties_t { + #[doc = "< [out] extension name"] + pub name: [::std::os::raw::c_char; 256usize], + #[doc = "< [out] extension version using ::ZE_MAKE_VERSION"] + pub version: u32, +} +#[test] +fn bindgen_test_layout__ze_driver_extension_properties_t() { + assert_eq!( + ::std::mem::size_of::<_ze_driver_extension_properties_t>(), + 260usize, + concat!("Size of: ", stringify!(_ze_driver_extension_properties_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_driver_extension_properties_t>(), + 4usize, + concat!( + "Alignment of ", + stringify!(_ze_driver_extension_properties_t) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_driver_extension_properties_t>())).name as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_driver_extension_properties_t), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_driver_extension_properties_t>())).version as *const _ + as usize + }, + 256usize, + concat!( + "Offset of field: ", + stringify!(_ze_driver_extension_properties_t), + "::", + stringify!(version) + ) + ); +} extern "C" { #[doc = ""] - #[doc = " @brief Retrieves an extension function for the specified driver"] + #[doc = " @brief Retrieves extension properties"] #[doc = ""] #[doc = " @details"] #[doc = " - The application may call this function from simultaneous threads."] @@ -679,7 +1146,7 @@ extern "C" { #[doc = ""] #[doc = " @remarks"] #[doc = " _Analogues_"] - #[doc = " - **clGetExtensionFunctionAddressForPlatform**"] + #[doc = " - **vkEnumerateInstanceExtensionProperties**"] #[doc = ""] #[doc = " @returns"] #[doc = " - ::ZE_RESULT_SUCCESS"] @@ -688,12 +1155,11 @@ extern "C" { #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] #[doc = " + `nullptr == hDriver`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pFuncName`"] - #[doc = " + `nullptr == pfunc`"] - pub fn zeDriverGetExtensionFunctionAddress( + #[doc = " + `nullptr == pCount`"] + pub fn zeDriverGetExtensionProperties( hDriver: ze_driver_handle_t, - pFuncName: *const ::std::os::raw::c_char, - pfunc: *mut *mut ::std::os::raw::c_void, + pCount: *mut u32, + pExtensionProperties: *mut ze_driver_extension_properties_t, ) -> ze_result_t; } extern "C" { @@ -701,6 +1167,11 @@ extern "C" { #[doc = " @brief Retrieves devices within a driver"] #[doc = ""] #[doc = " @details"] + #[doc = " - Multiple calls to this function will return identical device handles,"] + #[doc = " in the same order."] + #[doc = " - The number and order of handles returned from this function is"] + #[doc = " affected by the ::ZE_AFFINITY_MASK and ::ZE_ENABLE_PCI_ID_DEVICE_ORDER"] + #[doc = " environment variables."] #[doc = " - The application may call this function from simultaneous threads."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -723,6 +1194,10 @@ extern "C" { #[doc = " @brief Retrieves a sub-device from a device"] #[doc = ""] #[doc = " @details"] + #[doc = " - Multiple calls to this function will return identical device handles,"] + #[doc = " in the same order."] + #[doc = " - The number of handles returned from this function is affected by the"] + #[doc = " ::ZE_AFFINITY_MASK environment variable."] #[doc = " - The application may call this function from simultaneous threads."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -744,27 +1219,30 @@ extern "C" { phSubdevices: *mut ze_device_handle_t, ) -> ze_result_t; } -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_device_properties_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_device_properties_version_t { - #[doc = "< version 0.91"] - ZE_DEVICE_PROPERTIES_VERSION_CURRENT = 91, +impl _ze_device_type_t { + #[doc = "< Graphics Processing Unit"] + pub const ZE_DEVICE_TYPE_GPU: _ze_device_type_t = _ze_device_type_t(1); } -#[doc = ""] -#[doc = " @brief API version of ::ze_device_properties_t"] -pub use self::_ze_device_properties_version_t as ze_device_properties_version_t; -#[repr(i32)] +impl _ze_device_type_t { + #[doc = "< Central Processing Unit"] + pub const ZE_DEVICE_TYPE_CPU: _ze_device_type_t = _ze_device_type_t(2); +} +impl _ze_device_type_t { + #[doc = "< Field Programmable Gate Array"] + pub const ZE_DEVICE_TYPE_FPGA: _ze_device_type_t = _ze_device_type_t(3); +} +impl _ze_device_type_t { + #[doc = "< Memory Copy Accelerator"] + pub const ZE_DEVICE_TYPE_MCA: _ze_device_type_t = _ze_device_type_t(4); +} +impl _ze_device_type_t { + pub const ZE_DEVICE_TYPE_FORCE_UINT32: _ze_device_type_t = _ze_device_type_t(2147483647); +} +#[repr(transparent)] #[doc = ""] #[doc = " @brief Supported device types"] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_device_type_t { - #[doc = "< Graphics Processing Unit"] - ZE_DEVICE_TYPE_GPU = 1, - #[doc = "< Field Programmable Gate Array"] - ZE_DEVICE_TYPE_FPGA = 2, -} +pub struct _ze_device_type_t(pub u32); #[doc = ""] #[doc = " @brief Supported device types"] pub use self::_ze_device_type_t as ze_device_type_t; @@ -773,7 +1251,7 @@ pub use self::_ze_device_type_t as ze_device_type_t; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct _ze_device_uuid_t { - #[doc = "< Opaque data representing a device UUID"] + #[doc = "< [out] opaque data representing a device UUID"] pub id: [u8; 16usize], } #[test] @@ -799,39 +1277,90 @@ fn bindgen_test_layout__ze_device_uuid_t() { ) ); } +impl _ze_device_property_flags_t { + #[doc = "< Device is integrated with the Host."] + pub const ZE_DEVICE_PROPERTY_FLAG_INTEGRATED: _ze_device_property_flags_t = + _ze_device_property_flags_t(1); +} +impl _ze_device_property_flags_t { + #[doc = "< Device handle used for query represents a sub-device."] + pub const ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE: _ze_device_property_flags_t = + _ze_device_property_flags_t(2); +} +impl _ze_device_property_flags_t { + #[doc = "< Device supports error correction memory access."] + pub const ZE_DEVICE_PROPERTY_FLAG_ECC: _ze_device_property_flags_t = + _ze_device_property_flags_t(4); +} +impl _ze_device_property_flags_t { + #[doc = "< Device supports on-demand page-faulting."] + pub const ZE_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING: _ze_device_property_flags_t = + _ze_device_property_flags_t(8); +} +impl _ze_device_property_flags_t { + pub const ZE_DEVICE_PROPERTY_FLAG_FORCE_UINT32: _ze_device_property_flags_t = + _ze_device_property_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_device_property_flags_t> for _ze_device_property_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_device_property_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_device_property_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_device_property_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_device_property_flags_t> for _ze_device_property_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_device_property_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_device_property_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_device_property_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported device property flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_device_property_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported device property flags"] +pub use self::_ze_device_property_flags_t as ze_device_property_flags_t; #[doc = ""] #[doc = " @brief Device properties queried using ::zeDeviceGetProperties"] #[repr(C)] #[derive(Copy, Clone)] pub struct _ze_device_properties_t { - #[doc = "< [in] ::ZE_DEVICE_PROPERTIES_VERSION_CURRENT"] - pub version: ze_device_properties_version_t, + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, #[doc = "< [out] generic device type"] pub type_: ze_device_type_t, #[doc = "< [out] vendor id from PCI configuration"] pub vendorId: u32, #[doc = "< [out] device id from PCI configuration"] pub deviceId: u32, - #[doc = "< [out] universal unique identifier."] - pub uuid: ze_device_uuid_t, - #[doc = "< [out] If the device handle used for query represents a sub-device."] - pub isSubdevice: ze_bool_t, - #[doc = "< [out] sub-device id. Only valid if isSubdevice is true."] + #[doc = "< [out] 0 (none) or a valid combination of ::ze_device_property_flags_t"] + pub flags: ze_device_property_flags_t, + #[doc = "< [out] sub-device id. Only valid if ::ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE"] + #[doc = "< is set."] pub subdeviceId: u32, #[doc = "< [out] Clock rate for device core."] pub coreClockRate: u32, - #[doc = "< [out] Supports unified physical memory between Host and device."] - pub unifiedMemorySupported: ze_bool_t, - #[doc = "< [out] Supports error correction memory access."] - pub eccMemorySupported: ze_bool_t, - #[doc = "< [out] Supports on-demand page-faulting."] - pub onDemandPageFaultsSupported: ze_bool_t, - #[doc = "< [out] Maximum number of logical command queues."] - pub maxCommandQueues: u32, - #[doc = "< [out] Number of asynchronous compute engines"] - pub numAsyncComputeEngines: u32, - #[doc = "< [out] Number of asynchronous copy engines"] - pub numAsyncCopyEngines: u32, + #[doc = "< [out] Maximum memory allocation size."] + pub maxMemAllocSize: u64, + #[doc = "< [out] Maximum number of logical hardware contexts."] + pub maxHardwareContexts: u32, #[doc = "< [out] Maximum priority for command queues. Higher value is higher"] #[doc = "< priority."] pub maxCommandQueuePriority: u32, @@ -848,6 +1377,13 @@ pub struct _ze_device_properties_t { #[doc = "< [out] Returns the resolution of device timer in nanoseconds used for"] #[doc = "< profiling, timestamps, etc."] pub timerResolution: u64, + #[doc = "< [out] Returns the number of valid bits in the timestamp value."] + pub timestampValidBits: u32, + #[doc = "< [out] Returns the number of valid bits in the kernel timestamp values"] + pub kernelTimestampValidBits: u32, + #[doc = "< [out] universal unique identifier. Note: Subdevices will have their"] + #[doc = "< own uuid."] + pub uuid: ze_device_uuid_t, #[doc = "< [out] Device name"] pub name: [::std::os::raw::c_char; 256usize], } @@ -855,7 +1391,7 @@ pub struct _ze_device_properties_t { fn bindgen_test_layout__ze_device_properties_t() { assert_eq!( ::std::mem::size_of::<_ze_device_properties_t>(), - 352usize, + 368usize, concat!("Size of: ", stringify!(_ze_device_properties_t)) ); assert_eq!( @@ -864,18 +1400,28 @@ fn bindgen_test_layout__ze_device_properties_t() { concat!("Alignment of ", stringify!(_ze_device_properties_t)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).version as *const _ as usize }, + unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).stype as *const _ as usize }, 0usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), "::", - stringify!(version) + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_properties_t), + "::", + stringify!(pNext) ) ); assert_eq!( unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).type_ as *const _ as usize }, - 4usize, + 16usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), @@ -887,7 +1433,7 @@ fn bindgen_test_layout__ze_device_properties_t() { unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).vendorId as *const _ as usize }, - 8usize, + 20usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), @@ -899,7 +1445,7 @@ fn bindgen_test_layout__ze_device_properties_t() { unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).deviceId as *const _ as usize }, - 12usize, + 24usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), @@ -908,32 +1454,20 @@ fn bindgen_test_layout__ze_device_properties_t() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).uuid as *const _ as usize }, - 16usize, + unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).flags as *const _ as usize }, + 28usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), "::", - stringify!(uuid) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_properties_t>())).isSubdevice as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_properties_t), - "::", - stringify!(isSubdevice) + stringify!(flags) ) ); assert_eq!( unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).subdeviceId as *const _ as usize }, - 36usize, + 32usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), @@ -945,7 +1479,7 @@ fn bindgen_test_layout__ze_device_properties_t() { unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).coreClockRate as *const _ as usize }, - 40usize, + 36usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), @@ -955,46 +1489,19 @@ fn bindgen_test_layout__ze_device_properties_t() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_properties_t>())).unifiedMemorySupported as *const _ - as usize + &(*(::std::ptr::null::<_ze_device_properties_t>())).maxMemAllocSize as *const _ as usize }, - 44usize, + 40usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), "::", - stringify!(unifiedMemorySupported) + stringify!(maxMemAllocSize) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_properties_t>())).eccMemorySupported as *const _ - as usize - }, - 45usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_properties_t), - "::", - stringify!(eccMemorySupported) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_properties_t>())).onDemandPageFaultsSupported - as *const _ as usize - }, - 46usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_properties_t), - "::", - stringify!(onDemandPageFaultsSupported) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_properties_t>())).maxCommandQueues as *const _ + &(*(::std::ptr::null::<_ze_device_properties_t>())).maxHardwareContexts as *const _ as usize }, 48usize, @@ -1002,33 +1509,7 @@ fn bindgen_test_layout__ze_device_properties_t() { "Offset of field: ", stringify!(_ze_device_properties_t), "::", - stringify!(maxCommandQueues) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_properties_t>())).numAsyncComputeEngines as *const _ - as usize - }, - 52usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_properties_t), - "::", - stringify!(numAsyncComputeEngines) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_properties_t>())).numAsyncCopyEngines as *const _ - as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_properties_t), - "::", - stringify!(numAsyncCopyEngines) + stringify!(maxHardwareContexts) ) ); assert_eq!( @@ -1036,7 +1517,7 @@ fn bindgen_test_layout__ze_device_properties_t() { &(*(::std::ptr::null::<_ze_device_properties_t>())).maxCommandQueuePriority as *const _ as usize }, - 60usize, + 52usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), @@ -1048,7 +1529,7 @@ fn bindgen_test_layout__ze_device_properties_t() { unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).numThreadsPerEU as *const _ as usize }, - 64usize, + 56usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), @@ -1061,7 +1542,7 @@ fn bindgen_test_layout__ze_device_properties_t() { &(*(::std::ptr::null::<_ze_device_properties_t>())).physicalEUSimdWidth as *const _ as usize }, - 68usize, + 60usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), @@ -1074,7 +1555,7 @@ fn bindgen_test_layout__ze_device_properties_t() { &(*(::std::ptr::null::<_ze_device_properties_t>())).numEUsPerSubslice as *const _ as usize }, - 72usize, + 64usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), @@ -1087,7 +1568,7 @@ fn bindgen_test_layout__ze_device_properties_t() { &(*(::std::ptr::null::<_ze_device_properties_t>())).numSubslicesPerSlice as *const _ as usize }, - 76usize, + 68usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), @@ -1099,7 +1580,7 @@ fn bindgen_test_layout__ze_device_properties_t() { unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).numSlices as *const _ as usize }, - 80usize, + 72usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), @@ -1111,7 +1592,7 @@ fn bindgen_test_layout__ze_device_properties_t() { unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).timerResolution as *const _ as usize }, - 88usize, + 80usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), @@ -1120,8 +1601,44 @@ fn bindgen_test_layout__ze_device_properties_t() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).name as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::<_ze_device_properties_t>())).timestampValidBits as *const _ + as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_properties_t), + "::", + stringify!(timestampValidBits) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_properties_t>())).kernelTimestampValidBits as *const _ + as usize + }, + 92usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_properties_t), + "::", + stringify!(kernelTimestampValidBits) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).uuid as *const _ as usize }, 96usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_properties_t), + "::", + stringify!(uuid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_device_properties_t>())).name as *const _ as usize }, + 112usize, concat!( "Offset of field: ", stringify!(_ze_device_properties_t), @@ -1155,26 +1672,17 @@ extern "C" { pDeviceProperties: *mut ze_device_properties_t, ) -> ze_result_t; } -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_device_compute_properties_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_device_compute_properties_version_t { - #[doc = "< version 0.91"] - ZE_DEVICE_COMPUTE_PROPERTIES_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_device_compute_properties_t"] -pub use self::_ze_device_compute_properties_version_t as ze_device_compute_properties_version_t; #[doc = ""] #[doc = " @brief Device compute properties queried using ::zeDeviceGetComputeProperties"] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct _ze_device_compute_properties_t { - #[doc = "< [in] ::ZE_DEVICE_COMPUTE_PROPERTIES_VERSION_CURRENT"] - pub version: ze_device_compute_properties_version_t, - #[doc = "< [out] Maximum items per compute group. (maxGroupSizeX * maxGroupSizeY"] - #[doc = "< * maxGroupSizeZ) <= maxTotalGroupSize"] + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, + #[doc = "< [out] Maximum items per compute group. (groupSizeX * groupSizeY *"] + #[doc = "< groupSizeZ) <= maxTotalGroupSize"] pub maxTotalGroupSize: u32, #[doc = "< [out] Maximum items for X dimension in group"] pub maxGroupSizeX: u32, @@ -1200,24 +1708,36 @@ pub struct _ze_device_compute_properties_t { fn bindgen_test_layout__ze_device_compute_properties_t() { assert_eq!( ::std::mem::size_of::<_ze_device_compute_properties_t>(), - 72usize, + 88usize, concat!("Size of: ", stringify!(_ze_device_compute_properties_t)) ); assert_eq!( ::std::mem::align_of::<_ze_device_compute_properties_t>(), - 4usize, + 8usize, concat!("Alignment of ", stringify!(_ze_device_compute_properties_t)) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_compute_properties_t>())).version as *const _ as usize + &(*(::std::ptr::null::<_ze_device_compute_properties_t>())).stype as *const _ as usize }, 0usize, concat!( "Offset of field: ", stringify!(_ze_device_compute_properties_t), "::", - stringify!(version) + stringify!(stype) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_compute_properties_t>())).pNext as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_compute_properties_t), + "::", + stringify!(pNext) ) ); assert_eq!( @@ -1225,7 +1745,7 @@ fn bindgen_test_layout__ze_device_compute_properties_t() { &(*(::std::ptr::null::<_ze_device_compute_properties_t>())).maxTotalGroupSize as *const _ as usize }, - 4usize, + 16usize, concat!( "Offset of field: ", stringify!(_ze_device_compute_properties_t), @@ -1238,7 +1758,7 @@ fn bindgen_test_layout__ze_device_compute_properties_t() { &(*(::std::ptr::null::<_ze_device_compute_properties_t>())).maxGroupSizeX as *const _ as usize }, - 8usize, + 20usize, concat!( "Offset of field: ", stringify!(_ze_device_compute_properties_t), @@ -1251,7 +1771,7 @@ fn bindgen_test_layout__ze_device_compute_properties_t() { &(*(::std::ptr::null::<_ze_device_compute_properties_t>())).maxGroupSizeY as *const _ as usize }, - 12usize, + 24usize, concat!( "Offset of field: ", stringify!(_ze_device_compute_properties_t), @@ -1264,7 +1784,7 @@ fn bindgen_test_layout__ze_device_compute_properties_t() { &(*(::std::ptr::null::<_ze_device_compute_properties_t>())).maxGroupSizeZ as *const _ as usize }, - 16usize, + 28usize, concat!( "Offset of field: ", stringify!(_ze_device_compute_properties_t), @@ -1277,7 +1797,7 @@ fn bindgen_test_layout__ze_device_compute_properties_t() { &(*(::std::ptr::null::<_ze_device_compute_properties_t>())).maxGroupCountX as *const _ as usize }, - 20usize, + 32usize, concat!( "Offset of field: ", stringify!(_ze_device_compute_properties_t), @@ -1290,7 +1810,7 @@ fn bindgen_test_layout__ze_device_compute_properties_t() { &(*(::std::ptr::null::<_ze_device_compute_properties_t>())).maxGroupCountY as *const _ as usize }, - 24usize, + 36usize, concat!( "Offset of field: ", stringify!(_ze_device_compute_properties_t), @@ -1303,7 +1823,7 @@ fn bindgen_test_layout__ze_device_compute_properties_t() { &(*(::std::ptr::null::<_ze_device_compute_properties_t>())).maxGroupCountZ as *const _ as usize }, - 28usize, + 40usize, concat!( "Offset of field: ", stringify!(_ze_device_compute_properties_t), @@ -1316,7 +1836,7 @@ fn bindgen_test_layout__ze_device_compute_properties_t() { &(*(::std::ptr::null::<_ze_device_compute_properties_t>())).maxSharedLocalMemory as *const _ as usize }, - 32usize, + 44usize, concat!( "Offset of field: ", stringify!(_ze_device_compute_properties_t), @@ -1329,7 +1849,7 @@ fn bindgen_test_layout__ze_device_compute_properties_t() { &(*(::std::ptr::null::<_ze_device_compute_properties_t>())).numSubGroupSizes as *const _ as usize }, - 36usize, + 48usize, concat!( "Offset of field: ", stringify!(_ze_device_compute_properties_t), @@ -1342,7 +1862,7 @@ fn bindgen_test_layout__ze_device_compute_properties_t() { &(*(::std::ptr::null::<_ze_device_compute_properties_t>())).subGroupSizes as *const _ as usize }, - 40usize, + 52usize, concat!( "Offset of field: ", stringify!(_ze_device_compute_properties_t), @@ -1376,23 +1896,12 @@ extern "C" { pComputeProperties: *mut ze_device_compute_properties_t, ) -> ze_result_t; } -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_device_kernel_properties_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_device_kernel_properties_version_t { - #[doc = "< version 0.91"] - ZE_DEVICE_KERNEL_PROPERTIES_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_device_kernel_properties_t"] -pub use self::_ze_device_kernel_properties_version_t as ze_device_kernel_properties_version_t; #[doc = ""] #[doc = " @brief Native kernel universal unique id (UUID)"] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct _ze_native_kernel_uuid_t { - #[doc = "< Opaque data representing a native kernel UUID"] + #[doc = "< [out] opaque data representing a native kernel UUID"] pub id: [u8; 16usize], } #[test] @@ -1418,51 +1927,164 @@ fn bindgen_test_layout__ze_native_kernel_uuid_t() { ) ); } -#[repr(i32)] +impl _ze_device_module_flags_t { + #[doc = "< Device supports 16-bit floating-point operations"] + pub const ZE_DEVICE_MODULE_FLAG_FP16: _ze_device_module_flags_t = _ze_device_module_flags_t(1); +} +impl _ze_device_module_flags_t { + #[doc = "< Device supports 64-bit floating-point operations"] + pub const ZE_DEVICE_MODULE_FLAG_FP64: _ze_device_module_flags_t = _ze_device_module_flags_t(2); +} +impl _ze_device_module_flags_t { + #[doc = "< Device supports 64-bit atomic operations"] + pub const ZE_DEVICE_MODULE_FLAG_INT64_ATOMICS: _ze_device_module_flags_t = + _ze_device_module_flags_t(4); +} +impl _ze_device_module_flags_t { + #[doc = "< Device supports four component dot product and accumulate operations"] + pub const ZE_DEVICE_MODULE_FLAG_DP4A: _ze_device_module_flags_t = _ze_device_module_flags_t(8); +} +impl _ze_device_module_flags_t { + pub const ZE_DEVICE_MODULE_FLAG_FORCE_UINT32: _ze_device_module_flags_t = + _ze_device_module_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_device_module_flags_t> for _ze_device_module_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_device_module_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_device_module_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_device_module_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_device_module_flags_t> for _ze_device_module_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_device_module_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_device_module_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_device_module_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] #[doc = ""] -#[doc = " @brief Floating Point capabilities"] -#[doc = ""] -#[doc = " @details"] -#[doc = " - floating-point capabilities of the device."] +#[doc = " @brief Supported device module flags"] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_fp_capabilities_t { - #[doc = "< None"] - ZE_FP_CAPS_NONE = 0, +pub struct _ze_device_module_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported device module flags"] +pub use self::_ze_device_module_flags_t as ze_device_module_flags_t; +impl _ze_device_fp_flags_t { #[doc = "< Supports denorms"] - ZE_FP_CAPS_DENORM = 1, + pub const ZE_DEVICE_FP_FLAG_DENORM: _ze_device_fp_flags_t = _ze_device_fp_flags_t(1); +} +impl _ze_device_fp_flags_t { #[doc = "< Supports INF and quiet NaNs"] - ZE_FP_CAPS_INF_NAN = 2, + pub const ZE_DEVICE_FP_FLAG_INF_NAN: _ze_device_fp_flags_t = _ze_device_fp_flags_t(2); +} +impl _ze_device_fp_flags_t { #[doc = "< Supports rounding to nearest even rounding mode"] - ZE_FP_CAPS_ROUND_TO_NEAREST = 4, + pub const ZE_DEVICE_FP_FLAG_ROUND_TO_NEAREST: _ze_device_fp_flags_t = _ze_device_fp_flags_t(4); +} +impl _ze_device_fp_flags_t { #[doc = "< Supports rounding to zero."] - ZE_FP_CAPS_ROUND_TO_ZERO = 8, + pub const ZE_DEVICE_FP_FLAG_ROUND_TO_ZERO: _ze_device_fp_flags_t = _ze_device_fp_flags_t(8); +} +impl _ze_device_fp_flags_t { #[doc = "< Supports rounding to both positive and negative INF."] - ZE_FP_CAPS_ROUND_TO_INF = 16, + pub const ZE_DEVICE_FP_FLAG_ROUND_TO_INF: _ze_device_fp_flags_t = _ze_device_fp_flags_t(16); +} +impl _ze_device_fp_flags_t { #[doc = "< Supports IEEE754-2008 fused multiply-add."] - ZE_FP_CAPS_FMA = 32, + pub const ZE_DEVICE_FP_FLAG_FMA: _ze_device_fp_flags_t = _ze_device_fp_flags_t(32); +} +impl _ze_device_fp_flags_t { #[doc = "< Supports rounding as defined by IEEE754 for divide and sqrt"] #[doc = "< operations."] - ZE_FP_CAPS_ROUNDED_DIVIDE_SQRT = 64, - #[doc = "< Uses software implementation for basic floating-point operations."] - ZE_FP_CAPS_SOFT_FLOAT = 128, + pub const ZE_DEVICE_FP_FLAG_ROUNDED_DIVIDE_SQRT: _ze_device_fp_flags_t = + _ze_device_fp_flags_t(64); } +impl _ze_device_fp_flags_t { + #[doc = "< Uses software implementation for basic floating-point operations."] + pub const ZE_DEVICE_FP_FLAG_SOFT_FLOAT: _ze_device_fp_flags_t = _ze_device_fp_flags_t(128); +} +impl _ze_device_fp_flags_t { + pub const ZE_DEVICE_FP_FLAG_FORCE_UINT32: _ze_device_fp_flags_t = + _ze_device_fp_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_device_fp_flags_t> for _ze_device_fp_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_device_fp_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_device_fp_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_device_fp_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_device_fp_flags_t> for _ze_device_fp_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_device_fp_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_device_fp_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_device_fp_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] #[doc = ""] -#[doc = " @brief Floating Point capabilities"] +#[doc = " @brief Supported floating-Point capability flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_device_fp_flags_t(pub u32); #[doc = ""] -#[doc = " @details"] -#[doc = " - floating-point capabilities of the device."] -pub use self::_ze_fp_capabilities_t as ze_fp_capabilities_t; +#[doc = " @brief Supported floating-Point capability flags"] +pub use self::_ze_device_fp_flags_t as ze_device_fp_flags_t; #[doc = ""] -#[doc = " @brief Device properties queried using ::zeDeviceGetKernelProperties"] +#[doc = " @brief Device module properties queried using ::zeDeviceGetModuleProperties"] #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct _ze_device_kernel_properties_t { - #[doc = "< [in] ::ZE_DEVICE_KERNEL_PROPERTIES_VERSION_CURRENT"] - pub version: ze_device_kernel_properties_version_t, +pub struct _ze_device_module_properties_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, #[doc = "< [out] Maximum supported SPIR-V version."] #[doc = "< Returns zero if SPIR-V is not supported."] #[doc = "< Contains major and minor attributes, use ::ZE_MAJOR_VERSION and ::ZE_MINOR_VERSION."] pub spirvVersionSupported: u32, + #[doc = "< [out] 0 or a valid combination of ::ze_device_module_flags_t"] + pub flags: ze_device_module_flags_t, + #[doc = "< [out] Capabilities for half-precision floating-point operations."] + #[doc = "< returns 0 (if ::ZE_DEVICE_MODULE_FLAG_FP16 is not set) or a"] + #[doc = "< combination of ::ze_device_fp_flags_t."] + pub fp16flags: ze_device_fp_flags_t, + #[doc = "< [out] Capabilities for single-precision floating-point operations."] + #[doc = "< returns a combination of ::ze_device_fp_flags_t."] + pub fp32flags: ze_device_fp_flags_t, + #[doc = "< [out] Capabilities for double-precision floating-point operations."] + #[doc = "< returns 0 (if ::ZE_DEVICE_MODULE_FLAG_FP64 is not set) or a"] + #[doc = "< combination of ::ze_device_fp_flags_t."] + pub fp64flags: ze_device_fp_flags_t, + #[doc = "< [out] Maximum kernel argument size that is supported."] + pub maxArgumentsSize: u32, + #[doc = "< [out] Maximum size of internal buffer that holds output of printf"] + #[doc = "< calls from kernel."] + pub printfBufferSize: u32, #[doc = "< [out] Compatibility UUID of supported native kernel."] #[doc = "< UUID may or may not be the same across driver release, devices, or"] #[doc = "< operating systems."] @@ -1470,197 +2092,150 @@ pub struct _ze_device_kernel_properties_t { #[doc = "< module using"] #[doc = "< previously created native kernel."] pub nativeKernelSupported: ze_native_kernel_uuid_t, - #[doc = "< [out] Supports 16-bit floating-point operations"] - pub fp16Supported: ze_bool_t, - #[doc = "< [out] Supports 64-bit floating-point operations"] - pub fp64Supported: ze_bool_t, - #[doc = "< [out] Supports 64-bit atomic operations"] - pub int64AtomicsSupported: ze_bool_t, - #[doc = "< [out] Supports four component dot product and accumulate operations"] - pub dp4aSupported: ze_bool_t, - #[doc = "< [out] Capabilities for half-precision floating-point operations."] - pub halfFpCapabilities: ze_fp_capabilities_t, - #[doc = "< [out] Capabilities for single-precision floating-point operations."] - pub singleFpCapabilities: ze_fp_capabilities_t, - #[doc = "< [out] Capabilities for double-precision floating-point operations."] - pub doubleFpCapabilities: ze_fp_capabilities_t, - #[doc = "< [out] Maximum kernel argument size that is supported."] - pub maxArgumentsSize: u32, - #[doc = "< [out] Maximum size of internal buffer that holds output of printf"] - #[doc = "< calls from kernel."] - pub printfBufferSize: u32, } #[test] -fn bindgen_test_layout__ze_device_kernel_properties_t() { +fn bindgen_test_layout__ze_device_module_properties_t() { assert_eq!( - ::std::mem::size_of::<_ze_device_kernel_properties_t>(), - 48usize, - concat!("Size of: ", stringify!(_ze_device_kernel_properties_t)) + ::std::mem::size_of::<_ze_device_module_properties_t>(), + 64usize, + concat!("Size of: ", stringify!(_ze_device_module_properties_t)) ); assert_eq!( - ::std::mem::align_of::<_ze_device_kernel_properties_t>(), - 4usize, - concat!("Alignment of ", stringify!(_ze_device_kernel_properties_t)) + ::std::mem::align_of::<_ze_device_module_properties_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_device_module_properties_t)) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_kernel_properties_t>())).version as *const _ as usize + &(*(::std::ptr::null::<_ze_device_module_properties_t>())).stype as *const _ as usize }, 0usize, concat!( "Offset of field: ", - stringify!(_ze_device_kernel_properties_t), + stringify!(_ze_device_module_properties_t), "::", - stringify!(version) + stringify!(stype) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_kernel_properties_t>())).spirvVersionSupported - as *const _ as usize + &(*(::std::ptr::null::<_ze_device_module_properties_t>())).pNext as *const _ as usize }, - 4usize, + 8usize, concat!( "Offset of field: ", - stringify!(_ze_device_kernel_properties_t), + stringify!(_ze_device_module_properties_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_module_properties_t>())).spirvVersionSupported + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_module_properties_t), "::", stringify!(spirvVersionSupported) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_kernel_properties_t>())).nativeKernelSupported - as *const _ as usize + &(*(::std::ptr::null::<_ze_device_module_properties_t>())).flags as *const _ as usize }, - 8usize, + 20usize, concat!( "Offset of field: ", - stringify!(_ze_device_kernel_properties_t), + stringify!(_ze_device_module_properties_t), "::", - stringify!(nativeKernelSupported) + stringify!(flags) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_kernel_properties_t>())).fp16Supported as *const _ + &(*(::std::ptr::null::<_ze_device_module_properties_t>())).fp16flags as *const _ as usize }, 24usize, concat!( "Offset of field: ", - stringify!(_ze_device_kernel_properties_t), + stringify!(_ze_device_module_properties_t), "::", - stringify!(fp16Supported) + stringify!(fp16flags) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_kernel_properties_t>())).fp64Supported as *const _ + &(*(::std::ptr::null::<_ze_device_module_properties_t>())).fp32flags as *const _ as usize }, - 25usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_kernel_properties_t), - "::", - stringify!(fp64Supported) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_kernel_properties_t>())).int64AtomicsSupported - as *const _ as usize - }, - 26usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_kernel_properties_t), - "::", - stringify!(int64AtomicsSupported) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_kernel_properties_t>())).dp4aSupported as *const _ - as usize - }, - 27usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_kernel_properties_t), - "::", - stringify!(dp4aSupported) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_kernel_properties_t>())).halfFpCapabilities - as *const _ as usize - }, 28usize, concat!( "Offset of field: ", - stringify!(_ze_device_kernel_properties_t), + stringify!(_ze_device_module_properties_t), "::", - stringify!(halfFpCapabilities) + stringify!(fp32flags) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_kernel_properties_t>())).singleFpCapabilities - as *const _ as usize + &(*(::std::ptr::null::<_ze_device_module_properties_t>())).fp64flags as *const _ + as usize }, 32usize, concat!( "Offset of field: ", - stringify!(_ze_device_kernel_properties_t), + stringify!(_ze_device_module_properties_t), "::", - stringify!(singleFpCapabilities) + stringify!(fp64flags) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_kernel_properties_t>())).doubleFpCapabilities - as *const _ as usize + &(*(::std::ptr::null::<_ze_device_module_properties_t>())).maxArgumentsSize as *const _ + as usize }, 36usize, concat!( "Offset of field: ", - stringify!(_ze_device_kernel_properties_t), - "::", - stringify!(doubleFpCapabilities) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_kernel_properties_t>())).maxArgumentsSize as *const _ - as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_kernel_properties_t), + stringify!(_ze_device_module_properties_t), "::", stringify!(maxArgumentsSize) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_kernel_properties_t>())).printfBufferSize as *const _ + &(*(::std::ptr::null::<_ze_device_module_properties_t>())).printfBufferSize as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_module_properties_t), + "::", + stringify!(printfBufferSize) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_module_properties_t>())).nativeKernelSupported + as *const _ as usize + }, 44usize, concat!( "Offset of field: ", - stringify!(_ze_device_kernel_properties_t), + stringify!(_ze_device_module_properties_t), "::", - stringify!(printfBufferSize) + stringify!(nativeKernelSupported) ) ); } extern "C" { #[doc = ""] - #[doc = " @brief Retrieves kernel properties of the device"] + #[doc = " @brief Retrieves module properties of the device"] #[doc = ""] #[doc = " @details"] #[doc = " - The application may call this function from simultaneous threads."] @@ -1673,43 +2248,281 @@ extern "C" { #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] #[doc = " + `nullptr == hDevice`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pKernelProperties`"] - pub fn zeDeviceGetKernelProperties( + #[doc = " + `nullptr == pModuleProperties`"] + pub fn zeDeviceGetModuleProperties( hDevice: ze_device_handle_t, - pKernelProperties: *mut ze_device_kernel_properties_t, + pModuleProperties: *mut ze_device_module_properties_t, ) -> ze_result_t; } -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_device_memory_properties_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_device_memory_properties_version_t { - #[doc = "< version 0.91"] - ZE_DEVICE_MEMORY_PROPERTIES_VERSION_CURRENT = 91, +impl _ze_command_queue_group_property_flags_t { + #[doc = "< Command queue group supports enqueing compute commands."] + pub const ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE: + _ze_command_queue_group_property_flags_t = _ze_command_queue_group_property_flags_t(1); } +impl _ze_command_queue_group_property_flags_t { + #[doc = "< Command queue group supports enqueing copy commands."] + pub const ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY: _ze_command_queue_group_property_flags_t = + _ze_command_queue_group_property_flags_t(2); +} +impl _ze_command_queue_group_property_flags_t { + #[doc = "< Command queue group supports cooperative kernels."] + #[doc = "< See ::zeCommandListAppendLaunchCooperativeKernel for more details."] + pub const ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS: + _ze_command_queue_group_property_flags_t = _ze_command_queue_group_property_flags_t(4); +} +impl _ze_command_queue_group_property_flags_t { + #[doc = "< Command queue groups supports metric streamers and queries."] + pub const ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS: + _ze_command_queue_group_property_flags_t = _ze_command_queue_group_property_flags_t(8); +} +impl _ze_command_queue_group_property_flags_t { + pub const ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_FORCE_UINT32: + _ze_command_queue_group_property_flags_t = + _ze_command_queue_group_property_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_command_queue_group_property_flags_t> + for _ze_command_queue_group_property_flags_t +{ + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_command_queue_group_property_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_command_queue_group_property_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_command_queue_group_property_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_command_queue_group_property_flags_t> + for _ze_command_queue_group_property_flags_t +{ + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_command_queue_group_property_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_command_queue_group_property_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_command_queue_group_property_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] #[doc = ""] -#[doc = " @brief API version of ::ze_device_memory_properties_t"] -pub use self::_ze_device_memory_properties_version_t as ze_device_memory_properties_version_t; +#[doc = " @brief Supported command queue group property flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_command_queue_group_property_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported command queue group property flags"] +pub use self::_ze_command_queue_group_property_flags_t as ze_command_queue_group_property_flags_t; +#[doc = ""] +#[doc = " @brief Command queue group properties queried using"] +#[doc = " ::zeDeviceGetCommandQueueGroupProperties"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_command_queue_group_properties_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, + #[doc = "< [out] 0 (none) or a valid combination of"] + #[doc = "< ::ze_command_queue_group_property_flags_t"] + pub flags: ze_command_queue_group_property_flags_t, + #[doc = "< [out] maximum `pattern_size` supported by command queue group."] + #[doc = "< See ::zeCommandListAppendMemoryFill for more details."] + pub maxMemoryFillPatternSize: usize, + #[doc = "< [out] the number of physical command queues within the group."] + pub numQueues: u32, +} +#[test] +fn bindgen_test_layout__ze_command_queue_group_properties_t() { + assert_eq!( + ::std::mem::size_of::<_ze_command_queue_group_properties_t>(), + 40usize, + concat!( + "Size of: ", + stringify!(_ze_command_queue_group_properties_t) + ) + ); + assert_eq!( + ::std::mem::align_of::<_ze_command_queue_group_properties_t>(), + 8usize, + concat!( + "Alignment of ", + stringify!(_ze_command_queue_group_properties_t) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_command_queue_group_properties_t>())).stype as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_command_queue_group_properties_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_command_queue_group_properties_t>())).pNext as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_command_queue_group_properties_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_command_queue_group_properties_t>())).flags as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_command_queue_group_properties_t), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_command_queue_group_properties_t>())) + .maxMemoryFillPatternSize as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_ze_command_queue_group_properties_t), + "::", + stringify!(maxMemoryFillPatternSize) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_command_queue_group_properties_t>())).numQueues as *const _ + as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(_ze_command_queue_group_properties_t), + "::", + stringify!(numQueues) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieves command queue group properties of the device."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - Properties are reported for each physical command queue type supported"] + #[doc = " by the device."] + #[doc = " - Multiple calls to this function will return properties in the same"] + #[doc = " order."] + #[doc = " - The order in which the properties are returned defines the command"] + #[doc = " queue group's ordinal."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - **vkGetPhysicalDeviceQueueFamilyProperties**"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hDevice`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pCount`"] + pub fn zeDeviceGetCommandQueueGroupProperties( + hDevice: ze_device_handle_t, + pCount: *mut u32, + pCommandQueueGroupProperties: *mut ze_command_queue_group_properties_t, + ) -> ze_result_t; +} +impl _ze_device_memory_property_flags_t { + #[doc = "< reserved for future use"] + pub const ZE_DEVICE_MEMORY_PROPERTY_FLAG_TBD: _ze_device_memory_property_flags_t = + _ze_device_memory_property_flags_t(1); +} +impl _ze_device_memory_property_flags_t { + pub const ZE_DEVICE_MEMORY_PROPERTY_FLAG_FORCE_UINT32: _ze_device_memory_property_flags_t = + _ze_device_memory_property_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_device_memory_property_flags_t> for _ze_device_memory_property_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_device_memory_property_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_device_memory_property_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_device_memory_property_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_device_memory_property_flags_t> for _ze_device_memory_property_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_device_memory_property_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_device_memory_property_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_device_memory_property_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported device memory property flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_device_memory_property_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported device memory property flags"] +pub use self::_ze_device_memory_property_flags_t as ze_device_memory_property_flags_t; #[doc = ""] #[doc = " @brief Device local memory properties queried using"] #[doc = " ::zeDeviceGetMemoryProperties"] #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct _ze_device_memory_properties_t { - #[doc = "< [in] ::ZE_DEVICE_MEMORY_PROPERTIES_VERSION_CURRENT"] - pub version: ze_device_memory_properties_version_t, + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, + #[doc = "< [out] 0 (none) or a valid combination of"] + #[doc = "< ::ze_device_memory_property_flags_t"] + pub flags: ze_device_memory_property_flags_t, #[doc = "< [out] Maximum clock rate for device memory."] pub maxClockRate: u32, #[doc = "< [out] Maximum bus width between device and memory."] pub maxBusWidth: u32, - #[doc = "< [out] Total memory size in bytes."] + #[doc = "< [out] Total memory size in bytes that is available to the device."] pub totalSize: u64, + #[doc = "< [out] Memory name"] + pub name: [::std::os::raw::c_char; 256usize], } #[test] fn bindgen_test_layout__ze_device_memory_properties_t() { assert_eq!( ::std::mem::size_of::<_ze_device_memory_properties_t>(), - 24usize, + 296usize, concat!("Size of: ", stringify!(_ze_device_memory_properties_t)) ); assert_eq!( @@ -1719,14 +2532,38 @@ fn bindgen_test_layout__ze_device_memory_properties_t() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_memory_properties_t>())).version as *const _ as usize + &(*(::std::ptr::null::<_ze_device_memory_properties_t>())).stype as *const _ as usize }, 0usize, concat!( "Offset of field: ", stringify!(_ze_device_memory_properties_t), "::", - stringify!(version) + stringify!(stype) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_memory_properties_t>())).pNext as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_memory_properties_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_memory_properties_t>())).flags as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_memory_properties_t), + "::", + stringify!(flags) ) ); assert_eq!( @@ -1734,7 +2571,7 @@ fn bindgen_test_layout__ze_device_memory_properties_t() { &(*(::std::ptr::null::<_ze_device_memory_properties_t>())).maxClockRate as *const _ as usize }, - 4usize, + 20usize, concat!( "Offset of field: ", stringify!(_ze_device_memory_properties_t), @@ -1747,7 +2584,7 @@ fn bindgen_test_layout__ze_device_memory_properties_t() { &(*(::std::ptr::null::<_ze_device_memory_properties_t>())).maxBusWidth as *const _ as usize }, - 8usize, + 24usize, concat!( "Offset of field: ", stringify!(_ze_device_memory_properties_t), @@ -1760,7 +2597,7 @@ fn bindgen_test_layout__ze_device_memory_properties_t() { &(*(::std::ptr::null::<_ze_device_memory_properties_t>())).totalSize as *const _ as usize }, - 16usize, + 32usize, concat!( "Offset of field: ", stringify!(_ze_device_memory_properties_t), @@ -1768,6 +2605,18 @@ fn bindgen_test_layout__ze_device_memory_properties_t() { stringify!(totalSize) ) ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_memory_properties_t>())).name as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_memory_properties_t), + "::", + stringify!(name) + ) + ); } extern "C" { #[doc = ""] @@ -1776,6 +2625,10 @@ extern "C" { #[doc = " @details"] #[doc = " - Properties are reported for each physical memory type supported by the"] #[doc = " device."] + #[doc = " - Multiple calls to this function will return properties in the same"] + #[doc = " order."] + #[doc = " - The order in which the properties are returned defines the device's"] + #[doc = " local memory ordinal."] #[doc = " - The application may call this function from simultaneous threads."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -1797,68 +2650,103 @@ extern "C" { pMemProperties: *mut ze_device_memory_properties_t, ) -> ze_result_t; } -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_device_memory_access_properties_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_device_memory_access_properties_version_t { - #[doc = "< version 0.91"] - ZE_DEVICE_MEMORY_ACCESS_PROPERTIES_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_device_memory_access_properties_t"] -pub use self::_ze_device_memory_access_properties_version_t as ze_device_memory_access_properties_version_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Memory access capabilities"] -#[doc = ""] -#[doc = " @details"] -#[doc = " - Supported access capabilities for different types of memory"] -#[doc = " allocations"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_memory_access_capabilities_t { - #[doc = "< Access not supported"] - ZE_MEMORY_ACCESS_NONE = 0, +impl _ze_memory_access_cap_flags_t { #[doc = "< Supports load/store access"] - ZE_MEMORY_ACCESS = 1, - #[doc = "< Supports atomic access"] - ZE_MEMORY_ATOMIC_ACCESS = 2, - #[doc = "< Supports concurrent access"] - ZE_MEMORY_CONCURRENT_ACCESS = 4, - #[doc = "< Supports concurrent atomic access"] - ZE_MEMORY_CONCURRENT_ATOMIC_ACCESS = 8, + pub const ZE_MEMORY_ACCESS_CAP_FLAG_RW: _ze_memory_access_cap_flags_t = + _ze_memory_access_cap_flags_t(1); } +impl _ze_memory_access_cap_flags_t { + #[doc = "< Supports atomic access"] + pub const ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC: _ze_memory_access_cap_flags_t = + _ze_memory_access_cap_flags_t(2); +} +impl _ze_memory_access_cap_flags_t { + #[doc = "< Supports concurrent access"] + pub const ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT: _ze_memory_access_cap_flags_t = + _ze_memory_access_cap_flags_t(4); +} +impl _ze_memory_access_cap_flags_t { + #[doc = "< Supports concurrent atomic access"] + pub const ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT_ATOMIC: _ze_memory_access_cap_flags_t = + _ze_memory_access_cap_flags_t(8); +} +impl _ze_memory_access_cap_flags_t { + pub const ZE_MEMORY_ACCESS_CAP_FLAG_FORCE_UINT32: _ze_memory_access_cap_flags_t = + _ze_memory_access_cap_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_memory_access_cap_flags_t> for _ze_memory_access_cap_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_memory_access_cap_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_memory_access_cap_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_memory_access_cap_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_memory_access_cap_flags_t> for _ze_memory_access_cap_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_memory_access_cap_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_memory_access_cap_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_memory_access_cap_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] #[doc = ""] -#[doc = " @brief Memory access capabilities"] +#[doc = " @brief Memory access capability flags"] #[doc = ""] #[doc = " @details"] #[doc = " - Supported access capabilities for different types of memory"] #[doc = " allocations"] -pub use self::_ze_memory_access_capabilities_t as ze_memory_access_capabilities_t; +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_memory_access_cap_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Memory access capability flags"] +#[doc = ""] +#[doc = " @details"] +#[doc = " - Supported access capabilities for different types of memory"] +#[doc = " allocations"] +pub use self::_ze_memory_access_cap_flags_t as ze_memory_access_cap_flags_t; #[doc = ""] #[doc = " @brief Device memory access properties queried using"] #[doc = " ::zeDeviceGetMemoryAccessProperties"] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct _ze_device_memory_access_properties_t { - #[doc = "< [in] ::ZE_DEVICE_MEMORY_ACCESS_PROPERTIES_VERSION_CURRENT"] - pub version: ze_device_memory_access_properties_version_t, - #[doc = "< [out] Bitfield describing host memory capabilities"] - pub hostAllocCapabilities: ze_memory_access_capabilities_t, - #[doc = "< [out] Bitfield describing device memory capabilities"] - pub deviceAllocCapabilities: ze_memory_access_capabilities_t, - #[doc = "< [out] Bitfield describing shared (single-device) memory capabilities"] - pub sharedSingleDeviceAllocCapabilities: ze_memory_access_capabilities_t, - #[doc = "< [out] Bitfield describing shared (cross-device) memory capabilities"] - pub sharedCrossDeviceAllocCapabilities: ze_memory_access_capabilities_t, - #[doc = "< [out] Bitfield describing shared (system) memory capabilities"] - pub sharedSystemAllocCapabilities: ze_memory_access_capabilities_t, + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, + #[doc = "< [out] host memory capabilities."] + #[doc = "< returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flags_t."] + pub hostAllocCapabilities: ze_memory_access_cap_flags_t, + #[doc = "< [out] device memory capabilities."] + #[doc = "< returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flags_t."] + pub deviceAllocCapabilities: ze_memory_access_cap_flags_t, + #[doc = "< [out] shared, single-device memory capabilities."] + #[doc = "< returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flags_t."] + pub sharedSingleDeviceAllocCapabilities: ze_memory_access_cap_flags_t, + #[doc = "< [out] shared, cross-device memory capabilities."] + #[doc = "< returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flags_t."] + pub sharedCrossDeviceAllocCapabilities: ze_memory_access_cap_flags_t, + #[doc = "< [out] shared, system memory capabilities."] + #[doc = "< returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flags_t."] + pub sharedSystemAllocCapabilities: ze_memory_access_cap_flags_t, } #[test] fn bindgen_test_layout__ze_device_memory_access_properties_t() { assert_eq!( ::std::mem::size_of::<_ze_device_memory_access_properties_t>(), - 24usize, + 40usize, concat!( "Size of: ", stringify!(_ze_device_memory_access_properties_t) @@ -1866,7 +2754,7 @@ fn bindgen_test_layout__ze_device_memory_access_properties_t() { ); assert_eq!( ::std::mem::align_of::<_ze_device_memory_access_properties_t>(), - 4usize, + 8usize, concat!( "Alignment of ", stringify!(_ze_device_memory_access_properties_t) @@ -1874,7 +2762,7 @@ fn bindgen_test_layout__ze_device_memory_access_properties_t() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_memory_access_properties_t>())).version as *const _ + &(*(::std::ptr::null::<_ze_device_memory_access_properties_t>())).stype as *const _ as usize }, 0usize, @@ -1882,7 +2770,20 @@ fn bindgen_test_layout__ze_device_memory_access_properties_t() { "Offset of field: ", stringify!(_ze_device_memory_access_properties_t), "::", - stringify!(version) + stringify!(stype) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_memory_access_properties_t>())).pNext as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_memory_access_properties_t), + "::", + stringify!(pNext) ) ); assert_eq!( @@ -1890,7 +2791,7 @@ fn bindgen_test_layout__ze_device_memory_access_properties_t() { &(*(::std::ptr::null::<_ze_device_memory_access_properties_t>())).hostAllocCapabilities as *const _ as usize }, - 4usize, + 16usize, concat!( "Offset of field: ", stringify!(_ze_device_memory_access_properties_t), @@ -1903,7 +2804,7 @@ fn bindgen_test_layout__ze_device_memory_access_properties_t() { &(*(::std::ptr::null::<_ze_device_memory_access_properties_t>())) .deviceAllocCapabilities as *const _ as usize }, - 8usize, + 20usize, concat!( "Offset of field: ", stringify!(_ze_device_memory_access_properties_t), @@ -1916,7 +2817,7 @@ fn bindgen_test_layout__ze_device_memory_access_properties_t() { &(*(::std::ptr::null::<_ze_device_memory_access_properties_t>())) .sharedSingleDeviceAllocCapabilities as *const _ as usize }, - 12usize, + 24usize, concat!( "Offset of field: ", stringify!(_ze_device_memory_access_properties_t), @@ -1929,7 +2830,7 @@ fn bindgen_test_layout__ze_device_memory_access_properties_t() { &(*(::std::ptr::null::<_ze_device_memory_access_properties_t>())) .sharedCrossDeviceAllocCapabilities as *const _ as usize }, - 16usize, + 28usize, concat!( "Offset of field: ", stringify!(_ze_device_memory_access_properties_t), @@ -1942,7 +2843,7 @@ fn bindgen_test_layout__ze_device_memory_access_properties_t() { &(*(::std::ptr::null::<_ze_device_memory_access_properties_t>())) .sharedSystemAllocCapabilities as *const _ as usize }, - 20usize, + 32usize, concat!( "Offset of field: ", stringify!(_ze_device_memory_access_properties_t), @@ -1976,44 +2877,69 @@ extern "C" { pMemAccessProperties: *mut ze_device_memory_access_properties_t, ) -> ze_result_t; } -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_device_cache_properties_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_device_cache_properties_version_t { - #[doc = "< version 0.91"] - ZE_DEVICE_CACHE_PROPERTIES_VERSION_CURRENT = 91, +impl _ze_device_cache_property_flags_t { + #[doc = "< Device support User Cache Control (i.e. SLM section vs Generic Cache)"] + pub const ZE_DEVICE_CACHE_PROPERTY_FLAG_USER_CONTROL: _ze_device_cache_property_flags_t = + _ze_device_cache_property_flags_t(1); } +impl _ze_device_cache_property_flags_t { + pub const ZE_DEVICE_CACHE_PROPERTY_FLAG_FORCE_UINT32: _ze_device_cache_property_flags_t = + _ze_device_cache_property_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_device_cache_property_flags_t> for _ze_device_cache_property_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_device_cache_property_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_device_cache_property_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_device_cache_property_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_device_cache_property_flags_t> for _ze_device_cache_property_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_device_cache_property_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_device_cache_property_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_device_cache_property_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] #[doc = ""] -#[doc = " @brief API version of ::ze_device_cache_properties_t"] -pub use self::_ze_device_cache_properties_version_t as ze_device_cache_properties_version_t; +#[doc = " @brief Supported cache control property flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_device_cache_property_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported cache control property flags"] +pub use self::_ze_device_cache_property_flags_t as ze_device_cache_property_flags_t; #[doc = ""] #[doc = " @brief Device cache properties queried using ::zeDeviceGetCacheProperties"] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct _ze_device_cache_properties_t { - #[doc = "< [in] ::ZE_DEVICE_CACHE_PROPERTIES_VERSION_CURRENT"] - pub version: ze_device_cache_properties_version_t, - #[doc = "< [out] Support User control on Intermediate Cache (i.e. Resize SLM"] - #[doc = "< section vs Generic Cache)"] - pub intermediateCacheControlSupported: ze_bool_t, - #[doc = "< [out] Per-cache Intermediate Cache (L1/L2) size, in bytes"] - pub intermediateCacheSize: usize, - #[doc = "< [out] Cacheline size in bytes for intermediate cacheline (L1/L2)."] - pub intermediateCachelineSize: u32, - #[doc = "< [out] Support User control on Last Level Cache (i.e. Resize SLM"] - #[doc = "< section vs Generic Cache)."] - pub lastLevelCacheSizeControlSupported: ze_bool_t, - #[doc = "< [out] Per-cache Last Level Cache (L3) size, in bytes"] - pub lastLevelCacheSize: usize, - #[doc = "< [out] Cacheline size in bytes for last-level cacheline (L3)."] - pub lastLevelCachelineSize: u32, + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, + #[doc = "< [out] 0 (none) or a valid combination of"] + #[doc = "< ::ze_device_cache_property_flags_t"] + pub flags: ze_device_cache_property_flags_t, + #[doc = "< [out] Per-cache size, in bytes"] + pub cacheSize: usize, } #[test] fn bindgen_test_layout__ze_device_cache_properties_t() { assert_eq!( ::std::mem::size_of::<_ze_device_cache_properties_t>(), - 40usize, + 32usize, concat!("Size of: ", stringify!(_ze_device_cache_properties_t)) ); assert_eq!( @@ -2023,92 +2949,50 @@ fn bindgen_test_layout__ze_device_cache_properties_t() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_cache_properties_t>())).version as *const _ as usize + &(*(::std::ptr::null::<_ze_device_cache_properties_t>())).stype as *const _ as usize }, 0usize, concat!( "Offset of field: ", stringify!(_ze_device_cache_properties_t), "::", - stringify!(version) + stringify!(stype) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_cache_properties_t>())) - .intermediateCacheControlSupported as *const _ as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_cache_properties_t), - "::", - stringify!(intermediateCacheControlSupported) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_cache_properties_t>())).intermediateCacheSize - as *const _ as usize + &(*(::std::ptr::null::<_ze_device_cache_properties_t>())).pNext as *const _ as usize }, 8usize, concat!( "Offset of field: ", stringify!(_ze_device_cache_properties_t), "::", - stringify!(intermediateCacheSize) + stringify!(pNext) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_cache_properties_t>())).intermediateCachelineSize - as *const _ as usize + &(*(::std::ptr::null::<_ze_device_cache_properties_t>())).flags as *const _ as usize }, 16usize, concat!( "Offset of field: ", stringify!(_ze_device_cache_properties_t), "::", - stringify!(intermediateCachelineSize) + stringify!(flags) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_cache_properties_t>())) - .lastLevelCacheSizeControlSupported as *const _ as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_cache_properties_t), - "::", - stringify!(lastLevelCacheSizeControlSupported) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_cache_properties_t>())).lastLevelCacheSize as *const _ - as usize + &(*(::std::ptr::null::<_ze_device_cache_properties_t>())).cacheSize as *const _ as usize }, 24usize, concat!( "Offset of field: ", stringify!(_ze_device_cache_properties_t), "::", - stringify!(lastLevelCacheSize) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_cache_properties_t>())).lastLevelCachelineSize - as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_cache_properties_t), - "::", - stringify!(lastLevelCachelineSize) + stringify!(cacheSize) ) ); } @@ -2131,57 +3015,54 @@ extern "C" { #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] #[doc = " + `nullptr == hDevice`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pCacheProperties`"] + #[doc = " + `nullptr == pCount`"] pub fn zeDeviceGetCacheProperties( hDevice: ze_device_handle_t, + pCount: *mut u32, pCacheProperties: *mut ze_device_cache_properties_t, ) -> ze_result_t; } -#[repr(i32)] #[doc = ""] -#[doc = " @brief API version of ::ze_device_image_properties_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_device_image_properties_version_t { - #[doc = "< version 0.91"] - ZE_DEVICE_IMAGE_PROPERTIES_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_device_image_properties_t"] -pub use self::_ze_device_image_properties_version_t as ze_device_image_properties_version_t; -#[doc = ""] -#[doc = " @brief Device image properties queried using ::zeDeviceGetComputeProperties"] +#[doc = " @brief Device image properties queried using ::zeDeviceGetImageProperties"] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct _ze_device_image_properties_t { - #[doc = "< [in] ::ZE_DEVICE_IMAGE_PROPERTIES_VERSION_CURRENT"] - pub version: ze_device_image_properties_version_t, - #[doc = "< [out] Supports reading and writing of images. See"] - #[doc = "< ::::zeImageGetProperties for format-specific capabilities."] - pub supported: ze_bool_t, - #[doc = "< [out] Maximum image dimensions for 1D resources."] + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, + #[doc = "< [out] Maximum image dimensions for 1D resources. if 0, then 1D images"] + #[doc = "< are unsupported."] pub maxImageDims1D: u32, - #[doc = "< [out] Maximum image dimensions for 2D resources."] + #[doc = "< [out] Maximum image dimensions for 2D resources. if 0, then 2D images"] + #[doc = "< are unsupported."] pub maxImageDims2D: u32, - #[doc = "< [out] Maximum image dimensions for 3D resources."] + #[doc = "< [out] Maximum image dimensions for 3D resources. if 0, then 3D images"] + #[doc = "< are unsupported."] pub maxImageDims3D: u32, - #[doc = "< [out] Maximum image buffer size in bytes."] + #[doc = "< [out] Maximum image buffer size in bytes. if 0, then buffer images are"] + #[doc = "< unsupported."] pub maxImageBufferSize: u64, - #[doc = "< [out] Maximum image array slices"] + #[doc = "< [out] Maximum image array slices. if 0, then image arrays are"] + #[doc = "< unsupported."] pub maxImageArraySlices: u32, - #[doc = "< [out] Max samplers that can be used in kernel."] + #[doc = "< [out] Max samplers that can be used in kernel. if 0, then sampling is"] + #[doc = "< unsupported."] pub maxSamplers: u32, #[doc = "< [out] Returns the maximum number of simultaneous image objects that"] - #[doc = "< can be read from by a kernel."] + #[doc = "< can be read from by a kernel. if 0, then reading images is"] + #[doc = "< unsupported."] pub maxReadImageArgs: u32, #[doc = "< [out] Returns the maximum number of simultaneous image objects that"] - #[doc = "< can be written to by a kernel."] + #[doc = "< can be written to by a kernel. if 0, then writing images is"] + #[doc = "< unsupported."] pub maxWriteImageArgs: u32, } #[test] fn bindgen_test_layout__ze_device_image_properties_t() { assert_eq!( ::std::mem::size_of::<_ze_device_image_properties_t>(), - 48usize, + 56usize, concat!("Size of: ", stringify!(_ze_device_image_properties_t)) ); assert_eq!( @@ -2191,26 +3072,26 @@ fn bindgen_test_layout__ze_device_image_properties_t() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_image_properties_t>())).version as *const _ as usize + &(*(::std::ptr::null::<_ze_device_image_properties_t>())).stype as *const _ as usize }, 0usize, concat!( "Offset of field: ", stringify!(_ze_device_image_properties_t), "::", - stringify!(version) + stringify!(stype) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_image_properties_t>())).supported as *const _ as usize + &(*(::std::ptr::null::<_ze_device_image_properties_t>())).pNext as *const _ as usize }, - 4usize, + 8usize, concat!( "Offset of field: ", stringify!(_ze_device_image_properties_t), "::", - stringify!(supported) + stringify!(pNext) ) ); assert_eq!( @@ -2218,7 +3099,7 @@ fn bindgen_test_layout__ze_device_image_properties_t() { &(*(::std::ptr::null::<_ze_device_image_properties_t>())).maxImageDims1D as *const _ as usize }, - 8usize, + 16usize, concat!( "Offset of field: ", stringify!(_ze_device_image_properties_t), @@ -2231,7 +3112,7 @@ fn bindgen_test_layout__ze_device_image_properties_t() { &(*(::std::ptr::null::<_ze_device_image_properties_t>())).maxImageDims2D as *const _ as usize }, - 12usize, + 20usize, concat!( "Offset of field: ", stringify!(_ze_device_image_properties_t), @@ -2244,7 +3125,7 @@ fn bindgen_test_layout__ze_device_image_properties_t() { &(*(::std::ptr::null::<_ze_device_image_properties_t>())).maxImageDims3D as *const _ as usize }, - 16usize, + 24usize, concat!( "Offset of field: ", stringify!(_ze_device_image_properties_t), @@ -2257,7 +3138,7 @@ fn bindgen_test_layout__ze_device_image_properties_t() { &(*(::std::ptr::null::<_ze_device_image_properties_t>())).maxImageBufferSize as *const _ as usize }, - 24usize, + 32usize, concat!( "Offset of field: ", stringify!(_ze_device_image_properties_t), @@ -2270,7 +3151,7 @@ fn bindgen_test_layout__ze_device_image_properties_t() { &(*(::std::ptr::null::<_ze_device_image_properties_t>())).maxImageArraySlices as *const _ as usize }, - 32usize, + 40usize, concat!( "Offset of field: ", stringify!(_ze_device_image_properties_t), @@ -2283,7 +3164,7 @@ fn bindgen_test_layout__ze_device_image_properties_t() { &(*(::std::ptr::null::<_ze_device_image_properties_t>())).maxSamplers as *const _ as usize }, - 36usize, + 44usize, concat!( "Offset of field: ", stringify!(_ze_device_image_properties_t), @@ -2296,7 +3177,7 @@ fn bindgen_test_layout__ze_device_image_properties_t() { &(*(::std::ptr::null::<_ze_device_image_properties_t>())).maxReadImageArgs as *const _ as usize }, - 40usize, + 48usize, concat!( "Offset of field: ", stringify!(_ze_device_image_properties_t), @@ -2309,7 +3190,7 @@ fn bindgen_test_layout__ze_device_image_properties_t() { &(*(::std::ptr::null::<_ze_device_image_properties_t>())).maxWriteImageArgs as *const _ as usize }, - 44usize, + 52usize, concat!( "Offset of field: ", stringify!(_ze_device_image_properties_t), @@ -2320,10 +3201,10 @@ fn bindgen_test_layout__ze_device_image_properties_t() { } extern "C" { #[doc = ""] - #[doc = " @brief Retrieves image X_DEVICE_MEMORY_ACCESS_PROPERTIES_VERSION_CURRENT of"] - #[doc = " the device"] + #[doc = " @brief Retrieves image properties of the device"] #[doc = ""] #[doc = " @details"] + #[doc = " - See ::zeImageGetProperties for format-specific capabilities."] #[doc = " - The application may call this function from simultaneous threads."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -2340,83 +3221,256 @@ extern "C" { pImageProperties: *mut ze_device_image_properties_t, ) -> ze_result_t; } -#[repr(i32)] #[doc = ""] -#[doc = " @brief API version of ::ze_device_p2p_properties_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_device_p2p_properties_version_t { - #[doc = "< version 0.91"] - ZE_DEVICE_P2P_PROPERTIES_VERSION_CURRENT = 91, +#[doc = " @brief Device external memory import and export properties"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_device_external_memory_properties_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, + #[doc = "< [out] Supported external memory import types for memory allocations."] + pub memoryAllocationImportTypes: ze_external_memory_type_flags_t, + #[doc = "< [out] Supported external memory export types for memory allocations."] + pub memoryAllocationExportTypes: ze_external_memory_type_flags_t, + #[doc = "< [out] Supported external memory import types for images."] + pub imageImportTypes: ze_external_memory_type_flags_t, + #[doc = "< [out] Supported external memory export types for images."] + pub imageExportTypes: ze_external_memory_type_flags_t, } +#[test] +fn bindgen_test_layout__ze_device_external_memory_properties_t() { + assert_eq!( + ::std::mem::size_of::<_ze_device_external_memory_properties_t>(), + 32usize, + concat!( + "Size of: ", + stringify!(_ze_device_external_memory_properties_t) + ) + ); + assert_eq!( + ::std::mem::align_of::<_ze_device_external_memory_properties_t>(), + 8usize, + concat!( + "Alignment of ", + stringify!(_ze_device_external_memory_properties_t) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_external_memory_properties_t>())).stype as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_external_memory_properties_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_external_memory_properties_t>())).pNext as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_external_memory_properties_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_external_memory_properties_t>())) + .memoryAllocationImportTypes as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_external_memory_properties_t), + "::", + stringify!(memoryAllocationImportTypes) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_external_memory_properties_t>())) + .memoryAllocationExportTypes as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_external_memory_properties_t), + "::", + stringify!(memoryAllocationExportTypes) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_external_memory_properties_t>())).imageImportTypes + as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_external_memory_properties_t), + "::", + stringify!(imageImportTypes) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_external_memory_properties_t>())).imageExportTypes + as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_external_memory_properties_t), + "::", + stringify!(imageExportTypes) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieves external memory import and export of the device"] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hDevice`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pExternalMemoryProperties`"] + pub fn zeDeviceGetExternalMemoryProperties( + hDevice: ze_device_handle_t, + pExternalMemoryProperties: *mut ze_device_external_memory_properties_t, + ) -> ze_result_t; +} +impl _ze_device_p2p_property_flags_t { + #[doc = "< Device supports access between peer devices."] + pub const ZE_DEVICE_P2P_PROPERTY_FLAG_ACCESS: _ze_device_p2p_property_flags_t = + _ze_device_p2p_property_flags_t(1); +} +impl _ze_device_p2p_property_flags_t { + #[doc = "< Device supports atomics between peer devices."] + pub const ZE_DEVICE_P2P_PROPERTY_FLAG_ATOMICS: _ze_device_p2p_property_flags_t = + _ze_device_p2p_property_flags_t(2); +} +impl _ze_device_p2p_property_flags_t { + pub const ZE_DEVICE_P2P_PROPERTY_FLAG_FORCE_UINT32: _ze_device_p2p_property_flags_t = + _ze_device_p2p_property_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_device_p2p_property_flags_t> for _ze_device_p2p_property_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_device_p2p_property_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_device_p2p_property_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_device_p2p_property_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_device_p2p_property_flags_t> for _ze_device_p2p_property_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_device_p2p_property_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_device_p2p_property_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_device_p2p_property_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] #[doc = ""] -#[doc = " @brief API version of ::ze_device_p2p_properties_t"] -pub use self::_ze_device_p2p_properties_version_t as ze_device_p2p_properties_version_t; +#[doc = " @brief Supported device peer-to-peer property flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_device_p2p_property_flags_t(pub u32); #[doc = ""] -#[doc = " @brief Device properties queried using ::zeDeviceGetP2PProperties"] +#[doc = " @brief Supported device peer-to-peer property flags"] +pub use self::_ze_device_p2p_property_flags_t as ze_device_p2p_property_flags_t; +#[doc = ""] +#[doc = " @brief Device peer-to-peer properties queried using"] +#[doc = " ::zeDeviceGetP2PProperties"] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct _ze_device_p2p_properties_t { - #[doc = "< [in] ::ZE_DEVICE_P2P_PROPERTIES_VERSION_CURRENT"] - pub version: ze_device_p2p_properties_version_t, - #[doc = "< [out] Supports access between peer devices."] - pub accessSupported: ze_bool_t, - #[doc = "< [out] Supports atomics between peer devices."] - pub atomicsSupported: ze_bool_t, + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, + #[doc = "< [out] 0 (none) or a valid combination of"] + #[doc = "< ::ze_device_p2p_property_flags_t"] + pub flags: ze_device_p2p_property_flags_t, } #[test] fn bindgen_test_layout__ze_device_p2p_properties_t() { assert_eq!( ::std::mem::size_of::<_ze_device_p2p_properties_t>(), - 8usize, + 24usize, concat!("Size of: ", stringify!(_ze_device_p2p_properties_t)) ); assert_eq!( ::std::mem::align_of::<_ze_device_p2p_properties_t>(), - 4usize, + 8usize, concat!("Alignment of ", stringify!(_ze_device_p2p_properties_t)) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_p2p_properties_t>())).version as *const _ as usize + &(*(::std::ptr::null::<_ze_device_p2p_properties_t>())).stype as *const _ as usize }, 0usize, concat!( "Offset of field: ", stringify!(_ze_device_p2p_properties_t), "::", - stringify!(version) + stringify!(stype) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_p2p_properties_t>())).accessSupported as *const _ - as usize + &(*(::std::ptr::null::<_ze_device_p2p_properties_t>())).pNext as *const _ as usize }, - 4usize, + 8usize, concat!( "Offset of field: ", stringify!(_ze_device_p2p_properties_t), "::", - stringify!(accessSupported) + stringify!(pNext) ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::<_ze_device_p2p_properties_t>())).atomicsSupported as *const _ - as usize + &(*(::std::ptr::null::<_ze_device_p2p_properties_t>())).flags as *const _ as usize }, - 5usize, + 16usize, concat!( "Offset of field: ", stringify!(_ze_device_p2p_properties_t), "::", - stringify!(atomicsSupported) + stringify!(flags) ) ); } extern "C" { #[doc = ""] - #[doc = " @brief Retrieves Peer-to-Peer properties between one device and a peer"] + #[doc = " @brief Retrieves peer-to-peer properties between one device and a peer"] #[doc = " devices"] #[doc = ""] #[doc = " @details"] @@ -2475,34 +3529,16 @@ extern "C" { value: *mut ze_bool_t, ) -> ze_result_t; } -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported Cache Config"] -#[doc = ""] -#[doc = " @details"] -#[doc = " - Supported Cache Config (Default, Large SLM, Large Data Cache)"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_cache_config_t { - #[doc = "< Default Config"] - ZE_CACHE_CONFIG_DEFAULT = 1, - #[doc = "< Large SLM size"] - ZE_CACHE_CONFIG_LARGE_SLM = 2, - #[doc = "< Large General Data size"] - ZE_CACHE_CONFIG_LARGE_DATA = 4, -} -#[doc = ""] -#[doc = " @brief Supported Cache Config"] -#[doc = ""] -#[doc = " @details"] -#[doc = " - Supported Cache Config (Default, Large SLM, Large Data Cache)"] -pub use self::_ze_cache_config_t as ze_cache_config_t; extern "C" { #[doc = ""] - #[doc = " @brief Sets the preferred Last Level cache configuration for a device."] + #[doc = " @brief Returns current status of the device."] #[doc = ""] #[doc = " @details"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same device handle."] + #[doc = " - Once a device is reset, this call will update the OS handle attached"] + #[doc = " to the device handle."] + #[doc = " - The application may call this function from simultaneous threads with"] + #[doc = " the same device handle."] + #[doc = " - The implementation of this function must be thread-safe."] #[doc = ""] #[doc = " @returns"] #[doc = " - ::ZE_RESULT_SUCCESS"] @@ -2510,77 +3546,281 @@ extern "C" { #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] #[doc = " + `nullptr == hDevice`"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " + Device is available for use."] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " + Device is lost; must be reset for use."] + pub fn zeDeviceGetStatus(hDevice: ze_device_handle_t) -> ze_result_t; +} +impl _ze_context_flags_t { + #[doc = "< reserved for future use"] + pub const ZE_CONTEXT_FLAG_TBD: _ze_context_flags_t = _ze_context_flags_t(1); +} +impl _ze_context_flags_t { + pub const ZE_CONTEXT_FLAG_FORCE_UINT32: _ze_context_flags_t = _ze_context_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_context_flags_t> for _ze_context_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_context_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_context_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_context_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_context_flags_t> for _ze_context_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_context_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_context_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_context_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported context creation flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_context_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported context creation flags"] +pub use self::_ze_context_flags_t as ze_context_flags_t; +#[doc = ""] +#[doc = " @brief Context descriptor"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_context_desc_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in][optional] pointer to extension-specific structure"] + pub pNext: *const ::std::os::raw::c_void, + #[doc = "< [in] creation flags."] + #[doc = "< must be 0 (default) or a valid combination of ::ze_context_flags_t;"] + #[doc = "< default behavior may use implicit driver-based heuristics."] + pub flags: ze_context_flags_t, +} +#[test] +fn bindgen_test_layout__ze_context_desc_t() { + assert_eq!( + ::std::mem::size_of::<_ze_context_desc_t>(), + 24usize, + concat!("Size of: ", stringify!(_ze_context_desc_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_context_desc_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_context_desc_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_context_desc_t>())).stype as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_context_desc_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_context_desc_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_context_desc_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_context_desc_t>())).flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_context_desc_t), + "::", + stringify!(flags) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Creates a context for the driver."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must only use the context for the driver which was"] + #[doc = " provided during creation."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hDriver`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == desc`"] + #[doc = " + `nullptr == phContext`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + CacheConfig"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE"] - pub fn zeDeviceSetLastLevelCacheConfig( - hDevice: ze_device_handle_t, - CacheConfig: ze_cache_config_t, + #[doc = " + `0x1 < desc->flags`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + pub fn zeContextCreate( + hDriver: ze_driver_handle_t, + desc: *const ze_context_desc_t, + phContext: *mut ze_context_handle_t, ) -> ze_result_t; } -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_command_queue_desc_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_command_queue_desc_version_t { - #[doc = "< version 0.91"] - ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT = 91, +extern "C" { + #[doc = ""] + #[doc = " @brief Destroys a context."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the context before it is deleted."] + #[doc = " - The implementation of this function may immediately free all Host and"] + #[doc = " Device allocations associated with this context."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same context handle."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] + pub fn zeContextDestroy(hContext: ze_context_handle_t) -> ze_result_t; } -#[doc = ""] -#[doc = " @brief API version of ::ze_command_queue_desc_t"] -pub use self::_ze_command_queue_desc_version_t as ze_command_queue_desc_version_t; -#[repr(i32)] +extern "C" { + #[doc = ""] + #[doc = " @brief Returns current status of the context."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads with"] + #[doc = " the same context handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " + Context is available for use."] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " + Context is invalid; due to device lost or reset."] + pub fn zeContextGetStatus(hContext: ze_context_handle_t) -> ze_result_t; +} +impl _ze_command_queue_flags_t { + #[doc = "< command queue should be optimized for submission to a single device engine."] + #[doc = "< driver **must** disable any implicit optimizations for distributing"] + #[doc = "< work across multiple engines."] + #[doc = "< this flag should be used when applications want full control over"] + #[doc = "< multi-engine submission and scheduling."] + pub const ZE_COMMAND_QUEUE_FLAG_EXPLICIT_ONLY: _ze_command_queue_flags_t = + _ze_command_queue_flags_t(1); +} +impl _ze_command_queue_flags_t { + pub const ZE_COMMAND_QUEUE_FLAG_FORCE_UINT32: _ze_command_queue_flags_t = + _ze_command_queue_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_command_queue_flags_t> for _ze_command_queue_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_command_queue_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_command_queue_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_command_queue_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_command_queue_flags_t> for _ze_command_queue_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_command_queue_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_command_queue_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_command_queue_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] #[doc = ""] #[doc = " @brief Supported command queue flags"] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_command_queue_flag_t { - #[doc = "< default behavior"] - ZE_COMMAND_QUEUE_FLAG_NONE = 0, - #[doc = "< command queue only supports enqueuing copy-only command lists"] - ZE_COMMAND_QUEUE_FLAG_COPY_ONLY = 1, - #[doc = "< command queue is not tied to a physical command queue; driver may"] - #[doc = "< dynamically assign based on usage"] - ZE_COMMAND_QUEUE_FLAG_LOGICAL_ONLY = 2, - #[doc = "< command queue reserves and cannot consume more than a single slice."] - #[doc = "< 'slice' size is device-specific. cannot be combined with COPY_ONLY."] - ZE_COMMAND_QUEUE_FLAG_SINGLE_SLICE_ONLY = 4, - #[doc = "< command queue supports command list with cooperative kernels. See"] - #[doc = "< ::zeCommandListAppendLaunchCooperativeKernel for more details. cannot"] - #[doc = "< be combined with COPY_ONLY."] - ZE_COMMAND_QUEUE_FLAG_SUPPORTS_COOPERATIVE_KERNELS = 8, -} +pub struct _ze_command_queue_flags_t(pub u32); #[doc = ""] #[doc = " @brief Supported command queue flags"] -pub use self::_ze_command_queue_flag_t as ze_command_queue_flag_t; -#[repr(i32)] +pub use self::_ze_command_queue_flags_t as ze_command_queue_flags_t; +impl _ze_command_queue_mode_t { + #[doc = "< implicit default behavior; uses driver-based heuristics"] + pub const ZE_COMMAND_QUEUE_MODE_DEFAULT: _ze_command_queue_mode_t = _ze_command_queue_mode_t(0); +} +impl _ze_command_queue_mode_t { + #[doc = "< Device execution always completes immediately on execute;"] + #[doc = "< Host thread is blocked using wait on implicit synchronization object"] + pub const ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS: _ze_command_queue_mode_t = + _ze_command_queue_mode_t(1); +} +impl _ze_command_queue_mode_t { + #[doc = "< Device execution is scheduled and will complete in future;"] + #[doc = "< explicit synchronization object must be used to determine completeness"] + pub const ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS: _ze_command_queue_mode_t = + _ze_command_queue_mode_t(2); +} +impl _ze_command_queue_mode_t { + pub const ZE_COMMAND_QUEUE_MODE_FORCE_UINT32: _ze_command_queue_mode_t = + _ze_command_queue_mode_t(2147483647); +} +#[repr(transparent)] #[doc = ""] #[doc = " @brief Supported command queue modes"] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_command_queue_mode_t { - #[doc = "< implicit default behavior; uses driver-based heuristics"] - ZE_COMMAND_QUEUE_MODE_DEFAULT = 0, - #[doc = "< Device execution always completes immediately on execute;"] - #[doc = "< Host thread is blocked using wait on implicit synchronization object"] - ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS = 1, - #[doc = "< Device execution is scheduled and will complete in future;"] - #[doc = "< explicit synchronization object must be used to determine completeness"] - ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS = 2, -} +pub struct _ze_command_queue_mode_t(pub u32); #[doc = ""] #[doc = " @brief Supported command queue modes"] pub use self::_ze_command_queue_mode_t as ze_command_queue_mode_t; -#[repr(i32)] +impl _ze_command_queue_priority_t { + #[doc = "< [default] normal priority"] + pub const ZE_COMMAND_QUEUE_PRIORITY_NORMAL: _ze_command_queue_priority_t = + _ze_command_queue_priority_t(0); +} +impl _ze_command_queue_priority_t { + #[doc = "< lower priority than normal"] + pub const ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW: _ze_command_queue_priority_t = + _ze_command_queue_priority_t(1); +} +impl _ze_command_queue_priority_t { + #[doc = "< higher priority than normal"] + pub const ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH: _ze_command_queue_priority_t = + _ze_command_queue_priority_t(2); +} +impl _ze_command_queue_priority_t { + pub const ZE_COMMAND_QUEUE_PRIORITY_FORCE_UINT32: _ze_command_queue_priority_t = + _ze_command_queue_priority_t(2147483647); +} +#[repr(transparent)] #[doc = ""] #[doc = " @brief Supported command queue priorities"] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_command_queue_priority_t { - #[doc = "< [default] normal priority"] - ZE_COMMAND_QUEUE_PRIORITY_NORMAL = 0, - #[doc = "< lower priority than normal"] - ZE_COMMAND_QUEUE_PRIORITY_LOW = 1, - #[doc = "< higher priority than normal"] - ZE_COMMAND_QUEUE_PRIORITY_HIGH = 2, -} +pub struct _ze_command_queue_priority_t(pub u32); #[doc = ""] #[doc = " @brief Supported command queue priorities"] pub use self::_ze_command_queue_priority_t as ze_command_queue_priority_t; @@ -2589,77 +3829,55 @@ pub use self::_ze_command_queue_priority_t as ze_command_queue_priority_t; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct _ze_command_queue_desc_t { - #[doc = "< [in] ::ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT"] - pub version: ze_command_queue_desc_version_t, - #[doc = "< [in] creation flags"] - pub flags: ze_command_queue_flag_t, + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in][optional] pointer to extension-specific structure"] + pub pNext: *const ::std::os::raw::c_void, + #[doc = "< [in] command queue group ordinal"] + pub ordinal: u32, + #[doc = "< [in] command queue index within the group;"] + #[doc = "< must be zero if ::ZE_COMMAND_QUEUE_FLAG_EXPLICIT_ONLY is not set"] + pub index: u32, + #[doc = "< [in] usage flags."] + #[doc = "< must be 0 (default) or a valid combination of ::ze_command_queue_flags_t;"] + #[doc = "< default behavior may use implicit driver-based heuristics to balance"] + #[doc = "< latency and throughput."] + pub flags: ze_command_queue_flags_t, #[doc = "< [in] operation mode"] pub mode: ze_command_queue_mode_t, #[doc = "< [in] priority"] pub priority: ze_command_queue_priority_t, - #[doc = "< [in] if logical-only flag is set, then will be ignored;"] - #[doc = "< if supports-cooperative-kernels is set, then may be ignored;"] - #[doc = "< else-if copy-only flag is set, then must be less than ::ze_device_properties_t.numAsyncCopyEngines;"] - #[doc = "< otherwise must be less than"] - #[doc = "< ::ze_device_properties_t.numAsyncComputeEngines. When using sub-devices"] - #[doc = "< the ::ze_device_properties_t.numAsyncComputeEngines must be queried"] - #[doc = "< from the sub-device being used."] - pub ordinal: u32, } #[test] fn bindgen_test_layout__ze_command_queue_desc_t() { assert_eq!( ::std::mem::size_of::<_ze_command_queue_desc_t>(), - 20usize, + 40usize, concat!("Size of: ", stringify!(_ze_command_queue_desc_t)) ); assert_eq!( ::std::mem::align_of::<_ze_command_queue_desc_t>(), - 4usize, + 8usize, concat!("Alignment of ", stringify!(_ze_command_queue_desc_t)) ); assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_command_queue_desc_t>())).version as *const _ as usize - }, + unsafe { &(*(::std::ptr::null::<_ze_command_queue_desc_t>())).stype as *const _ as usize }, 0usize, concat!( "Offset of field: ", stringify!(_ze_command_queue_desc_t), "::", - stringify!(version) + stringify!(stype) ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_command_queue_desc_t>())).flags as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_command_queue_desc_t), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_command_queue_desc_t>())).mode as *const _ as usize }, + unsafe { &(*(::std::ptr::null::<_ze_command_queue_desc_t>())).pNext as *const _ as usize }, 8usize, concat!( "Offset of field: ", stringify!(_ze_command_queue_desc_t), "::", - stringify!(mode) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_command_queue_desc_t>())).priority as *const _ as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(_ze_command_queue_desc_t), - "::", - stringify!(priority) + stringify!(pNext) ) ); assert_eq!( @@ -2674,16 +3892,60 @@ fn bindgen_test_layout__ze_command_queue_desc_t() { stringify!(ordinal) ) ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_command_queue_desc_t>())).index as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(_ze_command_queue_desc_t), + "::", + stringify!(index) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_command_queue_desc_t>())).flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_ze_command_queue_desc_t), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_command_queue_desc_t>())).mode as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(_ze_command_queue_desc_t), + "::", + stringify!(mode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_command_queue_desc_t>())).priority as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(_ze_command_queue_desc_t), + "::", + stringify!(priority) + ) + ); } extern "C" { #[doc = ""] - #[doc = " @brief Creates a command queue on the device."] + #[doc = " @brief Creates a command queue on the context."] #[doc = ""] #[doc = " @details"] - #[doc = " - The command queue can only be used on the device on which it was"] - #[doc = " created."] + #[doc = " - A command queue represents a logical input stream to the device, tied"] + #[doc = " to a physical input stream."] + #[doc = " - The application must only use the command queue for the device, or its"] + #[doc = " sub-devices, which was provided during creation."] #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] + #[doc = " - The implementation of this function must be thread-safe."] #[doc = ""] #[doc = " @remarks"] #[doc = " _Analogues_"] @@ -2694,19 +3956,19 @@ extern "C" { #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] #[doc = " + `nullptr == hDevice`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] #[doc = " + `nullptr == desc`"] #[doc = " + `nullptr == phCommandQueue`"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION"] - #[doc = " + `::ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT < desc->version`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + desc->flags"] - #[doc = " + desc->mode"] - #[doc = " + desc->priority"] + #[doc = " + `0x1 < desc->flags`"] + #[doc = " + `::ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS < desc->mode`"] + #[doc = " + `::ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH < desc->priority`"] #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] pub fn zeCommandQueueCreate( + hContext: ze_context_handle_t, hDevice: ze_device_handle_t, desc: *const ze_command_queue_desc_t, phCommandQueue: *mut ze_command_queue_handle_t, @@ -2717,13 +3979,15 @@ extern "C" { #[doc = " @brief Destroys a command queue."] #[doc = ""] #[doc = " @details"] - #[doc = " - The application is responsible for making sure the device is not"] - #[doc = " currently referencing the command queue before it is deleted"] - #[doc = " - The implementation of this function will immediately free all Host and"] + #[doc = " - The application must destroy all fence handles created from the"] + #[doc = " command queue before destroying the command queue itself"] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the command queue before it is deleted"] + #[doc = " - The implementation of this function may immediately free all Host and"] #[doc = " Device allocations associated with this command queue"] - #[doc = " - The application may **not** call this function from simultaneous"] + #[doc = " - The application must **not** call this function from simultaneous"] #[doc = " threads with the same command queue handle."] - #[doc = " - The implementation of this function should be lock-free."] + #[doc = " - The implementation of this function must be thread-safe."] #[doc = ""] #[doc = " @remarks"] #[doc = " _Analogues_"] @@ -2743,6 +4007,13 @@ extern "C" { #[doc = " @brief Executes a command list in a command queue."] #[doc = ""] #[doc = " @details"] + #[doc = " - The application must ensure the command lists are accessible by the"] + #[doc = " device on which the command queue was created."] + #[doc = " - The application must only execute command lists created with an"] + #[doc = " identical command queue group ordinal to the command queue."] + #[doc = " - The application must use a fence created using the same command queue."] + #[doc = " - The application must ensure the command queue, command list and fence"] + #[doc = " were created on the same context."] #[doc = " - The application may call this function from simultaneous threads."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -2787,87 +4058,139 @@ extern "C" { #[doc = " + timeout expired"] pub fn zeCommandQueueSynchronize( hCommandQueue: ze_command_queue_handle_t, - timeout: u32, + timeout: u64, ) -> ze_result_t; } -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_command_list_desc_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_command_list_desc_version_t { - #[doc = "< version 0.91"] - ZE_COMMAND_LIST_DESC_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_command_list_desc_t"] -pub use self::_ze_command_list_desc_version_t as ze_command_list_desc_version_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported command list creation flags"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_command_list_flag_t { - #[doc = "< default behavior"] - ZE_COMMAND_LIST_FLAG_NONE = 0, - #[doc = "< command list **only** contains copy operations (and synchronization primitives)."] - #[doc = "< this command list may **only** be submitted to a command queue created"] - #[doc = "< with ::ZE_COMMAND_QUEUE_FLAG_COPY_ONLY."] - ZE_COMMAND_LIST_FLAG_COPY_ONLY = 1, - #[doc = "< driver may reorder programs and copys between barriers and"] - #[doc = "< synchronization primitives."] +impl _ze_command_list_flags_t { + #[doc = "< driver may reorder commands (e.g., kernels, copies) between barriers"] + #[doc = "< and synchronization primitives."] #[doc = "< using this flag may increase Host overhead of ::zeCommandListClose."] #[doc = "< therefore, this flag should **not** be set for low-latency usage-models."] - ZE_COMMAND_LIST_FLAG_RELAXED_ORDERING = 2, - #[doc = "< driver may perform additional optimizations that increase dexecution"] + pub const ZE_COMMAND_LIST_FLAG_RELAXED_ORDERING: _ze_command_list_flags_t = + _ze_command_list_flags_t(1); +} +impl _ze_command_list_flags_t { + #[doc = "< driver may perform additional optimizations that increase execution"] #[doc = "< throughput."] #[doc = "< using this flag may increase Host overhead of ::zeCommandListClose and ::zeCommandQueueExecuteCommandLists."] #[doc = "< therefore, this flag should **not** be set for low-latency usage-models."] - ZE_COMMAND_LIST_FLAG_MAXIMIZE_THROUGHPUT = 4, + pub const ZE_COMMAND_LIST_FLAG_MAXIMIZE_THROUGHPUT: _ze_command_list_flags_t = + _ze_command_list_flags_t(2); +} +impl _ze_command_list_flags_t { #[doc = "< command list should be optimized for submission to a single command"] #[doc = "< queue and device engine."] #[doc = "< driver **must** disable any implicit optimizations for distributing"] #[doc = "< work across multiple engines."] #[doc = "< this flag should be used when applications want full control over"] #[doc = "< multi-engine submission and scheduling."] - ZE_COMMAND_LIST_FLAG_EXPLICIT_ONLY = 8, + pub const ZE_COMMAND_LIST_FLAG_EXPLICIT_ONLY: _ze_command_list_flags_t = + _ze_command_list_flags_t(4); } +impl _ze_command_list_flags_t { + pub const ZE_COMMAND_LIST_FLAG_FORCE_UINT32: _ze_command_list_flags_t = + _ze_command_list_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_command_list_flags_t> for _ze_command_list_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_command_list_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_command_list_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_command_list_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_command_list_flags_t> for _ze_command_list_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_command_list_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_command_list_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_command_list_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] #[doc = ""] #[doc = " @brief Supported command list creation flags"] -pub use self::_ze_command_list_flag_t as ze_command_list_flag_t; +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_command_list_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported command list creation flags"] +pub use self::_ze_command_list_flags_t as ze_command_list_flags_t; #[doc = ""] #[doc = " @brief Command List descriptor"] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct _ze_command_list_desc_t { - #[doc = "< [in] ::ZE_COMMAND_LIST_DESC_VERSION_CURRENT"] - pub version: ze_command_list_desc_version_t, - #[doc = "< [in] creation flags"] - pub flags: ze_command_list_flag_t, + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in][optional] pointer to extension-specific structure"] + pub pNext: *const ::std::os::raw::c_void, + #[doc = "< [in] command queue group ordinal to which this command list will be"] + #[doc = "< submitted"] + pub commandQueueGroupOrdinal: u32, + #[doc = "< [in] usage flags."] + #[doc = "< must be 0 (default) or a valid combination of ::ze_command_list_flags_t;"] + #[doc = "< default behavior may use implicit driver-based heuristics to balance"] + #[doc = "< latency and throughput."] + pub flags: ze_command_list_flags_t, } #[test] fn bindgen_test_layout__ze_command_list_desc_t() { assert_eq!( ::std::mem::size_of::<_ze_command_list_desc_t>(), - 8usize, + 24usize, concat!("Size of: ", stringify!(_ze_command_list_desc_t)) ); assert_eq!( ::std::mem::align_of::<_ze_command_list_desc_t>(), - 4usize, + 8usize, concat!("Alignment of ", stringify!(_ze_command_list_desc_t)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_command_list_desc_t>())).version as *const _ as usize }, + unsafe { &(*(::std::ptr::null::<_ze_command_list_desc_t>())).stype as *const _ as usize }, 0usize, concat!( "Offset of field: ", stringify!(_ze_command_list_desc_t), "::", - stringify!(version) + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_command_list_desc_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_command_list_desc_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_command_list_desc_t>())).commandQueueGroupOrdinal as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_command_list_desc_t), + "::", + stringify!(commandQueueGroupOrdinal) ) ); assert_eq!( unsafe { &(*(::std::ptr::null::<_ze_command_list_desc_t>())).flags as *const _ as usize }, - 4usize, + 20usize, concat!( "Offset of field: ", stringify!(_ze_command_list_desc_t), @@ -2878,32 +4201,33 @@ fn bindgen_test_layout__ze_command_list_desc_t() { } extern "C" { #[doc = ""] - #[doc = " @brief Creates a command list on the device for submitting commands to any"] - #[doc = " command queue."] + #[doc = " @brief Creates a command list on the context."] #[doc = ""] #[doc = " @details"] - #[doc = " - The command list can only be used on the device on which it was"] - #[doc = " created."] + #[doc = " - A command list represents a sequence of commands for execution on a"] + #[doc = " command queue."] #[doc = " - The command list is created in the 'open' state."] + #[doc = " - The application must only use the command list for the device, or its"] + #[doc = " sub-devices, which was provided during creation."] #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] + #[doc = " - The implementation of this function must be thread-safe."] #[doc = ""] #[doc = " @returns"] #[doc = " - ::ZE_RESULT_SUCCESS"] #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] #[doc = " + `nullptr == hDevice`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] #[doc = " + `nullptr == desc`"] #[doc = " + `nullptr == phCommandList`"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION"] - #[doc = " + `::ZE_COMMAND_LIST_DESC_VERSION_CURRENT < desc->version`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + desc->flags"] + #[doc = " + `0x7 < desc->flags`"] #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] pub fn zeCommandListCreate( + hContext: ze_context_handle_t, hDevice: ze_device_handle_t, desc: *const ze_command_list_desc_t, phCommandList: *mut ze_command_list_handle_t, @@ -2911,35 +4235,37 @@ extern "C" { } extern "C" { #[doc = ""] - #[doc = " @brief Creates a command list on the device with an implicit command queue"] - #[doc = " for immediate submission of commands."] + #[doc = " @brief Creates an immediate command list on the context."] #[doc = ""] #[doc = " @details"] - #[doc = " - The command list can only be used on the device on which it was"] - #[doc = " created."] + #[doc = " - An immediate command list is used for low-latency submission of"] + #[doc = " commands."] + #[doc = " - An immediate command list creates an implicit command queue."] #[doc = " - The command list is created in the 'open' state and never needs to be"] #[doc = " closed."] + #[doc = " - The application must only use the command list for the device, or its"] + #[doc = " sub-devices, which was provided during creation."] #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] + #[doc = " - The implementation of this function must be thread-safe."] #[doc = ""] #[doc = " @returns"] #[doc = " - ::ZE_RESULT_SUCCESS"] #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] #[doc = " + `nullptr == hDevice`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] #[doc = " + `nullptr == altdesc`"] #[doc = " + `nullptr == phCommandList`"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION"] - #[doc = " + `::ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT < altdesc->version`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + altdesc->flags"] - #[doc = " + altdesc->mode"] - #[doc = " + altdesc->priority"] + #[doc = " + `0x1 < altdesc->flags`"] + #[doc = " + `::ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS < altdesc->mode`"] + #[doc = " + `::ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH < altdesc->priority`"] #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] pub fn zeCommandListCreateImmediate( + hContext: ze_context_handle_t, hDevice: ze_device_handle_t, altdesc: *const ze_command_queue_desc_t, phCommandList: *mut ze_command_list_handle_t, @@ -2950,13 +4276,13 @@ extern "C" { #[doc = " @brief Destroys a command list."] #[doc = ""] #[doc = " @details"] - #[doc = " - The application is responsible for making sure the device is not"] - #[doc = " currently referencing the command list before it is deleted"] - #[doc = " - The implementation of this function will immediately free all Host and"] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the command list before it is deleted."] + #[doc = " - The implementation of this function may immediately free all Host and"] #[doc = " Device allocations associated with this command list."] - #[doc = " - The application may **not** call this function from simultaneous"] + #[doc = " - The application must **not** call this function from simultaneous"] #[doc = " threads with the same command list handle."] - #[doc = " - The implementation of this function should be lock-free."] + #[doc = " - The implementation of this function must be thread-safe."] #[doc = ""] #[doc = " @returns"] #[doc = " - ::ZE_RESULT_SUCCESS"] @@ -2972,7 +4298,7 @@ extern "C" { #[doc = " @brief Closes a command list; ready to be executed by a command queue."] #[doc = ""] #[doc = " @details"] - #[doc = " - The application may **not** call this function from simultaneous"] + #[doc = " - The application must **not** call this function from simultaneous"] #[doc = " threads with the same command list handle."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -2990,9 +4316,9 @@ extern "C" { #[doc = " commands."] #[doc = ""] #[doc = " @details"] - #[doc = " - The application is responsible for making sure the device is not"] - #[doc = " currently referencing the command list before it is reset"] - #[doc = " - The application may **not** call this function from simultaneous"] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the command list before it is reset"] + #[doc = " - The application must **not** call this function from simultaneous"] #[doc = " threads with the same command list handle."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -3004,468 +4330,24 @@ extern "C" { #[doc = " + `nullptr == hCommandList`"] pub fn zeCommandListReset(hCommandList: ze_command_list_handle_t) -> ze_result_t; } -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_image_desc_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_image_desc_version_t { - #[doc = "< version 0.91"] - ZE_IMAGE_DESC_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_image_desc_t"] -pub use self::_ze_image_desc_version_t as ze_image_desc_version_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported image creation flags"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_image_flag_t { - #[doc = "< programs will read contents"] - ZE_IMAGE_FLAG_PROGRAM_READ = 1, - #[doc = "< programs will write contents"] - ZE_IMAGE_FLAG_PROGRAM_WRITE = 2, - #[doc = "< device should cache contents"] - ZE_IMAGE_FLAG_BIAS_CACHED = 4, - #[doc = "< device should not cache contents"] - ZE_IMAGE_FLAG_BIAS_UNCACHED = 8, -} -#[doc = ""] -#[doc = " @brief Supported image creation flags"] -pub use self::_ze_image_flag_t as ze_image_flag_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported image types"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_image_type_t { - #[doc = "< 1D"] - ZE_IMAGE_TYPE_1D = 0, - #[doc = "< 1D array"] - ZE_IMAGE_TYPE_1DARRAY = 1, - #[doc = "< 2D"] - ZE_IMAGE_TYPE_2D = 2, - #[doc = "< 2D array"] - ZE_IMAGE_TYPE_2DARRAY = 3, - #[doc = "< 3D"] - ZE_IMAGE_TYPE_3D = 4, - #[doc = "< Buffer"] - ZE_IMAGE_TYPE_BUFFER = 5, -} -#[doc = ""] -#[doc = " @brief Supported image types"] -pub use self::_ze_image_type_t as ze_image_type_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported image format layouts"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_image_format_layout_t { - #[doc = "< 8-bit single component layout"] - ZE_IMAGE_FORMAT_LAYOUT_8 = 0, - #[doc = "< 16-bit single component layout"] - ZE_IMAGE_FORMAT_LAYOUT_16 = 1, - #[doc = "< 32-bit single component layout"] - ZE_IMAGE_FORMAT_LAYOUT_32 = 2, - #[doc = "< 2-component 8-bit layout"] - ZE_IMAGE_FORMAT_LAYOUT_8_8 = 3, - #[doc = "< 4-component 8-bit layout"] - ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8 = 4, - #[doc = "< 2-component 16-bit layout"] - ZE_IMAGE_FORMAT_LAYOUT_16_16 = 5, - #[doc = "< 4-component 16-bit layout"] - ZE_IMAGE_FORMAT_LAYOUT_16_16_16_16 = 6, - #[doc = "< 2-component 32-bit layout"] - ZE_IMAGE_FORMAT_LAYOUT_32_32 = 7, - #[doc = "< 4-component 32-bit layout"] - ZE_IMAGE_FORMAT_LAYOUT_32_32_32_32 = 8, - #[doc = "< 4-component 10_10_10_2 layout"] - ZE_IMAGE_FORMAT_LAYOUT_10_10_10_2 = 9, - #[doc = "< 3-component 11_11_10 layout"] - ZE_IMAGE_FORMAT_LAYOUT_11_11_10 = 10, - #[doc = "< 3-component 5_6_5 layout"] - ZE_IMAGE_FORMAT_LAYOUT_5_6_5 = 11, - #[doc = "< 4-component 5_5_5_1 layout"] - ZE_IMAGE_FORMAT_LAYOUT_5_5_5_1 = 12, - #[doc = "< 4-component 4_4_4_4 layout"] - ZE_IMAGE_FORMAT_LAYOUT_4_4_4_4 = 13, - #[doc = "< Media Format: Y8. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_Y8 = 14, - #[doc = "< Media Format: NV12. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_NV12 = 15, - #[doc = "< Media Format: YUYV. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_YUYV = 16, - #[doc = "< Media Format: VYUY. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_VYUY = 17, - #[doc = "< Media Format: YVYU. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_YVYU = 18, - #[doc = "< Media Format: UYVY. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_UYVY = 19, - #[doc = "< Media Format: AYUV. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_AYUV = 20, - #[doc = "< Media Format: YUAV. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_YUAV = 21, - #[doc = "< Media Format: P010. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_P010 = 22, - #[doc = "< Media Format: Y410. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_Y410 = 23, - #[doc = "< Media Format: P012. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_P012 = 24, - #[doc = "< Media Format: Y16. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_Y16 = 25, - #[doc = "< Media Format: P016. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_P016 = 26, - #[doc = "< Media Format: Y216. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_Y216 = 27, - #[doc = "< Media Format: P216. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_P216 = 28, - #[doc = "< Media Format: P416. Format type and swizzle is ignored for this."] - ZE_IMAGE_FORMAT_LAYOUT_P416 = 29, -} -#[doc = ""] -#[doc = " @brief Supported image format layouts"] -pub use self::_ze_image_format_layout_t as ze_image_format_layout_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported image format types"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_image_format_type_t { - #[doc = "< Unsigned integer"] - ZE_IMAGE_FORMAT_TYPE_UINT = 0, - #[doc = "< Signed integer"] - ZE_IMAGE_FORMAT_TYPE_SINT = 1, - #[doc = "< Unsigned normalized integer"] - ZE_IMAGE_FORMAT_TYPE_UNORM = 2, - #[doc = "< Signed normalized integer"] - ZE_IMAGE_FORMAT_TYPE_SNORM = 3, - #[doc = "< Float"] - ZE_IMAGE_FORMAT_TYPE_FLOAT = 4, -} -#[doc = ""] -#[doc = " @brief Supported image format types"] -pub use self::_ze_image_format_type_t as ze_image_format_type_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported image format component swizzle into channel"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_image_format_swizzle_t { - #[doc = "< Red component"] - ZE_IMAGE_FORMAT_SWIZZLE_R = 0, - #[doc = "< Green component"] - ZE_IMAGE_FORMAT_SWIZZLE_G = 1, - #[doc = "< Blue component"] - ZE_IMAGE_FORMAT_SWIZZLE_B = 2, - #[doc = "< Alpha component"] - ZE_IMAGE_FORMAT_SWIZZLE_A = 3, - #[doc = "< Zero"] - ZE_IMAGE_FORMAT_SWIZZLE_0 = 4, - #[doc = "< One"] - ZE_IMAGE_FORMAT_SWIZZLE_1 = 5, - #[doc = "< Don't care"] - ZE_IMAGE_FORMAT_SWIZZLE_X = 6, -} -#[doc = ""] -#[doc = " @brief Supported image format component swizzle into channel"] -pub use self::_ze_image_format_swizzle_t as ze_image_format_swizzle_t; -#[doc = ""] -#[doc = " @brief Image format descriptor"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _ze_image_format_desc_t { - #[doc = "< [in] image format component layout"] - pub layout: ze_image_format_layout_t, - #[doc = "< [in] image format type. Media formats can't be used for"] - #[doc = "< ::ZE_IMAGE_TYPE_BUFFER."] - pub type_: ze_image_format_type_t, - #[doc = "< [in] image component swizzle into channel x"] - pub x: ze_image_format_swizzle_t, - #[doc = "< [in] image component swizzle into channel y"] - pub y: ze_image_format_swizzle_t, - #[doc = "< [in] image component swizzle into channel z"] - pub z: ze_image_format_swizzle_t, - #[doc = "< [in] image component swizzle into channel w"] - pub w: ze_image_format_swizzle_t, -} -#[test] -fn bindgen_test_layout__ze_image_format_desc_t() { - assert_eq!( - ::std::mem::size_of::<_ze_image_format_desc_t>(), - 24usize, - concat!("Size of: ", stringify!(_ze_image_format_desc_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_image_format_desc_t>(), - 4usize, - concat!("Alignment of ", stringify!(_ze_image_format_desc_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_format_desc_t>())).layout as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_format_desc_t), - "::", - stringify!(layout) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_format_desc_t>())).type_ as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_format_desc_t), - "::", - stringify!(type_) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_format_desc_t>())).x as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_format_desc_t), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_format_desc_t>())).y as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_format_desc_t), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_format_desc_t>())).z as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_format_desc_t), - "::", - stringify!(z) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_format_desc_t>())).w as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_format_desc_t), - "::", - stringify!(w) - ) - ); -} -#[doc = ""] -#[doc = " @brief Image descriptor"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _ze_image_desc_t { - #[doc = "< [in] ::ZE_IMAGE_DESC_VERSION_CURRENT"] - pub version: ze_image_desc_version_t, - #[doc = "< [in] creation flags"] - pub flags: ze_image_flag_t, - #[doc = "< [in] image type"] - pub type_: ze_image_type_t, - #[doc = "< [in] image format"] - pub format: ze_image_format_desc_t, - #[doc = "< [in] width in pixels for ::ze_image_type_t::1D/2D/3D and bytes for"] - #[doc = "< Buffer, see ::ze_device_image_properties_t::maxImageDims1D/2D/3D and"] - #[doc = "< maxImageBufferSize."] - pub width: u64, - #[doc = "< [in] height in pixels (2D or 3D only), see"] - #[doc = "< ::ze_device_image_properties_t::maxImageDims2D/3D"] - pub height: u32, - #[doc = "< [in] depth in pixels (3D only), see"] - #[doc = "< ::ze_device_image_properties_t::maxImageDims3D"] - pub depth: u32, - #[doc = "< [in] array levels (array types only), see"] - #[doc = "< ::ze_device_image_properties_t::maxImageArraySlices"] - pub arraylevels: u32, - #[doc = "< [in] mipmap levels (must be 0)"] - pub miplevels: u32, -} -#[test] -fn bindgen_test_layout__ze_image_desc_t() { - assert_eq!( - ::std::mem::size_of::<_ze_image_desc_t>(), - 64usize, - concat!("Size of: ", stringify!(_ze_image_desc_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_image_desc_t>(), - 8usize, - concat!("Alignment of ", stringify!(_ze_image_desc_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).version as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_desc_t), - "::", - stringify!(version) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).flags as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_desc_t), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).type_ as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_desc_t), - "::", - stringify!(type_) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).format as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_desc_t), - "::", - stringify!(format) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).width as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_desc_t), - "::", - stringify!(width) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).height as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_desc_t), - "::", - stringify!(height) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).depth as *const _ as usize }, - 52usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_desc_t), - "::", - stringify!(depth) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).arraylevels as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_desc_t), - "::", - stringify!(arraylevels) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).miplevels as *const _ as usize }, - 60usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_desc_t), - "::", - stringify!(miplevels) - ) - ); -} -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_image_properties_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_image_properties_version_t { - #[doc = "< version 0.91"] - ZE_IMAGE_PROPERTIES_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_image_properties_t"] -pub use self::_ze_image_properties_version_t as ze_image_properties_version_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported sampler filtering flags"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_image_sampler_filter_flags_t { - #[doc = "< device does not support filtering"] - ZE_IMAGE_SAMPLER_FILTER_FLAGS_NONE = 0, - #[doc = "< device supports point filtering"] - ZE_IMAGE_SAMPLER_FILTER_FLAGS_POINT = 1, - #[doc = "< device supports linear filtering"] - ZE_IMAGE_SAMPLER_FILTER_FLAGS_LINEAR = 2, -} -#[doc = ""] -#[doc = " @brief Supported sampler filtering flags"] -pub use self::_ze_image_sampler_filter_flags_t as ze_image_sampler_filter_flags_t; -#[doc = ""] -#[doc = " @brief Image properties"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _ze_image_properties_t { - #[doc = "< [in] ::ZE_IMAGE_PROPERTIES_VERSION_CURRENT"] - pub version: ze_image_properties_version_t, - #[doc = "< [out] supported sampler filtering"] - pub samplerFilterFlags: ze_image_sampler_filter_flags_t, -} -#[test] -fn bindgen_test_layout__ze_image_properties_t() { - assert_eq!( - ::std::mem::size_of::<_ze_image_properties_t>(), - 8usize, - concat!("Size of: ", stringify!(_ze_image_properties_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_image_properties_t>(), - 4usize, - concat!("Alignment of ", stringify!(_ze_image_properties_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_image_properties_t>())).version as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_properties_t), - "::", - stringify!(version) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_image_properties_t>())).samplerFilterFlags as *const _ - as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_image_properties_t), - "::", - stringify!(samplerFilterFlags) - ) - ); -} extern "C" { #[doc = ""] - #[doc = " @brief Retrieves supported properties of an image."] + #[doc = " @brief Appends a memory write of the device's global timestamp value into a"] + #[doc = " command list."] #[doc = ""] #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The application must ensure the events are accessible by the device on"] + #[doc = " which the command list was created."] + #[doc = " - The timestamp frequency can be queried from"] + #[doc = " ::ze_device_properties_t.timerResolution."] + #[doc = " - The number of valid bits in the timestamp value can be queried from"] + #[doc = " ::ze_device_properties_t.timestampValidBits."] + #[doc = " - The application must ensure the memory pointed to by dstptr is"] + #[doc = " accessible by the device on which the command list was created."] + #[doc = " - The application must ensure the command list and events were created,"] + #[doc = " and the memory was allocated, on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same command list handle."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] #[doc = " @returns"] @@ -3473,93 +4355,34 @@ extern "C" { #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDevice`"] + #[doc = " + `nullptr == hCommandList`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == desc`"] - #[doc = " + `nullptr == pImageProperties`"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION"] - #[doc = " + `::ZE_IMAGE_DESC_VERSION_CURRENT < desc->version`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + desc->flags"] - #[doc = " + desc->type"] - pub fn zeImageGetProperties( - hDevice: ze_device_handle_t, - desc: *const ze_image_desc_t, - pImageProperties: *mut ze_image_properties_t, + #[doc = " + `nullptr == dstptr`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] + pub fn zeCommandListAppendWriteGlobalTimestamp( + hCommandList: ze_command_list_handle_t, + dstptr: *mut u64, + hSignalEvent: ze_event_handle_t, + numWaitEvents: u32, + phWaitEvents: *mut ze_event_handle_t, ) -> ze_result_t; } -extern "C" { - #[doc = ""] - #[doc = " @brief Creates a image object on the device."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The image is only visible to the device on which it was created."] - #[doc = " - The image can be copied to another device using the"] - #[doc = " ::::zeCommandListAppendImageCopy functions."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - clCreateImage"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDevice`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == desc`"] - #[doc = " + `nullptr == phImage`"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION"] - #[doc = " + `::ZE_IMAGE_DESC_VERSION_CURRENT < desc->version`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + desc->flags"] - #[doc = " + desc->type"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] - pub fn zeImageCreate( - hDevice: ze_device_handle_t, - desc: *const ze_image_desc_t, - phImage: *mut ze_image_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Deletes a image object."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application is responsible for making sure the device is not"] - #[doc = " currently referencing the image before it is deleted"] - #[doc = " - The implementation of this function will immediately free all Host and"] - #[doc = " Device allocations associated with this image"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same image handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hImage`"] - #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] - pub fn zeImageDestroy(hImage: ze_image_handle_t) -> ze_result_t; -} extern "C" { #[doc = ""] #[doc = " @brief Appends an execution and global memory barrier into a command list."] #[doc = ""] #[doc = " @details"] + #[doc = " - The application must ensure the events are accessible by the device on"] + #[doc = " which the command list was created."] #[doc = " - If numWaitEvents is zero, then all previous commands are completed"] #[doc = " prior to the execution of the barrier."] #[doc = " - If numWaitEvents is non-zero, then then all phWaitEvents must be"] #[doc = " signaled prior to the execution of the barrier."] #[doc = " - This command blocks all following commands from beginning until the"] #[doc = " execution of the barrier completes."] - #[doc = " - The application may **not** call this function from simultaneous"] + #[doc = " - The application must **not** call this function from simultaneous"] #[doc = " threads with the same command list handle."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -3575,6 +4398,8 @@ extern "C" { #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] #[doc = " + `nullptr == hCommandList`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] pub fn zeCommandListAppendBarrier( hCommandList: ze_command_list_handle_t, hSignalEvent: ze_event_handle_t, @@ -3587,13 +4412,15 @@ extern "C" { #[doc = " @brief Appends a global memory ranges barrier into a command list."] #[doc = ""] #[doc = " @details"] + #[doc = " - The application must ensure the events are accessible by the device on"] + #[doc = " which the command list was created."] #[doc = " - If numWaitEvents is zero, then all previous commands are completed"] #[doc = " prior to the execution of the barrier."] #[doc = " - If numWaitEvents is non-zero, then then all phWaitEvents must be"] #[doc = " signaled prior to the execution of the barrier."] #[doc = " - This command blocks all following commands from beginning until the"] #[doc = " execution of the barrier completes."] - #[doc = " - The application may **not** call this function from simultaneous"] + #[doc = " - The application must **not** call this function from simultaneous"] #[doc = " threads with the same command list handle."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -3607,6 +4434,8 @@ extern "C" { #[doc = " + `nullptr == pRangeSizes`"] #[doc = " + `nullptr == pRanges`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] pub fn zeCommandListAppendMemoryRangesBarrier( hCommandList: ze_command_list_handle_t, numRanges: u32, @@ -3623,11 +4452,11 @@ extern "C" { #[doc = ""] #[doc = " @details"] #[doc = " - This is a special-case system level barrier that can be used to ensure"] - #[doc = " global observability of writes; typically needed after a producer"] - #[doc = " (e.g., NIC) performs direct writes to the device's memory (e.g.,"] - #[doc = " Direct RDMA writes). This is typically required when the memory"] - #[doc = " corresponding to the writes is subsequently accessed from a remote"] - #[doc = " device."] + #[doc = " global observability of writes;"] + #[doc = " typically needed after a producer (e.g., NIC) performs direct writes"] + #[doc = " to the device's memory (e.g., Direct RDMA writes)."] + #[doc = " This is typically required when the memory corresponding to the writes"] + #[doc = " is subsequently accessed from a remote device."] #[doc = " - The application may call this function from simultaneous threads."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -3636,2667 +4465,28 @@ extern "C" { #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] #[doc = " + `nullptr == hDevice`"] - pub fn zeDeviceSystemBarrier(hDevice: ze_device_handle_t) -> ze_result_t; -} -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_module_desc_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_module_desc_version_t { - #[doc = "< version 0.91"] - ZE_MODULE_DESC_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_module_desc_t"] -pub use self::_ze_module_desc_version_t as ze_module_desc_version_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported module creation input formats"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_module_format_t { - #[doc = "< Format is SPIRV IL format"] - ZE_MODULE_FORMAT_IL_SPIRV = 0, - #[doc = "< Format is device native format"] - ZE_MODULE_FORMAT_NATIVE = 1, -} -#[doc = ""] -#[doc = " @brief Supported module creation input formats"] -pub use self::_ze_module_format_t as ze_module_format_t; -#[doc = ""] -#[doc = " @brief Specialization constants - User defined constants"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _ze_module_constants_t { - #[doc = "< [in] Number of specialization constants."] - pub numConstants: u32, - #[doc = "< [in] Pointer to array of IDs that is sized to numConstants."] - pub pConstantIds: *const u32, - #[doc = "< [in] Pointer to array of values that is sized to numConstants."] - pub pConstantValues: *const u64, -} -#[test] -fn bindgen_test_layout__ze_module_constants_t() { - assert_eq!( - ::std::mem::size_of::<_ze_module_constants_t>(), - 24usize, - concat!("Size of: ", stringify!(_ze_module_constants_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_module_constants_t>(), - 8usize, - concat!("Alignment of ", stringify!(_ze_module_constants_t)) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_module_constants_t>())).numConstants as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_module_constants_t), - "::", - stringify!(numConstants) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_module_constants_t>())).pConstantIds as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_ze_module_constants_t), - "::", - stringify!(pConstantIds) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_module_constants_t>())).pConstantValues as *const _ as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(_ze_module_constants_t), - "::", - stringify!(pConstantValues) - ) - ); -} -#[doc = ""] -#[doc = " @brief Module descriptor"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _ze_module_desc_t { - #[doc = "< [in] ::ZE_MODULE_DESC_VERSION_CURRENT"] - pub version: ze_module_desc_version_t, - #[doc = "< [in] Module format passed in with pInputModule"] - pub format: ze_module_format_t, - #[doc = "< [in] size of input IL or ISA from pInputModule."] - pub inputSize: usize, - #[doc = "< [in] pointer to IL or ISA"] - pub pInputModule: *const u8, - #[doc = "< [in] string containing compiler flags. See programming guide for build"] - #[doc = "< flags."] - pub pBuildFlags: *const ::std::os::raw::c_char, - #[doc = "< [in] pointer to specialization constants. Valid only for SPIR-V input."] - #[doc = "< This must be set to nullptr if no specialization constants are"] - #[doc = "< provided."] - pub pConstants: *const ze_module_constants_t, -} -#[test] -fn bindgen_test_layout__ze_module_desc_t() { - assert_eq!( - ::std::mem::size_of::<_ze_module_desc_t>(), - 40usize, - concat!("Size of: ", stringify!(_ze_module_desc_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_module_desc_t>(), - 8usize, - concat!("Alignment of ", stringify!(_ze_module_desc_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_module_desc_t>())).version as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_module_desc_t), - "::", - stringify!(version) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_module_desc_t>())).format as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_module_desc_t), - "::", - stringify!(format) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_module_desc_t>())).inputSize as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_ze_module_desc_t), - "::", - stringify!(inputSize) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_module_desc_t>())).pInputModule as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(_ze_module_desc_t), - "::", - stringify!(pInputModule) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_module_desc_t>())).pBuildFlags as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(_ze_module_desc_t), - "::", - stringify!(pBuildFlags) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_module_desc_t>())).pConstants as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(_ze_module_desc_t), - "::", - stringify!(pConstants) - ) - ); -} -extern "C" { - #[doc = ""] - #[doc = " @brief Creates module object from an input IL or native binary."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - Compiles the module for execution on the device."] - #[doc = " - The module can only be used on the device on which it was created."] - #[doc = " - The module can be copied to other devices within the same driver"] - #[doc = " instance by using ::zeModuleGetNativeBinary."] - #[doc = " - The following build options are supported:"] - #[doc = " + \"-ze-opt-disable\" - Disable optimizations"] - #[doc = " + \"-ze-opt-greater-than-4GB-buffer-required\" - Use 64-bit offset"] - #[doc = " calculations for buffers."] - #[doc = " + \"-ze-opt-large-register-file\" - Increase number of registers"] - #[doc = " available to threads."] - #[doc = " - A build log can optionally be returned to the caller. The caller is"] - #[doc = " responsible for destroying build log using ::zeModuleBuildLogDestroy."] - #[doc = " - The module descriptor constants are only supported for SPIR-V"] - #[doc = " specialization constants."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDevice`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == desc`"] - #[doc = " + `nullptr == desc->pInputModule`"] - #[doc = " + `nullptr == desc->pBuildFlags`"] - #[doc = " + `nullptr == desc->pConstants`"] - #[doc = " + `nullptr == phModule`"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION"] - #[doc = " + `::ZE_MODULE_DESC_VERSION_CURRENT < desc->version`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + desc->format"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NATIVE_BINARY"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] - #[doc = " + `0 == desc->inputSize`"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] - #[doc = " - ::ZE_RESULT_ERROR_MODULE_BUILD_FAILURE"] - pub fn zeModuleCreate( + pub fn zeContextSystemBarrier( + hContext: ze_context_handle_t, hDevice: ze_device_handle_t, - desc: *const ze_module_desc_t, - phModule: *mut ze_module_handle_t, - phBuildLog: *mut ze_module_build_log_handle_t, ) -> ze_result_t; } -extern "C" { - #[doc = ""] - #[doc = " @brief Destroys module"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application is responsible for making sure the device is not"] - #[doc = " currently referencing the module before it is deleted"] - #[doc = " - The implementation of this function will immediately free all Host and"] - #[doc = " Device allocations associated with this module"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same module handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hModule`"] - #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] - pub fn zeModuleDestroy(hModule: ze_module_handle_t) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Destroys module build log object"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The implementation of this function will immediately free all Host"] - #[doc = " allocations associated with this object"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same build log handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = " - This function can be called before or after ::zeModuleDestroy for the"] - #[doc = " associated module."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hModuleBuildLog`"] - #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] - pub fn zeModuleBuildLogDestroy(hModuleBuildLog: ze_module_build_log_handle_t) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Retrieves text string for build log."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The caller can pass nullptr for pBuildLog when querying only for size."] - #[doc = " - The caller must provide memory for build log."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hModuleBuildLog`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pSize`"] - pub fn zeModuleBuildLogGetString( - hModuleBuildLog: ze_module_build_log_handle_t, - pSize: *mut usize, - pBuildLog: *mut ::std::os::raw::c_char, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Retrieve native binary from Module."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The native binary output can be cached to disk and new modules can be"] - #[doc = " later constructed from the cached copy."] - #[doc = " - The native binary will retain debugging information that is associated"] - #[doc = " with a module."] - #[doc = " - The caller can pass nullptr for pModuleNativeBinary when querying only"] - #[doc = " for size."] - #[doc = " - The implementation will copy the native binary into a buffer supplied"] - #[doc = " by the caller."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hModule`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pSize`"] - pub fn zeModuleGetNativeBinary( - hModule: ze_module_handle_t, - pSize: *mut usize, - pModuleNativeBinary: *mut u8, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Retrieve global variable pointer from Module."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hModule`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pGlobalName`"] - #[doc = " + `nullptr == pptr`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_GLOBAL_NAME"] - pub fn zeModuleGetGlobalPointer( - hModule: ze_module_handle_t, - pGlobalName: *const ::std::os::raw::c_char, - pptr: *mut *mut ::std::os::raw::c_void, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Retrieve all kernel names in the module."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hModule`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pCount`"] - pub fn zeModuleGetKernelNames( - hModule: ze_module_handle_t, - pCount: *mut u32, - pNames: *mut *const ::std::os::raw::c_char, - ) -> ze_result_t; -} -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_kernel_desc_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_kernel_desc_version_t { - #[doc = "< version 0.91"] - ZE_KERNEL_DESC_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_kernel_desc_t"] -pub use self::_ze_kernel_desc_version_t as ze_kernel_desc_version_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported kernel creation flags"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_kernel_flag_t { - #[doc = "< default driver behavior"] - ZE_KERNEL_FLAG_NONE = 0, - #[doc = "< force all device allocations to be resident during execution"] - ZE_KERNEL_FLAG_FORCE_RESIDENCY = 1, -} -#[doc = ""] -#[doc = " @brief Supported kernel creation flags"] -pub use self::_ze_kernel_flag_t as ze_kernel_flag_t; -#[doc = ""] -#[doc = " @brief Kernel descriptor"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _ze_kernel_desc_t { - #[doc = "< [in] ::ZE_KERNEL_DESC_VERSION_CURRENT"] - pub version: ze_kernel_desc_version_t, - #[doc = "< [in] creation flags"] - pub flags: ze_kernel_flag_t, - #[doc = "< [in] null-terminated name of kernel in module"] - pub pKernelName: *const ::std::os::raw::c_char, -} -#[test] -fn bindgen_test_layout__ze_kernel_desc_t() { - assert_eq!( - ::std::mem::size_of::<_ze_kernel_desc_t>(), - 16usize, - concat!("Size of: ", stringify!(_ze_kernel_desc_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_kernel_desc_t>(), - 8usize, - concat!("Alignment of ", stringify!(_ze_kernel_desc_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_kernel_desc_t>())).version as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_kernel_desc_t), - "::", - stringify!(version) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_kernel_desc_t>())).flags as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_kernel_desc_t), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_kernel_desc_t>())).pKernelName as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_ze_kernel_desc_t), - "::", - stringify!(pKernelName) - ) - ); -} -extern "C" { - #[doc = ""] - #[doc = " @brief Create a kernel object from a module by name"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hModule`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == desc`"] - #[doc = " + `nullptr == desc->pKernelName`"] - #[doc = " + `nullptr == phKernel`"] - #[doc = " + `nullptr == desc->pKernelName`"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION"] - #[doc = " + `::ZE_KERNEL_DESC_VERSION_CURRENT < desc->version`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + desc->flags"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_KERNEL_NAME"] - pub fn zeKernelCreate( - hModule: ze_module_handle_t, - desc: *const ze_kernel_desc_t, - phKernel: *mut ze_kernel_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Destroys a kernel object"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - All kernels must be destroyed before the module is destroyed."] - #[doc = " - The application is responsible for making sure the device is not"] - #[doc = " currently referencing the kernel before it is deleted"] - #[doc = " - The implementation of this function will immediately free all Host and"] - #[doc = " Device allocations associated with this kernel"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same kernel handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hKernel`"] - #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] - pub fn zeKernelDestroy(hKernel: ze_kernel_handle_t) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Retrieve a function pointer from a module by name"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The function pointer is unique for the device on which the module was"] - #[doc = " created."] - #[doc = " - The function pointer is no longer valid if module is destroyed."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hModule`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pFunctionName`"] - #[doc = " + `nullptr == pfnFunction`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_FUNCTION_NAME"] - pub fn zeModuleGetFunctionPointer( - hModule: ze_module_handle_t, - pFunctionName: *const ::std::os::raw::c_char, - pfnFunction: *mut *mut ::std::os::raw::c_void, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Set group size for a kernel"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same kernel handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = " - The implementation will copy the group size information into a command"] - #[doc = " list when the function is appended."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hKernel`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION"] - pub fn zeKernelSetGroupSize( - hKernel: ze_kernel_handle_t, - groupSizeX: u32, - groupSizeY: u32, - groupSizeZ: u32, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Query a suggested group size for a kernel given a global size for each"] - #[doc = " dimension."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = " - This function ignores the group size that is set using"] - #[doc = " ::zeKernelSetGroupSize."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hKernel`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == groupSizeX`"] - #[doc = " + `nullptr == groupSizeY`"] - #[doc = " + `nullptr == groupSizeZ`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION"] - pub fn zeKernelSuggestGroupSize( - hKernel: ze_kernel_handle_t, - globalSizeX: u32, - globalSizeY: u32, - globalSizeZ: u32, - groupSizeX: *mut u32, - groupSizeY: *mut u32, - groupSizeZ: *mut u32, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Query a suggested max group count a cooperative kernel."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hKernel`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == totalGroupCount`"] - pub fn zeKernelSuggestMaxCooperativeGroupCount( - hKernel: ze_kernel_handle_t, - totalGroupCount: *mut u32, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Set kernel argument used on kernel launch."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - This function may **not** be called from simultaneous threads with the"] - #[doc = " same function handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = " - The implementation will copy the arguments into a command list when"] - #[doc = " the function is appended."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hKernel`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE"] - pub fn zeKernelSetArgumentValue( - hKernel: ze_kernel_handle_t, - argIndex: u32, - argSize: usize, - pArgValue: *const ::std::os::raw::c_void, - ) -> ze_result_t; -} -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Kernel attributes"] -#[doc = ""] -#[doc = " @remarks"] -#[doc = " _Analogues_"] -#[doc = " - **cl_kernel_exec_info**"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_kernel_attribute_t { - #[doc = "< Indicates that the function accesses host allocations indirectly"] - #[doc = "< (default: false, type: bool_t)"] - ZE_KERNEL_ATTR_INDIRECT_HOST_ACCESS = 0, - #[doc = "< Indicates that the function accesses device allocations indirectly"] - #[doc = "< (default: false, type: bool_t)"] - ZE_KERNEL_ATTR_INDIRECT_DEVICE_ACCESS = 1, - #[doc = "< Indicates that the function accesses shared allocations indirectly"] - #[doc = "< (default: false, type: bool_t)"] - ZE_KERNEL_ATTR_INDIRECT_SHARED_ACCESS = 2, - #[doc = "< Declared kernel attributes (i.e. can be specified with __attribute__"] - #[doc = "< in runtime language). (type: char[]) Returned as a null-terminated"] - #[doc = "< string and each attribute is separated by a space."] - #[doc = "< ::zeKernelSetAttribute is not supported for this."] - ZE_KERNEL_ATTR_SOURCE_ATTRIBUTE = 3, -} -#[doc = ""] -#[doc = " @brief Kernel attributes"] -#[doc = ""] -#[doc = " @remarks"] -#[doc = " _Analogues_"] -#[doc = " - **cl_kernel_exec_info**"] -pub use self::_ze_kernel_attribute_t as ze_kernel_attribute_t; -extern "C" { - #[doc = ""] - #[doc = " @brief Sets a kernel attribute"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - This function may **not** be called from simultaneous threads with the"] - #[doc = " same function handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - **clSetKernelExecInfo**"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hKernel`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + attr"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE"] - pub fn zeKernelSetAttribute( - hKernel: ze_kernel_handle_t, - attr: ze_kernel_attribute_t, - size: u32, - pValue: *const ::std::os::raw::c_void, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Gets a kernel attribute"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - This function may **not** be called from simultaneous threads with the"] - #[doc = " same function handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = " - The caller sets pValue to nullptr when querying only for size."] - #[doc = " - The caller must provide memory for pValue querying when querying size."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hKernel`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + attr"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pSize`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE"] - pub fn zeKernelGetAttribute( - hKernel: ze_kernel_handle_t, - attr: ze_kernel_attribute_t, - pSize: *mut u32, - pValue: *mut ::std::os::raw::c_void, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Sets the preferred Intermediate cache configuration for a kernel."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same kernel handle."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hKernel`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + CacheConfig"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE"] - pub fn zeKernelSetIntermediateCacheConfig( - hKernel: ze_kernel_handle_t, - CacheConfig: ze_cache_config_t, - ) -> ze_result_t; -} -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_kernel_properties_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_kernel_properties_version_t { - #[doc = "< version 0.91"] - ZE_KERNEL_PROPERTIES_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_kernel_properties_t"] -pub use self::_ze_kernel_properties_version_t as ze_kernel_properties_version_t; -#[doc = ""] -#[doc = " @brief Kernel properties"] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _ze_kernel_properties_t { - #[doc = "< [in] ::ZE_KERNEL_PROPERTIES_VERSION_CURRENT"] - pub version: ze_kernel_properties_version_t, - #[doc = "< [out] Kernel name"] - pub name: [::std::os::raw::c_char; 256usize], - #[doc = "< [out] number of kernel arguments."] - pub numKernelArgs: u32, - #[doc = "< [out] required group size in the X dimension"] - pub requiredGroupSizeX: u32, - #[doc = "< [out] required group size in the Y dimension"] - pub requiredGroupSizeY: u32, - #[doc = "< [out] required group size in the Z dimension"] - pub requiredGroupSizeZ: u32, -} -#[test] -fn bindgen_test_layout__ze_kernel_properties_t() { - assert_eq!( - ::std::mem::size_of::<_ze_kernel_properties_t>(), - 276usize, - concat!("Size of: ", stringify!(_ze_kernel_properties_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_kernel_properties_t>(), - 4usize, - concat!("Alignment of ", stringify!(_ze_kernel_properties_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_kernel_properties_t>())).version as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_kernel_properties_t), - "::", - stringify!(version) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_kernel_properties_t>())).name as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_kernel_properties_t), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_kernel_properties_t>())).numKernelArgs as *const _ as usize - }, - 260usize, - concat!( - "Offset of field: ", - stringify!(_ze_kernel_properties_t), - "::", - stringify!(numKernelArgs) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_kernel_properties_t>())).requiredGroupSizeX as *const _ - as usize - }, - 264usize, - concat!( - "Offset of field: ", - stringify!(_ze_kernel_properties_t), - "::", - stringify!(requiredGroupSizeX) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_kernel_properties_t>())).requiredGroupSizeY as *const _ - as usize - }, - 268usize, - concat!( - "Offset of field: ", - stringify!(_ze_kernel_properties_t), - "::", - stringify!(requiredGroupSizeY) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_kernel_properties_t>())).requiredGroupSizeZ as *const _ - as usize - }, - 272usize, - concat!( - "Offset of field: ", - stringify!(_ze_kernel_properties_t), - "::", - stringify!(requiredGroupSizeZ) - ) - ); -} -extern "C" { - #[doc = ""] - #[doc = " @brief Retrieve kernel properties."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hKernel`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pKernelProperties`"] - pub fn zeKernelGetProperties( - hKernel: ze_kernel_handle_t, - pKernelProperties: *mut ze_kernel_properties_t, - ) -> ze_result_t; -} -#[doc = ""] -#[doc = " @brief Kernel dispatch group count."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _ze_group_count_t { - #[doc = "< [in] number of thread groups in X dimension"] - pub groupCountX: u32, - #[doc = "< [in] number of thread groups in Y dimension"] - pub groupCountY: u32, - #[doc = "< [in] number of thread groups in Z dimension"] - pub groupCountZ: u32, -} -#[test] -fn bindgen_test_layout__ze_group_count_t() { - assert_eq!( - ::std::mem::size_of::<_ze_group_count_t>(), - 12usize, - concat!("Size of: ", stringify!(_ze_group_count_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_group_count_t>(), - 4usize, - concat!("Alignment of ", stringify!(_ze_group_count_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_group_count_t>())).groupCountX as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_group_count_t), - "::", - stringify!(groupCountX) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_group_count_t>())).groupCountY as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_group_count_t), - "::", - stringify!(groupCountY) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_group_count_t>())).groupCountZ as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_ze_group_count_t), - "::", - stringify!(groupCountZ) - ) - ); -} -extern "C" { - #[doc = ""] - #[doc = " @brief Launch kernel over one or more work groups."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - This may **only** be called for a command list created with command"] - #[doc = " queue group ordinal that supports compute."] - #[doc = " - This function may **not** be called from simultaneous threads with the"] - #[doc = " same command list handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hCommandList`"] - #[doc = " + `nullptr == hKernel`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pLaunchFuncArgs`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] - pub fn zeCommandListAppendLaunchKernel( - hCommandList: ze_command_list_handle_t, - hKernel: ze_kernel_handle_t, - pLaunchFuncArgs: *const ze_group_count_t, - hSignalEvent: ze_event_handle_t, - numWaitEvents: u32, - phWaitEvents: *mut ze_event_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Launch kernel cooperatively over one or more work groups."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - This may **only** be called for a command list created with command"] - #[doc = " queue group ordinal that supports compute."] - #[doc = " - This may only be used for a command list that are submitted to command"] - #[doc = " queue with cooperative flag set."] - #[doc = " - This function may **not** be called from simultaneous threads with the"] - #[doc = " same command list handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = " - Use ::zeKernelSuggestMaxCooperativeGroupCount to recommend max group"] - #[doc = " count for device for cooperative functions that device supports."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hCommandList`"] - #[doc = " + `nullptr == hKernel`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pLaunchFuncArgs`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] - pub fn zeCommandListAppendLaunchCooperativeKernel( - hCommandList: ze_command_list_handle_t, - hKernel: ze_kernel_handle_t, - pLaunchFuncArgs: *const ze_group_count_t, - hSignalEvent: ze_event_handle_t, - numWaitEvents: u32, - phWaitEvents: *mut ze_event_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Launch kernel over one or more work groups using indirect arguments."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The launch arguments need to be device visible."] - #[doc = " - The launch arguments buffer may not be reused until the function has"] - #[doc = " completed on the device."] - #[doc = " - This may **only** be called for a command list created with command"] - #[doc = " queue group ordinal that supports compute."] - #[doc = " - This function may **not** be called from simultaneous threads with the"] - #[doc = " same command list handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hCommandList`"] - #[doc = " + `nullptr == hKernel`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pLaunchArgumentsBuffer`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] - pub fn zeCommandListAppendLaunchKernelIndirect( - hCommandList: ze_command_list_handle_t, - hKernel: ze_kernel_handle_t, - pLaunchArgumentsBuffer: *const ze_group_count_t, - hSignalEvent: ze_event_handle_t, - numWaitEvents: u32, - phWaitEvents: *mut ze_event_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Launch multiple kernels over one or more work groups using an array of"] - #[doc = " indirect arguments."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The array of launch arguments need to be device visible."] - #[doc = " - The array of launch arguments buffer may not be reused until the"] - #[doc = " kernel has completed on the device."] - #[doc = " - This may **only** be called for a command list created with command"] - #[doc = " queue group ordinal that supports compute."] - #[doc = " - This function may **not** be called from simultaneous threads with the"] - #[doc = " same command list handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hCommandList`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == phKernels`"] - #[doc = " + `nullptr == pCountBuffer`"] - #[doc = " + `nullptr == pLaunchArgumentsBuffer`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] - pub fn zeCommandListAppendLaunchMultipleKernelsIndirect( - hCommandList: ze_command_list_handle_t, - numKernels: u32, - phKernels: *mut ze_kernel_handle_t, - pCountBuffer: *const u32, - pLaunchArgumentsBuffer: *const ze_group_count_t, - hSignalEvent: ze_event_handle_t, - numWaitEvents: u32, - phWaitEvents: *mut ze_event_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Makes memory resident for the device."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - If the application does not properly manage residency then the device"] - #[doc = " may experience unrecoverable page-faults."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDevice`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == ptr`"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] - pub fn zeDeviceMakeMemoryResident( - hDevice: ze_device_handle_t, - ptr: *mut ::std::os::raw::c_void, - size: usize, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Allows memory to be evicted from the device."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application is responsible for making sure the device is not"] - #[doc = " currently referencing the memory before it is evicted"] - #[doc = " - Memory is always implicitly evicted if it is resident when freed."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDevice`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == ptr`"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] - pub fn zeDeviceEvictMemory( - hDevice: ze_device_handle_t, - ptr: *mut ::std::os::raw::c_void, - size: usize, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Makes image resident for the device."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - If the application does not properly manage residency then the device"] - #[doc = " may experience unrecoverable page-faults."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDevice`"] - #[doc = " + `nullptr == hImage`"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] - pub fn zeDeviceMakeImageResident( - hDevice: ze_device_handle_t, - hImage: ze_image_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Allows image to be evicted from the device."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application is responsible for making sure the device is not"] - #[doc = " currently referencing the memory before it is evicted"] - #[doc = " - An image is always implicitly evicted if it is resident when"] - #[doc = " destroyed."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDevice`"] - #[doc = " + `nullptr == hImage`"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] - pub fn zeDeviceEvictImage( - hDevice: ze_device_handle_t, - hImage: ze_image_handle_t, - ) -> ze_result_t; -} -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_event_pool_desc_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_event_pool_desc_version_t { - #[doc = "< version 0.91"] - ZE_EVENT_POOL_DESC_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_event_pool_desc_t"] -pub use self::_ze_event_pool_desc_version_t as ze_event_pool_desc_version_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported event pool creation flags"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_event_pool_flag_t { - #[doc = "< signals and waits visible to the entire device and peer devices"] - ZE_EVENT_POOL_FLAG_DEFAULT = 0, - #[doc = "< signals and waits are also visible to host"] - ZE_EVENT_POOL_FLAG_HOST_VISIBLE = 1, - #[doc = "< signals and waits may be shared across processes"] - ZE_EVENT_POOL_FLAG_IPC = 2, - #[doc = "< Indicates all events in pool will contain timestamp information that"] - #[doc = "< can be queried using ::zeEventGetTimestamp"] - ZE_EVENT_POOL_FLAG_TIMESTAMP = 4, -} -#[doc = ""] -#[doc = " @brief Supported event pool creation flags"] -pub use self::_ze_event_pool_flag_t as ze_event_pool_flag_t; -#[doc = ""] -#[doc = " @brief Event pool descriptor"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _ze_event_pool_desc_t { - #[doc = "< [in] ::ZE_EVENT_POOL_DESC_VERSION_CURRENT"] - pub version: ze_event_pool_desc_version_t, - #[doc = "< [in] creation flags"] - pub flags: ze_event_pool_flag_t, - #[doc = "< [in] number of events within the pool"] - pub count: u32, -} -#[test] -fn bindgen_test_layout__ze_event_pool_desc_t() { - assert_eq!( - ::std::mem::size_of::<_ze_event_pool_desc_t>(), - 12usize, - concat!("Size of: ", stringify!(_ze_event_pool_desc_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_event_pool_desc_t>(), - 4usize, - concat!("Alignment of ", stringify!(_ze_event_pool_desc_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_event_pool_desc_t>())).version as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_event_pool_desc_t), - "::", - stringify!(version) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_event_pool_desc_t>())).flags as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_event_pool_desc_t), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_event_pool_desc_t>())).count as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_ze_event_pool_desc_t), - "::", - stringify!(count) - ) - ); -} -extern "C" { - #[doc = ""] - #[doc = " @brief Creates a pool for a set of event(s) for the driver"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDriver`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == desc`"] - #[doc = " + `nullptr == phEventPool`"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION"] - #[doc = " + `::ZE_EVENT_POOL_DESC_VERSION_CURRENT < desc->version`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + desc->flags"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] - pub fn zeEventPoolCreate( - hDriver: ze_driver_handle_t, - desc: *const ze_event_pool_desc_t, - numDevices: u32, - phDevices: *mut ze_device_handle_t, - phEventPool: *mut ze_event_pool_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Deletes an event pool object."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application is responsible for destroying all event handles"] - #[doc = " created from the pool before destroying the pool itself"] - #[doc = " - The application is responsible for making sure the device is not"] - #[doc = " currently referencing the any event within the pool before it is"] - #[doc = " deleted"] - #[doc = " - The implementation of this function will immediately free all Host and"] - #[doc = " Device allocations associated with this event pool"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same event pool handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hEventPool`"] - #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] - pub fn zeEventPoolDestroy(hEventPool: ze_event_pool_handle_t) -> ze_result_t; -} -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_event_desc_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_event_desc_version_t { - #[doc = "< version 0.91"] - ZE_EVENT_DESC_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_event_desc_t"] -pub use self::_ze_event_desc_version_t as ze_event_desc_version_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported event scope flags"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_event_scope_flag_t { - #[doc = "< execution synchronization only; no cache hierarchies are flushed or"] - #[doc = "< invalidated"] - ZE_EVENT_SCOPE_FLAG_NONE = 0, - #[doc = "< cache hierarchies are flushed or invalidated sufficient for local"] - #[doc = "< sub-device access"] - ZE_EVENT_SCOPE_FLAG_SUBDEVICE = 1, - #[doc = "< cache hierarchies are flushed or invalidated sufficient for global"] - #[doc = "< device access and peer device access"] - ZE_EVENT_SCOPE_FLAG_DEVICE = 2, - #[doc = "< cache hierarchies are flushed or invalidated sufficient for device and"] - #[doc = "< host access"] - ZE_EVENT_SCOPE_FLAG_HOST = 4, -} -#[doc = ""] -#[doc = " @brief Supported event scope flags"] -pub use self::_ze_event_scope_flag_t as ze_event_scope_flag_t; -#[doc = ""] -#[doc = " @brief Event descriptor"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _ze_event_desc_t { - #[doc = "< [in] ::ZE_EVENT_DESC_VERSION_CURRENT"] - pub version: ze_event_desc_version_t, - #[doc = "< [in] index of the event within the pool; must be less-than the count"] - #[doc = "< specified during pool creation"] - pub index: u32, - #[doc = "< [in] defines the scope of relevant cache hierarchies to flush on a"] - #[doc = "< signal action before the event is triggered"] - pub signal: ze_event_scope_flag_t, - #[doc = "< [in] defines the scope of relevant cache hierarchies to invalidate on"] - #[doc = "< a wait action after the event is complete"] - pub wait: ze_event_scope_flag_t, -} -#[test] -fn bindgen_test_layout__ze_event_desc_t() { - assert_eq!( - ::std::mem::size_of::<_ze_event_desc_t>(), - 16usize, - concat!("Size of: ", stringify!(_ze_event_desc_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_event_desc_t>(), - 4usize, - concat!("Alignment of ", stringify!(_ze_event_desc_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_event_desc_t>())).version as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_event_desc_t), - "::", - stringify!(version) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_event_desc_t>())).index as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_event_desc_t), - "::", - stringify!(index) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_event_desc_t>())).signal as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_ze_event_desc_t), - "::", - stringify!(signal) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_event_desc_t>())).wait as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(_ze_event_desc_t), - "::", - stringify!(wait) - ) - ); -} -extern "C" { - #[doc = ""] - #[doc = " @brief Creates an event on the device."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - Multiple events cannot be created using the same location within the"] - #[doc = " same pool."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - **clCreateUserEvent**"] - #[doc = " - vkCreateEvent"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hEventPool`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == desc`"] - #[doc = " + `nullptr == phEvent`"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION"] - #[doc = " + `::ZE_EVENT_DESC_VERSION_CURRENT < desc->version`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + desc->signal"] - #[doc = " + desc->wait"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] - pub fn zeEventCreate( - hEventPool: ze_event_pool_handle_t, - desc: *const ze_event_desc_t, - phEvent: *mut ze_event_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Deletes an event object."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application is responsible for making sure the device is not"] - #[doc = " currently referencing the event before it is deleted"] - #[doc = " - The implementation of this function will immediately free all Host and"] - #[doc = " Device allocations associated with this event"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same event handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - **clReleaseEvent**"] - #[doc = " - vkDestroyEvent"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hEvent`"] - #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] - pub fn zeEventDestroy(hEvent: ze_event_handle_t) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Gets an IPC event pool handle for the specified event handle that can"] - #[doc = " be shared with another process."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hEventPool`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == phIpc`"] - pub fn zeEventPoolGetIpcHandle( - hEventPool: ze_event_pool_handle_t, - phIpc: *mut ze_ipc_event_pool_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Opens an IPC event pool handle to retrieve an event pool handle from"] - #[doc = " another process."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The event handle in this process should not be freed with"] - #[doc = " ::zeEventPoolDestroy, but rather with ::zeEventPoolCloseIpcHandle."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDriver`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == phEventPool`"] - pub fn zeEventPoolOpenIpcHandle( - hDriver: ze_driver_handle_t, - hIpc: ze_ipc_event_pool_handle_t, - phEventPool: *mut ze_event_pool_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Closes an IPC event handle in the current process."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - Closes an IPC event handle by destroying events that were opened in"] - #[doc = " this process using ::zeEventPoolOpenIpcHandle."] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same event pool handle."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hEventPool`"] - pub fn zeEventPoolCloseIpcHandle(hEventPool: ze_event_pool_handle_t) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Appends a signal of the event from the device into a command list."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same command list handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - **clSetUserEventStatus**"] - #[doc = " - vkCmdSetEvent"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hCommandList`"] - #[doc = " + `nullptr == hEvent`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] - pub fn zeCommandListAppendSignalEvent( - hCommandList: ze_command_list_handle_t, - hEvent: ze_event_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Appends wait on event(s) on the device into a command list."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same command list handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hCommandList`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == phEvents`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] - pub fn zeCommandListAppendWaitOnEvents( - hCommandList: ze_command_list_handle_t, - numEvents: u32, - phEvents: *mut ze_event_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Signals a event from host."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - clSetUserEventStatus"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hEvent`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] - pub fn zeEventHostSignal(hEvent: ze_event_handle_t) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief The current host thread waits on an event to be signaled."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - clWaitForEvents"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hEvent`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] - #[doc = " - ::ZE_RESULT_NOT_READY"] - #[doc = " + timeout expired"] - pub fn zeEventHostSynchronize(hEvent: ze_event_handle_t, timeout: u32) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Queries an event object's status."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - **clGetEventInfo**"] - #[doc = " - vkGetEventStatus"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hEvent`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] - #[doc = " - ::ZE_RESULT_NOT_READY"] - #[doc = " + not signaled"] - pub fn zeEventQueryStatus(hEvent: ze_event_handle_t) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Reset an event back to not signaled state"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same command list handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - vkResetEvent"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hCommandList`"] - #[doc = " + `nullptr == hEvent`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] - pub fn zeCommandListAppendEventReset( - hCommandList: ze_command_list_handle_t, - hEvent: ze_event_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Reset an event back to not signaled state"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - vkResetEvent"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hEvent`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] - pub fn zeEventHostReset(hEvent: ze_event_handle_t) -> ze_result_t; -} -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported timestamp types"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_event_timestamp_type_t { - #[doc = "< wall-clock time start in GPU clocks for event. Data is uint64_t."] - ZE_EVENT_TIMESTAMP_GLOBAL_START = 0, - #[doc = "< wall-clock time end in GPU clocks for event.Data is uint64_t."] - ZE_EVENT_TIMESTAMP_GLOBAL_END = 1, - #[doc = "< context time start in GPU clocks for event. Only includes time while"] - #[doc = "< HW context is actively running on GPU. Data is uint64_t."] - ZE_EVENT_TIMESTAMP_CONTEXT_START = 2, - #[doc = "< context time end in GPU clocks for event. Only includes time while HW"] - #[doc = "< context is actively running on GPU. Data is uint64_t."] - ZE_EVENT_TIMESTAMP_CONTEXT_END = 3, -} -#[doc = ""] -#[doc = " @brief Supported timestamp types"] -pub use self::_ze_event_timestamp_type_t as ze_event_timestamp_type_t; -extern "C" { - #[doc = ""] - #[doc = " @brief Query timestamp information associated with an event. Event must come"] - #[doc = " from an event pool that was created using"] - #[doc = " ::ZE_EVENT_POOL_FLAG_TIMESTAMP flag."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hEvent`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + timestampType"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == dstptr`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] - pub fn zeEventGetTimestamp( - hEvent: ze_event_handle_t, - timestampType: ze_event_timestamp_type_t, - dstptr: *mut ::std::os::raw::c_void, - ) -> ze_result_t; -} -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_sampler_desc_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_sampler_desc_version_t { - #[doc = "< version 0.91"] - ZE_SAMPLER_DESC_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_sampler_desc_t"] -pub use self::_ze_sampler_desc_version_t as ze_sampler_desc_version_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Sampler addressing modes"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_sampler_address_mode_t { - #[doc = "< No coordinate modifications for out-of-bounds image access."] - ZE_SAMPLER_ADDRESS_MODE_NONE = 0, - #[doc = "< Out-of-bounds coordinates are wrapped back around."] - ZE_SAMPLER_ADDRESS_MODE_REPEAT = 1, - #[doc = "< Out-of-bounds coordinates are clamped to edge."] - ZE_SAMPLER_ADDRESS_MODE_CLAMP = 2, - #[doc = "< Out-of-bounds coordinates are clamped to border color which is (0.0f,"] - #[doc = "< 0.0f, 0.0f, 0.0f) if image format swizzle contains alpha, otherwise"] - #[doc = "< (0.0f, 0.0f, 0.0f, 1.0f)."] - ZE_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, - #[doc = "< Out-of-bounds coordinates are mirrored starting from edge."] - ZE_SAMPLER_ADDRESS_MODE_MIRROR = 4, -} -#[doc = ""] -#[doc = " @brief Sampler addressing modes"] -pub use self::_ze_sampler_address_mode_t as ze_sampler_address_mode_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Sampler filtering modes"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_sampler_filter_mode_t { - #[doc = "< No coordinate modifications for out of bounds image access."] - ZE_SAMPLER_FILTER_MODE_NEAREST = 0, - #[doc = "< Out-of-bounds coordinates are wrapped back around."] - ZE_SAMPLER_FILTER_MODE_LINEAR = 1, -} -#[doc = ""] -#[doc = " @brief Sampler filtering modes"] -pub use self::_ze_sampler_filter_mode_t as ze_sampler_filter_mode_t; -#[doc = ""] -#[doc = " @brief Sampler descriptor"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _ze_sampler_desc_t { - #[doc = "< [in] ::ZE_SAMPLER_DESC_VERSION_CURRENT"] - pub version: ze_sampler_desc_version_t, - #[doc = "< [in] Sampler addressing mode to determine how out-of-bounds"] - #[doc = "< coordinates are handled."] - pub addressMode: ze_sampler_address_mode_t, - #[doc = "< [in] Sampler filter mode to determine how samples are filtered."] - pub filterMode: ze_sampler_filter_mode_t, - #[doc = "< [in] Are coordinates normalized [0, 1] or not."] - pub isNormalized: ze_bool_t, -} -#[test] -fn bindgen_test_layout__ze_sampler_desc_t() { - assert_eq!( - ::std::mem::size_of::<_ze_sampler_desc_t>(), - 16usize, - concat!("Size of: ", stringify!(_ze_sampler_desc_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_sampler_desc_t>(), - 4usize, - concat!("Alignment of ", stringify!(_ze_sampler_desc_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_sampler_desc_t>())).version as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_sampler_desc_t), - "::", - stringify!(version) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_sampler_desc_t>())).addressMode as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_sampler_desc_t), - "::", - stringify!(addressMode) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_sampler_desc_t>())).filterMode as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_ze_sampler_desc_t), - "::", - stringify!(filterMode) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_sampler_desc_t>())).isNormalized as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(_ze_sampler_desc_t), - "::", - stringify!(isNormalized) - ) - ); -} -extern "C" { - #[doc = ""] - #[doc = " @brief Creates sampler object."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The sampler can only be used on the device on which it was created."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDevice`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == desc`"] - #[doc = " + `nullptr == phSampler`"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION"] - #[doc = " + `::ZE_SAMPLER_DESC_VERSION_CURRENT < desc->version`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + desc->addressMode"] - #[doc = " + desc->filterMode"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] - pub fn zeSamplerCreate( - hDevice: ze_device_handle_t, - desc: *const ze_sampler_desc_t, - phSampler: *mut ze_sampler_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Destroys sampler object"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application is responsible for making sure the device is not"] - #[doc = " currently referencing the sampler before it is deleted"] - #[doc = " - The implementation of this function will immediately free all Host and"] - #[doc = " Device allocations associated with this module"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same sampler handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hSampler`"] - #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] - pub fn zeSamplerDestroy(hSampler: ze_sampler_handle_t) -> ze_result_t; -} -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_device_mem_alloc_desc_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_device_mem_alloc_desc_version_t { - #[doc = "< version 0.91"] - ZE_DEVICE_MEM_ALLOC_DESC_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_device_mem_alloc_desc_t"] -pub use self::_ze_device_mem_alloc_desc_version_t as ze_device_mem_alloc_desc_version_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported memory allocation flags"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_device_mem_alloc_flag_t { - #[doc = "< implicit default behavior; uses driver-based heuristics"] - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT = 0, - #[doc = "< device should cache allocation"] - ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_CACHED = 1, - #[doc = "< device should not cache allocation (UC)"] - ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_UNCACHED = 2, -} -#[doc = ""] -#[doc = " @brief Supported memory allocation flags"] -pub use self::_ze_device_mem_alloc_flag_t as ze_device_mem_alloc_flag_t; -#[doc = ""] -#[doc = " @brief Device mem alloc descriptor"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _ze_device_mem_alloc_desc_t { - #[doc = "< [in] ::ZE_DEVICE_MEM_ALLOC_DESC_VERSION_CURRENT"] - pub version: ze_device_mem_alloc_desc_version_t, - #[doc = "< [in] flags specifying additional allocation controls"] - pub flags: ze_device_mem_alloc_flag_t, - #[doc = "< [in] ordinal of the device's local memory to allocate from;"] - #[doc = "< must be less than the count returned from ::zeDeviceGetMemoryProperties"] - pub ordinal: u32, -} -#[test] -fn bindgen_test_layout__ze_device_mem_alloc_desc_t() { - assert_eq!( - ::std::mem::size_of::<_ze_device_mem_alloc_desc_t>(), - 12usize, - concat!("Size of: ", stringify!(_ze_device_mem_alloc_desc_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_device_mem_alloc_desc_t>(), - 4usize, - concat!("Alignment of ", stringify!(_ze_device_mem_alloc_desc_t)) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_mem_alloc_desc_t>())).version as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_mem_alloc_desc_t), - "::", - stringify!(version) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_mem_alloc_desc_t>())).flags as *const _ as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_mem_alloc_desc_t), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_device_mem_alloc_desc_t>())).ordinal as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_ze_device_mem_alloc_desc_t), - "::", - stringify!(ordinal) - ) - ); -} -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_host_mem_alloc_desc_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_host_mem_alloc_desc_version_t { - #[doc = "< version 0.91"] - ZE_HOST_MEM_ALLOC_DESC_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_host_mem_alloc_desc_t"] -pub use self::_ze_host_mem_alloc_desc_version_t as ze_host_mem_alloc_desc_version_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported host memory allocation flags"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_host_mem_alloc_flag_t { - #[doc = "< implicit default behavior; uses driver-based heuristics"] - ZE_HOST_MEM_ALLOC_FLAG_DEFAULT = 0, - #[doc = "< host should cache allocation"] - ZE_HOST_MEM_ALLOC_FLAG_BIAS_CACHED = 1, - #[doc = "< host should not cache allocation (UC)"] - ZE_HOST_MEM_ALLOC_FLAG_BIAS_UNCACHED = 2, - #[doc = "< host memory should be allocated write-combined (WC)"] - ZE_HOST_MEM_ALLOC_FLAG_BIAS_WRITE_COMBINED = 4, -} -#[doc = ""] -#[doc = " @brief Supported host memory allocation flags"] -pub use self::_ze_host_mem_alloc_flag_t as ze_host_mem_alloc_flag_t; -#[doc = ""] -#[doc = " @brief Host mem alloc descriptor"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _ze_host_mem_alloc_desc_t { - #[doc = "< [in] ::ZE_HOST_MEM_ALLOC_DESC_VERSION_CURRENT"] - pub version: ze_host_mem_alloc_desc_version_t, - #[doc = "< [in] flags specifying additional allocation controls"] - pub flags: ze_host_mem_alloc_flag_t, -} -#[test] -fn bindgen_test_layout__ze_host_mem_alloc_desc_t() { - assert_eq!( - ::std::mem::size_of::<_ze_host_mem_alloc_desc_t>(), - 8usize, - concat!("Size of: ", stringify!(_ze_host_mem_alloc_desc_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_host_mem_alloc_desc_t>(), - 4usize, - concat!("Alignment of ", stringify!(_ze_host_mem_alloc_desc_t)) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_host_mem_alloc_desc_t>())).version as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_host_mem_alloc_desc_t), - "::", - stringify!(version) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_host_mem_alloc_desc_t>())).flags as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_host_mem_alloc_desc_t), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = ""] - #[doc = " @brief Allocates memory that is shared between the host and one or more"] - #[doc = " devices"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - Shared allocations share ownership between the host and one or more"] - #[doc = " devices."] - #[doc = " - Shared allocations may optionally be associated with a device by"] - #[doc = " passing a handle to the device."] - #[doc = " - Devices supporting only single-device shared access capabilities may"] - #[doc = " access shared memory associated with the device."] - #[doc = " For these devices, ownership of the allocation is shared between the"] - #[doc = " host and the associated device only."] - #[doc = " - Passing nullptr as the device handle does not associate the shared"] - #[doc = " allocation with any device."] - #[doc = " For allocations with no associated device, ownership of the allocation"] - #[doc = " is shared between the host and all devices supporting cross-device"] - #[doc = " shared access capabilities."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDriver`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == device_desc`"] - #[doc = " + `nullptr == host_desc`"] - #[doc = " + `nullptr == pptr`"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION"] - #[doc = " + `::ZE_DEVICE_MEM_ALLOC_DESC_VERSION_CURRENT < device_desc->version`"] - #[doc = " + `::ZE_HOST_MEM_ALLOC_DESC_VERSION_CURRENT < host_desc->version`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + device_desc->flags"] - #[doc = " + host_desc->flags"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] - pub fn zeDriverAllocSharedMem( - hDriver: ze_driver_handle_t, - device_desc: *const ze_device_mem_alloc_desc_t, - host_desc: *const ze_host_mem_alloc_desc_t, - size: usize, - alignment: usize, - hDevice: ze_device_handle_t, - pptr: *mut *mut ::std::os::raw::c_void, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Allocates memory specific to a device"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - A device allocation is owned by a specific device."] - #[doc = " - In general, a device allocation may only be accessed by the device"] - #[doc = " that owns it."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDriver`"] - #[doc = " + `nullptr == hDevice`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == device_desc`"] - #[doc = " + `nullptr == pptr`"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION"] - #[doc = " + `::ZE_DEVICE_MEM_ALLOC_DESC_VERSION_CURRENT < device_desc->version`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + device_desc->flags"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] - pub fn zeDriverAllocDeviceMem( - hDriver: ze_driver_handle_t, - device_desc: *const ze_device_mem_alloc_desc_t, - size: usize, - alignment: usize, - hDevice: ze_device_handle_t, - pptr: *mut *mut ::std::os::raw::c_void, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Allocates host memory"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - A host allocation is owned by the host process."] - #[doc = " - Host allocations are accessible by the host and all devices within the"] - #[doc = " driver driver."] - #[doc = " - Host allocations are frequently used as staging areas to transfer data"] - #[doc = " to or from devices."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDriver`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == host_desc`"] - #[doc = " + `nullptr == pptr`"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION"] - #[doc = " + `::ZE_HOST_MEM_ALLOC_DESC_VERSION_CURRENT < host_desc->version`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + host_desc->flags"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] - pub fn zeDriverAllocHostMem( - hDriver: ze_driver_handle_t, - host_desc: *const ze_host_mem_alloc_desc_t, - size: usize, - alignment: usize, - pptr: *mut *mut ::std::os::raw::c_void, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Frees allocated host memory, device memory, or shared memory"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application is responsible for making sure the device is not"] - #[doc = " currently referencing the memory before it is freed"] - #[doc = " - The implementation of this function will immediately free all Host and"] - #[doc = " Device allocations associated with this memory"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same pointer."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDriver`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == ptr`"] - pub fn zeDriverFreeMem( - hDriver: ze_driver_handle_t, - ptr: *mut ::std::os::raw::c_void, - ) -> ze_result_t; -} -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_memory_allocation_properties_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_memory_allocation_properties_version_t { - #[doc = "< version 0.91"] - ZE_MEMORY_ALLOCATION_PROPERTIES_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_memory_allocation_properties_t"] -pub use self::_ze_memory_allocation_properties_version_t as ze_memory_allocation_properties_version_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Memory allocation type"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_memory_type_t { - #[doc = "< the memory pointed to is of unknown type"] - ZE_MEMORY_TYPE_UNKNOWN = 0, - #[doc = "< the memory pointed to is a host allocation"] - ZE_MEMORY_TYPE_HOST = 1, - #[doc = "< the memory pointed to is a device allocation"] - ZE_MEMORY_TYPE_DEVICE = 2, - #[doc = "< the memory pointed to is a shared ownership allocation"] - ZE_MEMORY_TYPE_SHARED = 3, -} -#[doc = ""] -#[doc = " @brief Memory allocation type"] -pub use self::_ze_memory_type_t as ze_memory_type_t; -#[doc = ""] -#[doc = " @brief Memory allocation properties queried using"] -#[doc = " ::zeDriverGetMemAllocProperties"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _ze_memory_allocation_properties_t { - #[doc = "< [in] ::ZE_MEMORY_ALLOCATION_PROPERTIES_VERSION_CURRENT"] - pub version: ze_memory_allocation_properties_version_t, - #[doc = "< [out] type of allocated memory"] - pub type_: ze_memory_type_t, - #[doc = "< [out] identifier for this allocation"] - pub id: u64, -} -#[test] -fn bindgen_test_layout__ze_memory_allocation_properties_t() { - assert_eq!( - ::std::mem::size_of::<_ze_memory_allocation_properties_t>(), - 16usize, - concat!("Size of: ", stringify!(_ze_memory_allocation_properties_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_memory_allocation_properties_t>(), - 8usize, - concat!( - "Alignment of ", - stringify!(_ze_memory_allocation_properties_t) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_memory_allocation_properties_t>())).version as *const _ - as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_memory_allocation_properties_t), - "::", - stringify!(version) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_memory_allocation_properties_t>())).type_ as *const _ - as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_memory_allocation_properties_t), - "::", - stringify!(type_) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::<_ze_memory_allocation_properties_t>())).id as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_ze_memory_allocation_properties_t), - "::", - stringify!(id) - ) - ); -} -extern "C" { - #[doc = ""] - #[doc = " @brief Retrieves attributes of a memory allocation"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDriver`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == ptr`"] - #[doc = " + `nullptr == pMemAllocProperties`"] - pub fn zeDriverGetMemAllocProperties( - hDriver: ze_driver_handle_t, - ptr: *const ::std::os::raw::c_void, - pMemAllocProperties: *mut ze_memory_allocation_properties_t, - phDevice: *mut ze_device_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Retrieves the base address and/or size of an allocation"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDriver`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == ptr`"] - pub fn zeDriverGetMemAddressRange( - hDriver: ze_driver_handle_t, - ptr: *const ::std::os::raw::c_void, - pBase: *mut *mut ::std::os::raw::c_void, - pSize: *mut usize, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Creates an IPC memory handle for the specified allocation in the"] - #[doc = " sending process"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - Takes a pointer to the base of a device memory allocation and exports"] - #[doc = " it for use in another process."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDriver`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == ptr`"] - #[doc = " + `nullptr == pIpcHandle`"] - pub fn zeDriverGetMemIpcHandle( - hDriver: ze_driver_handle_t, - ptr: *const ::std::os::raw::c_void, - pIpcHandle: *mut ze_ipc_mem_handle_t, - ) -> ze_result_t; -} -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported IPC memory flags"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_ipc_memory_flag_t { - #[doc = "< No special flags"] - ZE_IPC_MEMORY_FLAG_NONE = 0, -} -#[doc = ""] -#[doc = " @brief Supported IPC memory flags"] -pub use self::_ze_ipc_memory_flag_t as ze_ipc_memory_flag_t; -extern "C" { - #[doc = ""] - #[doc = " @brief Opens an IPC memory handle to retrieve a device pointer in a receiving"] - #[doc = " process"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - Takes an IPC memory handle from a sending process and associates it"] - #[doc = " with a device pointer usable in this process."] - #[doc = " - The device pointer in this process should not be freed with"] - #[doc = " ::zeDriverFreeMem, but rather with ::zeDriverCloseMemIpcHandle."] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDriver`"] - #[doc = " + `nullptr == hDevice`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + flags"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == pptr`"] - pub fn zeDriverOpenMemIpcHandle( - hDriver: ze_driver_handle_t, - hDevice: ze_device_handle_t, - handle: ze_ipc_mem_handle_t, - flags: ze_ipc_memory_flag_t, - pptr: *mut *mut ::std::os::raw::c_void, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Closes an IPC memory handle in a receiving process"] - #[doc = ""] - #[doc = " @details"] - #[doc = " - Closes an IPC memory handle by unmapping memory that was opened in"] - #[doc = " this process using ::zeDriverOpenMemIpcHandle."] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same pointer."] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hDriver`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == ptr`"] - pub fn zeDriverCloseMemIpcHandle( - hDriver: ze_driver_handle_t, - ptr: *const ::std::os::raw::c_void, - ) -> ze_result_t; -} -#[repr(i32)] -#[doc = ""] -#[doc = " @brief API version of ::ze_fence_desc_t"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_fence_desc_version_t { - #[doc = "< version 0.91"] - ZE_FENCE_DESC_VERSION_CURRENT = 91, -} -#[doc = ""] -#[doc = " @brief API version of ::ze_fence_desc_t"] -pub use self::_ze_fence_desc_version_t as ze_fence_desc_version_t; -#[repr(i32)] -#[doc = ""] -#[doc = " @brief Supported fence creation flags"] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_fence_flag_t { - #[doc = "< default behavior"] - ZE_FENCE_FLAG_NONE = 0, -} -#[doc = ""] -#[doc = " @brief Supported fence creation flags"] -pub use self::_ze_fence_flag_t as ze_fence_flag_t; -#[doc = ""] -#[doc = " @brief Fence descriptor"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _ze_fence_desc_t { - #[doc = "< [in] ::ZE_FENCE_DESC_VERSION_CURRENT"] - pub version: ze_fence_desc_version_t, - #[doc = "< [in] creation flags"] - pub flags: ze_fence_flag_t, -} -#[test] -fn bindgen_test_layout__ze_fence_desc_t() { - assert_eq!( - ::std::mem::size_of::<_ze_fence_desc_t>(), - 8usize, - concat!("Size of: ", stringify!(_ze_fence_desc_t)) - ); - assert_eq!( - ::std::mem::align_of::<_ze_fence_desc_t>(), - 4usize, - concat!("Alignment of ", stringify!(_ze_fence_desc_t)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_fence_desc_t>())).version as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_ze_fence_desc_t), - "::", - stringify!(version) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::<_ze_fence_desc_t>())).flags as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(_ze_fence_desc_t), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = ""] - #[doc = " @brief Creates a fence object on the device's command queue."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - **vkCreateFence**"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hCommandQueue`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] - #[doc = " + `nullptr == desc`"] - #[doc = " + `nullptr == phFence`"] - #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION"] - #[doc = " + `::ZE_FENCE_DESC_VERSION_CURRENT < desc->version`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + desc->flags"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] - #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] - pub fn zeFenceCreate( - hCommandQueue: ze_command_queue_handle_t, - desc: *const ze_fence_desc_t, - phFence: *mut ze_fence_handle_t, - ) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Deletes a fence object."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application is responsible for making sure the device is not"] - #[doc = " currently referencing the fence before it is deleted"] - #[doc = " - The implementation of this function will immediately free all Host and"] - #[doc = " Device allocations associated with this fence"] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same fence handle."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - **vkDestroyFence**"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hFence`"] - #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] - pub fn zeFenceDestroy(hFence: ze_fence_handle_t) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief The current host thread waits on a fence to be signaled."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - **vkWaitForFences**"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hFence`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] - #[doc = " - ::ZE_RESULT_NOT_READY"] - #[doc = " + timeout expired"] - pub fn zeFenceHostSynchronize(hFence: ze_fence_handle_t, timeout: u32) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Queries a fence object's status."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - **vkGetFenceStatus**"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hFence`"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] - #[doc = " - ::ZE_RESULT_NOT_READY"] - #[doc = " + not signaled"] - pub fn zeFenceQueryStatus(hFence: ze_fence_handle_t) -> ze_result_t; -} -extern "C" { - #[doc = ""] - #[doc = " @brief Reset a fence back to the not signaled state."] - #[doc = ""] - #[doc = " @details"] - #[doc = " - The application may call this function from simultaneous threads."] - #[doc = " - The implementation of this function should be lock-free."] - #[doc = ""] - #[doc = " @remarks"] - #[doc = " _Analogues_"] - #[doc = " - **vkResetFences**"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " - ::ZE_RESULT_SUCCESS"] - #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] - #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] - #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] - #[doc = " + `nullptr == hFence`"] - pub fn zeFenceReset(hFence: ze_fence_handle_t) -> ze_result_t; -} extern "C" { #[doc = ""] #[doc = " @brief Copies host, device, or shared memory."] #[doc = ""] #[doc = " @details"] - #[doc = " - The memory pointed to by both srcptr and dstptr must be accessible by"] - #[doc = " the device on which the command list is created."] - #[doc = " - The application may **not** call this function from simultaneous"] + #[doc = " - The application must ensure the memory pointed to by dstptr and srcptr"] + #[doc = " is accessible by the device on which the command list was created."] + #[doc = " - The implementation must not access the memory pointed to by dstptr and"] + #[doc = " srcptr as they are free to be modified by either the Host or device up"] + #[doc = " until execution."] + #[doc = " - The application must ensure the events are accessible by the device on"] + #[doc = " which the command list was created."] + #[doc = " - The application must ensure the command list and events were created,"] + #[doc = " and the memory was allocated, on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] #[doc = " threads with the same command list handle."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -6317,12 +4507,16 @@ extern "C" { #[doc = " + `nullptr == dstptr`"] #[doc = " + `nullptr == srcptr`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] pub fn zeCommandListAppendMemoryCopy( hCommandList: ze_command_list_handle_t, dstptr: *mut ::std::os::raw::c_void, srcptr: *const ::std::os::raw::c_void, size: usize, - hEvent: ze_event_handle_t, + hSignalEvent: ze_event_handle_t, + numWaitEvents: u32, + phWaitEvents: *mut ze_event_handle_t, ) -> ze_result_t; } extern "C" { @@ -6330,12 +4524,20 @@ extern "C" { #[doc = " @brief Initializes host, device, or shared memory."] #[doc = ""] #[doc = " @details"] - #[doc = " - The memory pointed to by dstptr must be accessible by the device on"] - #[doc = " which the command list is created."] + #[doc = " - The application must ensure the memory pointed to by dstptr is"] + #[doc = " accessible by the device on which the command list was created."] + #[doc = " - The implementation must not access the memory pointed to by dstptr as"] + #[doc = " it is free to be modified by either the Host or device up until"] + #[doc = " execution."] #[doc = " - The value to initialize memory to is described by the pattern and the"] #[doc = " pattern size."] - #[doc = " - The pattern size must be a power of two."] - #[doc = " - The application may **not** call this function from simultaneous"] + #[doc = " - The pattern size must be a power-of-two and less than"] + #[doc = " ::ze_command_queue_group_properties_t.maxMemoryFillPatternSize."] + #[doc = " - The application must ensure the events are accessible by the device on"] + #[doc = " which the command list was created."] + #[doc = " - The application must enusre the command list and events were created,"] + #[doc = " and the memory was allocated, on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] #[doc = " threads with the same command list handle."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -6354,13 +4556,17 @@ extern "C" { #[doc = " + `nullptr == ptr`"] #[doc = " + `nullptr == pattern`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] pub fn zeCommandListAppendMemoryFill( hCommandList: ze_command_list_handle_t, ptr: *mut ::std::os::raw::c_void, pattern: *const ::std::os::raw::c_void, pattern_size: usize, size: usize, - hEvent: ze_event_handle_t, + hSignalEvent: ze_event_handle_t, + numWaitEvents: u32, + phWaitEvents: *mut ze_event_handle_t, ) -> ze_result_t; } #[doc = ""] @@ -6461,12 +4667,19 @@ extern "C" { #[doc = " memory."] #[doc = ""] #[doc = " @details"] - #[doc = " - The memory pointed to by both srcptr and dstptr must be accessible by"] - #[doc = " the device on which the command list is created."] + #[doc = " - The application must ensure the memory pointed to by dstptr and srcptr"] + #[doc = " is accessible by the device on which the command list was created."] + #[doc = " - The implementation must not access the memory pointed to by dstptr and"] + #[doc = " srcptr as they are free to be modified by either the Host or device up"] + #[doc = " until execution."] #[doc = " - The region width, height, and depth for both src and dst must be same."] #[doc = " The origins can be different."] #[doc = " - The src and dst regions cannot be overlapping."] - #[doc = " - The application may **not** call this function from simultaneous"] + #[doc = " - The application must ensure the events are accessible by the device on"] + #[doc = " which the command list was created."] + #[doc = " - The application must ensure the command list and events were created,"] + #[doc = " and the memory was allocated, on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] #[doc = " threads with the same command list handle."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -6483,6 +4696,8 @@ extern "C" { #[doc = " + `nullptr == srcRegion`"] #[doc = " - ::ZE_RESULT_ERROR_OVERLAPPING_REGIONS"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] pub fn zeCommandListAppendMemoryCopyRegion( hCommandList: ze_command_list_handle_t, dstptr: *mut ::std::os::raw::c_void, @@ -6493,15 +4708,66 @@ extern "C" { srcRegion: *const ze_copy_region_t, srcPitch: u32, srcSlicePitch: u32, - hEvent: ze_event_handle_t, + hSignalEvent: ze_event_handle_t, + numWaitEvents: u32, + phWaitEvents: *mut ze_event_handle_t, ) -> ze_result_t; } extern "C" { #[doc = ""] - #[doc = " @brief Copies a image."] + #[doc = " @brief Copies host, device, or shared memory from another context."] #[doc = ""] #[doc = " @details"] - #[doc = " - The application may **not** call this function from simultaneous"] + #[doc = " - The current active and source context must be from the same driver."] + #[doc = " - The application must ensure the memory pointed to by dstptr and srcptr"] + #[doc = " is accessible by the device on which the command list was created."] + #[doc = " - The implementation must not access the memory pointed to by dstptr and"] + #[doc = " srcptr as they are free to be modified by either the Host or device up"] + #[doc = " until execution."] + #[doc = " - The application must ensure the events are accessible by the device on"] + #[doc = " which the command list was created."] + #[doc = " - The application must ensure the command list and events were created,"] + #[doc = " and the memory was allocated, on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same command list handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hCommandList`"] + #[doc = " + `nullptr == hContextSrc`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == dstptr`"] + #[doc = " + `nullptr == srcptr`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] + pub fn zeCommandListAppendMemoryCopyFromContext( + hCommandList: ze_command_list_handle_t, + dstptr: *mut ::std::os::raw::c_void, + hContextSrc: ze_context_handle_t, + srcptr: *const ::std::os::raw::c_void, + size: usize, + hSignalEvent: ze_event_handle_t, + numWaitEvents: u32, + phWaitEvents: *mut ze_event_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Copies an image."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the image and events are accessible by the"] + #[doc = " device on which the command list was created."] + #[doc = " - The application must ensure the image format descriptors for both"] + #[doc = " source and destination images are the same."] + #[doc = " - The application must ensure the command list, images and events were"] + #[doc = " created on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] #[doc = " threads with the same command list handle."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -6518,11 +4784,15 @@ extern "C" { #[doc = " + `nullptr == hDstImage`"] #[doc = " + `nullptr == hSrcImage`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] pub fn zeCommandListAppendImageCopy( hCommandList: ze_command_list_handle_t, hDstImage: ze_image_handle_t, hSrcImage: ze_image_handle_t, - hEvent: ze_event_handle_t, + hSignalEvent: ze_event_handle_t, + numWaitEvents: u32, + phWaitEvents: *mut ze_event_handle_t, ) -> ze_result_t; } #[doc = ""] @@ -6619,13 +4889,19 @@ fn bindgen_test_layout__ze_image_region_t() { } extern "C" { #[doc = ""] - #[doc = " @brief Copies a region of a image to another image."] + #[doc = " @brief Copies a region of an image to another image."] #[doc = ""] #[doc = " @details"] + #[doc = " - The application must ensure the image and events are accessible by the"] + #[doc = " device on which the command list was created."] #[doc = " - The region width and height for both src and dst must be same. The"] #[doc = " origins can be different."] #[doc = " - The src and dst regions cannot be overlapping."] - #[doc = " - The application may **not** call this function from simultaneous"] + #[doc = " - The application must ensure the image format descriptors for both"] + #[doc = " source and destination images are the same."] + #[doc = " - The application must ensure the command list, images and events were"] + #[doc = " created, and the memory was allocated, on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] #[doc = " threads with the same command list handle."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -6639,23 +4915,36 @@ extern "C" { #[doc = " + `nullptr == hSrcImage`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] #[doc = " - ::ZE_RESULT_ERROR_OVERLAPPING_REGIONS"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] pub fn zeCommandListAppendImageCopyRegion( hCommandList: ze_command_list_handle_t, hDstImage: ze_image_handle_t, hSrcImage: ze_image_handle_t, pDstRegion: *const ze_image_region_t, pSrcRegion: *const ze_image_region_t, - hEvent: ze_event_handle_t, + hSignalEvent: ze_event_handle_t, + numWaitEvents: u32, + phWaitEvents: *mut ze_event_handle_t, ) -> ze_result_t; } extern "C" { #[doc = ""] - #[doc = " @brief Copies from a image to device or shared memory."] + #[doc = " @brief Copies from an image to device or shared memory."] #[doc = ""] #[doc = " @details"] - #[doc = " - The memory pointed to by dstptr must be accessible by the device on"] - #[doc = " which the command list is created."] - #[doc = " - The application may **not** call this function from simultaneous"] + #[doc = " - The application must ensure the memory pointed to by dstptr is"] + #[doc = " accessible by the device on which the command list was created."] + #[doc = " - The implementation must not access the memory pointed to by dstptr as"] + #[doc = " it is free to be modified by either the Host or device up until"] + #[doc = " execution."] + #[doc = " - The application must ensure the image and events are accessible by the"] + #[doc = " device on which the command list was created."] + #[doc = " - The application must ensure the image format descriptor for the source"] + #[doc = " image is not a media format."] + #[doc = " - The application must ensure the command list, image and events were"] + #[doc = " created, and the memory was allocated, on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] #[doc = " threads with the same command list handle."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -6673,22 +4962,35 @@ extern "C" { #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] #[doc = " + `nullptr == dstptr`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] pub fn zeCommandListAppendImageCopyToMemory( hCommandList: ze_command_list_handle_t, dstptr: *mut ::std::os::raw::c_void, hSrcImage: ze_image_handle_t, pSrcRegion: *const ze_image_region_t, - hEvent: ze_event_handle_t, + hSignalEvent: ze_event_handle_t, + numWaitEvents: u32, + phWaitEvents: *mut ze_event_handle_t, ) -> ze_result_t; } extern "C" { #[doc = ""] - #[doc = " @brief Copies to a image from device or shared memory."] + #[doc = " @brief Copies to an image from device or shared memory."] #[doc = ""] #[doc = " @details"] - #[doc = " - The memory pointed to by srcptr must be accessible by the device on"] - #[doc = " which the command list is created."] - #[doc = " - The application may **not** call this function from simultaneous"] + #[doc = " - The application must ensure the memory pointed to by srcptr is"] + #[doc = " accessible by the device on which the command list was created."] + #[doc = " - The implementation must not access the memory pointed to by srcptr as"] + #[doc = " it is free to be modified by either the Host or device up until"] + #[doc = " execution."] + #[doc = " - The application must ensure the image and events are accessible by the"] + #[doc = " device on which the command list was created."] + #[doc = " - The application must ensure the image format descriptor for the"] + #[doc = " destination image is not a media format."] + #[doc = " - The application must ensure the command list, image and events were"] + #[doc = " created, and the memory was allocated, on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] #[doc = " threads with the same command list handle."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -6706,12 +5008,16 @@ extern "C" { #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] #[doc = " + `nullptr == srcptr`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] pub fn zeCommandListAppendImageCopyFromMemory( hCommandList: ze_command_list_handle_t, hDstImage: ze_image_handle_t, srcptr: *const ::std::os::raw::c_void, pDstRegion: *const ze_image_region_t, - hEvent: ze_event_handle_t, + hSignalEvent: ze_event_handle_t, + numWaitEvents: u32, + phWaitEvents: *mut ze_event_handle_t, ) -> ze_result_t; } extern "C" { @@ -6732,7 +5038,11 @@ extern "C" { #[doc = " such as at a page boundary."] #[doc = " In this case, the memory range may be expanded such that the start and"] #[doc = " end of the range satisfy granularity requirements."] - #[doc = " - The application may **not** call this function from simultaneous"] + #[doc = " - The application must ensure the memory pointed to by ptr is accessible"] + #[doc = " by the device on which the command list was created."] + #[doc = " - The application must ensure the command list was created, and the"] + #[doc = " memory was allocated, on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] #[doc = " threads with the same command list handle."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] @@ -6754,32 +5064,48 @@ extern "C" { size: usize, ) -> ze_result_t; } -#[repr(i32)] +impl _ze_memory_advice_t { + #[doc = "< hint that memory will be read from frequently and written to rarely"] + pub const ZE_MEMORY_ADVICE_SET_READ_MOSTLY: _ze_memory_advice_t = _ze_memory_advice_t(0); +} +impl _ze_memory_advice_t { + #[doc = "< removes the affect of ::ZE_MEMORY_ADVICE_SET_READ_MOSTLY"] + pub const ZE_MEMORY_ADVICE_CLEAR_READ_MOSTLY: _ze_memory_advice_t = _ze_memory_advice_t(1); +} +impl _ze_memory_advice_t { + #[doc = "< hint that the preferred memory location is the specified device"] + pub const ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION: _ze_memory_advice_t = _ze_memory_advice_t(2); +} +impl _ze_memory_advice_t { + #[doc = "< removes the affect of ::ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION"] + pub const ZE_MEMORY_ADVICE_CLEAR_PREFERRED_LOCATION: _ze_memory_advice_t = + _ze_memory_advice_t(3); +} +impl _ze_memory_advice_t { + #[doc = "< hints that memory will mostly be accessed non-atomically"] + pub const ZE_MEMORY_ADVICE_SET_NON_ATOMIC_MOSTLY: _ze_memory_advice_t = _ze_memory_advice_t(4); +} +impl _ze_memory_advice_t { + #[doc = "< removes the affect of ::ZE_MEMORY_ADVICE_SET_NON_ATOMIC_MOSTLY"] + pub const ZE_MEMORY_ADVICE_CLEAR_NON_ATOMIC_MOSTLY: _ze_memory_advice_t = + _ze_memory_advice_t(5); +} +impl _ze_memory_advice_t { + #[doc = "< hints that memory should be cached"] + pub const ZE_MEMORY_ADVICE_BIAS_CACHED: _ze_memory_advice_t = _ze_memory_advice_t(6); +} +impl _ze_memory_advice_t { + #[doc = "< hints that memory should be not be cached"] + pub const ZE_MEMORY_ADVICE_BIAS_UNCACHED: _ze_memory_advice_t = _ze_memory_advice_t(7); +} +impl _ze_memory_advice_t { + pub const ZE_MEMORY_ADVICE_FORCE_UINT32: _ze_memory_advice_t = _ze_memory_advice_t(2147483647); +} +#[repr(transparent)] #[doc = ""] #[doc = " @brief Supported memory advice hints"] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _ze_memory_advice_t { - #[doc = "< hint that memory will be read from frequently and written to rarely"] - ZE_MEMORY_ADVICE_SET_READ_MOSTLY = 0, - #[doc = "< removes the affect of ::ZE_MEMORY_ADVICE_SET_READ_MOSTLY"] - ZE_MEMORY_ADVICE_CLEAR_READ_MOSTLY = 1, - #[doc = "< hint that the preferred memory location is the specified device"] - ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION = 2, - #[doc = "< removes the affect of ::ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION"] - ZE_MEMORY_ADVICE_CLEAR_PREFERRED_LOCATION = 3, - #[doc = "< hint that memory will be accessed by the specified device"] - ZE_MEMORY_ADVICE_SET_ACCESSED_BY = 4, - #[doc = "< removes the affect of ::ZE_MEMORY_ADVICE_SET_ACCESSED_BY"] - ZE_MEMORY_ADVICE_CLEAR_ACCESSED_BY = 5, - #[doc = "< hints that memory will mostly be accessed non-atomically"] - ZE_MEMORY_ADVICE_SET_NON_ATOMIC_MOSTLY = 6, - #[doc = "< removes the affect of ::ZE_MEMORY_ADVICE_SET_NON_ATOMIC_MOSTLY"] - ZE_MEMORY_ADVICE_CLEAR_NON_ATOMIC_MOSTLY = 7, - #[doc = "< hints that memory should be cached"] - ZE_MEMORY_ADVICE_BIAS_CACHED = 8, - #[doc = "< hints that memory should be not be cached"] - ZE_MEMORY_ADVICE_BIAS_UNCACHED = 9, -} +pub struct _ze_memory_advice_t(pub u32); #[doc = ""] #[doc = " @brief Supported memory advice hints"] pub use self::_ze_memory_advice_t as ze_memory_advice_t; @@ -6799,8 +5125,13 @@ extern "C" { #[doc = " such as at a page boundary."] #[doc = " In this case, the memory range may be expanded such that the start and"] #[doc = " end of the range satisfy granularity requirements."] - #[doc = " - The application may **not** call this function from simultaneous"] - #[doc = " threads with the same command list handle."] + #[doc = " - The application must ensure the memory pointed to by ptr is accessible"] + #[doc = " by the device on which the command list was created."] + #[doc = " - The application must ensure the command list was created, and memory"] + #[doc = " was allocated, on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same command list handle, and the memory was"] + #[doc = " allocated."] #[doc = " - The implementation of this function should be lock-free."] #[doc = ""] #[doc = " @returns"] @@ -6813,7 +5144,7 @@ extern "C" { #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] #[doc = " + `nullptr == ptr`"] #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] - #[doc = " + advice"] + #[doc = " + `::ZE_MEMORY_ADVICE_BIAS_UNCACHED < advice`"] pub fn zeCommandListAppendMemAdvise( hCommandList: ze_command_list_handle_t, hDevice: ze_device_handle_t, @@ -6822,3 +5153,4796 @@ extern "C" { advice: ze_memory_advice_t, ) -> ze_result_t; } +impl _ze_event_pool_flags_t { + #[doc = "< signals and waits are also visible to host"] + pub const ZE_EVENT_POOL_FLAG_HOST_VISIBLE: _ze_event_pool_flags_t = _ze_event_pool_flags_t(1); +} +impl _ze_event_pool_flags_t { + #[doc = "< signals and waits may be shared across processes"] + pub const ZE_EVENT_POOL_FLAG_IPC: _ze_event_pool_flags_t = _ze_event_pool_flags_t(2); +} +impl _ze_event_pool_flags_t { + #[doc = "< Indicates all events in pool will contain kernel timestamps; cannot be"] + #[doc = "< combined with ::ZE_EVENT_POOL_FLAG_IPC"] + pub const ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP: _ze_event_pool_flags_t = + _ze_event_pool_flags_t(4); +} +impl _ze_event_pool_flags_t { + pub const ZE_EVENT_POOL_FLAG_FORCE_UINT32: _ze_event_pool_flags_t = + _ze_event_pool_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_event_pool_flags_t> for _ze_event_pool_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_event_pool_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_event_pool_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_event_pool_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_event_pool_flags_t> for _ze_event_pool_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_event_pool_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_event_pool_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_event_pool_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported event pool creation flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_event_pool_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported event pool creation flags"] +pub use self::_ze_event_pool_flags_t as ze_event_pool_flags_t; +#[doc = ""] +#[doc = " @brief Event pool descriptor"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_event_pool_desc_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in][optional] pointer to extension-specific structure"] + pub pNext: *const ::std::os::raw::c_void, + #[doc = "< [in] creation flags."] + #[doc = "< must be 0 (default) or a valid combination of ::ze_event_pool_flags_t;"] + #[doc = "< default behavior is signals and waits are visible to the entire device"] + #[doc = "< and peer devices."] + pub flags: ze_event_pool_flags_t, + #[doc = "< [in] number of events within the pool; must be greater than 0"] + pub count: u32, +} +#[test] +fn bindgen_test_layout__ze_event_pool_desc_t() { + assert_eq!( + ::std::mem::size_of::<_ze_event_pool_desc_t>(), + 24usize, + concat!("Size of: ", stringify!(_ze_event_pool_desc_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_event_pool_desc_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_event_pool_desc_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_event_pool_desc_t>())).stype as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_event_pool_desc_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_event_pool_desc_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_event_pool_desc_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_event_pool_desc_t>())).flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_event_pool_desc_t), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_event_pool_desc_t>())).count as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(_ze_event_pool_desc_t), + "::", + stringify!(count) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Creates a pool of events on the context."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must only use events within the pool for the"] + #[doc = " device(s), or their sub-devices, which were provided during creation."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == desc`"] + #[doc = " + `nullptr == phEventPool`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `0x7 < desc->flags`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `0 < desc->count`"] + #[doc = " + `(nullptr == phDevices) && (0 < numDevices)`"] + pub fn zeEventPoolCreate( + hContext: ze_context_handle_t, + desc: *const ze_event_pool_desc_t, + numDevices: u32, + phDevices: *mut ze_device_handle_t, + phEventPool: *mut ze_event_pool_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Deletes an event pool object."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must destroy all event handles created from the pool"] + #[doc = " before destroying the pool itself."] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the any event within the pool before it is deleted."] + #[doc = " - The implementation of this function may immediately free all Host and"] + #[doc = " Device allocations associated with this event pool."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same event pool handle."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hEventPool`"] + #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] + pub fn zeEventPoolDestroy(hEventPool: ze_event_pool_handle_t) -> ze_result_t; +} +impl _ze_event_scope_flags_t { + #[doc = "< cache hierarchies are flushed or invalidated sufficient for local"] + #[doc = "< sub-device access"] + pub const ZE_EVENT_SCOPE_FLAG_SUBDEVICE: _ze_event_scope_flags_t = _ze_event_scope_flags_t(1); +} +impl _ze_event_scope_flags_t { + #[doc = "< cache hierarchies are flushed or invalidated sufficient for global"] + #[doc = "< device access and peer device access"] + pub const ZE_EVENT_SCOPE_FLAG_DEVICE: _ze_event_scope_flags_t = _ze_event_scope_flags_t(2); +} +impl _ze_event_scope_flags_t { + #[doc = "< cache hierarchies are flushed or invalidated sufficient for device and"] + #[doc = "< host access"] + pub const ZE_EVENT_SCOPE_FLAG_HOST: _ze_event_scope_flags_t = _ze_event_scope_flags_t(4); +} +impl _ze_event_scope_flags_t { + pub const ZE_EVENT_SCOPE_FLAG_FORCE_UINT32: _ze_event_scope_flags_t = + _ze_event_scope_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_event_scope_flags_t> for _ze_event_scope_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_event_scope_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_event_scope_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_event_scope_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_event_scope_flags_t> for _ze_event_scope_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_event_scope_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_event_scope_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_event_scope_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported event scope flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_event_scope_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported event scope flags"] +pub use self::_ze_event_scope_flags_t as ze_event_scope_flags_t; +#[doc = ""] +#[doc = " @brief Event descriptor"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_event_desc_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in][optional] pointer to extension-specific structure"] + pub pNext: *const ::std::os::raw::c_void, + #[doc = "< [in] index of the event within the pool; must be less-than the count"] + #[doc = "< specified during pool creation"] + pub index: u32, + #[doc = "< [in] defines the scope of relevant cache hierarchies to flush on a"] + #[doc = "< signal action before the event is triggered."] + #[doc = "< must be 0 (default) or a valid combination of ::ze_event_scope_flags_t;"] + #[doc = "< default behavior is execution synchronization only, no cache"] + #[doc = "< hierarchies are flushed."] + pub signal: ze_event_scope_flags_t, + #[doc = "< [in] defines the scope of relevant cache hierarchies to invalidate on"] + #[doc = "< a wait action after the event is complete."] + #[doc = "< must be 0 (default) or a valid combination of ::ze_event_scope_flags_t;"] + #[doc = "< default behavior is execution synchronization only, no cache"] + #[doc = "< hierarchies are invalidated."] + pub wait: ze_event_scope_flags_t, +} +#[test] +fn bindgen_test_layout__ze_event_desc_t() { + assert_eq!( + ::std::mem::size_of::<_ze_event_desc_t>(), + 32usize, + concat!("Size of: ", stringify!(_ze_event_desc_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_event_desc_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_event_desc_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_event_desc_t>())).stype as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_event_desc_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_event_desc_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_event_desc_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_event_desc_t>())).index as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_event_desc_t), + "::", + stringify!(index) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_event_desc_t>())).signal as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(_ze_event_desc_t), + "::", + stringify!(signal) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_event_desc_t>())).wait as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_ze_event_desc_t), + "::", + stringify!(wait) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Creates an event from the pool."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - An event is used to communicate fine-grain host-to-device,"] + #[doc = " device-to-host or device-to-device dependencies have completed."] + #[doc = " - The application must ensure the location in the pool is not being used"] + #[doc = " by another event."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same event pool handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - **clCreateUserEvent**"] + #[doc = " - vkCreateEvent"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hEventPool`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == desc`"] + #[doc = " + `nullptr == phEvent`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `0x7 < desc->signal`"] + #[doc = " + `0x7 < desc->wait`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + pub fn zeEventCreate( + hEventPool: ze_event_pool_handle_t, + desc: *const ze_event_desc_t, + phEvent: *mut ze_event_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Deletes an event object."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the event before it is deleted."] + #[doc = " - The implementation of this function may immediately free all Host and"] + #[doc = " Device allocations associated with this event."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same event handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - **clReleaseEvent**"] + #[doc = " - vkDestroyEvent"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hEvent`"] + #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] + pub fn zeEventDestroy(hEvent: ze_event_handle_t) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Gets an IPC event pool handle for the specified event handle that can"] + #[doc = " be shared with another process."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - Event pool must have been created with ::ZE_EVENT_POOL_FLAG_IPC."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hEventPool`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == phIpc`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + pub fn zeEventPoolGetIpcHandle( + hEventPool: ze_event_pool_handle_t, + phIpc: *mut ze_ipc_event_pool_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Opens an IPC event pool handle to retrieve an event pool handle from"] + #[doc = " another process."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - Multiple calls to this function with the same IPC handle will return"] + #[doc = " unique event pool handles."] + #[doc = " - The event handle in this process should not be freed with"] + #[doc = " ::zeEventPoolDestroy, but rather with ::zeEventPoolCloseIpcHandle."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == phEventPool`"] + pub fn zeEventPoolOpenIpcHandle( + hContext: ze_context_handle_t, + hIpc: ze_ipc_event_pool_handle_t, + phEventPool: *mut ze_event_pool_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Closes an IPC event handle in the current process."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - Closes an IPC event handle by destroying events that were opened in"] + #[doc = " this process using ::zeEventPoolOpenIpcHandle."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same event pool handle."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hEventPool`"] + pub fn zeEventPoolCloseIpcHandle(hEventPool: ze_event_pool_handle_t) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Appends a signal of the event from the device into a command list."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the events are accessible by the device on"] + #[doc = " which the command list was created."] + #[doc = " - The duration of an event created from an event pool that was created"] + #[doc = " using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag is undefined."] + #[doc = " However, for consistency and orthogonality the event will report"] + #[doc = " correctly as signaled when used by other event API functionality."] + #[doc = " - The application must ensure the command list and events were created"] + #[doc = " on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same command list handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - **clSetUserEventStatus**"] + #[doc = " - vkCmdSetEvent"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hCommandList`"] + #[doc = " + `nullptr == hEvent`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + pub fn zeCommandListAppendSignalEvent( + hCommandList: ze_command_list_handle_t, + hEvent: ze_event_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Appends wait on event(s) on the device into a command list."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the events are accessible by the device on"] + #[doc = " which the command list was created."] + #[doc = " - The application must ensure the command list and events were created"] + #[doc = " on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same command list handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hCommandList`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == phEvents`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + pub fn zeCommandListAppendWaitOnEvents( + hCommandList: ze_command_list_handle_t, + numEvents: u32, + phEvents: *mut ze_event_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Signals a event from host."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The duration of an event created from an event pool that was created"] + #[doc = " using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag is undefined."] + #[doc = " However, for consistency and orthogonality the event will report"] + #[doc = " correctly as signaled when used by other event API functionality."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - clSetUserEventStatus"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hEvent`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + pub fn zeEventHostSignal(hEvent: ze_event_handle_t) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief The current host thread waits on an event to be signaled."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - clWaitForEvents"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hEvent`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_NOT_READY"] + #[doc = " + timeout expired"] + pub fn zeEventHostSynchronize(hEvent: ze_event_handle_t, timeout: u64) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Queries an event object's status on the host."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - **clGetEventInfo**"] + #[doc = " - vkGetEventStatus"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hEvent`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_NOT_READY"] + #[doc = " + not signaled"] + pub fn zeEventQueryStatus(hEvent: ze_event_handle_t) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Appends a reset of an event back to not signaled state into a command"] + #[doc = " list."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the events are accessible by the device on"] + #[doc = " which the command list was created."] + #[doc = " - The application must ensure the command list and events were created"] + #[doc = " on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same command list handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - vkResetEvent"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hCommandList`"] + #[doc = " + `nullptr == hEvent`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + pub fn zeCommandListAppendEventReset( + hCommandList: ze_command_list_handle_t, + hEvent: ze_event_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief The current host thread resets an event back to not signaled state."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - vkResetEvent"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hEvent`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + pub fn zeEventHostReset(hEvent: ze_event_handle_t) -> ze_result_t; +} +#[doc = ""] +#[doc = " @brief Kernel timestamp clock data"] +#[doc = ""] +#[doc = " @details"] +#[doc = " - The timestamp frequency can be queried from"] +#[doc = " ::ze_device_properties_t.timerResolution."] +#[doc = " - The number of valid bits in the timestamp value can be queried from"] +#[doc = " ::ze_device_properties_t.kernelTimestampValidBits."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_kernel_timestamp_data_t { + #[doc = "< [out] device clock at start of kernel execution"] + pub kernelStart: u64, + #[doc = "< [out] device clock at end of kernel execution"] + pub kernelEnd: u64, +} +#[test] +fn bindgen_test_layout__ze_kernel_timestamp_data_t() { + assert_eq!( + ::std::mem::size_of::<_ze_kernel_timestamp_data_t>(), + 16usize, + concat!("Size of: ", stringify!(_ze_kernel_timestamp_data_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_kernel_timestamp_data_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_kernel_timestamp_data_t)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_timestamp_data_t>())).kernelStart as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_timestamp_data_t), + "::", + stringify!(kernelStart) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_timestamp_data_t>())).kernelEnd as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_timestamp_data_t), + "::", + stringify!(kernelEnd) + ) + ); +} +#[doc = ""] +#[doc = " @brief Kernel timestamp result"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_kernel_timestamp_result_t { + #[doc = "< [out] wall-clock data"] + pub global: ze_kernel_timestamp_data_t, + #[doc = "< [out] context-active data; only includes clocks while device context"] + #[doc = "< was actively executing."] + pub context: ze_kernel_timestamp_data_t, +} +#[test] +fn bindgen_test_layout__ze_kernel_timestamp_result_t() { + assert_eq!( + ::std::mem::size_of::<_ze_kernel_timestamp_result_t>(), + 32usize, + concat!("Size of: ", stringify!(_ze_kernel_timestamp_result_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_kernel_timestamp_result_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_kernel_timestamp_result_t)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_timestamp_result_t>())).global as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_timestamp_result_t), + "::", + stringify!(global) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_timestamp_result_t>())).context as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_timestamp_result_t), + "::", + stringify!(context) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Queries an event's timestamp value on the host."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the event was created from an event pool"] + #[doc = " that was created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag."] + #[doc = " - The destination memory will be unmodified if the event has not been"] + #[doc = " signaled."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hEvent`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == dstptr`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_NOT_READY"] + #[doc = " + not signaled"] + pub fn zeEventQueryKernelTimestamp( + hEvent: ze_event_handle_t, + dstptr: *mut ze_kernel_timestamp_result_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Appends a query of an events' timestamp value(s) into a command list."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the events are accessible by the device on"] + #[doc = " which the command list was created."] + #[doc = " - The application must ensure the events were created from an event pool"] + #[doc = " that was created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag."] + #[doc = " - The application must ensure the memory pointed to by both dstptr and"] + #[doc = " pOffsets is accessible by the device on which the command list was"] + #[doc = " created."] + #[doc = " - The value(s) written to the destination buffer are undefined if any"] + #[doc = " timestamp event has not been signaled."] + #[doc = " - If pOffsets is nullptr, then multiple results will be appended"] + #[doc = " sequentially into memory in the same order as phEvents."] + #[doc = " - The application must ensure the command list and events were created,"] + #[doc = " and the memory was allocated, on the same context."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same command list handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hCommandList`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == phEvents`"] + #[doc = " + `nullptr == dstptr`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] + pub fn zeCommandListAppendQueryKernelTimestamps( + hCommandList: ze_command_list_handle_t, + numEvents: u32, + phEvents: *mut ze_event_handle_t, + dstptr: *mut ::std::os::raw::c_void, + pOffsets: *const usize, + hSignalEvent: ze_event_handle_t, + numWaitEvents: u32, + phWaitEvents: *mut ze_event_handle_t, + ) -> ze_result_t; +} +impl _ze_fence_flags_t { + #[doc = "< fence is created in the signaled state, otherwise not signaled."] + pub const ZE_FENCE_FLAG_SIGNALED: _ze_fence_flags_t = _ze_fence_flags_t(1); +} +impl _ze_fence_flags_t { + pub const ZE_FENCE_FLAG_FORCE_UINT32: _ze_fence_flags_t = _ze_fence_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_fence_flags_t> for _ze_fence_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_fence_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_fence_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_fence_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_fence_flags_t> for _ze_fence_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_fence_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_fence_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_fence_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported fence creation flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_fence_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported fence creation flags"] +pub use self::_ze_fence_flags_t as ze_fence_flags_t; +#[doc = ""] +#[doc = " @brief Fence descriptor"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_fence_desc_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in][optional] pointer to extension-specific structure"] + pub pNext: *const ::std::os::raw::c_void, + #[doc = "< [in] creation flags."] + #[doc = "< must be 0 (default) or a valid combination of ::ze_fence_flags_t."] + pub flags: ze_fence_flags_t, +} +#[test] +fn bindgen_test_layout__ze_fence_desc_t() { + assert_eq!( + ::std::mem::size_of::<_ze_fence_desc_t>(), + 24usize, + concat!("Size of: ", stringify!(_ze_fence_desc_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_fence_desc_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_fence_desc_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_fence_desc_t>())).stype as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_fence_desc_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_fence_desc_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_fence_desc_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_fence_desc_t>())).flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_fence_desc_t), + "::", + stringify!(flags) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Creates a fence for the command queue."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - A fence is a heavyweight synchronization primitive used to communicate"] + #[doc = " to the host that command list execution has completed."] + #[doc = " - The application must only use the fence for the command queue which"] + #[doc = " was provided during creation."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - **vkCreateFence**"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hCommandQueue`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == desc`"] + #[doc = " + `nullptr == phFence`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `0x1 < desc->flags`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + pub fn zeFenceCreate( + hCommandQueue: ze_command_queue_handle_t, + desc: *const ze_fence_desc_t, + phFence: *mut ze_fence_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Deletes a fence object."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the fence before it is deleted."] + #[doc = " - The implementation of this function may immediately free all Host and"] + #[doc = " Device allocations associated with this fence."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same fence handle."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - **vkDestroyFence**"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hFence`"] + #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] + pub fn zeFenceDestroy(hFence: ze_fence_handle_t) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief The current host thread waits on a fence to be signaled."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - **vkWaitForFences**"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hFence`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_NOT_READY"] + #[doc = " + timeout expired"] + pub fn zeFenceHostSynchronize(hFence: ze_fence_handle_t, timeout: u64) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Queries a fence object's status."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - **vkGetFenceStatus**"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hFence`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_NOT_READY"] + #[doc = " + not signaled"] + pub fn zeFenceQueryStatus(hFence: ze_fence_handle_t) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Reset a fence back to the not signaled state."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - **vkResetFences**"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hFence`"] + pub fn zeFenceReset(hFence: ze_fence_handle_t) -> ze_result_t; +} +impl _ze_image_flags_t { + #[doc = "< kernels will write contents"] + pub const ZE_IMAGE_FLAG_KERNEL_WRITE: _ze_image_flags_t = _ze_image_flags_t(1); +} +impl _ze_image_flags_t { + #[doc = "< device should not cache contents"] + pub const ZE_IMAGE_FLAG_BIAS_UNCACHED: _ze_image_flags_t = _ze_image_flags_t(2); +} +impl _ze_image_flags_t { + pub const ZE_IMAGE_FLAG_FORCE_UINT32: _ze_image_flags_t = _ze_image_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_image_flags_t> for _ze_image_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_image_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_image_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_image_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_image_flags_t> for _ze_image_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_image_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_image_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_image_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported image creation flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_image_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported image creation flags"] +pub use self::_ze_image_flags_t as ze_image_flags_t; +impl _ze_image_type_t { + #[doc = "< 1D"] + pub const ZE_IMAGE_TYPE_1D: _ze_image_type_t = _ze_image_type_t(0); +} +impl _ze_image_type_t { + #[doc = "< 1D array"] + pub const ZE_IMAGE_TYPE_1DARRAY: _ze_image_type_t = _ze_image_type_t(1); +} +impl _ze_image_type_t { + #[doc = "< 2D"] + pub const ZE_IMAGE_TYPE_2D: _ze_image_type_t = _ze_image_type_t(2); +} +impl _ze_image_type_t { + #[doc = "< 2D array"] + pub const ZE_IMAGE_TYPE_2DARRAY: _ze_image_type_t = _ze_image_type_t(3); +} +impl _ze_image_type_t { + #[doc = "< 3D"] + pub const ZE_IMAGE_TYPE_3D: _ze_image_type_t = _ze_image_type_t(4); +} +impl _ze_image_type_t { + #[doc = "< Buffer"] + pub const ZE_IMAGE_TYPE_BUFFER: _ze_image_type_t = _ze_image_type_t(5); +} +impl _ze_image_type_t { + pub const ZE_IMAGE_TYPE_FORCE_UINT32: _ze_image_type_t = _ze_image_type_t(2147483647); +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported image types"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_image_type_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported image types"] +pub use self::_ze_image_type_t as ze_image_type_t; +impl _ze_image_format_layout_t { + #[doc = "< 8-bit single component layout"] + pub const ZE_IMAGE_FORMAT_LAYOUT_8: _ze_image_format_layout_t = _ze_image_format_layout_t(0); +} +impl _ze_image_format_layout_t { + #[doc = "< 16-bit single component layout"] + pub const ZE_IMAGE_FORMAT_LAYOUT_16: _ze_image_format_layout_t = _ze_image_format_layout_t(1); +} +impl _ze_image_format_layout_t { + #[doc = "< 32-bit single component layout"] + pub const ZE_IMAGE_FORMAT_LAYOUT_32: _ze_image_format_layout_t = _ze_image_format_layout_t(2); +} +impl _ze_image_format_layout_t { + #[doc = "< 2-component 8-bit layout"] + pub const ZE_IMAGE_FORMAT_LAYOUT_8_8: _ze_image_format_layout_t = _ze_image_format_layout_t(3); +} +impl _ze_image_format_layout_t { + #[doc = "< 4-component 8-bit layout"] + pub const ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8: _ze_image_format_layout_t = + _ze_image_format_layout_t(4); +} +impl _ze_image_format_layout_t { + #[doc = "< 2-component 16-bit layout"] + pub const ZE_IMAGE_FORMAT_LAYOUT_16_16: _ze_image_format_layout_t = + _ze_image_format_layout_t(5); +} +impl _ze_image_format_layout_t { + #[doc = "< 4-component 16-bit layout"] + pub const ZE_IMAGE_FORMAT_LAYOUT_16_16_16_16: _ze_image_format_layout_t = + _ze_image_format_layout_t(6); +} +impl _ze_image_format_layout_t { + #[doc = "< 2-component 32-bit layout"] + pub const ZE_IMAGE_FORMAT_LAYOUT_32_32: _ze_image_format_layout_t = + _ze_image_format_layout_t(7); +} +impl _ze_image_format_layout_t { + #[doc = "< 4-component 32-bit layout"] + pub const ZE_IMAGE_FORMAT_LAYOUT_32_32_32_32: _ze_image_format_layout_t = + _ze_image_format_layout_t(8); +} +impl _ze_image_format_layout_t { + #[doc = "< 4-component 10_10_10_2 layout"] + pub const ZE_IMAGE_FORMAT_LAYOUT_10_10_10_2: _ze_image_format_layout_t = + _ze_image_format_layout_t(9); +} +impl _ze_image_format_layout_t { + #[doc = "< 3-component 11_11_10 layout"] + pub const ZE_IMAGE_FORMAT_LAYOUT_11_11_10: _ze_image_format_layout_t = + _ze_image_format_layout_t(10); +} +impl _ze_image_format_layout_t { + #[doc = "< 3-component 5_6_5 layout"] + pub const ZE_IMAGE_FORMAT_LAYOUT_5_6_5: _ze_image_format_layout_t = + _ze_image_format_layout_t(11); +} +impl _ze_image_format_layout_t { + #[doc = "< 4-component 5_5_5_1 layout"] + pub const ZE_IMAGE_FORMAT_LAYOUT_5_5_5_1: _ze_image_format_layout_t = + _ze_image_format_layout_t(12); +} +impl _ze_image_format_layout_t { + #[doc = "< 4-component 4_4_4_4 layout"] + pub const ZE_IMAGE_FORMAT_LAYOUT_4_4_4_4: _ze_image_format_layout_t = + _ze_image_format_layout_t(13); +} +impl _ze_image_format_layout_t { + #[doc = "< Media Format: Y8. Format type and swizzle is ignored for this."] + pub const ZE_IMAGE_FORMAT_LAYOUT_Y8: _ze_image_format_layout_t = _ze_image_format_layout_t(14); +} +impl _ze_image_format_layout_t { + #[doc = "< Media Format: NV12. Format type and swizzle is ignored for this."] + pub const ZE_IMAGE_FORMAT_LAYOUT_NV12: _ze_image_format_layout_t = + _ze_image_format_layout_t(15); +} +impl _ze_image_format_layout_t { + #[doc = "< Media Format: YUYV. Format type and swizzle is ignored for this."] + pub const ZE_IMAGE_FORMAT_LAYOUT_YUYV: _ze_image_format_layout_t = + _ze_image_format_layout_t(16); +} +impl _ze_image_format_layout_t { + #[doc = "< Media Format: VYUY. Format type and swizzle is ignored for this."] + pub const ZE_IMAGE_FORMAT_LAYOUT_VYUY: _ze_image_format_layout_t = + _ze_image_format_layout_t(17); +} +impl _ze_image_format_layout_t { + #[doc = "< Media Format: YVYU. Format type and swizzle is ignored for this."] + pub const ZE_IMAGE_FORMAT_LAYOUT_YVYU: _ze_image_format_layout_t = + _ze_image_format_layout_t(18); +} +impl _ze_image_format_layout_t { + #[doc = "< Media Format: UYVY. Format type and swizzle is ignored for this."] + pub const ZE_IMAGE_FORMAT_LAYOUT_UYVY: _ze_image_format_layout_t = + _ze_image_format_layout_t(19); +} +impl _ze_image_format_layout_t { + #[doc = "< Media Format: AYUV. Format type and swizzle is ignored for this."] + pub const ZE_IMAGE_FORMAT_LAYOUT_AYUV: _ze_image_format_layout_t = + _ze_image_format_layout_t(20); +} +impl _ze_image_format_layout_t { + #[doc = "< Media Format: P010. Format type and swizzle is ignored for this."] + pub const ZE_IMAGE_FORMAT_LAYOUT_P010: _ze_image_format_layout_t = + _ze_image_format_layout_t(21); +} +impl _ze_image_format_layout_t { + #[doc = "< Media Format: Y410. Format type and swizzle is ignored for this."] + pub const ZE_IMAGE_FORMAT_LAYOUT_Y410: _ze_image_format_layout_t = + _ze_image_format_layout_t(22); +} +impl _ze_image_format_layout_t { + #[doc = "< Media Format: P012. Format type and swizzle is ignored for this."] + pub const ZE_IMAGE_FORMAT_LAYOUT_P012: _ze_image_format_layout_t = + _ze_image_format_layout_t(23); +} +impl _ze_image_format_layout_t { + #[doc = "< Media Format: Y16. Format type and swizzle is ignored for this."] + pub const ZE_IMAGE_FORMAT_LAYOUT_Y16: _ze_image_format_layout_t = _ze_image_format_layout_t(24); +} +impl _ze_image_format_layout_t { + #[doc = "< Media Format: P016. Format type and swizzle is ignored for this."] + pub const ZE_IMAGE_FORMAT_LAYOUT_P016: _ze_image_format_layout_t = + _ze_image_format_layout_t(25); +} +impl _ze_image_format_layout_t { + #[doc = "< Media Format: Y216. Format type and swizzle is ignored for this."] + pub const ZE_IMAGE_FORMAT_LAYOUT_Y216: _ze_image_format_layout_t = + _ze_image_format_layout_t(26); +} +impl _ze_image_format_layout_t { + #[doc = "< Media Format: P216. Format type and swizzle is ignored for this."] + pub const ZE_IMAGE_FORMAT_LAYOUT_P216: _ze_image_format_layout_t = + _ze_image_format_layout_t(27); +} +impl _ze_image_format_layout_t { + pub const ZE_IMAGE_FORMAT_LAYOUT_FORCE_UINT32: _ze_image_format_layout_t = + _ze_image_format_layout_t(2147483647); +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported image format layouts"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_image_format_layout_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported image format layouts"] +pub use self::_ze_image_format_layout_t as ze_image_format_layout_t; +impl _ze_image_format_type_t { + #[doc = "< Unsigned integer"] + pub const ZE_IMAGE_FORMAT_TYPE_UINT: _ze_image_format_type_t = _ze_image_format_type_t(0); +} +impl _ze_image_format_type_t { + #[doc = "< Signed integer"] + pub const ZE_IMAGE_FORMAT_TYPE_SINT: _ze_image_format_type_t = _ze_image_format_type_t(1); +} +impl _ze_image_format_type_t { + #[doc = "< Unsigned normalized integer"] + pub const ZE_IMAGE_FORMAT_TYPE_UNORM: _ze_image_format_type_t = _ze_image_format_type_t(2); +} +impl _ze_image_format_type_t { + #[doc = "< Signed normalized integer"] + pub const ZE_IMAGE_FORMAT_TYPE_SNORM: _ze_image_format_type_t = _ze_image_format_type_t(3); +} +impl _ze_image_format_type_t { + #[doc = "< Float"] + pub const ZE_IMAGE_FORMAT_TYPE_FLOAT: _ze_image_format_type_t = _ze_image_format_type_t(4); +} +impl _ze_image_format_type_t { + pub const ZE_IMAGE_FORMAT_TYPE_FORCE_UINT32: _ze_image_format_type_t = + _ze_image_format_type_t(2147483647); +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported image format types"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_image_format_type_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported image format types"] +pub use self::_ze_image_format_type_t as ze_image_format_type_t; +impl _ze_image_format_swizzle_t { + #[doc = "< Red component"] + pub const ZE_IMAGE_FORMAT_SWIZZLE_R: _ze_image_format_swizzle_t = _ze_image_format_swizzle_t(0); +} +impl _ze_image_format_swizzle_t { + #[doc = "< Green component"] + pub const ZE_IMAGE_FORMAT_SWIZZLE_G: _ze_image_format_swizzle_t = _ze_image_format_swizzle_t(1); +} +impl _ze_image_format_swizzle_t { + #[doc = "< Blue component"] + pub const ZE_IMAGE_FORMAT_SWIZZLE_B: _ze_image_format_swizzle_t = _ze_image_format_swizzle_t(2); +} +impl _ze_image_format_swizzle_t { + #[doc = "< Alpha component"] + pub const ZE_IMAGE_FORMAT_SWIZZLE_A: _ze_image_format_swizzle_t = _ze_image_format_swizzle_t(3); +} +impl _ze_image_format_swizzle_t { + #[doc = "< Zero"] + pub const ZE_IMAGE_FORMAT_SWIZZLE_0: _ze_image_format_swizzle_t = _ze_image_format_swizzle_t(4); +} +impl _ze_image_format_swizzle_t { + #[doc = "< One"] + pub const ZE_IMAGE_FORMAT_SWIZZLE_1: _ze_image_format_swizzle_t = _ze_image_format_swizzle_t(5); +} +impl _ze_image_format_swizzle_t { + #[doc = "< Don't care"] + pub const ZE_IMAGE_FORMAT_SWIZZLE_X: _ze_image_format_swizzle_t = _ze_image_format_swizzle_t(6); +} +impl _ze_image_format_swizzle_t { + pub const ZE_IMAGE_FORMAT_SWIZZLE_FORCE_UINT32: _ze_image_format_swizzle_t = + _ze_image_format_swizzle_t(2147483647); +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported image format component swizzle into channel"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_image_format_swizzle_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported image format component swizzle into channel"] +pub use self::_ze_image_format_swizzle_t as ze_image_format_swizzle_t; +#[doc = ""] +#[doc = " @brief Image format"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_image_format_t { + #[doc = "< [in] image format component layout"] + pub layout: ze_image_format_layout_t, + #[doc = "< [in] image format type. Media formats can't be used for"] + #[doc = "< ::ZE_IMAGE_TYPE_BUFFER."] + pub type_: ze_image_format_type_t, + #[doc = "< [in] image component swizzle into channel x"] + pub x: ze_image_format_swizzle_t, + #[doc = "< [in] image component swizzle into channel y"] + pub y: ze_image_format_swizzle_t, + #[doc = "< [in] image component swizzle into channel z"] + pub z: ze_image_format_swizzle_t, + #[doc = "< [in] image component swizzle into channel w"] + pub w: ze_image_format_swizzle_t, +} +#[test] +fn bindgen_test_layout__ze_image_format_t() { + assert_eq!( + ::std::mem::size_of::<_ze_image_format_t>(), + 24usize, + concat!("Size of: ", stringify!(_ze_image_format_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_image_format_t>(), + 4usize, + concat!("Alignment of ", stringify!(_ze_image_format_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_format_t>())).layout as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_format_t), + "::", + stringify!(layout) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_format_t>())).type_ as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_format_t), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_format_t>())).x as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_format_t), + "::", + stringify!(x) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_format_t>())).y as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_format_t), + "::", + stringify!(y) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_format_t>())).z as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_format_t), + "::", + stringify!(z) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_format_t>())).w as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_format_t), + "::", + stringify!(w) + ) + ); +} +#[doc = ""] +#[doc = " @brief Image descriptor"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_image_desc_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in][optional] pointer to extension-specific structure"] + pub pNext: *const ::std::os::raw::c_void, + #[doc = "< [in] creation flags."] + #[doc = "< must be 0 (default) or a valid combination of ::ze_image_flags_t;"] + #[doc = "< default is read-only, cached access."] + pub flags: ze_image_flags_t, + #[doc = "< [in] image type"] + pub type_: ze_image_type_t, + #[doc = "< [in] image format"] + pub format: ze_image_format_t, + #[doc = "< [in] width dimension."] + #[doc = "< ::ZE_IMAGE_TYPE_BUFFER: size in bytes; see"] + #[doc = "< ::ze_device_image_properties_t.maxImageBufferSize for limits."] + #[doc = "< ::ZE_IMAGE_TYPE_1D, ::ZE_IMAGE_TYPE_1DARRAY: width in pixels; see"] + #[doc = "< ::ze_device_image_properties_t.maxImageDims1D for limits."] + #[doc = "< ::ZE_IMAGE_TYPE_2D, ::ZE_IMAGE_TYPE_2DARRAY: width in pixels; see"] + #[doc = "< ::ze_device_image_properties_t.maxImageDims2D for limits."] + #[doc = "< ::ZE_IMAGE_TYPE_3D: width in pixels; see"] + #[doc = "< ::ze_device_image_properties_t.maxImageDims3D for limits."] + pub width: u64, + #[doc = "< [in] height dimension."] + #[doc = "< ::ZE_IMAGE_TYPE_2D, ::ZE_IMAGE_TYPE_2DARRAY: height in pixels; see"] + #[doc = "< ::ze_device_image_properties_t.maxImageDims2D for limits."] + #[doc = "< ::ZE_IMAGE_TYPE_3D: height in pixels; see"] + #[doc = "< ::ze_device_image_properties_t.maxImageDims3D for limits."] + #[doc = "< other: ignored."] + pub height: u32, + #[doc = "< [in] depth dimension."] + #[doc = "< ::ZE_IMAGE_TYPE_3D: depth in pixels; see"] + #[doc = "< ::ze_device_image_properties_t.maxImageDims3D for limits."] + #[doc = "< other: ignored."] + pub depth: u32, + #[doc = "< [in] array levels."] + #[doc = "< ::ZE_IMAGE_TYPE_1DARRAY, ::ZE_IMAGE_TYPE_2DARRAY: see"] + #[doc = "< ::ze_device_image_properties_t.maxImageArraySlices for limits."] + #[doc = "< other: ignored."] + pub arraylevels: u32, + #[doc = "< [in] mipmap levels (must be 0)"] + pub miplevels: u32, +} +#[test] +fn bindgen_test_layout__ze_image_desc_t() { + assert_eq!( + ::std::mem::size_of::<_ze_image_desc_t>(), + 72usize, + concat!("Size of: ", stringify!(_ze_image_desc_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_image_desc_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_image_desc_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).stype as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_desc_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_desc_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_desc_t), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).type_ as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_desc_t), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).format as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_desc_t), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).width as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_desc_t), + "::", + stringify!(width) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).height as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_desc_t), + "::", + stringify!(height) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).depth as *const _ as usize }, + 60usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_desc_t), + "::", + stringify!(depth) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).arraylevels as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_desc_t), + "::", + stringify!(arraylevels) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_desc_t>())).miplevels as *const _ as usize }, + 68usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_desc_t), + "::", + stringify!(miplevels) + ) + ); +} +impl _ze_image_sampler_filter_flags_t { + #[doc = "< device supports point filtering"] + pub const ZE_IMAGE_SAMPLER_FILTER_FLAG_POINT: _ze_image_sampler_filter_flags_t = + _ze_image_sampler_filter_flags_t(1); +} +impl _ze_image_sampler_filter_flags_t { + #[doc = "< device supports linear filtering"] + pub const ZE_IMAGE_SAMPLER_FILTER_FLAG_LINEAR: _ze_image_sampler_filter_flags_t = + _ze_image_sampler_filter_flags_t(2); +} +impl _ze_image_sampler_filter_flags_t { + pub const ZE_IMAGE_SAMPLER_FILTER_FLAG_FORCE_UINT32: _ze_image_sampler_filter_flags_t = + _ze_image_sampler_filter_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_image_sampler_filter_flags_t> for _ze_image_sampler_filter_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_image_sampler_filter_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_image_sampler_filter_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_image_sampler_filter_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_image_sampler_filter_flags_t> for _ze_image_sampler_filter_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_image_sampler_filter_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_image_sampler_filter_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_image_sampler_filter_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported sampler filtering flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_image_sampler_filter_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported sampler filtering flags"] +pub use self::_ze_image_sampler_filter_flags_t as ze_image_sampler_filter_flags_t; +#[doc = ""] +#[doc = " @brief Image properties"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_image_properties_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, + #[doc = "< [out] supported sampler filtering."] + #[doc = "< returns 0 (unsupported) or a combination of ::ze_image_sampler_filter_flags_t."] + pub samplerFilterFlags: ze_image_sampler_filter_flags_t, +} +#[test] +fn bindgen_test_layout__ze_image_properties_t() { + assert_eq!( + ::std::mem::size_of::<_ze_image_properties_t>(), + 24usize, + concat!("Size of: ", stringify!(_ze_image_properties_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_image_properties_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_image_properties_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_properties_t>())).stype as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_properties_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_image_properties_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_properties_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_image_properties_t>())).samplerFilterFlags as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_image_properties_t), + "::", + stringify!(samplerFilterFlags) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieves supported properties of an image."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hDevice`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == desc`"] + #[doc = " + `nullptr == pImageProperties`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `0x3 < desc->flags`"] + #[doc = " + `::ZE_IMAGE_TYPE_BUFFER < desc->type`"] + pub fn zeImageGetProperties( + hDevice: ze_device_handle_t, + desc: *const ze_image_desc_t, + pImageProperties: *mut ze_image_properties_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Creates an image on the context."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must only use the image for the device, or its"] + #[doc = " sub-devices, which was provided during creation."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @remarks"] + #[doc = " _Analogues_"] + #[doc = " - clCreateImage"] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " + `nullptr == hDevice`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == desc`"] + #[doc = " + `nullptr == phImage`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `0x3 < desc->flags`"] + #[doc = " + `::ZE_IMAGE_TYPE_BUFFER < desc->type`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + pub fn zeImageCreate( + hContext: ze_context_handle_t, + hDevice: ze_device_handle_t, + desc: *const ze_image_desc_t, + phImage: *mut ze_image_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Deletes an image object."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the image before it is deleted."] + #[doc = " - The implementation of this function may immediately free all Host and"] + #[doc = " Device allocations associated with this image."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same image handle."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hImage`"] + #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] + pub fn zeImageDestroy(hImage: ze_image_handle_t) -> ze_result_t; +} +impl _ze_device_mem_alloc_flags_t { + #[doc = "< device should cache allocation"] + pub const ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_CACHED: _ze_device_mem_alloc_flags_t = + _ze_device_mem_alloc_flags_t(1); +} +impl _ze_device_mem_alloc_flags_t { + #[doc = "< device should not cache allocation (UC)"] + pub const ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_UNCACHED: _ze_device_mem_alloc_flags_t = + _ze_device_mem_alloc_flags_t(2); +} +impl _ze_device_mem_alloc_flags_t { + pub const ZE_DEVICE_MEM_ALLOC_FLAG_FORCE_UINT32: _ze_device_mem_alloc_flags_t = + _ze_device_mem_alloc_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_device_mem_alloc_flags_t> for _ze_device_mem_alloc_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_device_mem_alloc_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_device_mem_alloc_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_device_mem_alloc_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_device_mem_alloc_flags_t> for _ze_device_mem_alloc_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_device_mem_alloc_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_device_mem_alloc_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_device_mem_alloc_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported memory allocation flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_device_mem_alloc_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported memory allocation flags"] +pub use self::_ze_device_mem_alloc_flags_t as ze_device_mem_alloc_flags_t; +#[doc = ""] +#[doc = " @brief Device memory allocation descriptor"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_device_mem_alloc_desc_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in][optional] pointer to extension-specific structure"] + pub pNext: *const ::std::os::raw::c_void, + #[doc = "< [in] flags specifying additional allocation controls."] + #[doc = "< must be 0 (default) or a valid combination of ::ze_device_mem_alloc_flags_t;"] + #[doc = "< default behavior may use implicit driver-based heuristics."] + pub flags: ze_device_mem_alloc_flags_t, + #[doc = "< [in] ordinal of the device's local memory to allocate from."] + #[doc = "< must be less than the count returned from ::zeDeviceGetMemoryProperties."] + pub ordinal: u32, +} +#[test] +fn bindgen_test_layout__ze_device_mem_alloc_desc_t() { + assert_eq!( + ::std::mem::size_of::<_ze_device_mem_alloc_desc_t>(), + 24usize, + concat!("Size of: ", stringify!(_ze_device_mem_alloc_desc_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_device_mem_alloc_desc_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_device_mem_alloc_desc_t)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_mem_alloc_desc_t>())).stype as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_mem_alloc_desc_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_mem_alloc_desc_t>())).pNext as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_mem_alloc_desc_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_mem_alloc_desc_t>())).flags as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_mem_alloc_desc_t), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_device_mem_alloc_desc_t>())).ordinal as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(_ze_device_mem_alloc_desc_t), + "::", + stringify!(ordinal) + ) + ); +} +impl _ze_host_mem_alloc_flags_t { + #[doc = "< host should cache allocation"] + pub const ZE_HOST_MEM_ALLOC_FLAG_BIAS_CACHED: _ze_host_mem_alloc_flags_t = + _ze_host_mem_alloc_flags_t(1); +} +impl _ze_host_mem_alloc_flags_t { + #[doc = "< host should not cache allocation (UC)"] + pub const ZE_HOST_MEM_ALLOC_FLAG_BIAS_UNCACHED: _ze_host_mem_alloc_flags_t = + _ze_host_mem_alloc_flags_t(2); +} +impl _ze_host_mem_alloc_flags_t { + #[doc = "< host memory should be allocated write-combined (WC)"] + pub const ZE_HOST_MEM_ALLOC_FLAG_BIAS_WRITE_COMBINED: _ze_host_mem_alloc_flags_t = + _ze_host_mem_alloc_flags_t(4); +} +impl _ze_host_mem_alloc_flags_t { + pub const ZE_HOST_MEM_ALLOC_FLAG_FORCE_UINT32: _ze_host_mem_alloc_flags_t = + _ze_host_mem_alloc_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_host_mem_alloc_flags_t> for _ze_host_mem_alloc_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_host_mem_alloc_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_host_mem_alloc_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_host_mem_alloc_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_host_mem_alloc_flags_t> for _ze_host_mem_alloc_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_host_mem_alloc_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_host_mem_alloc_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_host_mem_alloc_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported host memory allocation flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_host_mem_alloc_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported host memory allocation flags"] +pub use self::_ze_host_mem_alloc_flags_t as ze_host_mem_alloc_flags_t; +#[doc = ""] +#[doc = " @brief Host memory allocation descriptor"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_host_mem_alloc_desc_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in][optional] pointer to extension-specific structure"] + pub pNext: *const ::std::os::raw::c_void, + #[doc = "< [in] flags specifying additional allocation controls."] + #[doc = "< must be 0 (default) or a valid combination of ::ze_host_mem_alloc_flags_t;"] + #[doc = "< default behavior may use implicit driver-based heuristics."] + pub flags: ze_host_mem_alloc_flags_t, +} +#[test] +fn bindgen_test_layout__ze_host_mem_alloc_desc_t() { + assert_eq!( + ::std::mem::size_of::<_ze_host_mem_alloc_desc_t>(), + 24usize, + concat!("Size of: ", stringify!(_ze_host_mem_alloc_desc_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_host_mem_alloc_desc_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_host_mem_alloc_desc_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_host_mem_alloc_desc_t>())).stype as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_host_mem_alloc_desc_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_host_mem_alloc_desc_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_host_mem_alloc_desc_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_host_mem_alloc_desc_t>())).flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_host_mem_alloc_desc_t), + "::", + stringify!(flags) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Allocates shared memory on the context."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - Shared allocations share ownership between the host and one or more"] + #[doc = " devices."] + #[doc = " - Shared allocations may optionally be associated with a device by"] + #[doc = " passing a handle to the device."] + #[doc = " - Devices supporting only single-device shared access capabilities may"] + #[doc = " access shared memory associated with the device."] + #[doc = " For these devices, ownership of the allocation is shared between the"] + #[doc = " host and the associated device only."] + #[doc = " - Passing nullptr as the device handle does not associate the shared"] + #[doc = " allocation with any device."] + #[doc = " For allocations with no associated device, ownership of the allocation"] + #[doc = " is shared between the host and all devices supporting cross-device"] + #[doc = " shared access capabilities."] + #[doc = " - The application must only use the memory allocation for the context"] + #[doc = " and device, or its sub-devices, which was provided during allocation."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == device_desc`"] + #[doc = " + `nullptr == host_desc`"] + #[doc = " + `nullptr == pptr`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `0x3 < device_desc->flags`"] + #[doc = " + `0x7 < host_desc->flags`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE"] + #[doc = " + `0 == size`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT"] + #[doc = " + Must be zero or a power-of-two"] + #[doc = " + `0 != (alignment & (alignment - 1))`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + pub fn zeMemAllocShared( + hContext: ze_context_handle_t, + device_desc: *const ze_device_mem_alloc_desc_t, + host_desc: *const ze_host_mem_alloc_desc_t, + size: usize, + alignment: usize, + hDevice: ze_device_handle_t, + pptr: *mut *mut ::std::os::raw::c_void, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Allocates device memory on the context."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - Device allocations are owned by a specific device."] + #[doc = " - In general, a device allocation may only be accessed by the device"] + #[doc = " that owns it."] + #[doc = " - The application must only use the memory allocation for the context"] + #[doc = " and device, or its sub-devices, which was provided during allocation."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " + `nullptr == hDevice`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == device_desc`"] + #[doc = " + `nullptr == pptr`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `0x3 < device_desc->flags`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE"] + #[doc = " + `0 == size`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT"] + #[doc = " + Must be zero or a power-of-two"] + #[doc = " + `0 != (alignment & (alignment - 1))`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + pub fn zeMemAllocDevice( + hContext: ze_context_handle_t, + device_desc: *const ze_device_mem_alloc_desc_t, + size: usize, + alignment: usize, + hDevice: ze_device_handle_t, + pptr: *mut *mut ::std::os::raw::c_void, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Allocates host memory on the context."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - Host allocations are owned by the host process."] + #[doc = " - Host allocations are accessible by the host and all devices within the"] + #[doc = " driver's context."] + #[doc = " - Host allocations are frequently used as staging areas to transfer data"] + #[doc = " to or from devices."] + #[doc = " - The application must only use the memory allocation for the context"] + #[doc = " which was provided during allocation."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == host_desc`"] + #[doc = " + `nullptr == pptr`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `0x7 < host_desc->flags`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE"] + #[doc = " + `0 == size`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT"] + #[doc = " + Must be zero or a power-of-two"] + #[doc = " + `0 != (alignment & (alignment - 1))`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + pub fn zeMemAllocHost( + hContext: ze_context_handle_t, + host_desc: *const ze_host_mem_alloc_desc_t, + size: usize, + alignment: usize, + pptr: *mut *mut ::std::os::raw::c_void, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Frees allocated host memory, device memory, or shared memory on the"] + #[doc = " context."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the memory before it is freed"] + #[doc = " - The implementation of this function may immediately free all Host and"] + #[doc = " Device allocations associated with this memory"] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same pointer."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == ptr`"] + pub fn zeMemFree( + hContext: ze_context_handle_t, + ptr: *mut ::std::os::raw::c_void, + ) -> ze_result_t; +} +impl _ze_memory_type_t { + #[doc = "< the memory pointed to is of unknown type"] + pub const ZE_MEMORY_TYPE_UNKNOWN: _ze_memory_type_t = _ze_memory_type_t(0); +} +impl _ze_memory_type_t { + #[doc = "< the memory pointed to is a host allocation"] + pub const ZE_MEMORY_TYPE_HOST: _ze_memory_type_t = _ze_memory_type_t(1); +} +impl _ze_memory_type_t { + #[doc = "< the memory pointed to is a device allocation"] + pub const ZE_MEMORY_TYPE_DEVICE: _ze_memory_type_t = _ze_memory_type_t(2); +} +impl _ze_memory_type_t { + #[doc = "< the memory pointed to is a shared ownership allocation"] + pub const ZE_MEMORY_TYPE_SHARED: _ze_memory_type_t = _ze_memory_type_t(3); +} +impl _ze_memory_type_t { + pub const ZE_MEMORY_TYPE_FORCE_UINT32: _ze_memory_type_t = _ze_memory_type_t(2147483647); +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Memory allocation type"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_memory_type_t(pub u32); +#[doc = ""] +#[doc = " @brief Memory allocation type"] +pub use self::_ze_memory_type_t as ze_memory_type_t; +#[doc = ""] +#[doc = " @brief Memory allocation properties queried using ::zeMemGetAllocProperties"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_memory_allocation_properties_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, + #[doc = "< [out] type of allocated memory"] + pub type_: ze_memory_type_t, + #[doc = "< [out] identifier for this allocation"] + pub id: u64, + #[doc = "< [out] page size used for allocation"] + pub pageSize: u64, +} +#[test] +fn bindgen_test_layout__ze_memory_allocation_properties_t() { + assert_eq!( + ::std::mem::size_of::<_ze_memory_allocation_properties_t>(), + 40usize, + concat!("Size of: ", stringify!(_ze_memory_allocation_properties_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_memory_allocation_properties_t>(), + 8usize, + concat!( + "Alignment of ", + stringify!(_ze_memory_allocation_properties_t) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_memory_allocation_properties_t>())).stype as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_memory_allocation_properties_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_memory_allocation_properties_t>())).pNext as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_memory_allocation_properties_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_memory_allocation_properties_t>())).type_ as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_memory_allocation_properties_t), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_memory_allocation_properties_t>())).id as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_ze_memory_allocation_properties_t), + "::", + stringify!(id) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_memory_allocation_properties_t>())).pageSize as *const _ + as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(_ze_memory_allocation_properties_t), + "::", + stringify!(pageSize) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieves attributes of a memory allocation"] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The application may query attributes of a memory allocation unrelated"] + #[doc = " to the context."] + #[doc = " When this occurs, the returned allocation type will be"] + #[doc = " ::ZE_MEMORY_TYPE_UNKNOWN, and the returned identifier and associated"] + #[doc = " device is unspecified."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == ptr`"] + #[doc = " + `nullptr == pMemAllocProperties`"] + pub fn zeMemGetAllocProperties( + hContext: ze_context_handle_t, + ptr: *const ::std::os::raw::c_void, + pMemAllocProperties: *mut ze_memory_allocation_properties_t, + phDevice: *mut ze_device_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieves the base address and/or size of an allocation"] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == ptr`"] + pub fn zeMemGetAddressRange( + hContext: ze_context_handle_t, + ptr: *const ::std::os::raw::c_void, + pBase: *mut *mut ::std::os::raw::c_void, + pSize: *mut usize, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Creates an IPC memory handle for the specified allocation"] + #[doc = ""] + #[doc = " @details"] + #[doc = " - Takes a pointer to a device memory allocation and creates an IPC"] + #[doc = " memory handle for exporting it for use in another process."] + #[doc = " - The pointer must be base pointer of the device memory allocation; i.e."] + #[doc = " the value returned from ::zeMemAllocDevice."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == ptr`"] + #[doc = " + `nullptr == pIpcHandle`"] + pub fn zeMemGetIpcHandle( + hContext: ze_context_handle_t, + ptr: *const ::std::os::raw::c_void, + pIpcHandle: *mut ze_ipc_mem_handle_t, + ) -> ze_result_t; +} +impl _ze_ipc_memory_flags_t { + #[doc = "< reserved for future use"] + pub const ZE_IPC_MEMORY_FLAG_TBD: _ze_ipc_memory_flags_t = _ze_ipc_memory_flags_t(1); +} +impl _ze_ipc_memory_flags_t { + pub const ZE_IPC_MEMORY_FLAG_FORCE_UINT32: _ze_ipc_memory_flags_t = + _ze_ipc_memory_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_ipc_memory_flags_t> for _ze_ipc_memory_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_ipc_memory_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_ipc_memory_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_ipc_memory_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_ipc_memory_flags_t> for _ze_ipc_memory_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_ipc_memory_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_ipc_memory_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_ipc_memory_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported IPC memory flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_ipc_memory_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported IPC memory flags"] +pub use self::_ze_ipc_memory_flags_t as ze_ipc_memory_flags_t; +extern "C" { + #[doc = ""] + #[doc = " @brief Opens an IPC memory handle to retrieve a device pointer on the"] + #[doc = " context."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - Takes an IPC memory handle from a remote process and associates it"] + #[doc = " with a device pointer usable in this process."] + #[doc = " - The device pointer in this process should not be freed with"] + #[doc = " ::zeMemFree, but rather with ::zeMemCloseIpcHandle."] + #[doc = " - Multiple calls to this function with the same IPC handle will return"] + #[doc = " unique pointers."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " + `nullptr == hDevice`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `0x1 < flags`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pptr`"] + pub fn zeMemOpenIpcHandle( + hContext: ze_context_handle_t, + hDevice: ze_device_handle_t, + handle: ze_ipc_mem_handle_t, + flags: ze_ipc_memory_flags_t, + pptr: *mut *mut ::std::os::raw::c_void, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Closes an IPC memory handle"] + #[doc = ""] + #[doc = " @details"] + #[doc = " - Closes an IPC memory handle by unmapping memory that was opened in"] + #[doc = " this process using ::zeMemOpenIpcHandle."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same pointer."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == ptr`"] + pub fn zeMemCloseIpcHandle( + hContext: ze_context_handle_t, + ptr: *const ::std::os::raw::c_void, + ) -> ze_result_t; +} +impl _ze_module_format_t { + #[doc = "< Format is SPIRV IL format"] + pub const ZE_MODULE_FORMAT_IL_SPIRV: _ze_module_format_t = _ze_module_format_t(0); +} +impl _ze_module_format_t { + #[doc = "< Format is device native format"] + pub const ZE_MODULE_FORMAT_NATIVE: _ze_module_format_t = _ze_module_format_t(1); +} +impl _ze_module_format_t { + pub const ZE_MODULE_FORMAT_FORCE_UINT32: _ze_module_format_t = _ze_module_format_t(2147483647); +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported module creation input formats"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_module_format_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported module creation input formats"] +pub use self::_ze_module_format_t as ze_module_format_t; +#[doc = ""] +#[doc = " @brief Specialization constants - User defined constants"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_module_constants_t { + #[doc = "< [in] Number of specialization constants."] + pub numConstants: u32, + #[doc = "< [in][range(0, numConstants)] Array of IDs that is sized to"] + #[doc = "< numConstants."] + pub pConstantIds: *const u32, + #[doc = "< [in][range(0, numConstants)] Array of pointers to values that is sized"] + #[doc = "< to numConstants."] + pub pConstantValues: *mut *const ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout__ze_module_constants_t() { + assert_eq!( + ::std::mem::size_of::<_ze_module_constants_t>(), + 24usize, + concat!("Size of: ", stringify!(_ze_module_constants_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_module_constants_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_module_constants_t)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_module_constants_t>())).numConstants as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_module_constants_t), + "::", + stringify!(numConstants) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_module_constants_t>())).pConstantIds as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_module_constants_t), + "::", + stringify!(pConstantIds) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_module_constants_t>())).pConstantValues as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_module_constants_t), + "::", + stringify!(pConstantValues) + ) + ); +} +#[doc = ""] +#[doc = " @brief Module descriptor"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_module_desc_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in][optional] pointer to extension-specific structure"] + pub pNext: *const ::std::os::raw::c_void, + #[doc = "< [in] Module format passed in with pInputModule"] + pub format: ze_module_format_t, + #[doc = "< [in] size of input IL or ISA from pInputModule."] + pub inputSize: usize, + #[doc = "< [in] pointer to IL or ISA"] + pub pInputModule: *const u8, + #[doc = "< [in][optional] string containing compiler flags. Following options are supported."] + #[doc = "< - \"-ze-opt-disable\""] + #[doc = "< - Disable optimizations"] + #[doc = "< - \"-ze-opt-greater-than-4GB-buffer-required\""] + #[doc = "< - Use 64-bit offset calculations for buffers."] + #[doc = "< - \"-ze-opt-large-register-file\""] + #[doc = "< - Increase number of registers available to threads."] + #[doc = "< - \"-ze-opt-has-buffer-offset-arg\""] + #[doc = "< - Extend stateless to stateful optimization to more"] + #[doc = "< cases with the use of additional offset (e.g. 64-bit"] + #[doc = "< pointer to binding table with 32-bit offset)."] + #[doc = "< - \"-g\""] + #[doc = "< - Include debugging information."] + pub pBuildFlags: *const ::std::os::raw::c_char, + #[doc = "< [in][optional] pointer to specialization constants. Valid only for"] + #[doc = "< SPIR-V input. This must be set to nullptr if no specialization"] + #[doc = "< constants are provided."] + pub pConstants: *const ze_module_constants_t, +} +#[test] +fn bindgen_test_layout__ze_module_desc_t() { + assert_eq!( + ::std::mem::size_of::<_ze_module_desc_t>(), + 56usize, + concat!("Size of: ", stringify!(_ze_module_desc_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_module_desc_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_module_desc_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_module_desc_t>())).stype as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_module_desc_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_module_desc_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_module_desc_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_module_desc_t>())).format as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_module_desc_t), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_module_desc_t>())).inputSize as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_ze_module_desc_t), + "::", + stringify!(inputSize) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_module_desc_t>())).pInputModule as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(_ze_module_desc_t), + "::", + stringify!(pInputModule) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_module_desc_t>())).pBuildFlags as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(_ze_module_desc_t), + "::", + stringify!(pBuildFlags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_module_desc_t>())).pConstants as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(_ze_module_desc_t), + "::", + stringify!(pConstants) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Creates a module on the context."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - Compiles the module for execution on the device."] + #[doc = " - The application must only use the module for the device, or its"] + #[doc = " sub-devices, which was provided during creation."] + #[doc = " - The module can be copied to other devices and contexts within the same"] + #[doc = " driver instance by using ::zeModuleGetNativeBinary."] + #[doc = " - A build log can optionally be returned to the caller. The caller is"] + #[doc = " responsible for destroying build log using ::zeModuleBuildLogDestroy."] + #[doc = " - The module descriptor constants are only supported for SPIR-V"] + #[doc = " specialization constants."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " + `nullptr == hDevice`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == desc`"] + #[doc = " + `nullptr == desc->pInputModule`"] + #[doc = " + `nullptr == phModule`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `::ZE_MODULE_FORMAT_NATIVE < desc->format`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NATIVE_BINARY"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `0 == desc->inputSize`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_MODULE_BUILD_FAILURE"] + pub fn zeModuleCreate( + hContext: ze_context_handle_t, + hDevice: ze_device_handle_t, + desc: *const ze_module_desc_t, + phModule: *mut ze_module_handle_t, + phBuildLog: *mut ze_module_build_log_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Destroys module"] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must destroy all kernel and build log handles created"] + #[doc = " from the module before destroying the module itself."] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the module before it is deleted."] + #[doc = " - The implementation of this function may immediately free all Host and"] + #[doc = " Device allocations associated with this module."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same module handle."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hModule`"] + #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] + pub fn zeModuleDestroy(hModule: ze_module_handle_t) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Dynamically link modules together that share import/export linkage"] + #[doc = " dependencies."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - Modules support import and export linkage for functions and global"] + #[doc = " variables."] + #[doc = " - Modules that have imports can be dynamically linked to export modules"] + #[doc = " that satisfy those import requirements."] + #[doc = " - Modules can have both import and export linkages."] + #[doc = " - Modules that do not have any imports or exports do not need to be"] + #[doc = " linked."] + #[doc = " - Modules cannot be partially linked. All modules needed to satisfy all"] + #[doc = " import dependencies for a module must be passed in or"] + #[doc = " ::ZE_RESULT_ERROR_MODULE_LINK_FAILURE will returned."] + #[doc = " - Modules with imports need to be linked before kernel objects can be"] + #[doc = " created from them."] + #[doc = " - Modules will only be linked once. A module can be used in multiple"] + #[doc = " link calls if it has exports but it's imports will not be re-linked."] + #[doc = " - Ambiguous dependencies, where multiple modules satisfy the import"] + #[doc = " dependencies for another module, is not allowed."] + #[doc = " - ModuleGetNativeBinary can be called on any module regardless of"] + #[doc = " whether it is linked or not."] + #[doc = " - A link log can optionally be returned to the caller. The caller is"] + #[doc = " responsible for destroying build log using ::zeModuleBuildLogDestroy."] + #[doc = " - See SPIR-V specification for linkage details."] + #[doc = " - The application may call this function from simultaneous threads as"] + #[doc = " long as the import modules being linked are not the same."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == phModules`"] + #[doc = " - ::ZE_RESULT_ERROR_MODULE_LINK_FAILURE"] + pub fn zeModuleDynamicLink( + numModules: u32, + phModules: *mut ze_module_handle_t, + phLinkLog: *mut ze_module_build_log_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Destroys module build log object"] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The implementation of this function may immediately free all Host"] + #[doc = " allocations associated with this object."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same build log handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = " - This function can be called before or after ::zeModuleDestroy for the"] + #[doc = " associated module."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hModuleBuildLog`"] + #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] + pub fn zeModuleBuildLogDestroy(hModuleBuildLog: ze_module_build_log_handle_t) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieves text string for build log."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The caller can pass nullptr for pBuildLog when querying only for size."] + #[doc = " - The caller must provide memory for build log."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hModuleBuildLog`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pSize`"] + pub fn zeModuleBuildLogGetString( + hModuleBuildLog: ze_module_build_log_handle_t, + pSize: *mut usize, + pBuildLog: *mut ::std::os::raw::c_char, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieve native binary from Module."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The native binary output can be cached to disk and new modules can be"] + #[doc = " later constructed from the cached copy."] + #[doc = " - The native binary will retain debugging information that is associated"] + #[doc = " with a module."] + #[doc = " - The caller can pass nullptr for pModuleNativeBinary when querying only"] + #[doc = " for size."] + #[doc = " - The implementation will copy the native binary into a buffer supplied"] + #[doc = " by the caller."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hModule`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pSize`"] + pub fn zeModuleGetNativeBinary( + hModule: ze_module_handle_t, + pSize: *mut usize, + pModuleNativeBinary: *mut u8, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieve global variable pointer from Module."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may query global pointer from any module that either"] + #[doc = " exports or imports it."] + #[doc = " - The application must dynamically link a module that imports a global"] + #[doc = " before the global pointer can be queried from it."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hModule`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pGlobalName`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_GLOBAL_NAME"] + pub fn zeModuleGetGlobalPointer( + hModule: ze_module_handle_t, + pGlobalName: *const ::std::os::raw::c_char, + pSize: *mut usize, + pptr: *mut *mut ::std::os::raw::c_void, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieve all kernel names in the module."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hModule`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pCount`"] + pub fn zeModuleGetKernelNames( + hModule: ze_module_handle_t, + pCount: *mut u32, + pNames: *mut *const ::std::os::raw::c_char, + ) -> ze_result_t; +} +impl _ze_module_property_flags_t { + #[doc = "< Module has imports (i.e. imported global variables and/or kernels)."] + #[doc = "< See ::zeModuleDynamicLink."] + pub const ZE_MODULE_PROPERTY_FLAG_IMPORTS: _ze_module_property_flags_t = + _ze_module_property_flags_t(1); +} +impl _ze_module_property_flags_t { + pub const ZE_MODULE_PROPERTY_FLAG_FORCE_UINT32: _ze_module_property_flags_t = + _ze_module_property_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_module_property_flags_t> for _ze_module_property_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_module_property_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_module_property_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_module_property_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_module_property_flags_t> for _ze_module_property_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_module_property_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_module_property_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_module_property_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported module property flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_module_property_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported module property flags"] +pub use self::_ze_module_property_flags_t as ze_module_property_flags_t; +#[doc = ""] +#[doc = " @brief Module properties"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_module_properties_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, + #[doc = "< [out] 0 (none) or a valid combination of ::ze_module_property_flags_t"] + pub flags: ze_module_property_flags_t, +} +#[test] +fn bindgen_test_layout__ze_module_properties_t() { + assert_eq!( + ::std::mem::size_of::<_ze_module_properties_t>(), + 24usize, + concat!("Size of: ", stringify!(_ze_module_properties_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_module_properties_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_module_properties_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_module_properties_t>())).stype as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_module_properties_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_module_properties_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_module_properties_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_module_properties_t>())).flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_module_properties_t), + "::", + stringify!(flags) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieve module properties."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hModule`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pModuleProperties`"] + pub fn zeModuleGetProperties( + hModule: ze_module_handle_t, + pModuleProperties: *mut ze_module_properties_t, + ) -> ze_result_t; +} +impl _ze_kernel_flags_t { + #[doc = "< force all device allocations to be resident during execution"] + pub const ZE_KERNEL_FLAG_FORCE_RESIDENCY: _ze_kernel_flags_t = _ze_kernel_flags_t(1); +} +impl _ze_kernel_flags_t { + #[doc = "< application is responsible for all residency of device allocations."] + #[doc = "< driver may disable implicit residency management."] + pub const ZE_KERNEL_FLAG_EXPLICIT_RESIDENCY: _ze_kernel_flags_t = _ze_kernel_flags_t(2); +} +impl _ze_kernel_flags_t { + pub const ZE_KERNEL_FLAG_FORCE_UINT32: _ze_kernel_flags_t = _ze_kernel_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_kernel_flags_t> for _ze_kernel_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_kernel_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_kernel_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_kernel_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_kernel_flags_t> for _ze_kernel_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_kernel_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_kernel_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_kernel_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported kernel creation flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_kernel_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported kernel creation flags"] +pub use self::_ze_kernel_flags_t as ze_kernel_flags_t; +#[doc = ""] +#[doc = " @brief Kernel descriptor"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_kernel_desc_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in][optional] pointer to extension-specific structure"] + pub pNext: *const ::std::os::raw::c_void, + #[doc = "< [in] creation flags."] + #[doc = "< must be 0 (default) or a valid combination of ::ze_kernel_flags_t;"] + #[doc = "< default behavior may use driver-based residency."] + pub flags: ze_kernel_flags_t, + #[doc = "< [in] null-terminated name of kernel in module"] + pub pKernelName: *const ::std::os::raw::c_char, +} +#[test] +fn bindgen_test_layout__ze_kernel_desc_t() { + assert_eq!( + ::std::mem::size_of::<_ze_kernel_desc_t>(), + 32usize, + concat!("Size of: ", stringify!(_ze_kernel_desc_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_kernel_desc_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_kernel_desc_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_kernel_desc_t>())).stype as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_desc_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_kernel_desc_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_desc_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_kernel_desc_t>())).flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_desc_t), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_kernel_desc_t>())).pKernelName as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_desc_t), + "::", + stringify!(pKernelName) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Create a kernel from the module."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - Modules that have unresolved imports need to be dynamically linked"] + #[doc = " before a kernel can be created from them. (See ::zeModuleDynamicLink)"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hModule`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == desc`"] + #[doc = " + `nullptr == desc->pKernelName`"] + #[doc = " + `nullptr == phKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `0x3 < desc->flags`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_KERNEL_NAME"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_MODULE_UNLINKED"] + pub fn zeKernelCreate( + hModule: ze_module_handle_t, + desc: *const ze_kernel_desc_t, + phKernel: *mut ze_kernel_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Destroys a kernel object"] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the kernel before it is deleted."] + #[doc = " - The implementation of this function may immediately free all Host and"] + #[doc = " Device allocations associated with this kernel."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same kernel handle."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] + pub fn zeKernelDestroy(hKernel: ze_kernel_handle_t) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieve a function pointer from a module by name"] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The function pointer is unique for the device on which the module was"] + #[doc = " created."] + #[doc = " - The function pointer is no longer valid if module is destroyed."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hModule`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pFunctionName`"] + #[doc = " + `nullptr == pfnFunction`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_FUNCTION_NAME"] + pub fn zeModuleGetFunctionPointer( + hModule: ze_module_handle_t, + pFunctionName: *const ::std::os::raw::c_char, + pfnFunction: *mut *mut ::std::os::raw::c_void, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Set group size for a kernel on the current Host thread."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The implementation will maintain the group size in thread-local"] + #[doc = " storage."] + #[doc = " - The group size will be used when a ::zeCommandListAppendLaunchKernel"] + #[doc = " variant is called on the same Host thread."] + #[doc = " - The application may call this function from simultaneous threads with"] + #[doc = " the same kernel handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION"] + pub fn zeKernelSetGroupSize( + hKernel: ze_kernel_handle_t, + groupSizeX: u32, + groupSizeY: u32, + groupSizeZ: u32, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Query a suggested group size for a kernel given a global size for each"] + #[doc = " dimension."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - This function ignores the group size that is set using"] + #[doc = " ::zeKernelSetGroupSize."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == groupSizeX`"] + #[doc = " + `nullptr == groupSizeY`"] + #[doc = " + `nullptr == groupSizeZ`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION"] + pub fn zeKernelSuggestGroupSize( + hKernel: ze_kernel_handle_t, + globalSizeX: u32, + globalSizeY: u32, + globalSizeZ: u32, + groupSizeX: *mut u32, + groupSizeY: *mut u32, + groupSizeZ: *mut u32, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Query a suggested max group count for a cooperative kernel."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == totalGroupCount`"] + pub fn zeKernelSuggestMaxCooperativeGroupCount( + hKernel: ze_kernel_handle_t, + totalGroupCount: *mut u32, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Set kernel argument for a kernel on the current Host thread."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The implementation will maintain the argument values in thread-local"] + #[doc = " storage."] + #[doc = " - The argument values will be used when a"] + #[doc = " ::zeCommandListAppendLaunchKernel variant is called on the same Host"] + #[doc = " thread."] + #[doc = " - The application may call this function from simultaneous threads with"] + #[doc = " the same kernel handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE"] + pub fn zeKernelSetArgumentValue( + hKernel: ze_kernel_handle_t, + argIndex: u32, + argSize: usize, + pArgValue: *const ::std::os::raw::c_void, + ) -> ze_result_t; +} +impl _ze_kernel_indirect_access_flags_t { + #[doc = "< Indicates that the kernel accesses host allocations indirectly."] + pub const ZE_KERNEL_INDIRECT_ACCESS_FLAG_HOST: _ze_kernel_indirect_access_flags_t = + _ze_kernel_indirect_access_flags_t(1); +} +impl _ze_kernel_indirect_access_flags_t { + #[doc = "< Indicates that the kernel accesses device allocations indirectly."] + pub const ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE: _ze_kernel_indirect_access_flags_t = + _ze_kernel_indirect_access_flags_t(2); +} +impl _ze_kernel_indirect_access_flags_t { + #[doc = "< Indicates that the kernel accesses shared allocations indirectly."] + pub const ZE_KERNEL_INDIRECT_ACCESS_FLAG_SHARED: _ze_kernel_indirect_access_flags_t = + _ze_kernel_indirect_access_flags_t(4); +} +impl _ze_kernel_indirect_access_flags_t { + pub const ZE_KERNEL_INDIRECT_ACCESS_FLAG_FORCE_UINT32: _ze_kernel_indirect_access_flags_t = + _ze_kernel_indirect_access_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_kernel_indirect_access_flags_t> for _ze_kernel_indirect_access_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_kernel_indirect_access_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_kernel_indirect_access_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_kernel_indirect_access_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_kernel_indirect_access_flags_t> for _ze_kernel_indirect_access_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_kernel_indirect_access_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_kernel_indirect_access_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_kernel_indirect_access_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Kernel indirect access flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_kernel_indirect_access_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Kernel indirect access flags"] +pub use self::_ze_kernel_indirect_access_flags_t as ze_kernel_indirect_access_flags_t; +extern "C" { + #[doc = ""] + #[doc = " @brief Sets kernel indirect access flags."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application should specify which allocations will be indirectly"] + #[doc = " accessed by the kernel to allow driver to optimize which allocations"] + #[doc = " are made resident"] + #[doc = " - This function may **not** be called from simultaneous threads with the"] + #[doc = " same Kernel handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `0x7 < flags`"] + pub fn zeKernelSetIndirectAccess( + hKernel: ze_kernel_handle_t, + flags: ze_kernel_indirect_access_flags_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieve kernel indirect access flags."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - This function may be called from simultaneous threads with the same"] + #[doc = " Kernel handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pFlags`"] + pub fn zeKernelGetIndirectAccess( + hKernel: ze_kernel_handle_t, + pFlags: *mut ze_kernel_indirect_access_flags_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieve all declared kernel attributes (i.e. can be specified with"] + #[doc = " __attribute__ in runtime language)."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - This function may be called from simultaneous threads with the same"] + #[doc = " Kernel handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pSize`"] + pub fn zeKernelGetSourceAttributes( + hKernel: ze_kernel_handle_t, + pSize: *mut u32, + pString: *mut *mut ::std::os::raw::c_char, + ) -> ze_result_t; +} +impl _ze_cache_config_flags_t { + #[doc = "< Large SLM size"] + pub const ZE_CACHE_CONFIG_FLAG_LARGE_SLM: _ze_cache_config_flags_t = + _ze_cache_config_flags_t(1); +} +impl _ze_cache_config_flags_t { + #[doc = "< Large General Data size"] + pub const ZE_CACHE_CONFIG_FLAG_LARGE_DATA: _ze_cache_config_flags_t = + _ze_cache_config_flags_t(2); +} +impl _ze_cache_config_flags_t { + pub const ZE_CACHE_CONFIG_FLAG_FORCE_UINT32: _ze_cache_config_flags_t = + _ze_cache_config_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_cache_config_flags_t> for _ze_cache_config_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_cache_config_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_cache_config_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_cache_config_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_cache_config_flags_t> for _ze_cache_config_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_cache_config_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_cache_config_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_cache_config_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported Cache Config flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_cache_config_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported Cache Config flags"] +pub use self::_ze_cache_config_flags_t as ze_cache_config_flags_t; +extern "C" { + #[doc = ""] + #[doc = " @brief Sets the preferred cache configuration for a kernel on the current"] + #[doc = " Host thread."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The implementation will maintain the cache configuration in"] + #[doc = " thread-local storage."] + #[doc = " - The cache configuration will be used when a"] + #[doc = " ::zeCommandListAppendLaunchKernel variant is called on the same Host"] + #[doc = " thread."] + #[doc = " - The application may call this function from simultaneous threads with"] + #[doc = " the same kernel handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `0x3 < flags`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE"] + pub fn zeKernelSetCacheConfig( + hKernel: ze_kernel_handle_t, + flags: ze_cache_config_flags_t, + ) -> ze_result_t; +} +#[doc = ""] +#[doc = " @brief Kernel universal unique id (UUID)"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_kernel_uuid_t { + #[doc = "< [out] opaque data representing a kernel UUID"] + pub kid: [u8; 16usize], + #[doc = "< [out] opaque data representing the kernel's module UUID"] + pub mid: [u8; 16usize], +} +#[test] +fn bindgen_test_layout__ze_kernel_uuid_t() { + assert_eq!( + ::std::mem::size_of::<_ze_kernel_uuid_t>(), + 32usize, + concat!("Size of: ", stringify!(_ze_kernel_uuid_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_kernel_uuid_t>(), + 1usize, + concat!("Alignment of ", stringify!(_ze_kernel_uuid_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_kernel_uuid_t>())).kid as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_uuid_t), + "::", + stringify!(kid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_kernel_uuid_t>())).mid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_uuid_t), + "::", + stringify!(mid) + ) + ); +} +#[doc = ""] +#[doc = " @brief Kernel properties"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_kernel_properties_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in,out][optional] pointer to extension-specific structure"] + pub pNext: *mut ::std::os::raw::c_void, + #[doc = "< [out] number of kernel arguments."] + pub numKernelArgs: u32, + #[doc = "< [out] required group size in the X dimension,"] + #[doc = "< or zero if there is no required group size"] + pub requiredGroupSizeX: u32, + #[doc = "< [out] required group size in the Y dimension,"] + #[doc = "< or zero if there is no required group size"] + pub requiredGroupSizeY: u32, + #[doc = "< [out] required group size in the Z dimension,"] + #[doc = "< or zero if there is no required group size"] + pub requiredGroupSizeZ: u32, + #[doc = "< [out] required number of subgroups per thread group,"] + #[doc = "< or zero if there is no required number of subgroups"] + pub requiredNumSubGroups: u32, + #[doc = "< [out] required subgroup size,"] + #[doc = "< or zero if there is no required subgroup size"] + pub requiredSubgroupSize: u32, + #[doc = "< [out] maximum subgroup size"] + pub maxSubgroupSize: u32, + #[doc = "< [out] maximum number of subgroups per thread group"] + pub maxNumSubgroups: u32, + #[doc = "< [out] local memory size used by each thread group"] + pub localMemSize: u32, + #[doc = "< [out] private memory size allocated by compiler used by each thread"] + pub privateMemSize: u32, + #[doc = "< [out] spill memory size allocated by compiler"] + pub spillMemSize: u32, + #[doc = "< [out] universal unique identifier."] + pub uuid: ze_kernel_uuid_t, +} +#[test] +fn bindgen_test_layout__ze_kernel_properties_t() { + assert_eq!( + ::std::mem::size_of::<_ze_kernel_properties_t>(), + 96usize, + concat!("Size of: ", stringify!(_ze_kernel_properties_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_kernel_properties_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_kernel_properties_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_kernel_properties_t>())).stype as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_properties_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_kernel_properties_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_properties_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_properties_t>())).numKernelArgs as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_properties_t), + "::", + stringify!(numKernelArgs) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_properties_t>())).requiredGroupSizeX as *const _ + as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_properties_t), + "::", + stringify!(requiredGroupSizeX) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_properties_t>())).requiredGroupSizeY as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_properties_t), + "::", + stringify!(requiredGroupSizeY) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_properties_t>())).requiredGroupSizeZ as *const _ + as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_properties_t), + "::", + stringify!(requiredGroupSizeZ) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_properties_t>())).requiredNumSubGroups as *const _ + as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_properties_t), + "::", + stringify!(requiredNumSubGroups) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_properties_t>())).requiredSubgroupSize as *const _ + as usize + }, + 36usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_properties_t), + "::", + stringify!(requiredSubgroupSize) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_properties_t>())).maxSubgroupSize as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_properties_t), + "::", + stringify!(maxSubgroupSize) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_properties_t>())).maxNumSubgroups as *const _ as usize + }, + 44usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_properties_t), + "::", + stringify!(maxNumSubgroups) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_properties_t>())).localMemSize as *const _ as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_properties_t), + "::", + stringify!(localMemSize) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_properties_t>())).privateMemSize as *const _ as usize + }, + 52usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_properties_t), + "::", + stringify!(privateMemSize) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<_ze_kernel_properties_t>())).spillMemSize as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_properties_t), + "::", + stringify!(spillMemSize) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_kernel_properties_t>())).uuid as *const _ as usize }, + 60usize, + concat!( + "Offset of field: ", + stringify!(_ze_kernel_properties_t), + "::", + stringify!(uuid) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieve kernel properties."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pKernelProperties`"] + pub fn zeKernelGetProperties( + hKernel: ze_kernel_handle_t, + pKernelProperties: *mut ze_kernel_properties_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Retrieve kernel name from Kernel."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The caller can pass nullptr for pName when querying only for size."] + #[doc = " - The implementation will copy the kernel name into a buffer supplied by"] + #[doc = " the caller."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pSize`"] + pub fn zeKernelGetName( + hKernel: ze_kernel_handle_t, + pSize: *mut usize, + pName: *mut ::std::os::raw::c_char, + ) -> ze_result_t; +} +#[doc = ""] +#[doc = " @brief Kernel dispatch group count."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_group_count_t { + #[doc = "< [in] number of thread groups in X dimension"] + pub groupCountX: u32, + #[doc = "< [in] number of thread groups in Y dimension"] + pub groupCountY: u32, + #[doc = "< [in] number of thread groups in Z dimension"] + pub groupCountZ: u32, +} +#[test] +fn bindgen_test_layout__ze_group_count_t() { + assert_eq!( + ::std::mem::size_of::<_ze_group_count_t>(), + 12usize, + concat!("Size of: ", stringify!(_ze_group_count_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_group_count_t>(), + 4usize, + concat!("Alignment of ", stringify!(_ze_group_count_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_group_count_t>())).groupCountX as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_group_count_t), + "::", + stringify!(groupCountX) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_group_count_t>())).groupCountY as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(_ze_group_count_t), + "::", + stringify!(groupCountY) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_group_count_t>())).groupCountZ as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_group_count_t), + "::", + stringify!(groupCountZ) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Launch kernel over one or more work groups."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the kernel and events are accessible by"] + #[doc = " the device on which the command list was created."] + #[doc = " - This may **only** be called for a command list created with command"] + #[doc = " queue group ordinal that supports compute."] + #[doc = " - The application must ensure the command list, kernel and events were"] + #[doc = " created on the same context."] + #[doc = " - This function may **not** be called from simultaneous threads with the"] + #[doc = " same command list handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hCommandList`"] + #[doc = " + `nullptr == hKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pLaunchFuncArgs`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] + pub fn zeCommandListAppendLaunchKernel( + hCommandList: ze_command_list_handle_t, + hKernel: ze_kernel_handle_t, + pLaunchFuncArgs: *const ze_group_count_t, + hSignalEvent: ze_event_handle_t, + numWaitEvents: u32, + phWaitEvents: *mut ze_event_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Launch kernel cooperatively over one or more work groups."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the kernel and events are accessible by"] + #[doc = " the device on which the command list was created."] + #[doc = " - This may **only** be called for a command list created with command"] + #[doc = " queue group ordinal that supports compute."] + #[doc = " - This may only be used for a command list that are submitted to command"] + #[doc = " queue with cooperative flag set."] + #[doc = " - The application must ensure the command list, kernel and events were"] + #[doc = " created on the same context."] + #[doc = " - This function may **not** be called from simultaneous threads with the"] + #[doc = " same command list handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = " - Use ::zeKernelSuggestMaxCooperativeGroupCount to recommend max group"] + #[doc = " count for device for cooperative functions that device supports."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hCommandList`"] + #[doc = " + `nullptr == hKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pLaunchFuncArgs`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] + pub fn zeCommandListAppendLaunchCooperativeKernel( + hCommandList: ze_command_list_handle_t, + hKernel: ze_kernel_handle_t, + pLaunchFuncArgs: *const ze_group_count_t, + hSignalEvent: ze_event_handle_t, + numWaitEvents: u32, + phWaitEvents: *mut ze_event_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Launch kernel over one or more work groups using indirect arguments."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the kernel and events are accessible by"] + #[doc = " the device on which the command list was created."] + #[doc = " - The application must ensure the launch arguments are visible to the"] + #[doc = " device on which the command list was created."] + #[doc = " - The implementation must not access the contents of the launch"] + #[doc = " arguments as they are free to be modified by either the Host or device"] + #[doc = " up until execution."] + #[doc = " - This may **only** be called for a command list created with command"] + #[doc = " queue group ordinal that supports compute."] + #[doc = " - The application must ensure the command list, kernel and events were"] + #[doc = " created, and the memory was allocated, on the same context."] + #[doc = " - This function may **not** be called from simultaneous threads with the"] + #[doc = " same command list handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hCommandList`"] + #[doc = " + `nullptr == hKernel`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pLaunchArgumentsBuffer`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] + pub fn zeCommandListAppendLaunchKernelIndirect( + hCommandList: ze_command_list_handle_t, + hKernel: ze_kernel_handle_t, + pLaunchArgumentsBuffer: *const ze_group_count_t, + hSignalEvent: ze_event_handle_t, + numWaitEvents: u32, + phWaitEvents: *mut ze_event_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Launch multiple kernels over one or more work groups using an array of"] + #[doc = " indirect arguments."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the kernel and events are accessible by"] + #[doc = " the device on which the command list was created."] + #[doc = " - The application must ensure the array of launch arguments and count"] + #[doc = " buffer are visible to the device on which the command list was"] + #[doc = " created."] + #[doc = " - The implementation must not access the contents of the array of launch"] + #[doc = " arguments or count buffer as they are free to be modified by either"] + #[doc = " the Host or device up until execution."] + #[doc = " - This may **only** be called for a command list created with command"] + #[doc = " queue group ordinal that supports compute."] + #[doc = " - The application must enusre the command list, kernel and events were"] + #[doc = " created, and the memory was allocated, on the same context."] + #[doc = " - This function may **not** be called from simultaneous threads with the"] + #[doc = " same command list handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hCommandList`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == phKernels`"] + #[doc = " + `nullptr == pCountBuffer`"] + #[doc = " + `nullptr == pLaunchArgumentsBuffer`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_SIZE"] + #[doc = " + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`"] + pub fn zeCommandListAppendLaunchMultipleKernelsIndirect( + hCommandList: ze_command_list_handle_t, + numKernels: u32, + phKernels: *mut ze_kernel_handle_t, + pCountBuffer: *const u32, + pLaunchArgumentsBuffer: *const ze_group_count_t, + hSignalEvent: ze_event_handle_t, + numWaitEvents: u32, + phWaitEvents: *mut ze_event_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Makes memory resident for the device."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the memory is resident before being"] + #[doc = " referenced by the device"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " + `nullptr == hDevice`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == ptr`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + pub fn zeContextMakeMemoryResident( + hContext: ze_context_handle_t, + hDevice: ze_device_handle_t, + ptr: *mut ::std::os::raw::c_void, + size: usize, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Allows memory to be evicted from the device."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the memory before it is evicted"] + #[doc = " - The application may free the memory without evicting; the memory is"] + #[doc = " implicitly evicted when freed."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " + `nullptr == hDevice`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == ptr`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + pub fn zeContextEvictMemory( + hContext: ze_context_handle_t, + hDevice: ze_device_handle_t, + ptr: *mut ::std::os::raw::c_void, + size: usize, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Makes image resident for the device."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the image is resident before being"] + #[doc = " referenced by the device"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " + `nullptr == hDevice`"] + #[doc = " + `nullptr == hImage`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + pub fn zeContextMakeImageResident( + hContext: ze_context_handle_t, + hDevice: ze_device_handle_t, + hImage: ze_image_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Allows image to be evicted from the device."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the image before it is evicted"] + #[doc = " - The application may destroy the image without evicting; the image is"] + #[doc = " implicitly evicted when destroyed."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " + `nullptr == hDevice`"] + #[doc = " + `nullptr == hImage`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + pub fn zeContextEvictImage( + hContext: ze_context_handle_t, + hDevice: ze_device_handle_t, + hImage: ze_image_handle_t, + ) -> ze_result_t; +} +impl _ze_sampler_address_mode_t { + #[doc = "< No coordinate modifications for out-of-bounds image access."] + pub const ZE_SAMPLER_ADDRESS_MODE_NONE: _ze_sampler_address_mode_t = + _ze_sampler_address_mode_t(0); +} +impl _ze_sampler_address_mode_t { + #[doc = "< Out-of-bounds coordinates are wrapped back around."] + pub const ZE_SAMPLER_ADDRESS_MODE_REPEAT: _ze_sampler_address_mode_t = + _ze_sampler_address_mode_t(1); +} +impl _ze_sampler_address_mode_t { + #[doc = "< Out-of-bounds coordinates are clamped to edge."] + pub const ZE_SAMPLER_ADDRESS_MODE_CLAMP: _ze_sampler_address_mode_t = + _ze_sampler_address_mode_t(2); +} +impl _ze_sampler_address_mode_t { + #[doc = "< Out-of-bounds coordinates are clamped to border color which is (0.0f,"] + #[doc = "< 0.0f, 0.0f, 0.0f) if image format swizzle contains alpha, otherwise"] + #[doc = "< (0.0f, 0.0f, 0.0f, 1.0f)."] + pub const ZE_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER: _ze_sampler_address_mode_t = + _ze_sampler_address_mode_t(3); +} +impl _ze_sampler_address_mode_t { + #[doc = "< Out-of-bounds coordinates are mirrored starting from edge."] + pub const ZE_SAMPLER_ADDRESS_MODE_MIRROR: _ze_sampler_address_mode_t = + _ze_sampler_address_mode_t(4); +} +impl _ze_sampler_address_mode_t { + pub const ZE_SAMPLER_ADDRESS_MODE_FORCE_UINT32: _ze_sampler_address_mode_t = + _ze_sampler_address_mode_t(2147483647); +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Sampler addressing modes"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_sampler_address_mode_t(pub u32); +#[doc = ""] +#[doc = " @brief Sampler addressing modes"] +pub use self::_ze_sampler_address_mode_t as ze_sampler_address_mode_t; +impl _ze_sampler_filter_mode_t { + #[doc = "< No coordinate modifications for out of bounds image access."] + pub const ZE_SAMPLER_FILTER_MODE_NEAREST: _ze_sampler_filter_mode_t = + _ze_sampler_filter_mode_t(0); +} +impl _ze_sampler_filter_mode_t { + #[doc = "< Out-of-bounds coordinates are wrapped back around."] + pub const ZE_SAMPLER_FILTER_MODE_LINEAR: _ze_sampler_filter_mode_t = + _ze_sampler_filter_mode_t(1); +} +impl _ze_sampler_filter_mode_t { + pub const ZE_SAMPLER_FILTER_MODE_FORCE_UINT32: _ze_sampler_filter_mode_t = + _ze_sampler_filter_mode_t(2147483647); +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Sampler filtering modes"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_sampler_filter_mode_t(pub u32); +#[doc = ""] +#[doc = " @brief Sampler filtering modes"] +pub use self::_ze_sampler_filter_mode_t as ze_sampler_filter_mode_t; +#[doc = ""] +#[doc = " @brief Sampler descriptor"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_sampler_desc_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in][optional] pointer to extension-specific structure"] + pub pNext: *const ::std::os::raw::c_void, + #[doc = "< [in] Sampler addressing mode to determine how out-of-bounds"] + #[doc = "< coordinates are handled."] + pub addressMode: ze_sampler_address_mode_t, + #[doc = "< [in] Sampler filter mode to determine how samples are filtered."] + pub filterMode: ze_sampler_filter_mode_t, + #[doc = "< [in] Are coordinates normalized [0, 1] or not."] + pub isNormalized: ze_bool_t, +} +#[test] +fn bindgen_test_layout__ze_sampler_desc_t() { + assert_eq!( + ::std::mem::size_of::<_ze_sampler_desc_t>(), + 32usize, + concat!("Size of: ", stringify!(_ze_sampler_desc_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_sampler_desc_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_sampler_desc_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_sampler_desc_t>())).stype as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_sampler_desc_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_sampler_desc_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_sampler_desc_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_sampler_desc_t>())).addressMode as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_sampler_desc_t), + "::", + stringify!(addressMode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_sampler_desc_t>())).filterMode as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(_ze_sampler_desc_t), + "::", + stringify!(filterMode) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_sampler_desc_t>())).isNormalized as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_ze_sampler_desc_t), + "::", + stringify!(isNormalized) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Creates sampler on the context."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must only use the sampler for the device, or its"] + #[doc = " sub-devices, which was provided during creation."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " + `nullptr == hDevice`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == desc`"] + #[doc = " + `nullptr == phSampler`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `::ZE_SAMPLER_ADDRESS_MODE_MIRROR < desc->addressMode`"] + #[doc = " + `::ZE_SAMPLER_FILTER_MODE_LINEAR < desc->filterMode`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + pub fn zeSamplerCreate( + hContext: ze_context_handle_t, + hDevice: ze_device_handle_t, + desc: *const ze_sampler_desc_t, + phSampler: *mut ze_sampler_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Destroys sampler object"] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the sampler before it is deleted."] + #[doc = " - The implementation of this function may immediately free all Host and"] + #[doc = " Device allocations associated with this sampler."] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same sampler handle."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hSampler`"] + #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] + pub fn zeSamplerDestroy(hSampler: ze_sampler_handle_t) -> ze_result_t; +} +impl _ze_memory_access_attribute_t { + #[doc = "< Indicates the memory page is inaccessible."] + pub const ZE_MEMORY_ACCESS_ATTRIBUTE_NONE: _ze_memory_access_attribute_t = + _ze_memory_access_attribute_t(0); +} +impl _ze_memory_access_attribute_t { + #[doc = "< Indicates the memory page supports read write access."] + pub const ZE_MEMORY_ACCESS_ATTRIBUTE_READWRITE: _ze_memory_access_attribute_t = + _ze_memory_access_attribute_t(1); +} +impl _ze_memory_access_attribute_t { + #[doc = "< Indicates the memory page supports read-only access."] + pub const ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY: _ze_memory_access_attribute_t = + _ze_memory_access_attribute_t(2); +} +impl _ze_memory_access_attribute_t { + pub const ZE_MEMORY_ACCESS_ATTRIBUTE_FORCE_UINT32: _ze_memory_access_attribute_t = + _ze_memory_access_attribute_t(2147483647); +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Virtual memory page access attributes"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_memory_access_attribute_t(pub u32); +#[doc = ""] +#[doc = " @brief Virtual memory page access attributes"] +pub use self::_ze_memory_access_attribute_t as ze_memory_access_attribute_t; +extern "C" { + #[doc = ""] + #[doc = " @brief Reserves pages in virtual address space."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must only use the memory allocation on the context for"] + #[doc = " which it was created."] + #[doc = " - The starting address and size must be page aligned. See"] + #[doc = " ::zeVirtualMemQueryPageSize."] + #[doc = " - If pStart is not null then implementation will attempt to reserve"] + #[doc = " starting from that address. If not available then will find another"] + #[doc = " suitable starting address."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The access attributes will default to none to indicate reservation is"] + #[doc = " inaccessible."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pStart`"] + #[doc = " + `nullptr == pptr`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE"] + #[doc = " + `0 == size`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + pub fn zeVirtualMemReserve( + hContext: ze_context_handle_t, + pStart: *const ::std::os::raw::c_void, + size: usize, + pptr: *mut *mut ::std::os::raw::c_void, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Free pages in a reserved virtual address range."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - Any existing virtual mappings for the range will be unmapped."] + #[doc = " - Physical allocations objects that were mapped to this range will not"] + #[doc = " be destroyed. These need to be destroyed explicitly."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == ptr`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE"] + #[doc = " + `0 == size`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT"] + pub fn zeVirtualMemFree( + hContext: ze_context_handle_t, + ptr: *const ::std::os::raw::c_void, + size: usize, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Queries page size to use for aligning virtual memory reservations and"] + #[doc = " physical memory allocations."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " + `nullptr == hDevice`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == pagesize`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE"] + #[doc = " + `0 == size`"] + pub fn zeVirtualMemQueryPageSize( + hContext: ze_context_handle_t, + hDevice: ze_device_handle_t, + size: usize, + pagesize: *mut usize, + ) -> ze_result_t; +} +impl _ze_physical_mem_flags_t { + #[doc = "< reserved for future use."] + pub const ZE_PHYSICAL_MEM_FLAG_TBD: _ze_physical_mem_flags_t = _ze_physical_mem_flags_t(1); +} +impl _ze_physical_mem_flags_t { + pub const ZE_PHYSICAL_MEM_FLAG_FORCE_UINT32: _ze_physical_mem_flags_t = + _ze_physical_mem_flags_t(2147483647); +} +impl ::std::ops::BitOr<_ze_physical_mem_flags_t> for _ze_physical_mem_flags_t { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + _ze_physical_mem_flags_t(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for _ze_physical_mem_flags_t { + #[inline] + fn bitor_assign(&mut self, rhs: _ze_physical_mem_flags_t) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<_ze_physical_mem_flags_t> for _ze_physical_mem_flags_t { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + _ze_physical_mem_flags_t(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for _ze_physical_mem_flags_t { + #[inline] + fn bitand_assign(&mut self, rhs: _ze_physical_mem_flags_t) { + self.0 &= rhs.0; + } +} +#[repr(transparent)] +#[doc = ""] +#[doc = " @brief Supported physical memory creation flags"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct _ze_physical_mem_flags_t(pub u32); +#[doc = ""] +#[doc = " @brief Supported physical memory creation flags"] +pub use self::_ze_physical_mem_flags_t as ze_physical_mem_flags_t; +#[doc = ""] +#[doc = " @brief Physical memory descriptor"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _ze_physical_mem_desc_t { + #[doc = "< [in] type of this structure"] + pub stype: ze_structure_type_t, + #[doc = "< [in][optional] pointer to extension-specific structure"] + pub pNext: *const ::std::os::raw::c_void, + #[doc = "< [in] creation flags."] + #[doc = "< must be 0 (default) or a valid combination of ::ze_physical_mem_flags_t."] + pub flags: ze_physical_mem_flags_t, + #[doc = "< [in] size in bytes to reserve; must be page aligned."] + pub size: usize, +} +#[test] +fn bindgen_test_layout__ze_physical_mem_desc_t() { + assert_eq!( + ::std::mem::size_of::<_ze_physical_mem_desc_t>(), + 32usize, + concat!("Size of: ", stringify!(_ze_physical_mem_desc_t)) + ); + assert_eq!( + ::std::mem::align_of::<_ze_physical_mem_desc_t>(), + 8usize, + concat!("Alignment of ", stringify!(_ze_physical_mem_desc_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_physical_mem_desc_t>())).stype as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_ze_physical_mem_desc_t), + "::", + stringify!(stype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_physical_mem_desc_t>())).pNext as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_ze_physical_mem_desc_t), + "::", + stringify!(pNext) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_physical_mem_desc_t>())).flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_ze_physical_mem_desc_t), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_ze_physical_mem_desc_t>())).size as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_ze_physical_mem_desc_t), + "::", + stringify!(size) + ) + ); +} +extern "C" { + #[doc = ""] + #[doc = " @brief Creates a physical memory object for the context."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must only use the physical memory object on the"] + #[doc = " context for which it was created."] + #[doc = " - The size must be page aligned. See ::zeVirtualMemQueryPageSize."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " + `nullptr == hDevice`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == desc`"] + #[doc = " + `nullptr == phPhysicalMemory`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `0x1 < desc->flags`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE"] + #[doc = " + `0 == desc->size`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT"] + pub fn zePhysicalMemCreate( + hContext: ze_context_handle_t, + hDevice: ze_device_handle_t, + desc: *mut ze_physical_mem_desc_t, + phPhysicalMemory: *mut ze_physical_mem_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Destroys a physical memory object."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The application must ensure the device is not currently referencing"] + #[doc = " the physical memory object before it is deleted"] + #[doc = " - The application must **not** call this function from simultaneous"] + #[doc = " threads with the same physical memory handle."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " + `nullptr == hPhysicalMemory`"] + #[doc = " - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"] + pub fn zePhysicalMemDestroy( + hContext: ze_context_handle_t, + hPhysicalMemory: ze_physical_mem_handle_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Maps pages in virtual address space to pages from physical memory"] + #[doc = " object."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The virtual address range must have been reserved using"] + #[doc = " ::zeVirtualMemReserve."] + #[doc = " - The application must only use the mapped memory allocation on the"] + #[doc = " context for which it was created."] + #[doc = " - The virtual start address and size must be page aligned. See"] + #[doc = " ::zeVirtualMemQueryPageSize."] + #[doc = " - The application should use, for the starting address and size, the"] + #[doc = " same size alignment used for the physical allocation."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " + `nullptr == hPhysicalMemory`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == ptr`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `::ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY < access`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE"] + #[doc = " + `0 == size`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT"] + pub fn zeVirtualMemMap( + hContext: ze_context_handle_t, + ptr: *const ::std::os::raw::c_void, + size: usize, + hPhysicalMemory: ze_physical_mem_handle_t, + offset: usize, + access: ze_memory_access_attribute_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Unmaps pages in virtual address space from pages from a physical"] + #[doc = " memory object."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - The page access attributes for virtual address range will revert back"] + #[doc = " to none."] + #[doc = " - The application may call this function from simultaneous threads."] + #[doc = " - The implementation of this function must be thread-safe."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == ptr`"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT - \"Address must be page aligned\""] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE"] + #[doc = " + `0 == size`"] + #[doc = " + Size must be page aligned"] + pub fn zeVirtualMemUnmap( + hContext: ze_context_handle_t, + ptr: *const ::std::os::raw::c_void, + size: usize, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Set memory access attributes for a virtual address range."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - This function may be called from simultaneous threads with the same"] + #[doc = " function handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == ptr`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_ENUMERATION"] + #[doc = " + `::ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY < access`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT - \"Address must be page aligned\""] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE"] + #[doc = " + `0 == size`"] + #[doc = " + Size must be page aligned"] + pub fn zeVirtualMemSetAccessAttribute( + hContext: ze_context_handle_t, + ptr: *const ::std::os::raw::c_void, + size: usize, + access: ze_memory_access_attribute_t, + ) -> ze_result_t; +} +extern "C" { + #[doc = ""] + #[doc = " @brief Get memory access attribute for a virtual address range."] + #[doc = ""] + #[doc = " @details"] + #[doc = " - If size and outSize are equal then the pages in the specified virtual"] + #[doc = " address range have the same access attributes."] + #[doc = " - This function may be called from simultaneous threads with the same"] + #[doc = " function handle."] + #[doc = " - The implementation of this function should be lock-free."] + #[doc = ""] + #[doc = " @returns"] + #[doc = " - ::ZE_RESULT_SUCCESS"] + #[doc = " - ::ZE_RESULT_ERROR_UNINITIALIZED"] + #[doc = " - ::ZE_RESULT_ERROR_DEVICE_LOST"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE"] + #[doc = " + `nullptr == hContext`"] + #[doc = " - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER"] + #[doc = " + `nullptr == ptr`"] + #[doc = " + `nullptr == access`"] + #[doc = " + `nullptr == outSize`"] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT - \"Address must be page aligned\""] + #[doc = " - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE"] + #[doc = " + `0 == size`"] + #[doc = " + Size must be page aligned"] + pub fn zeVirtualMemGetAccessAttribute( + hContext: ze_context_handle_t, + ptr: *const ::std::os::raw::c_void, + size: usize, + access: *mut ze_memory_access_attribute_t, + outSize: *mut usize, + ) -> ze_result_t; +} diff --git a/level_zero-sys/src/ze_loader.lib b/level_zero-sys/src/ze_loader.lib index 03137fa..661240c 100644 Binary files a/level_zero-sys/src/ze_loader.lib and b/level_zero-sys/src/ze_loader.lib differ diff --git a/level_zero/src/ze.rs b/level_zero/src/ze.rs index eb3887b..3e7d3ce 100644 --- a/level_zero/src/ze.rs +++ b/level_zero/src/ze.rs @@ -6,13 +6,14 @@ use std::{ mem, ptr, }; -pub type Result = std::result::Result; - macro_rules! check { ($expr:expr) => { - let err = unsafe { $expr }; - if err != crate::sys::ze_result_t::ZE_RESULT_SUCCESS { - return Result::Err(Error::err(err)); + #[allow(unused_unsafe)] + { + let err = unsafe { $expr }; + if err != crate::sys::ze_result_t::ZE_RESULT_SUCCESS { + return Result::Err(Error(err)); + } } }; } @@ -26,173 +27,17 @@ macro_rules! check_panic { }; } +pub type Result = std::result::Result; + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Error { - NotReady = 1, - DeviceLost = 1879048193, - OutOfHostMemory = 1879048194, - OutOfDeviceMemory = 1879048195, - ModuleBuildFailure = 1879048196, - InsufficientPermissions = 1879113728, - NotAvailable = 1879113729, - Uninitialized = 2013265921, - UnsupportedVersion = 2013265922, - UnsupportedFeature = 2013265923, - InvalidArgument = 2013265924, - InvalidNullHandle = 2013265925, - HandleObjectInUse = 2013265926, - InvalidNullPointer = 2013265927, - InvalidSize = 2013265928, - UnsupportedSize = 2013265929, - UnsupportedAlignment = 2013265930, - InvalidSynchronizationObject = 2013265931, - InvalidEnumeration = 2013265932, - UnsupportedEnumeration = 2013265933, - UnsupportedImageFormat = 2013265934, - InvalidNativeBinary = 2013265935, - InvalidGlobalName = 2013265936, - InvalidKernelName = 2013265937, - InvalidFunctionName = 2013265938, - InvalidGroupSizeDimension = 2013265939, - InvalidGlobalWidthDimension = 2013265940, - InvalidKernelArgumentIndex = 2013265941, - InvalidKernelArgumentSize = 2013265942, - InvalidKernelAttributeValue = 2013265943, - InvalidCommandListType = 2013265944, - OverlappingRegions = 2013265945, - Unknown = 2147483647, -} +pub struct Error(pub sys::ze_result_t); impl Error { - pub fn new(r: sys::ze_result_t, t: T) -> Result { - Error::new_with(r, || t) - } - - pub fn new_with T>(r: sys::ze_result_t, f: F) -> Result { - match r { - sys::ze_result_t::ZE_RESULT_SUCCESS => Ok(f()), - sys::ze_result_t::ZE_RESULT_NOT_READY => Err(Error::NotReady), - sys::ze_result_t::ZE_RESULT_ERROR_DEVICE_LOST => Err(Error::DeviceLost), - sys::ze_result_t::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY => Err(Error::OutOfHostMemory), - sys::ze_result_t::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY => Err(Error::OutOfDeviceMemory), - sys::ze_result_t::ZE_RESULT_ERROR_MODULE_BUILD_FAILURE => { - Err(Error::ModuleBuildFailure) - } - sys::ze_result_t::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS => { - Err(Error::InsufficientPermissions) - } - sys::ze_result_t::ZE_RESULT_ERROR_NOT_AVAILABLE => Err(Error::NotAvailable), - sys::ze_result_t::ZE_RESULT_ERROR_UNINITIALIZED => Err(Error::Uninitialized), - sys::ze_result_t::ZE_RESULT_ERROR_UNSUPPORTED_VERSION => Err(Error::UnsupportedVersion), - sys::ze_result_t::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE => Err(Error::UnsupportedFeature), - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_ARGUMENT => Err(Error::InvalidArgument), - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_NULL_HANDLE => Err(Error::InvalidNullHandle), - sys::ze_result_t::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE => Err(Error::HandleObjectInUse), - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_NULL_POINTER => { - Err(Error::InvalidNullPointer) - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_SIZE => Err(Error::InvalidSize), - sys::ze_result_t::ZE_RESULT_ERROR_UNSUPPORTED_SIZE => Err(Error::UnsupportedSize), - sys::ze_result_t::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT => { - Err(Error::UnsupportedAlignment) - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT => { - Err(Error::InvalidSynchronizationObject) - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_ENUMERATION => Err(Error::InvalidEnumeration), - sys::ze_result_t::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION => { - Err(Error::UnsupportedEnumeration) - } - sys::ze_result_t::ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT => { - Err(Error::UnsupportedImageFormat) - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_NATIVE_BINARY => { - Err(Error::InvalidNativeBinary) - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_GLOBAL_NAME => Err(Error::InvalidGlobalName), - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_KERNEL_NAME => Err(Error::InvalidKernelName), - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_FUNCTION_NAME => { - Err(Error::InvalidFunctionName) - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION => { - Err(Error::InvalidGroupSizeDimension) - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION => { - Err(Error::InvalidGlobalWidthDimension) - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX => { - Err(Error::InvalidKernelArgumentIndex) - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE => { - Err(Error::InvalidKernelArgumentSize) - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE => { - Err(Error::InvalidKernelAttributeValue) - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE => { - Err(Error::InvalidCommandListType) - } - sys::ze_result_t::ZE_RESULT_ERROR_OVERLAPPING_REGIONS => Err(Error::OverlappingRegions), - sys::ze_result_t::ZE_RESULT_ERROR_UNKNOWN => Err(Error::Unknown), - } - } - - fn err(r: sys::ze_result_t) -> Self { - match r { - sys::ze_result_t::ZE_RESULT_SUCCESS => unreachable!(), - sys::ze_result_t::ZE_RESULT_NOT_READY => Error::NotReady, - sys::ze_result_t::ZE_RESULT_ERROR_DEVICE_LOST => Error::DeviceLost, - sys::ze_result_t::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY => Error::OutOfHostMemory, - sys::ze_result_t::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY => Error::OutOfDeviceMemory, - sys::ze_result_t::ZE_RESULT_ERROR_MODULE_BUILD_FAILURE => Error::ModuleBuildFailure, - sys::ze_result_t::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS => { - Error::InsufficientPermissions - } - sys::ze_result_t::ZE_RESULT_ERROR_NOT_AVAILABLE => Error::NotAvailable, - sys::ze_result_t::ZE_RESULT_ERROR_UNINITIALIZED => Error::Uninitialized, - sys::ze_result_t::ZE_RESULT_ERROR_UNSUPPORTED_VERSION => Error::UnsupportedVersion, - sys::ze_result_t::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE => Error::UnsupportedFeature, - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_ARGUMENT => Error::InvalidArgument, - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_NULL_HANDLE => Error::InvalidNullHandle, - sys::ze_result_t::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE => Error::HandleObjectInUse, - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_NULL_POINTER => Error::InvalidNullPointer, - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_SIZE => Error::InvalidSize, - sys::ze_result_t::ZE_RESULT_ERROR_UNSUPPORTED_SIZE => Error::UnsupportedSize, - sys::ze_result_t::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT => Error::UnsupportedAlignment, - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT => { - Error::InvalidSynchronizationObject - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_ENUMERATION => Error::InvalidEnumeration, - sys::ze_result_t::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION => { - Error::UnsupportedEnumeration - } - sys::ze_result_t::ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT => { - Error::UnsupportedImageFormat - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_NATIVE_BINARY => Error::InvalidNativeBinary, - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_GLOBAL_NAME => Error::InvalidGlobalName, - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_KERNEL_NAME => Error::InvalidKernelName, - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_FUNCTION_NAME => Error::InvalidFunctionName, - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION => { - Error::InvalidGroupSizeDimension - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION => { - Error::InvalidGlobalWidthDimension - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX => { - Error::InvalidKernelArgumentIndex - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE => { - Error::InvalidKernelArgumentSize - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE => { - Error::InvalidKernelAttributeValue - } - sys::ze_result_t::ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE => { - Error::InvalidCommandListType - } - sys::ze_result_t::ZE_RESULT_ERROR_OVERLAPPING_REGIONS => Error::OverlappingRegions, - sys::ze_result_t::ZE_RESULT_ERROR_UNKNOWN => Error::Unknown, + fn new(res: sys::ze_result_t, default: T) -> Result { + if res == sys::ze_result_t::ZE_RESULT_SUCCESS { + Ok(default) + } else { + Err(Self(res)) } } } @@ -207,7 +52,7 @@ impl std::error::Error for Error {} pub fn init() -> Result<()> { Error::new( - unsafe { sys::zeInit(sys::ze_init_flag_t::ZE_INIT_FLAG_NONE) }, + unsafe { sys::zeInit(sys::ze_init_flags_t::ZE_INIT_FLAG_GPU_ONLY) }, (), ) } @@ -246,6 +91,9 @@ impl Driver { &mut len, result.as_mut_ptr() as *mut _ )); + if (len as usize) < result.len() { + result.truncate(len as usize); + } Ok(result) } } @@ -260,6 +108,80 @@ impl Device { pub unsafe fn from_ffi(x: sys::ze_device_handle_t) -> Self { Self(x) } + + pub fn get_properties(&self) -> Result> { + let mut props = Box::new(unsafe { mem::zeroed::() }); + check! { sys::zeDeviceGetProperties(self.0, props.as_mut()) }; + Ok(props) + } + + pub fn get_image_properties(&self) -> Result> { + let mut props = Box::new(unsafe { mem::zeroed::() }); + check! { sys::zeDeviceGetImageProperties(self.0, props.as_mut()) }; + Ok(props) + } + + pub fn get_memory_properties(&self) -> Result> { + let mut count = 0u32; + check! { sys::zeDeviceGetMemoryProperties(self.0, &mut count, ptr::null_mut()) }; + if count == 0 { + return Ok(Vec::new()); + } + let mut props = + vec![unsafe { mem::zeroed::() }; count as usize]; + check! { sys::zeDeviceGetMemoryProperties(self.0, &mut count, props.as_mut_ptr()) }; + Ok(props) + } + + pub unsafe fn mem_alloc_device( + &mut self, + ctx: &mut Context, + size: usize, + alignment: usize, + ) -> Result<*mut c_void> { + let descr = sys::ze_device_mem_alloc_desc_t { + stype: sys::ze_structure_type_t::ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC, + pNext: ptr::null(), + flags: sys::ze_device_mem_alloc_flags_t(0), + ordinal: 0, + }; + let mut result = ptr::null_mut(); + // TODO: check current context for the device + check! { + sys::zeMemAllocDevice( + ctx.0, + &descr, + size, + alignment, + self.0, + &mut result, + ) + }; + Ok(result) + } +} + +#[repr(transparent)] +pub struct Context(sys::ze_context_handle_t); + +impl Context { + pub unsafe fn as_ffi(&self) -> sys::ze_context_handle_t { + self.0 + } + pub unsafe fn from_ffi(x: sys::ze_context_handle_t) -> Self { + Self(x) + } + + pub fn new(drv: &Driver) -> Result { + let ctx_desc = sys::ze_context_desc_t { + stype: sys::ze_structure_type_t::ZE_STRUCTURE_TYPE_CONTEXT_DESC, + pNext: ptr::null(), + flags: sys::ze_context_flags_t(0), + }; + let mut result = ptr::null_mut(); + check!(sys::zeContextCreate(drv.0, &ctx_desc, &mut result)); + Ok(Context(result)) + } } #[repr(transparent)] @@ -273,16 +195,23 @@ impl CommandQueue { Self(x) } - pub fn new(d: &Device) -> Result { + pub fn new(ctx: &mut Context, d: &Device) -> Result { let que_desc = sys::ze_command_queue_desc_t { - version: sys::ze_command_queue_desc_version_t::ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT, - flags: sys::ze_command_queue_flag_t::ZE_COMMAND_QUEUE_FLAG_NONE, + stype: sys::ze_structure_type_t::ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC, + pNext: ptr::null(), + ordinal: 0, + index: 0, + flags: sys::ze_command_queue_flags_t(0), mode: sys::ze_command_queue_mode_t::ZE_COMMAND_QUEUE_MODE_DEFAULT, priority: sys::ze_command_queue_priority_t::ZE_COMMAND_QUEUE_PRIORITY_NORMAL, - ordinal: 0, }; let mut result = ptr::null_mut(); - check!(sys::zeCommandQueueCreate(d.0, &que_desc, &mut result)); + check!(sys::zeCommandQueueCreate( + ctx.0, + d.0, + &que_desc, + &mut result + )); Ok(CommandQueue(result)) } @@ -318,17 +247,29 @@ impl Module { Self(x) } - pub fn new_spirv(d: &Device, bin: &[u8], opts: Option<&CStr>) -> Result { - Module::new(true, d, bin, opts) + pub fn new_spirv( + ctx: &mut Context, + d: &Device, + bin: &[u8], + opts: Option<&CStr>, + ) -> Result { + Module::new(ctx, true, d, bin, opts) } - pub fn new_native(d: &Device, bin: &[u8]) -> Result { - Module::new(false, d, bin, None) + pub fn new_native(ctx: &mut Context, d: &Device, bin: &[u8]) -> Result { + Module::new(ctx, false, d, bin, None) } - fn new(spirv: bool, d: &Device, bin: &[u8], opts: Option<&CStr>) -> Result { + fn new( + ctx: &mut Context, + spirv: bool, + d: &Device, + bin: &[u8], + opts: Option<&CStr>, + ) -> Result { let desc = sys::ze_module_desc_t { - version: sys::ze_module_desc_version_t::ZE_MODULE_DESC_VERSION_CURRENT, + stype: sys::ze_structure_type_t::ZE_STRUCTURE_TYPE_MODULE_DESC, + pNext: ptr::null(), format: if spirv { sys::ze_module_format_t::ZE_MODULE_FORMAT_IL_SPIRV } else { @@ -341,6 +282,7 @@ impl Module { }; let mut result: sys::ze_module_handle_t = ptr::null_mut(); check!(sys::zeModuleCreate( + ctx.0, d.0, &desc, &mut result, @@ -371,7 +313,7 @@ impl SafeRepr for f64 {} pub struct DeviceBuffer { ptr: *mut c_void, - driver: sys::ze_driver_handle_t, + ctx: sys::ze_context_handle_t, len: usize, marker: PhantomData, } @@ -380,33 +322,33 @@ impl DeviceBuffer { pub unsafe fn as_ffi(&self) -> *mut c_void { self.ptr } - pub unsafe fn from_ffi(driver: sys::ze_driver_handle_t, ptr: *mut c_void, len: usize) -> Self { + pub unsafe fn from_ffi(ctx: sys::ze_context_handle_t, ptr: *mut c_void, len: usize) -> Self { let marker = PhantomData::; Self { ptr, - driver, + ctx, len, marker, } } - pub fn new(drv: &Driver, dev: &Device, len: usize) -> Result { + pub fn new(ctx: &mut Context, dev: &Device, len: usize) -> Result { let desc = sys::_ze_device_mem_alloc_desc_t { - version: - sys::ze_device_mem_alloc_desc_version_t::ZE_DEVICE_MEM_ALLOC_DESC_VERSION_CURRENT, - flags: sys::ze_device_mem_alloc_flag_t::ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, + stype: sys::ze_structure_type_t::ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC, + pNext: ptr::null(), + flags: sys::ze_device_mem_alloc_flags_t(0), ordinal: 0, }; let mut result = ptr::null_mut(); - check!(sys::zeDriverAllocDeviceMem( - drv.0, + check!(sys::zeMemAllocDevice( + ctx.0, &desc, len * mem::size_of::(), mem::align_of::(), dev.0, &mut result )); - Ok(unsafe { Self::from_ffi(drv.0, result, len) }) + Ok(unsafe { Self::from_ffi(ctx.0, result, len) }) } pub fn len(&self) -> usize { @@ -417,7 +359,7 @@ impl DeviceBuffer { impl Drop for DeviceBuffer { #[allow(unused_must_use)] fn drop(&mut self) { - check_panic! { sys::zeDriverFreeMem(self.driver, self.ptr) }; + check_panic! { sys::zeMemFree(self.ctx, self.ptr) }; } } @@ -431,13 +373,15 @@ impl<'a> CommandList<'a> { Self(x, PhantomData) } - pub fn new(dev: &Device) -> Result { + pub fn new(ctx: &mut Context, dev: &Device) -> Result { let desc = sys::ze_command_list_desc_t { - version: sys::ze_command_list_desc_version_t::ZE_COMMAND_LIST_DESC_VERSION_CURRENT, - flags: sys::ze_command_list_flag_t::ZE_COMMAND_LIST_FLAG_NONE, + stype: sys::_ze_structure_type_t::ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC, + commandQueueGroupOrdinal: 0, + pNext: ptr::null(), + flags: sys::ze_command_list_flags_t(0), }; let mut result: sys::ze_command_list_handle_t = ptr::null_mut(); - check!(sys::zeCommandListCreate(dev.0, &desc, &mut result)); + check!(sys::zeCommandListCreate(ctx.0, dev.0, &desc, &mut result)); Ok(Self(result, PhantomData)) } @@ -449,19 +393,34 @@ impl<'a> CommandList<'a> { &mut self, dst: Dst, src: Src, - length: Option, - signal: Option<&Event<'a>>, + signal: Option<&mut Event<'a>>, + wait: &mut [Event<'a>], ) -> Result<()> { let dst = dst.into(); let src = src.into(); - let elements = length.unwrap_or(std::cmp::max(dst.len(), src.len())); - let event = signal.map(|e| e.0).unwrap_or(ptr::null_mut()); + let elements = std::cmp::min(dst.len(), src.len()); + let length = elements * mem::size_of::(); + unsafe { self.append_memory_copy_unsafe(dst.get(), src.get(), length, signal, wait) } + } + + pub unsafe fn append_memory_copy_unsafe( + &mut self, + dst: *mut c_void, + src: *const c_void, + length: usize, + signal: Option<&mut Event<'a>>, + wait: &mut [Event<'a>], + ) -> Result<()> { + let signal_event = signal.map(|e| e.0).unwrap_or(ptr::null_mut()); + let (wait_len, wait_ptr) = Event::raw_slice(wait); check!(sys::zeCommandListAppendMemoryCopy( self.0, - dst.get(), - src.get(), - elements * std::mem::size_of::(), - event, + dst, + src, + length, + signal_event, + wait_len, + wait_ptr )); Ok(()) } @@ -469,19 +428,23 @@ impl<'a> CommandList<'a> { pub fn append_memory_fill( &mut self, dst: BufferPtrMut<'a, T>, - pattern: T, - signal: Option<&Event<'a>>, + pattern: u8, + signal: Option<&mut Event<'a>>, + wait: &mut [Event<'a>], ) -> Result<()> { - let raw_pattern = &pattern as *const T as *const _; - let event = signal.map(|e| e.0).unwrap_or(ptr::null_mut()); + let raw_pattern = &pattern as *const u8 as *const _; + let signal_event = signal.map(|e| e.0).unwrap_or(ptr::null_mut()); + let (wait_len, wait_ptr) = unsafe { Event::raw_slice(wait) }; let byte_len = dst.len() * mem::size_of::(); check!(sys::zeCommandListAppendMemoryFill( self.0, dst.get(), raw_pattern, - mem::size_of::(), + mem::size_of::(), byte_len, - event, + signal_event, + wait_len, + wait_ptr )); Ok(()) } @@ -490,23 +453,23 @@ impl<'a> CommandList<'a> { &mut self, kernel: &'a Kernel, group_count: &[u32; 3], - signal: Option<&Event<'a>>, - wait: &[&Event<'a>], + signal: Option<&mut Event<'a>>, + wait: &mut [Event<'a>], ) -> Result<()> { let gr_count = sys::ze_group_count_t { groupCountX: group_count[0], groupCountY: group_count[1], groupCountZ: group_count[2], }; - let event = signal.map(|e| e.0).unwrap_or(ptr::null_mut()); - let mut wait_ptrs = wait.iter().map(|e| e.0).collect::>(); + let signal_event = signal.map(|e| e.0).unwrap_or(ptr::null_mut()); + let (wait_len, wait_ptr) = unsafe { Event::raw_slice(wait) }; check!(sys::zeCommandListAppendLaunchKernel( self.0, kernel.0, &gr_count, - event, - wait.len() as u32, - wait_ptrs.as_mut_ptr(), + signal_event, + wait_len, + wait_ptr, )); Ok(()) } @@ -528,8 +491,9 @@ pub struct FenceGuard<'a>( impl<'a> FenceGuard<'a> { fn new(q: &'a CommandQueue, cmd_list: sys::ze_command_list_handle_t) -> Result { let desc = sys::_ze_fence_desc_t { - version: sys::ze_fence_desc_version_t::ZE_FENCE_DESC_VERSION_CURRENT, - flags: sys::ze_fence_flag_t::ZE_FENCE_FLAG_NONE, + stype: sys::ze_structure_type_t::ZE_STRUCTURE_TYPE_FENCE_DESC, + pNext: ptr::null(), + flags: sys::ze_fence_flags_t(0), }; let mut result = ptr::null_mut(); check!(sys::zeFenceCreate(q.0, &desc, &mut result)); @@ -540,7 +504,7 @@ impl<'a> FenceGuard<'a> { impl<'a> Drop for FenceGuard<'a> { #[allow(unused_must_use)] fn drop(&mut self) { - check_panic! { sys::zeFenceHostSynchronize(self.0, u32::max_value()) }; + check_panic! { sys::zeFenceHostSynchronize(self.0, u64::max_value()) }; check_panic! { sys::zeFenceDestroy(self.0) }; check_panic! { sys::zeCommandListDestroy(self.1) }; } @@ -638,10 +602,11 @@ impl<'a> EventPool<'a> { pub unsafe fn from_ffi(x: sys::ze_event_pool_handle_t) -> Self { Self(x, PhantomData) } - pub fn new(driver: &Driver, count: u32, dev: Option<&[&'a Device]>) -> Result { + pub fn new(ctx: &mut Context, count: u32, dev: Option<&[&'a Device]>) -> Result { let desc = sys::ze_event_pool_desc_t { - version: sys::ze_event_pool_desc_version_t::ZE_EVENT_POOL_DESC_VERSION_CURRENT, - flags: sys::ze_event_pool_flag_t::ZE_EVENT_POOL_FLAG_DEFAULT, + stype: sys::ze_structure_type_t::ZE_STRUCTURE_TYPE_EVENT_POOL_DESC, + pNext: ptr::null(), + flags: sys::ze_event_pool_flags_t(0), count: count, }; let mut dev = dev.map(|d| d.iter().map(|d| d.0).collect::>()); @@ -649,7 +614,7 @@ impl<'a> EventPool<'a> { let dev_ptr = dev.as_mut().map_or(ptr::null_mut(), |d| d.as_mut_ptr()); let mut result = ptr::null_mut(); check!(sys::zeEventPoolCreate( - driver.0, + ctx.0, &desc, dev_len, dev_ptr, @@ -679,15 +644,25 @@ impl<'a> Event<'a> { pub fn new(pool: &'a EventPool, index: u32) -> Result { let desc = sys::ze_event_desc_t { - version: sys::ze_event_desc_version_t::ZE_EVENT_DESC_VERSION_CURRENT, + stype: sys::ze_structure_type_t::ZE_STRUCTURE_TYPE_EVENT_DESC, + pNext: ptr::null(), index: index, - signal: sys::ze_event_scope_flag_t::ZE_EVENT_SCOPE_FLAG_NONE, - wait: sys::ze_event_scope_flag_t::ZE_EVENT_SCOPE_FLAG_NONE, + signal: sys::ze_event_scope_flags_t(0), + wait: sys::ze_event_scope_flags_t(0), }; let mut result = ptr::null_mut(); check!(sys::zeEventCreate(pool.0, &desc, &mut result)); Ok(Self(result, PhantomData)) } + + unsafe fn raw_slice(e: &mut [Event]) -> (u32, *mut sys::ze_event_handle_t) { + let ptr = if e.len() == 0 { + ptr::null_mut() + } else { + e.as_mut_ptr() + }; + (e.len() as u32, ptr as *mut sys::ze_event_handle_t) + } } impl<'a> Drop for Event<'a> { @@ -710,8 +685,9 @@ impl<'a> Kernel<'a> { pub fn new_resident(module: &'a Module, name: &CStr) -> Result { let desc = sys::ze_kernel_desc_t { - version: sys::ze_kernel_desc_version_t::ZE_KERNEL_DESC_VERSION_CURRENT, - flags: sys::ze_kernel_flag_t::ZE_KERNEL_FLAG_FORCE_RESIDENCY, + stype: sys::ze_structure_type_t::ZE_STRUCTURE_TYPE_KERNEL_DESC, + pNext: ptr::null(), + flags: sys::ze_kernel_flags_t::ZE_KERNEL_FLAG_FORCE_RESIDENCY, pKernelName: name.as_ptr() as *const _, }; let mut result = ptr::null_mut(); @@ -719,18 +695,11 @@ impl<'a> Kernel<'a> { Ok(Self(result, PhantomData)) } - pub fn set_attribute_bool( + pub fn set_indirect_access( &mut self, - attr: sys::ze_kernel_attribute_t, - value: bool, + flags: sys::ze_kernel_indirect_access_flags_t, ) -> Result<()> { - let ze_bool: sys::ze_bool_t = if value { 1 } else { 0 }; - check!(sys::zeKernelSetAttribute( - self.0, - attr, - mem::size_of::() as u32, - &ze_bool as *const _ as *const _ - )); + check!(sys::zeKernelSetIndirectAccess(self.0, flags)); Ok(()) } @@ -771,3 +740,16 @@ impl<'a> Drop for Kernel<'a> { check_panic! { sys::zeKernelDestroy(self.0) }; } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn event_has_correct_layout() { + assert_eq!( + mem::size_of::(), + mem::size_of::() + ); + } +} diff --git a/notcuda/Cargo.toml b/notcuda/Cargo.toml index 7f24f33..b941a90 100644 --- a/notcuda/Cargo.toml +++ b/notcuda/Cargo.toml @@ -9,6 +9,9 @@ name = "nvcuda" crate-type = ["cdylib"] [dependencies] +ptx = { path = "../ptx" } +level_zero = { path = "../level_zero" } level_zero-sys = { path = "../level_zero-sys" } lazy_static = "1.4" -num_enum = "0.4" \ No newline at end of file +num_enum = "0.4" +lz4 = "1.23" \ No newline at end of file diff --git a/notcuda/src/cu.rs b/notcuda/src/cu.rs index 2b1c827..3bb5237 100644 --- a/notcuda/src/cu.rs +++ b/notcuda/src/cu.rs @@ -1,9 +1,10 @@ use num_enum::TryFromPrimitive; use std::convert::TryFrom; use std::os::raw::c_int; -use std::ptr; +use std::{mem, ptr}; +use crate::ze; -#[repr(C)] +#[repr(u32)] #[allow(non_camel_case_types)] pub enum Result { SUCCESS = 0, @@ -134,14 +135,14 @@ pub enum DeviceTextureAttribute { impl Result { - pub fn from_l0(result: l0::ze_result_t) -> Result { + pub fn from_l0(result: l0_sys::ze_result_t) -> Result { match result { - l0::ze_result_t::ZE_RESULT_SUCCESS => Result::SUCCESS, - l0::ze_result_t::ZE_RESULT_ERROR_UNINITIALIZED => Result::ERROR_NOT_INITIALIZED, - l0::ze_result_t::ZE_RESULT_ERROR_INVALID_ENUMERATION => Result::ERROR_INVALID_VALUE, - l0::ze_result_t::ZE_RESULT_ERROR_INVALID_ARGUMENT => Result::ERROR_INVALID_VALUE, - l0::ze_result_t::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY => Result::ERROR_OUT_OF_MEMORY, - l0::ze_result_t::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE => Result::ERROR_NOT_SUPPORTED, + l0_sys::ze_result_t::ZE_RESULT_SUCCESS => Result::SUCCESS, + l0_sys::ze_result_t::ZE_RESULT_ERROR_UNINITIALIZED => Result::ERROR_NOT_INITIALIZED, + l0_sys::ze_result_t::ZE_RESULT_ERROR_INVALID_ENUMERATION => Result::ERROR_INVALID_VALUE, + l0_sys::ze_result_t::ZE_RESULT_ERROR_INVALID_ARGUMENT => Result::ERROR_INVALID_VALUE, + l0_sys::ze_result_t::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY => Result::ERROR_OUT_OF_MEMORY, + l0_sys::ze_result_t::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE => Result::ERROR_NOT_SUPPORTED, _ => Result::ERROR_UNKNOWN } } @@ -157,11 +158,11 @@ pub struct Uuid { pub struct Device(pub c_int); #[repr(transparent)] -pub struct DevicePtr(usize); +pub struct DevicePtr(pub usize); #[repr(transparent)] -#[derive(Clone, PartialEq)] -pub struct Context(*mut ()); +#[derive(Clone, Copy, PartialEq)] +pub struct Context(pub *mut ze::Context); impl Context { pub fn null() -> Context { Context(ptr::null_mut()) @@ -169,7 +170,21 @@ impl Context { } #[repr(transparent)] -pub struct Module(*mut ()); +#[derive(Clone, Copy, PartialEq)] +pub struct Module(*mut ze::Module); + +impl Module { + pub fn null() -> Module { + Module(ptr::null_mut()) + } + + pub fn new(inner: ze::Module) -> Module { + let mut boxed = Box::new(inner); + let result = Module(boxed.as_mut()); + mem::forget(boxed); + result + } +} #[repr(transparent)] pub struct Function(*mut ()); diff --git a/notcuda/src/cuda/mod.rs b/notcuda/src/cuda/mod.rs new file mode 100644 index 0000000..63b9049 --- /dev/null +++ b/notcuda/src/cuda/mod.rs @@ -0,0 +1 @@ +pub mod rt; \ No newline at end of file diff --git a/notcuda/src/cuda/rt.rs b/notcuda/src/cuda/rt.rs new file mode 100644 index 0000000..3931bc3 --- /dev/null +++ b/notcuda/src/cuda/rt.rs @@ -0,0 +1,2 @@ +pub enum ContextState {} +pub enum ContextStateManager {} diff --git a/notcuda/src/export_table.rs b/notcuda/src/export_table.rs index c1fe5bc..b8b0cb7 100644 --- a/notcuda/src/export_table.rs +++ b/notcuda/src/export_table.rs @@ -1,8 +1,9 @@ -use super::cu; +use crate::cu; +use crate::{cuda, ze}; use std::mem; -use std::ptr; -use std::os::raw::{c_int, c_ulong}; +use std::os::raw::{c_int, c_uint, c_ulong, c_ushort}; +use std::{ffi::c_void, ptr, slice}; #[no_mangle] pub unsafe extern "C" fn cuGetExportTable( @@ -11,24 +12,24 @@ pub unsafe extern "C" fn cuGetExportTable( ) -> cu::Result { if table == ptr::null_mut() || id == ptr::null_mut() { cu::Result::ERROR_INVALID_VALUE - } else if *id == CU_ETID_ToolsRuntimeCallbackHooks { - *table = TABLE0.as_ptr() as *const _; + } else if *id == TOOLS_RUNTIME_CALLBACK_HOOKS_GUID { + *table = TOOLS_RUNTIME_CALLBACK_HOOKS_VTABLE.as_ptr() as *const _; cu::Result::SUCCESS - } else if *id == CU_ETID_CudartInterface { - *table = TABLE1.as_ptr() as *const _; + } else if *id == CUDART_INTERFACE_GUID { + *table = CUDART_INTERFACE_VTABLE.as_ptr() as *const _; cu::Result::SUCCESS - } else if *id == CU_ETID_ToolsTls { + } else if *id == TOOLS_TLS_GUID { *table = 1 as _; cu::Result::SUCCESS - } else if *id == CU_ETID_ContextLocalStorageInterface_v0301 { - *table = ContextLocalStorageInterface_v0301_VTABLE.as_ptr() as *const _; + } else if *id == CONTEXT_LOCAL_STORAGE_INTERFACE_V0301_GUID { + *table = CONTEXT_LOCAL_STORAGE_INTERFACE_V0301_VTABLE.as_ptr() as *const _; cu::Result::SUCCESS } else { cu::Result::ERROR_NOT_SUPPORTED } } -const CU_ETID_ToolsRuntimeCallbackHooks: cu::Uuid = cu::Uuid { +const TOOLS_RUNTIME_CALLBACK_HOOKS_GUID: cu::Uuid = cu::Uuid { x: [ 0xa0, 0x94, 0x79, 0x8c, 0x2e, 0x74, 0x2e, 0x74, 0x93, 0xf2, 0x08, 0x00, 0x20, 0x0c, 0x0a, 0x66, @@ -40,97 +41,254 @@ union VTableEntry { length: usize, } unsafe impl Sync for VTableEntry {} -const TABLE0_LEN: usize = 7; -static TABLE0: [VTableEntry; TABLE0_LEN] = [ +const TOOLS_RUNTIME_CALLBACK_HOOKS_LENGTH: usize = 7; +static TOOLS_RUNTIME_CALLBACK_HOOKS_VTABLE: [VTableEntry; TOOLS_RUNTIME_CALLBACK_HOOKS_LENGTH] = [ VTableEntry { - length: mem::size_of::<[VTableEntry; TABLE0_LEN]>(), + length: mem::size_of::<[VTableEntry; TOOLS_RUNTIME_CALLBACK_HOOKS_LENGTH]>(), }, VTableEntry { ptr: ptr::null() }, VTableEntry { - ptr: table0_fn1 as *const (), + ptr: runtime_callback_hooks_fn1 as *const (), }, VTableEntry { ptr: ptr::null() }, VTableEntry { ptr: ptr::null() }, VTableEntry { ptr: ptr::null() }, VTableEntry { - ptr: table0_fn5 as *const (), + ptr: runtime_callback_hooks_fn5 as *const (), }, ]; -static mut TABLE0_FN1_SPACE: [u8; 512] = [0; 512]; -static mut TABLE0_FN5_SPACE: [u8; 2] = [0; 2]; +static mut TOOLS_RUNTIME_CALLBACK_HOOKS_FN1_SPACE: [u8; 512] = [0; 512]; -unsafe extern "C" fn table0_fn1(ptr: *mut *mut u8, size: *mut usize) -> *mut u8 { - *ptr = TABLE0_FN1_SPACE.as_mut_ptr(); - *size = TABLE0_FN1_SPACE.len(); - return TABLE0_FN1_SPACE.as_mut_ptr(); +unsafe extern "C" fn runtime_callback_hooks_fn1(ptr: *mut *mut u8, size: *mut usize) -> *mut u8 { + *ptr = TOOLS_RUNTIME_CALLBACK_HOOKS_FN1_SPACE.as_mut_ptr(); + *size = TOOLS_RUNTIME_CALLBACK_HOOKS_FN1_SPACE.len(); + return TOOLS_RUNTIME_CALLBACK_HOOKS_FN1_SPACE.as_mut_ptr(); } -unsafe extern "C" fn table0_fn5(ptr: *mut *mut u8, size: *mut usize) -> *mut u8 { - *ptr = TABLE0_FN5_SPACE.as_mut_ptr(); - *size = TABLE0_FN5_SPACE.len(); - return TABLE0_FN5_SPACE.as_mut_ptr(); +static mut TOOLS_RUNTIME_CALLBACK_HOOKS_FN5_SPACE: [u8; 2] = [0; 2]; + +unsafe extern "C" fn runtime_callback_hooks_fn5(ptr: *mut *mut u8, size: *mut usize) -> *mut u8 { + *ptr = TOOLS_RUNTIME_CALLBACK_HOOKS_FN5_SPACE.as_mut_ptr(); + *size = TOOLS_RUNTIME_CALLBACK_HOOKS_FN5_SPACE.len(); + return TOOLS_RUNTIME_CALLBACK_HOOKS_FN5_SPACE.as_mut_ptr(); } -const CU_ETID_CudartInterface: cu::Uuid = cu::Uuid { +const CUDART_INTERFACE_GUID: cu::Uuid = cu::Uuid { x: [ 0x6b, 0xd5, 0xfb, 0x6c, 0x5b, 0xf4, 0xe7, 0x4a, 0x89, 0x87, 0xd9, 0x39, 0x12, 0xfd, 0x9d, - 0xf9 + 0xf9, ], }; -const TABLE1_LEN: usize = 10; -static TABLE1: [VTableEntry; TABLE1_LEN] = [ +const CUDART_INTERFACE_LENGTH: usize = 10; +static CUDART_INTERFACE_VTABLE: [VTableEntry; CUDART_INTERFACE_LENGTH] = [ VTableEntry { - length: mem::size_of::<[VTableEntry; TABLE1_LEN]>(), + length: mem::size_of::<[VTableEntry; CUDART_INTERFACE_LENGTH]>(), }, VTableEntry { ptr: ptr::null() }, VTableEntry { - ptr: table1_fn1 as *const (), + ptr: cudart_interface_fn1 as *const (), }, VTableEntry { ptr: ptr::null() }, VTableEntry { ptr: ptr::null() }, VTableEntry { ptr: ptr::null() }, - VTableEntry { ptr: ptr::null() }, VTableEntry { - ptr: table1_fn6 as *const (), + ptr: get_module_from_cubin as *const (), + }, + VTableEntry { + ptr: cudart_interface_fn6 as *const (), }, VTableEntry { ptr: ptr::null() }, VTableEntry { ptr: ptr::null() }, ]; -unsafe extern "C" fn table1_fn1(_: *mut c_ulong, _: c_int) -> c_int { +unsafe extern "C" fn cudart_interface_fn1(_: *mut c_ulong, _: c_int) -> c_int { 0 } -unsafe extern "C" fn table1_fn6(_: u64) { } +/* +fat_cubin: +typedef struct { + int magic; + int version; + const unsigned long long* data; + void *filename_or_fatbins; /* version 1: offline filename, + * version 2: array of prelinked fatbins */ +} __fatBinC_Wrapper_t; -const CU_ETID_ToolsTls: cu::Uuid = cu::Uuid { - x: [0x42, 0xd8, 0x5a, 0x81, 0x23, 0xf6, 0xcb, 0x47, 0x82, 0x98, 0xf6, 0xe7, 0x8a, 0x3a, 0xec, 0xdc], +data start with this header: +#define FATBIN_MAGIC 0xBA55ED50U +#define OLD_STYLE_FATBIN_MAGIC 0x1EE55A01U +#define FATBIN_VERSION 0x0001U + +struct fatbinary_ALIGN_(8) fatBinaryHeader +{ + unsigned int magic; // FATBIN_MAGIC + unsigned short version; // FATBIN_VERSION + unsigned short headerSize; + unsigned long long int fatSize; // size of the entire fat binary excluding this header }; +there's binary data after header -const CU_ETID_ContextLocalStorageInterface_v0301: cu::Uuid = cu::Uuid { - x: [0xc6, 0x93, 0x33, 0x6e, 0x11, 0x21, 0xdf, 0x11, 0xa8, 0xc3, 0x68, 0xf3, 0x55, 0xd8, 0x95, 0x93], +*/ + +const FATBINC_MAGIC: c_uint = 0x466243B1; +const FATBINC_VERSION: c_uint = 0x1; + +#[repr(C)] +struct FatbincWrapper { + magic: c_uint, + version: c_uint, + data: *const FatbinHeader, + filename_or_fatbins: *const c_void, +} + +const FATBIN_MAGIC: c_uint = 0xBA55ED50; +const FATBIN_VERSION: c_ushort = 0x01; + +#[repr(C, align(8))] +struct FatbinHeader { + magic: c_uint, + version: c_ushort, + header_size: c_ushort, + files_size: c_ulong, // excluding frame header, size of all blocks framed by this frame +} + +const FATBIN_FILE_HEADER_KIND_PTX: c_ushort = 0x01; +const FATBIN_FILE_HEADER_VERSION_CURRENT: c_ushort = 0x101; + +// assembly file header is a bit different, but we don't care +#[repr(C)] +struct FatbinFileHeader { + kind: c_ushort, + version: c_ushort, + header_size: c_uint, + padded_payload_size: c_uint, + unknown0: c_uint, // check if it's written into separately + payload_size: c_uint, + unknown1: c_uint, + unknown2: c_uint, + sm_version: c_uint, + bit_width: c_uint, + unknown3: c_uint, + unknown4: c_ulong, + unknown5: c_ulong, + uncompressed_payload: c_ulong, +} + +unsafe extern "C" fn get_module_from_cubin( + result: *mut cu::Module, + fatbinc_wrapper: *const FatbincWrapper, + _: *mut c_void, + _: *mut c_void, +) -> cu::Result { + if result == ptr::null_mut() || (*fatbinc_wrapper).magic != FATBINC_MAGIC || (*fatbinc_wrapper).version != FATBINC_VERSION { + return cu::Result::ERROR_INVALID_VALUE; + } + let fatbin_header = (*fatbinc_wrapper).data; + if (*fatbin_header).magic != FATBIN_MAGIC || (*fatbin_header).version != FATBIN_VERSION { + return cu::Result::ERROR_INVALID_VALUE; + } + let file = (fatbin_header as *const u8).add((*fatbin_header).header_size as usize); + let end = file.add((*fatbin_header).files_size as usize); + let mut ptx_files = get_ptx_files(file, end); + ptx_files.sort_unstable_by_key(|f| c_uint::max_value() - (**f).sm_version); + for file in ptx_files { + let slice = slice::from_raw_parts( + (file as *const u8).add((*file).header_size as usize), + (*file).payload_size as usize, + ); + let kernel_text = + lz4::block::decompress(slice, Some((*file).uncompressed_payload as i32)).unwrap(); + let module = ze::Module { + ptx_text: kernel_text, + }; + *result = cu::Module::new(module); + return cu::Result::SUCCESS + } + cu::Result::ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE +} + +unsafe fn get_ptx_files(file: *const u8, end: *const u8) -> Vec<*const FatbinFileHeader> { + let mut index = file; + let mut result = Vec::new(); + while index < end { + let file = index as *const FatbinFileHeader; + if (*file).kind == FATBIN_FILE_HEADER_KIND_PTX + && (*file).version == FATBIN_FILE_HEADER_VERSION_CURRENT + { + result.push(file) + } + index = index.add((*file).header_size as usize + (*file).padded_payload_size as usize); + } + result +} + +unsafe extern "C" fn cudart_interface_fn6(_: u64) {} + +const TOOLS_TLS_GUID: cu::Uuid = cu::Uuid { + x: [ + 0x42, 0xd8, 0x5a, 0x81, 0x23, 0xf6, 0xcb, 0x47, 0x82, 0x98, 0xf6, 0xe7, 0x8a, 0x3a, 0xec, + 0xdc, + ], }; -// the table is much bigger and start earlier -static ContextLocalStorageInterface_v0301_VTABLE: [VTableEntry; 4] = [ - VTableEntry { ptr: ContextLocalStorageInterface_v0301_VTABLE_fn0 as *const () }, - VTableEntry { ptr: ContextLocalStorageInterface_v0301_VTABLE_fn1 as *const () }, - VTableEntry { ptr: ContextLocalStorageInterface_v0301_VTABLE_fn2 as *const () }, +const CONTEXT_LOCAL_STORAGE_INTERFACE_V0301_GUID: cu::Uuid = cu::Uuid { + x: [ + 0xc6, 0x93, 0x33, 0x6e, 0x11, 0x21, 0xdf, 0x11, 0xa8, 0xc3, 0x68, 0xf3, 0x55, 0xd8, 0x95, + 0x93, + ], +}; + +// the table is much bigger and starts earlier +static CONTEXT_LOCAL_STORAGE_INTERFACE_V0301_VTABLE: [VTableEntry; 4] = [ + VTableEntry { + ptr: context_local_storage_ctor as *const (), + }, + VTableEntry { + ptr: context_local_storage_dtor as *const (), + }, + VTableEntry { + ptr: context_local_storage_get_state as *const (), + }, VTableEntry { ptr: ptr::null() }, ]; // some kind of ctor -unsafe extern "C" fn ContextLocalStorageInterface_v0301_VTABLE_fn0(ms: *mut usize, _: *mut (), _: *mut (), _: *mut ()) -> u32 { - 0 +unsafe extern "C" fn context_local_storage_ctor( + cu_ctx: cu::Context, // always zero + mgr: *mut cuda::rt::ContextStateManager, + ctx_state: *mut cuda::rt::ContextState, + // clsContextDestroyCallback, have to be called on cuDevicePrimaryCtxReset + dtor_cb: extern "C" fn( + cu::Context, + *mut cuda::rt::ContextStateManager, + *mut cuda::rt::ContextState, + ), +) -> cu::Result { + if cu_ctx.0 == ptr::null_mut() { + return cu::Result::ERROR_NOT_SUPPORTED; + } + (*cu_ctx.0).cuda_manager = mgr; + (*cu_ctx.0).cuda_state = ctx_state; + (*cu_ctx.0).cuda_dtor_cb = dtor_cb; + cu::Result::SUCCESS } // some kind of dtor -unsafe extern "C" fn ContextLocalStorageInterface_v0301_VTABLE_fn1(ms: *mut usize, _: *mut ()) -> u32 { +unsafe extern "C" fn context_local_storage_dtor(_: *mut usize, _: *mut ()) -> u32 { 0 } -unsafe extern "C" fn ContextLocalStorageInterface_v0301_VTABLE_fn2(_: *mut *mut (), _: *mut (), _: *mut ()) -> u32 { - 0 -} \ No newline at end of file +unsafe extern "C" fn context_local_storage_get_state( + ctx_state: *mut *mut cuda::rt::ContextState, + cu_ctx: cu::Context, + _: *mut cuda::rt::ContextStateManager, +) -> cu::Result { + if cu_ctx == cu::Context::null() { + return cu::Result::ERROR_INVALID_CONTEXT; + } + *ctx_state = (*cu_ctx.0).cuda_state; + cu::Result::SUCCESS +} diff --git a/notcuda/src/lib.rs b/notcuda/src/lib.rs index 707e89e..7e3b895 100644 --- a/notcuda/src/lib.rs +++ b/notcuda/src/lib.rs @@ -1,28 +1,17 @@ -extern crate level_zero_sys as l0; +extern crate level_zero as l0; +extern crate level_zero_sys as l0_sys; #[macro_use] extern crate lazy_static; +extern crate lz4; +use std::cell::RefCell; use std::convert::TryFrom; use std::os::raw::{c_char, c_int, c_uint}; use std::ptr; -use std::cell::RefCell; -use std::sync::Mutex; - -use ze::Versioned; - -#[macro_use] -macro_rules! l0_check_err { - ($exp:expr) => { - { - let result = unsafe{ $exp }; - if result != l0::ze_result_t::ZE_RESULT_SUCCESS { - return Err(result); - } - } - }; -} +use std::{ffi::c_void, sync::Mutex}; mod cu; +mod cuda; mod export_table; mod ze; @@ -31,32 +20,32 @@ thread_local! { } lazy_static! { - static ref GLOBAL_STATE: Mutex> = Mutex::new(None); + static ref GLOBAL_STATE: Mutex> = Mutex::new(None); } -struct Driver { - base: l0::ze_driver_handle_t, - devices: Vec:: +struct Context { + base: l0::Context, + devices: Vec, } -unsafe impl Send for Driver {} -unsafe impl Sync for Driver {} +unsafe impl Send for Context {} +unsafe impl Sync for Context {} -impl Driver { - fn new() -> Result { - let mut driver_count = 1; - let mut handle = ptr::null_mut(); - l0_check_err!{ l0::zeDriverGet(&mut driver_count, &mut handle) }; - let mut count = 0; - l0_check_err! { l0::zeDeviceGet(handle, &mut count, ptr::null_mut()) } - let mut devices = vec![ptr::null_mut(); count as usize]; - l0_check_err! { l0::zeDeviceGet(handle, &mut count, devices.as_mut_ptr()) } - if (count as usize) < devices.len() { - devices.truncate(count as usize); - } - Ok(Driver{ base: handle, devices: ze::Device::new_vec(devices) }) +impl Context { + fn new() -> l0::Result { + let driver = l0::Driver::get()?; + let ze_devices = driver[0].devices()?; + let mut ctx = l0::Context::new(&driver[0])?; + let devices = ze_devices + .into_iter() + .map(|d| ze::Device::new(&mut ctx, d)) + .collect::>()?; + Ok(Context { + base: ctx, + devices: devices, + }) } - fn call l0::ze_result_t>(f: F) -> cu::Result { + fn call l0_sys::ze_result_t>(f: F) -> cu::Result { let mut lock = GLOBAL_STATE.try_lock(); if let Ok(ref mut mutex) = lock { match **mutex { @@ -70,30 +59,43 @@ impl Driver { } } - fn call_device l0::ze_result_t>(cu::Device(dev): cu::Device, f: F) -> cu::Result { + fn call2 l0::Result<()>>(f: F) -> cu::Result { + Context::call(|ctx| match f(ctx) { + Ok(()) => l0::sys::ze_result_t::ZE_RESULT_SUCCESS, + Err(err) => err.0, + }) + } + + fn call_device l0::Result<()>>( + cu::Device(dev): cu::Device, + f: F, + ) -> cu::Result { if dev < 0 { return cu::Result::ERROR_INVALID_VALUE; } let dev = dev as usize; - Driver::call(|driver| { + Context::call(|driver| { if dev >= driver.devices.len() { - return l0::ze_result_t::ZE_RESULT_ERROR_INVALID_ARGUMENT; + return l0_sys::ze_result_t::ZE_RESULT_ERROR_INVALID_ARGUMENT; + } + match f(&mut driver.devices[dev]) { + Ok(()) => l0::sys::ze_result_t::ZE_RESULT_SUCCESS, + Err(err) => err.0, } - f(&mut driver.devices[dev]) }) } - fn device_get_count(&self, count: *mut i32) -> l0::ze_result_t { + fn device_get_count(&self, count: *mut i32) -> l0_sys::ze_result_t { unsafe { *count = self.devices.len() as i32 }; - l0::ze_result_t::ZE_RESULT_SUCCESS + l0_sys::ze_result_t::ZE_RESULT_SUCCESS } - fn device_get(&self, device: *mut cu::Device, ordinal: c_int) -> l0::ze_result_t { + fn device_get(&self, device: *mut cu::Device, ordinal: c_int) -> l0_sys::ze_result_t { if (ordinal as usize) >= self.devices.len() { - return l0::ze_result_t::ZE_RESULT_ERROR_INVALID_ARGUMENT; + return l0_sys::ze_result_t::ZE_RESULT_ERROR_INVALID_ARGUMENT; } unsafe { *device = cu::Device(ordinal) }; - l0::ze_result_t::ZE_RESULT_SUCCESS + l0_sys::ze_result_t::ZE_RESULT_SUCCESS } } @@ -108,16 +110,16 @@ pub unsafe extern "C" fn cuDriverGetVersion(version: *mut c_int) -> cu::Result { #[no_mangle] pub unsafe extern "C" fn cuInit(_: c_uint) -> cu::Result { - let l0_init = l0::zeInit(l0::ze_init_flag_t::ZE_INIT_FLAG_GPU_ONLY); - if l0_init != l0::ze_result_t::ZE_RESULT_SUCCESS { - return cu::Result::from_l0(l0_init); + let l0_sys_init = l0_sys::zeInit(l0_sys::ze_init_flags_t::ZE_INIT_FLAG_GPU_ONLY); + if l0_sys_init != l0_sys::ze_result_t::ZE_RESULT_SUCCESS { + return cu::Result::from_l0(l0_sys_init); } let mut lock = GLOBAL_STATE.try_lock(); if let Ok(ref mut mutex) = lock { if let None = **mutex { - match Driver::new() { + match Context::new() { Ok(state) => **mutex = Some(state), - Err(err) => return cu::Result::from_l0(err) + Err(err) => return cu::Result::from_l0(err.0), } } } else { @@ -131,7 +133,7 @@ pub extern "C" fn cuDeviceGetCount(count: *mut c_int) -> cu::Result { if count == ptr::null_mut() { return cu::Result::ERROR_INVALID_VALUE; } - Driver::call(|driver| driver.device_get_count(count)) + Context::call(|driver| driver.device_get_count(count)) } #[no_mangle] @@ -139,15 +141,19 @@ pub extern "C" fn cuDeviceGet(device: *mut cu::Device, ordinal: c_int) -> cu::Re if ordinal < 0 || device == ptr::null_mut() { return cu::Result::ERROR_INVALID_VALUE; } - Driver::call(|driver| driver.device_get(device, ordinal)) + Context::call(|driver| driver.device_get(device, ordinal)) } #[no_mangle] -pub extern "C" fn cuDeviceGetName(name: *mut c_char, len: c_int, dev_idx: cu::Device) -> cu::Result { +pub extern "C" fn cuDeviceGetName( + name: *mut c_char, + len: c_int, + dev_idx: cu::Device, +) -> cu::Result { if name == ptr::null_mut() || len <= 0 { return cu::Result::ERROR_INVALID_VALUE; } - Driver::call_device(dev_idx, |dev| dev.get_name(name, len)) + Context::call_device(dev_idx, |dev| dev.get_name(name, len)) } #[no_mangle] @@ -155,27 +161,32 @@ pub extern "C" fn cuDeviceTotalMem_v2(bytes: *mut usize, dev_idx: cu::Device) -> if bytes == ptr::null_mut() { return cu::Result::ERROR_INVALID_VALUE; } - Driver::call_device(dev_idx, |dev| dev.total_mem(bytes)) + Context::call_device(dev_idx, |dev| dev.total_mem(bytes)) } #[no_mangle] -pub extern "C" fn cuDeviceGetAttribute(pi: *mut c_int, attrib: c_int, dev_idx: cu::Device) -> cu::Result { - +pub extern "C" fn cuDeviceGetAttribute( + pi: *mut c_int, + attrib: c_int, + dev_idx: cu::Device, +) -> cu::Result { if pi == ptr::null_mut() { return cu::Result::ERROR_INVALID_VALUE; } let attrib = match u8::try_from(attrib) { Ok(a) => a, - Err(_) => return cu::Result::ERROR_INVALID_VALUE + Err(_) => return cu::Result::ERROR_INVALID_VALUE, }; match cu::DeviceAttribute::try_new(attrib) { Some(cu::DeviceAttribute::Static(a)) => { unsafe { *pi = ze::Device::get_attribute_static(a) }; cu::Result::SUCCESS - }, - Some(cu::DeviceAttribute::Dynamic(a)) => Driver::call_device(dev_idx, |dev| dev.get_attribute(pi, a)), + } + Some(cu::DeviceAttribute::Dynamic(a)) => { + Context::call_device(dev_idx, |dev| dev.get_attribute(pi, a)) + } // TODO: add support for more properties - None => cu::Result::SUCCESS + None => cu::Result::SUCCESS, } } @@ -184,16 +195,14 @@ pub extern "C" fn cuDeviceGetUuid(uuid: *mut cu::Uuid, dev_idx: cu::Device) -> c if uuid == ptr::null_mut() { return cu::Result::ERROR_INVALID_VALUE; } - Driver::call_device(dev_idx, |dev| dev.get_uuid(uuid)) + Context::call_device(dev_idx, |dev| dev.get_uuid(uuid)) } #[no_mangle] pub extern "C" fn cuCtxGetCurrent(pctx: *mut cu::Context) -> cu::Result { - let ctx = CONTEXT_STACK.with(|stack| { - match stack.borrow().last() { - Some(ctx) => ctx.clone(), - None => cu::Context::null() - } + let ctx = CONTEXT_STACK.with(|stack| match stack.borrow().last() { + Some(ctx) => ctx.clone(), + None => cu::Context::null(), }); unsafe { *pctx = ctx }; cu::Result::SUCCESS @@ -206,7 +215,7 @@ pub extern "C" fn cuCtxSetCurrent(ctx: cu::Context) -> cu::Result { stack.pop(); if ctx != cu::Context::null() { stack.push(ctx); - } + } }); cu::Result::SUCCESS } @@ -216,42 +225,67 @@ pub extern "C" fn cuMemAlloc_v2(dptr: *mut cu::DevicePtr, bytesize: usize) -> cu if dptr == ptr::null_mut() || bytesize == 0 { return cu::Result::ERROR_INVALID_VALUE; } - Driver::call(|drv| { - let mut descr = l0::ze_device_mem_alloc_desc_t::new(); - descr.flags = l0::ze_device_mem_alloc_flag_t::ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT; - descr.ordinal = 0; - // TODO: check current context for the device - unsafe { l0::zeDriverAllocDeviceMem(drv.base, &descr, bytesize, 0, drv.devices[0].0, dptr as *mut _) } + Context::call2(|drv| { + unsafe { + *dptr = cu::DevicePtr(drv.devices[0].base.mem_alloc_device( + &mut drv.base, + bytesize, + 0, + )? as usize) + }; + Ok(()) }) } #[no_mangle] -pub extern "C" fn cuCtxDestroy_v2(ctx: cu::Context) -> cu::Result -{ +pub extern "C" fn cuCtxDestroy_v2(ctx: cu::Context) -> cu::Result { cu::Result::ERROR_NOT_SUPPORTED } #[no_mangle] -pub extern "C" fn cuMemcpyDtoH_v2(dstHost: *mut (), srcDevice: cu::DevicePtr, byte_count: usize) -> cu::Result -{ +pub extern "C" fn cuMemcpyDtoH_v2( + dst_host: *mut c_void, + src_device: cu::DevicePtr, + byte_count: usize, +) -> cu::Result { + if dst_host == ptr::null_mut() || src_device.0 == 0 || byte_count == 0 { + return cu::Result::ERROR_INVALID_VALUE; + } + // TODO: choose the right device from device ptr + Context::call(|drv| { + let cu_dev = &mut drv.devices[0]; + // Safe, because there's no Drop impl for device + let dev = unsafe { l0::Device::from_ffi(cu_dev.base.as_ffi()) }; + let queue = &mut cu_dev.default_queue; + let result = unsafe { + memcpy_impl( + &mut drv.base, + dst_host, + src_device.0 as *mut _, + byte_count, + &dev, + queue, + ) + }; + match result { + Ok(()) => l0_sys::ze_result_t::ZE_RESULT_SUCCESS, + Err(e) => e.0, + } + }) +} + +#[no_mangle] +pub extern "C" fn cuMemFree_v2(srcDevice: cu::DevicePtr) -> cu::Result { cu::Result::ERROR_NOT_SUPPORTED } #[no_mangle] -pub extern "C" fn cuMemFree_v2(srcDevice: cu::DevicePtr) -> cu::Result -{ +pub extern "C" fn cuModuleLoad(module: *mut cu::Module, fname: *const c_char) -> cu::Result { cu::Result::ERROR_NOT_SUPPORTED } #[no_mangle] -pub extern "C" fn cuModuleLoad(module: *mut cu::Module, fname: *const c_char) -> cu::Result -{ - cu::Result::ERROR_NOT_SUPPORTED -} - -#[no_mangle] -pub extern "C" fn cuGetErrorString(error: cu::Result, pStr: *mut *const c_char) -> cu::Result -{ +pub extern "C" fn cuGetErrorString(error: cu::Result, pStr: *mut *const c_char) -> cu::Result { cu::Result::ERROR_NOT_SUPPORTED } @@ -267,43 +301,97 @@ pub extern "C" fn cuLaunchKernel( sharedMemBytes: c_uint, hStream: cu::Stream, kernelParams: *mut *mut (), - extra: *mut *mut ()) - -> cu::Result -{ + extra: *mut *mut (), +) -> cu::Result { cu::Result::ERROR_NOT_SUPPORTED } #[no_mangle] +#[allow(non_snake_case)] pub extern "C" fn cuModuleLoadDataEx( module: *mut cu::Module, image: *const (), numOptions: c_uint, options: *mut cu::JitOption, - optionValues: *mut *mut ()) -> cu::Result -{ + optionValues: *mut *mut (), +) -> cu::Result { cu::Result::ERROR_NOT_SUPPORTED } #[no_mangle] pub extern "C" fn cuMemcpyHtoD_v2( - dstDevice: cu::DevicePtr, - srcHost: *const (), - ByteCount: usize) -> cu::Result -{ - cu::Result::ERROR_NOT_SUPPORTED + dst_device: cu::DevicePtr, + src_host: *const c_void, + byte_count: usize, +) -> cu::Result { + if dst_device.0 == 0 || src_host == ptr::null_mut() || byte_count == 0 { + return cu::Result::ERROR_INVALID_VALUE; + } + // TODO: choose the right device from device ptr + Context::call(|drv| { + let cu_dev = &mut drv.devices[0]; + // Safe, because there's no Drop impl for device + let dev = unsafe { l0::Device::from_ffi(cu_dev.base.as_ffi()) }; + let queue = &mut cu_dev.default_queue; + let result = unsafe { + memcpy_impl( + &mut drv.base, + dst_device.0 as *mut _, + src_host, + byte_count, + &dev, + queue, + ) + }; + match result { + Ok(()) => l0_sys::ze_result_t::ZE_RESULT_SUCCESS, + Err(e) => e.0, + } + }) +} + +unsafe fn memcpy_impl( + ctx: &mut l0::Context, + dst: *mut c_void, + src: *const c_void, + bytes_count: usize, + dev: &l0::Device, + queue: &mut l0::CommandQueue, +) -> l0::Result<()> { + let mut cmd_list = l0::CommandList::new(ctx, &dev)?; + cmd_list.append_memory_copy_unsafe(dst, src, bytes_count, None, &mut [])?; + queue.execute(cmd_list)?; + Ok(()) } #[no_mangle] -pub extern "C" fn cuCtxCreate_v2(pctx: *mut cu::Context, flags: c_uint, dev: cu::Device) -> cu::Result -{ - cu::Result::SUCCESS +pub extern "C" fn cuCtxCreate_v2( + pctx: *mut cu::Context, + flags: c_uint, + dev: cu::Device, +) -> cu::Result { + if pctx == ptr::null_mut() { + return cu::Result::ERROR_INVALID_VALUE; + } + cu::Result::ERROR_NOT_SUPPORTED } #[no_mangle] pub extern "C" fn cuModuleGetFunction( hfunc: *mut cu::Function, hmod: cu::Module, - name: *const c_char) -> cu::Result -{ + name: *const c_char, +) -> cu::Result { cu::Result::ERROR_NOT_SUPPORTED -} \ No newline at end of file +} + +#[no_mangle] +pub extern "C" fn cuDevicePrimaryCtxRetain(pctx: *mut cu::Context, dev: cu::Device) -> cu::Result { + cu::Result::SUCCESS +} + +#[no_mangle] +pub extern "C" fn cuCtxGetDevice(dev: *mut cu::Device) -> cu::Result { + unsafe { *dev = cu::Device(0) }; + cu::Result::SUCCESS +} diff --git a/notcuda/src/ze.rs b/notcuda/src/ze.rs index 748691e..c41fd2b 100644 --- a/notcuda/src/ze.rs +++ b/notcuda/src/ze.rs @@ -1,141 +1,73 @@ -use level_zero_sys::*; use super::cu; +use crate::cuda; use std::cmp; -use std::mem; use std::os::raw::{c_char, c_int}; -use std::ptr; -macro_rules! assert_size_eq { - ($x:ty, $($xs:ty),+ $(,)?) => { - const _: fn() = || { - $(let _ = ::std::mem::transmute::<$x, $xs>;)+ - }; - }; +pub struct Device { + pub base: l0::Device, + pub default_queue: l0::CommandQueue, + properties: Option>, + image_properties: Option>, + memory_properties: Option>, } -macro_rules! l0_check { - ($exp:expr) => { - { - let result = unsafe{ $exp }; - if result != l0::ze_result_t::ZE_RESULT_SUCCESS { - return result; - } - } - }; -} - -fn either(r: Result) -> T { - match r { - Ok(x) => x, - Err(x) => x - } -} - -pub trait Versioned : Sized { - type Version; - - fn new() -> Self { - let mut result = unsafe { std::mem::zeroed::() }; - let ver = result.version(); - *ver = Self::current(); - return result; - } - - fn current() -> Self::Version; - - fn version(&mut self) -> &mut Self::Version; -} - -impl Versioned for ze_device_memory_properties_t { - type Version = ze_device_memory_properties_version_t; - fn current() -> Self::Version { - ze_device_memory_properties_version_t::ZE_DEVICE_MEMORY_PROPERTIES_VERSION_CURRENT - } - fn version(&mut self) -> &mut Self::Version { - &mut self.version - } -} - -impl Versioned for ze_device_properties_t { - type Version = ze_device_properties_version_t; - fn current() -> Self::Version { - ze_device_properties_version_t::ZE_DEVICE_PROPERTIES_VERSION_CURRENT - } - fn version(&mut self) -> &mut Self::Version { - &mut self.version - } -} - -impl Versioned for ze_device_image_properties_t { - type Version = ze_device_image_properties_version_t; - fn current() -> Self::Version { - ze_device_image_properties_version_t::ZE_DEVICE_IMAGE_PROPERTIES_VERSION_CURRENT - } - fn version(&mut self) -> &mut Self::Version { - &mut self.version - } -} - -impl Versioned for ze_device_mem_alloc_desc_t { - type Version = ze_device_mem_alloc_desc_version_t; - fn current() -> Self::Version { - ze_device_mem_alloc_desc_version_t::ZE_DEVICE_MEM_ALLOC_DESC_VERSION_CURRENT - } - fn version(&mut self) -> &mut Self::Version { - &mut self.version - } -} - -#[derive(Clone, Copy)] -#[repr(transparent)] // required so a Vec can be safely transmutted to Vec -pub struct Device(pub ze_device_handle_t); - impl Device { - pub fn new_vec(v: Vec) -> Vec { - assert_size_eq!(Device, ze_device_handle_t); - unsafe { mem::transmute(v) } + pub fn new(ctx: &mut l0::Context, d: l0::Device) -> l0::Result { + let queue = l0::CommandQueue::new(ctx, &d)?; + Ok(Self { + base: d, + default_queue: queue, + properties: None, + image_properties: None, + memory_properties: None, + }) } - fn get_device_properties(self) -> Result, ze_result_t> { - let mut props = Box::new(l0::ze_device_properties_t::new()); - l0_check_err! { l0::zeDeviceGetProperties(self.0, props.as_mut()) }; - Ok(props) + fn get_properties<'a>(&'a mut self) -> l0::Result<&'a l0::sys::ze_device_properties_t> { + if let Some(ref prop) = self.properties { + return Ok(prop); + } + match self.base.get_properties() { + Ok(prop) => Ok(self.properties.get_or_insert(prop)), + Err(e) => Err(e), + } } - fn get_device_image_properties(self) -> Result, ze_result_t> { - let mut props = Box::new(l0::ze_device_image_properties_t::new()); - l0_check_err! { l0::zeDeviceGetImageProperties(self.0, props.as_mut()) }; - Ok(props) + fn get_image_properties(&mut self) -> l0::Result<&l0::sys::ze_device_image_properties_t> { + if let Some(ref prop) = self.image_properties { + return Ok(prop); + } + match self.base.get_image_properties() { + Ok(prop) => Ok(self.image_properties.get_or_insert(prop)), + Err(e) => Err(e), + } } - pub fn get_name(self, name: *mut c_char, len: c_int) -> l0::ze_result_t { - let props = match self.get_device_properties() { - Ok(props) => props, - Err(res) => return res - }; + fn get_memory_properties(&mut self) -> l0::Result<&[l0::sys::ze_device_memory_properties_t]> { + if let Some(ref prop) = self.memory_properties { + return Ok(prop); + } + match self.base.get_memory_properties() { + Ok(prop) => Ok(self.memory_properties.get_or_insert(prop)), + Err(e) => Err(e), + } + } + + pub fn get_name(&mut self, name: *mut c_char, len: c_int) -> l0::Result<()> { + let props = self.get_properties()?; let null_pos = props.name.iter().position(|&c| c == 0).unwrap_or(0); let dst_null_pos = cmp::min((len - 1) as usize, null_pos); unsafe { *(name.add(dst_null_pos)) = 0 }; unsafe { std::ptr::copy_nonoverlapping(props.name.as_ptr(), name, dst_null_pos) }; - l0::ze_result_t::ZE_RESULT_SUCCESS + Ok(()) } - pub fn total_mem(self, bytes: *mut usize) -> l0::ze_result_t { - let mut count = 0; - l0_check! { l0::zeDeviceGetMemoryProperties(self.0, &mut count, ptr::null_mut()) }; - if count == 0 { - return l0::ze_result_t::ZE_RESULT_ERROR_UNKNOWN; - } - let mut props = vec![l0::ze_device_memory_properties_t::new(); count as usize]; - l0_check! { l0::zeDeviceGetMemoryProperties(self.0, &mut count, props.as_mut_ptr()) }; - let iter_count = cmp::min(count as usize, props.len()); - if iter_count == 0 { - return l0::ze_result_t::ZE_RESULT_ERROR_UNKNOWN; - } - let max_mem = props.iter().take(iter_count).map(|p| p.totalSize).max().unwrap(); + pub fn total_mem(&mut self, bytes: *mut usize) -> l0::Result<()> { + let props = self.get_memory_properties()?; + let max_mem = props.iter().map(|p| p.totalSize).max().unwrap(); unsafe { *bytes = max_mem as usize }; - l0::ze_result_t::ZE_RESULT_SUCCESS + Ok(()) } pub fn get_attribute_static(attr: cu::DeviceStaticAttribute) -> c_int { @@ -148,38 +80,61 @@ impl Device { } } - fn get_attribute_general(attr: cu::DeviceGeneralAttribute, props: &l0::ze_device_properties_t) -> c_int { + fn get_attribute_general( + attr: cu::DeviceGeneralAttribute, + props: &l0_sys::ze_device_properties_t, + ) -> c_int { match attr { - cu::DeviceGeneralAttribute::CAN_MAP_HOST_MEMORY => props.unifiedMemorySupported as i32, - cu::DeviceGeneralAttribute::ASYNC_ENGINE_COUNT => props.numAsyncCopyEngines as i32, - cu::DeviceGeneralAttribute::MULTIPROCESSOR_COUNT => (props.numSlicesPerTile * props.numSubslicesPerSlice) as i32, - } - } - - fn get_attribute_texture(attr: cu::DeviceTextureAttribute, props: &l0::ze_device_image_properties_t) -> c_int { - match attr { - cu::DeviceTextureAttribute::MAXIMUM_TEXTURE1D_WIDTH => cmp::min(props.maxImageDims1D, c_int::max_value() as u32) as c_int, - } - } - - pub fn get_attribute(self, pi: *mut c_int, attr: cu::DeviceDynamicAttribute) -> l0::ze_result_t { - let value_or_err = match attr { - cu::DeviceDynamicAttribute::General(a) => self.get_device_properties().map(|p| Device::get_attribute_general(a, &p)), - cu::DeviceDynamicAttribute::Texture(a) => self.get_device_image_properties().map(|p| Device::get_attribute_texture(a, &p)), - }; - match value_or_err { - Ok(value) => { - unsafe { *pi = value }; - l0::ze_result_t::ZE_RESULT_SUCCESS + cu::DeviceGeneralAttribute::CAN_MAP_HOST_MEMORY => 1, + cu::DeviceGeneralAttribute::ASYNC_ENGINE_COUNT => props.maxHardwareContexts as i32, + cu::DeviceGeneralAttribute::MULTIPROCESSOR_COUNT => { + (props.numSlices * props.numSubslicesPerSlice * props.numEUsPerSubslice) as i32 } - Err(e) => e } } - pub fn get_uuid(self, uuid: *mut cu::Uuid) -> l0::ze_result_t { - either(self.get_device_properties().map(|prop| { - unsafe { *uuid = cu::Uuid{ x: prop.uuid.id } }; - l0::ze_result_t::ZE_RESULT_SUCCESS - })) + fn get_attribute_texture( + attr: cu::DeviceTextureAttribute, + props: &l0_sys::ze_device_image_properties_t, + ) -> c_int { + match attr { + cu::DeviceTextureAttribute::MAXIMUM_TEXTURE1D_WIDTH => { + cmp::min(props.maxImageDims1D, c_int::max_value() as u32) as c_int + } + } } -} \ No newline at end of file + + pub fn get_attribute( + &mut self, + pi: *mut c_int, + attr: cu::DeviceDynamicAttribute, + ) -> l0::Result<()> { + let value = match attr { + cu::DeviceDynamicAttribute::General(a) => { + Device::get_attribute_general(a, self.get_properties()?) + } + cu::DeviceDynamicAttribute::Texture(a) => { + Device::get_attribute_texture(a, self.get_image_properties()?) + } + }; + unsafe { *pi = value }; + Ok(()) + } + + pub fn get_uuid(&mut self, uuid: *mut cu::Uuid) -> l0::Result<()> { + let props = self.get_properties()?; + unsafe { *uuid = cu::Uuid { x: props.uuid.id } }; + Ok(()) + } +} + +pub struct Context { + pub cuda_manager: *mut cuda::rt::ContextStateManager, + pub cuda_state: *mut cuda::rt::ContextState, + pub cuda_dtor_cb: + extern "C" fn(cu::Context, *mut cuda::rt::ContextStateManager, *mut cuda::rt::ContextState), +} + +pub struct Module { + pub ptx_text: Vec, +} diff --git a/ptx/src/test/spirv_run/mod.rs b/ptx/src/test/spirv_run/mod.rs index c159280..7de2c54 100644 --- a/ptx/src/test/spirv_run/mod.rs +++ b/ptx/src/test/spirv_run/mod.rs @@ -100,34 +100,37 @@ fn run_spirv + ze::SafeRepr + Copy + Debug>( ) }; let mut result = vec![0u8.into(); output.len()]; - let mut drivers = ze::Driver::get()?; - let drv = drivers.drain(0..1).next().unwrap(); - let mut devices = drv.devices()?; - let dev = devices.drain(0..1).next().unwrap(); - let queue = ze::CommandQueue::new(&dev)?; - let module = ze::Module::new_spirv(&dev, byte_il, None)?; - let mut kernel = ze::Kernel::new_resident(&module, name)?; - kernel.set_attribute_bool( - ze::sys::ze_kernel_attribute_t::ZE_KERNEL_ATTR_INDIRECT_DEVICE_ACCESS, - true, - )?; - let mut inp_b = ze::DeviceBuffer::::new(&drv, &dev, input.len())?; - let mut out_b = ze::DeviceBuffer::::new(&drv, &dev, output.len())?; - let inp_b_ptr_mut: ze::BufferPtrMut = (&mut inp_b).into(); - let event_pool = ze::EventPool::new(&drv, 3, Some(&[&dev]))?; - let ev0 = ze::Event::new(&event_pool, 0)?; - let ev1 = ze::Event::new(&event_pool, 1)?; - let ev2 = ze::Event::new(&event_pool, 2)?; - let mut cmd_list = ze::CommandList::new(&dev)?; - let out_b_ptr_mut: ze::BufferPtrMut = (&mut out_b).into(); - cmd_list.append_memory_copy(inp_b_ptr_mut, input, None, Some(&ev0))?; - cmd_list.append_memory_fill(out_b_ptr_mut, 0u8.into(), Some(&ev1))?; - kernel.set_group_size(1, 1, 1)?; - kernel.set_arg_buffer(0, inp_b_ptr_mut)?; - kernel.set_arg_buffer(1, out_b_ptr_mut)?; - cmd_list.append_launch_kernel(&kernel, &[1, 1, 1], Some(&ev2), &[&ev0, &ev1])?; - cmd_list.append_memory_copy(result.as_mut_slice(), out_b_ptr_mut, None, Some(&ev2))?; - queue.execute(cmd_list)?; + { + let mut drivers = ze::Driver::get()?; + let drv = drivers.drain(0..1).next().unwrap(); + let mut ctx = ze::Context::new(&drv)?; + let mut devices = drv.devices()?; + let dev = devices.drain(0..1).next().unwrap(); + let queue = ze::CommandQueue::new(&mut ctx, &dev)?; + let module = ze::Module::new_spirv(&mut ctx, &dev, byte_il, None)?; + let mut kernel = ze::Kernel::new_resident(&module, name)?; + kernel.set_indirect_access( + ze::sys::ze_kernel_indirect_access_flags_t::ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE, + )?; + let mut inp_b = ze::DeviceBuffer::::new(&mut ctx, &dev, input.len())?; + let mut out_b = ze::DeviceBuffer::::new(&mut ctx, &dev, output.len())?; + let inp_b_ptr_mut: ze::BufferPtrMut = (&mut inp_b).into(); + let event_pool = ze::EventPool::new(&mut ctx, 3, Some(&[&dev]))?; + let ev0 = ze::Event::new(&event_pool, 0)?; + let ev1 = ze::Event::new(&event_pool, 1)?; + let mut ev2 = ze::Event::new(&event_pool, 2)?; + let mut cmd_list = ze::CommandList::new(&mut ctx, &dev)?; + let out_b_ptr_mut: ze::BufferPtrMut = (&mut out_b).into(); + let mut init_evs = [ev0, ev1]; + cmd_list.append_memory_copy(inp_b_ptr_mut, input, Some(&mut init_evs[0]), &mut [])?; + cmd_list.append_memory_fill(out_b_ptr_mut, 0, Some(&mut init_evs[1]), &mut [])?; + kernel.set_group_size(1, 1, 1)?; + kernel.set_arg_buffer(0, inp_b_ptr_mut)?; + kernel.set_arg_buffer(1, out_b_ptr_mut)?; + cmd_list.append_launch_kernel(&kernel, &[1, 1, 1], Some(&mut ev2), &mut init_evs)?; + cmd_list.append_memory_copy(result.as_mut_slice(), out_b_ptr_mut, None, &mut [ev2])?; + queue.execute(cmd_list)?; + } Ok(result) } diff --git a/ptx/src/translate.rs b/ptx/src/translate.rs index ebce1dd..c0cdf01 100644 --- a/ptx/src/translate.rs +++ b/ptx/src/translate.rs @@ -121,19 +121,10 @@ impl TypeWordMap { }) } - fn get_or_add_extended( - &mut self, - b: &mut dr::Builder, - t: ast::ExtendedScalarType, - ) -> spirv::Word { - let key: SpirvScalarKey = t.into(); - self.get_or_add_spirv_scalar(b, key) - } - fn get_or_add(&mut self, b: &mut dr::Builder, t: SpirvType) -> spirv::Word { match t { SpirvType::Base(key) => self.get_or_add_spirv_scalar(b, key), - SpirvType::Pointer(typ, mut storage) => { + SpirvType::Pointer(typ, storage) => { let base = self.get_or_add_spirv_scalar(b, typ); *self .complex @@ -728,7 +719,7 @@ fn emit_function_body_ops( builder.shift_left_logical(result_type, Some(a.dst), a.src1, a.src2)?; } ast::Instruction::Cvt(dets, arg) => { - emit_cvt(builder, map, opencl, dets, arg)?; + emit_cvt(builder, map, dets, arg)?; } ast::Instruction::Cvta(_, arg) => { // This would be only meaningful if const/slm/global pointers @@ -754,7 +745,6 @@ fn emit_function_body_ops( fn emit_cvt( builder: &mut dr::Builder, map: &mut TypeWordMap, - opencl: spirv::Word, dets: &ast::CvtDetails, arg: &ast::Arg2, ) -> Result<(), dr::Error> { @@ -841,7 +831,6 @@ fn emit_cvt( builder.bitcast(result_type, Some(arg.dst), src)?; } } - _ => todo!(), } Ok(()) } diff --git a/spirv_tools-sys/build.rs b/spirv_tools-sys/build.rs index 8cdf695..ae72561 100644 --- a/spirv_tools-sys/build.rs +++ b/spirv_tools-sys/build.rs @@ -18,6 +18,10 @@ fn main() -> Result<(), VarError> { "cargo:rustc-link-search=native={}/bin", spirv_tools_dir.display() ); + println!( + "cargo:rustc-link-search=native={}/lib", + spirv_tools_dir.display() + ); // dynamic linking to avoid linking to C++ runtime println!("cargo:rustc-link-lib=dylib=SPIRV-Tools-shared"); Ok(())