From 0c015003a6c76f90ceec0586468ffd7400d22d87 Mon Sep 17 00:00:00 2001 From: Andrzej Janik Date: Mon, 9 Sep 2024 18:58:46 +0200 Subject: [PATCH 1/5] Add LLVM dependency --- .gitmodules | 5 +++++ ext/llvm-project | 1 + 2 files changed, 6 insertions(+) create mode 160000 ext/llvm-project diff --git a/.gitmodules b/.gitmodules index 9796b044..e710202a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,3 +5,8 @@ [submodule "ext/spirv-headers"] path = ext/spirv-headers url = https://github.com/KhronosGroup/SPIRV-Headers +[submodule "ext/llvm-project"] + path = ext/llvm-project + url = https://github.com/llvm/llvm-project + branch = release/17.x + shallow = true diff --git a/ext/llvm-project b/ext/llvm-project new file mode 160000 index 00000000..6009708b --- /dev/null +++ b/ext/llvm-project @@ -0,0 +1 @@ +Subproject commit 6009708b4367171ccdbf4b5905cb6a803753fe18 From 2d34303a1801bb2bd2fb8d8f9ff55419f8732ef1 Mon Sep 17 00:00:00 2001 From: Andrzej Janik Date: Wed, 11 Sep 2024 16:01:30 +0200 Subject: [PATCH 2/5] Try use inkwell --- .cargo/config.toml | 7 +- amd_comgr-sys/Cargo.toml | 8 + amd_comgr-sys/README | 1 + amd_comgr-sys/build.rs | 20 + amd_comgr-sys/lib/amd_comgr_2.def | 68 + amd_comgr-sys/lib/amd_comgr_2.lib | Bin 0 -> 18512 bytes amd_comgr-sys/src/amd_comgr.rs | 937 +++ amd_comgr-sys/src/lib.rs | 3 + hip_runtime-sys/Cargo.toml | 2 +- hip_runtime-sys/README | 3 +- hip_runtime-sys/build.rs | 7 +- hip_runtime-sys/lib/amdhip64.def | 308 - hip_runtime-sys/lib/amdhip64.lib | Bin 71480 -> 0 bytes hip_runtime-sys/lib/amdhip64_6.def | 567 ++ hip_runtime-sys/lib/amdhip64_6.lib | Bin 0 -> 129670 bytes hip_runtime-sys/src/hip_runtime_api.rs | 8540 +++++++++++++----------- llvm_zluda/Cargo.toml | 22 + llvm_zluda/build.rs | 129 + llvm_zluda/src/lib.cpp | 13 + llvm_zluda/src/lib.rs | 15 + ptx/Cargo.toml | 4 +- ptx/src/pass/emit_llvm.rs | 708 ++ ptx/src/pass/mod.rs | 29 +- ptx/src/test/spirv_run/mod.rs | 347 +- ptx_parser/src/ast.rs | 11 +- 25 files changed, 7144 insertions(+), 4605 deletions(-) create mode 100644 amd_comgr-sys/Cargo.toml create mode 100644 amd_comgr-sys/README create mode 100644 amd_comgr-sys/build.rs create mode 100644 amd_comgr-sys/lib/amd_comgr_2.def create mode 100644 amd_comgr-sys/lib/amd_comgr_2.lib create mode 100644 amd_comgr-sys/src/amd_comgr.rs create mode 100644 amd_comgr-sys/src/lib.rs delete mode 100644 hip_runtime-sys/lib/amdhip64.def delete mode 100644 hip_runtime-sys/lib/amdhip64.lib create mode 100644 hip_runtime-sys/lib/amdhip64_6.def create mode 100644 hip_runtime-sys/lib/amdhip64_6.lib create mode 100644 llvm_zluda/Cargo.toml create mode 100644 llvm_zluda/build.rs create mode 100644 llvm_zluda/src/lib.cpp create mode 100644 llvm_zluda/src/lib.rs create mode 100644 ptx/src/pass/emit_llvm.rs diff --git a/.cargo/config.toml b/.cargo/config.toml index 6833199d..f03ab8cf 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,2 @@ -[build] -rustflags = ["-C", "target-cpu=haswell"] - -[target."x86_64-pc-windows-gnu"] -rustflags = ["-C", "link-self-contained=y", "-C", "target-cpu=haswell"] +[patch.crates-io] +inkwell = { git = "https://github.com/vosen/inkwell.git", rev = "46027c2afb7e98976438cdcc41a2949dedb60b2e" } diff --git a/amd_comgr-sys/Cargo.toml b/amd_comgr-sys/Cargo.toml new file mode 100644 index 00000000..0516a2d6 --- /dev/null +++ b/amd_comgr-sys/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "amd_comgr-sys" +version = "0.0.0" +authors = ["Andrzej Janik "] +edition = "2021" +links = "amd_comgr" + +[lib] \ No newline at end of file diff --git a/amd_comgr-sys/README b/amd_comgr-sys/README new file mode 100644 index 00000000..5d4e3cce --- /dev/null +++ b/amd_comgr-sys/README @@ -0,0 +1 @@ +bindgen --rust-target 1.77 /opt/rocm/include/amd_comgr/amd_comgr.h -o /tmp/amd_comgr.rs --no-layout-tests --default-enum-style=newtype --allowlist-function "amd_comgr.*" --allowlist-type "amd_comgr.*" --no-derive-debug --must-use-type amd_comgr_status_t --allowlist-var "^AMD_COMGR.*$" diff --git a/amd_comgr-sys/build.rs b/amd_comgr-sys/build.rs new file mode 100644 index 00000000..f89fc388 --- /dev/null +++ b/amd_comgr-sys/build.rs @@ -0,0 +1,20 @@ +use std::env::VarError; +use std::{env, path::PathBuf}; + +fn main() -> Result<(), VarError> { + if cfg!(windows) { + println!("cargo:rustc-link-lib=dylib=amd_comgr_2"); + let env = env::var("CARGO_CFG_TARGET_ENV")?; + if env == "msvc" { + let mut path = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?); + path.push("lib"); + println!("cargo:rustc-link-search=native={}", path.display()); + } else { + println!("cargo:rustc-link-search=native=C:\\Windows\\System32"); + }; + } else { + println!("cargo:rustc-link-lib=dylib=amd_comgr"); + println!("cargo:rustc-link-search=native=/opt/rocm/lib/"); + } + Ok(()) +} diff --git a/amd_comgr-sys/lib/amd_comgr_2.def b/amd_comgr-sys/lib/amd_comgr_2.def new file mode 100644 index 00000000..5154db50 --- /dev/null +++ b/amd_comgr-sys/lib/amd_comgr_2.def @@ -0,0 +1,68 @@ +; +; Definition file of amd_comgr_2.dll +; Automatic generated by gendef +; written by Kai Tietz 2008 +; +LIBRARY "amd_comgr_2.dll" +EXPORTS +amd_comgr_action_data_count +amd_comgr_action_data_get_data +amd_comgr_action_info_get_isa_name +amd_comgr_action_info_get_language +amd_comgr_action_info_get_logging +amd_comgr_action_info_get_option_list_count +amd_comgr_action_info_get_option_list_item +amd_comgr_action_info_get_options +amd_comgr_action_info_get_working_directory_path +amd_comgr_action_info_set_isa_name +amd_comgr_action_info_set_language +amd_comgr_action_info_set_logging +amd_comgr_action_info_set_option_list +amd_comgr_action_info_set_options +amd_comgr_action_info_set_working_directory_path +amd_comgr_create_action_info +amd_comgr_create_data +amd_comgr_create_data_set +amd_comgr_create_disassembly_info +amd_comgr_create_symbolizer_info +amd_comgr_data_set_add +amd_comgr_data_set_remove +amd_comgr_demangle_symbol_name +amd_comgr_destroy_action_info +amd_comgr_destroy_data_set +amd_comgr_destroy_disassembly_info +amd_comgr_destroy_metadata +amd_comgr_destroy_symbolizer_info +amd_comgr_disassemble_instruction +amd_comgr_do_action +amd_comgr_get_data +amd_comgr_get_data_isa_name +amd_comgr_get_data_kind +amd_comgr_get_data_metadata +amd_comgr_get_data_name +amd_comgr_get_isa_count +amd_comgr_get_isa_metadata +amd_comgr_get_isa_name +amd_comgr_get_mangled_name +amd_comgr_get_metadata_kind +amd_comgr_get_metadata_list_size +amd_comgr_get_metadata_map_size +amd_comgr_get_metadata_string +amd_comgr_get_version +amd_comgr_index_list_metadata +amd_comgr_iterate_map_metadata +amd_comgr_iterate_symbols +amd_comgr_lookup_code_object +amd_comgr_map_elf_virtual_address_to_code_object_offset +amd_comgr_map_name_expression_to_symbol_name +amd_comgr_metadata_lookup +amd_comgr_populate_mangled_names +amd_comgr_populate_name_expression_map +amd_comgr_release_data +amd_comgr_set_data +amd_comgr_set_data_from_file_slice +amd_comgr_set_data_name +amd_comgr_status_string +amd_comgr_symbol_get_info +amd_comgr_symbol_lookup +amd_comgr_symbolize diff --git a/amd_comgr-sys/lib/amd_comgr_2.lib b/amd_comgr-sys/lib/amd_comgr_2.lib new file mode 100644 index 0000000000000000000000000000000000000000..8c02f0ba35df8a0db19e4e0c5e59340830634145 GIT binary patch literal 18512 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 literal 0 HcmV?d00001 diff --git a/amd_comgr-sys/src/amd_comgr.rs b/amd_comgr-sys/src/amd_comgr.rs new file mode 100644 index 00000000..b80be7b7 --- /dev/null +++ b/amd_comgr-sys/src/amd_comgr.rs @@ -0,0 +1,937 @@ +/* automatically generated by rust-bindgen 0.70.1 */ + +pub const AMD_COMGR_INTERFACE_VERSION_MAJOR: u32 = 2; +pub const AMD_COMGR_INTERFACE_VERSION_MINOR: u32 = 7; +impl amd_comgr_status_s { + #[doc = " The function has been executed successfully."] + pub const AMD_COMGR_STATUS_SUCCESS: amd_comgr_status_s = + amd_comgr_status_s(unsafe { ::std::num::NonZeroU32::new_unchecked(0) }); +} +impl amd_comgr_status_s { + #[doc = " A generic error has occurred."] + pub const AMD_COMGR_STATUS_ERROR: amd_comgr_status_s = + amd_comgr_status_s(unsafe { ::std::num::NonZeroU32::new_unchecked(1) }); +} +impl amd_comgr_status_s { + #[doc = " One of the actual arguments does not meet a precondition stated\n in the documentation of the corresponding formal argument. This\n includes both invalid Action types, and invalid arguments to\n valid Action types."] + pub const AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT: amd_comgr_status_s = + amd_comgr_status_s(unsafe { ::std::num::NonZeroU32::new_unchecked(2) }); +} +impl amd_comgr_status_s { + #[doc = " Failed to allocate the necessary resources."] + pub const AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES: amd_comgr_status_s = + amd_comgr_status_s(unsafe { ::std::num::NonZeroU32::new_unchecked(3) }); +} +#[repr(transparent)] +#[doc = " @brief Status codes."] +#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)] +pub struct amd_comgr_status_s(pub ::std::num::NonZeroU32); +type amd_comgr_status_t = Result<(), self::amd_comgr_status_s>; +impl amd_comgr_language_s { + #[doc = " No high level language."] + pub const AMD_COMGR_LANGUAGE_NONE: amd_comgr_language_s = amd_comgr_language_s(0); +} +impl amd_comgr_language_s { + #[doc = " OpenCL 1.2."] + pub const AMD_COMGR_LANGUAGE_OPENCL_1_2: amd_comgr_language_s = amd_comgr_language_s(1); +} +impl amd_comgr_language_s { + #[doc = " OpenCL 2.0."] + pub const AMD_COMGR_LANGUAGE_OPENCL_2_0: amd_comgr_language_s = amd_comgr_language_s(2); +} +impl amd_comgr_language_s { + #[doc = " AMD Hetrogeneous C++ (HC)."] + pub const AMD_COMGR_LANGUAGE_HC: amd_comgr_language_s = amd_comgr_language_s(3); +} +impl amd_comgr_language_s { + #[doc = " HIP."] + pub const AMD_COMGR_LANGUAGE_HIP: amd_comgr_language_s = amd_comgr_language_s(4); +} +impl amd_comgr_language_s { + #[doc = " LLVM IR, either textual (.ll) or bitcode (.bc) format."] + pub const AMD_COMGR_LANGUAGE_LLVM_IR: amd_comgr_language_s = amd_comgr_language_s(5); +} +impl amd_comgr_language_s { + #[doc = " Marker for last valid language."] + pub const AMD_COMGR_LANGUAGE_LAST: amd_comgr_language_s = amd_comgr_language_s(5); +} +#[repr(transparent)] +#[doc = " @brief The source languages supported by the compiler."] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct amd_comgr_language_s(pub ::std::os::raw::c_uint); +#[doc = " @brief The source languages supported by the compiler."] +pub use self::amd_comgr_language_s as amd_comgr_language_t; +extern "C" { + #[must_use] + #[doc = " @brief Query additional information about a status code.\n\n @param[in] status Status code.\n\n @param[out] status_string A NUL-terminated string that describes\n the error status.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n status is an invalid status code, or @p status_string is NULL."] + pub fn amd_comgr_status_string( + status: amd_comgr_status_t, + status_string: *mut *const ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[doc = " @brief Get the version of the code object manager interface\n supported.\n\n An interface is backwards compatible with an implementation with an\n equal major version, and a greater than or equal minor version.\n\n @param[out] major Major version number.\n\n @param[out] minor Minor version number."] + pub fn amd_comgr_get_version(major: *mut usize, minor: *mut usize); +} +impl amd_comgr_data_kind_s { + #[doc = " No data is available."] + pub const AMD_COMGR_DATA_KIND_UNDEF: amd_comgr_data_kind_s = amd_comgr_data_kind_s(0); +} +impl amd_comgr_data_kind_s { + #[doc = " The data is a textual main source."] + pub const AMD_COMGR_DATA_KIND_SOURCE: amd_comgr_data_kind_s = amd_comgr_data_kind_s(1); +} +impl amd_comgr_data_kind_s { + #[doc = " The data is a textual source that is included in the main source\n or other include source."] + pub const AMD_COMGR_DATA_KIND_INCLUDE: amd_comgr_data_kind_s = amd_comgr_data_kind_s(2); +} +impl amd_comgr_data_kind_s { + #[doc = " The data is a precompiled-header source that is included in the main\n source or other include source."] + pub const AMD_COMGR_DATA_KIND_PRECOMPILED_HEADER: amd_comgr_data_kind_s = + amd_comgr_data_kind_s(3); +} +impl amd_comgr_data_kind_s { + #[doc = " The data is a diagnostic output."] + pub const AMD_COMGR_DATA_KIND_DIAGNOSTIC: amd_comgr_data_kind_s = amd_comgr_data_kind_s(4); +} +impl amd_comgr_data_kind_s { + #[doc = " The data is a textual log output."] + pub const AMD_COMGR_DATA_KIND_LOG: amd_comgr_data_kind_s = amd_comgr_data_kind_s(5); +} +impl amd_comgr_data_kind_s { + #[doc = " The data is compiler LLVM IR bit code for a specific isa."] + pub const AMD_COMGR_DATA_KIND_BC: amd_comgr_data_kind_s = amd_comgr_data_kind_s(6); +} +impl amd_comgr_data_kind_s { + #[doc = " The data is a relocatable machine code object for a specific isa."] + pub const AMD_COMGR_DATA_KIND_RELOCATABLE: amd_comgr_data_kind_s = amd_comgr_data_kind_s(7); +} +impl amd_comgr_data_kind_s { + #[doc = " The data is an executable machine code object for a specific\n isa. An executable is the kind of code object that can be loaded\n and executed."] + pub const AMD_COMGR_DATA_KIND_EXECUTABLE: amd_comgr_data_kind_s = amd_comgr_data_kind_s(8); +} +impl amd_comgr_data_kind_s { + #[doc = " The data is a block of bytes."] + pub const AMD_COMGR_DATA_KIND_BYTES: amd_comgr_data_kind_s = amd_comgr_data_kind_s(9); +} +impl amd_comgr_data_kind_s { + #[doc = " The data is a fat binary (clang-offload-bundler output)."] + pub const AMD_COMGR_DATA_KIND_FATBIN: amd_comgr_data_kind_s = amd_comgr_data_kind_s(16); +} +impl amd_comgr_data_kind_s { + #[doc = " The data is an archive."] + pub const AMD_COMGR_DATA_KIND_AR: amd_comgr_data_kind_s = amd_comgr_data_kind_s(17); +} +impl amd_comgr_data_kind_s { + #[doc = " The data is a bundled bitcode."] + pub const AMD_COMGR_DATA_KIND_BC_BUNDLE: amd_comgr_data_kind_s = amd_comgr_data_kind_s(18); +} +impl amd_comgr_data_kind_s { + #[doc = " The data is a bundled archive."] + pub const AMD_COMGR_DATA_KIND_AR_BUNDLE: amd_comgr_data_kind_s = amd_comgr_data_kind_s(19); +} +impl amd_comgr_data_kind_s { + #[doc = " Marker for last valid data kind."] + pub const AMD_COMGR_DATA_KIND_LAST: amd_comgr_data_kind_s = amd_comgr_data_kind_s(19); +} +#[repr(transparent)] +#[doc = " @brief The kinds of data supported."] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct amd_comgr_data_kind_s(pub ::std::os::raw::c_uint); +#[doc = " @brief The kinds of data supported."] +pub use self::amd_comgr_data_kind_s as amd_comgr_data_kind_t; +#[doc = " @brief A handle to a data object.\n\n Data objects are used to hold the data which is either an input or\n output of a code object manager action."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct amd_comgr_data_s { + pub handle: u64, +} +#[doc = " @brief A handle to a data object.\n\n Data objects are used to hold the data which is either an input or\n output of a code object manager action."] +pub type amd_comgr_data_t = amd_comgr_data_s; +#[doc = " @brief A handle to an action data object.\n\n An action data object holds a set of data objects. These can be\n used as inputs to an action, or produced as the result of an\n action."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct amd_comgr_data_set_s { + pub handle: u64, +} +#[doc = " @brief A handle to an action data object.\n\n An action data object holds a set of data objects. These can be\n used as inputs to an action, or produced as the result of an\n action."] +pub type amd_comgr_data_set_t = amd_comgr_data_set_s; +#[doc = " @brief A handle to an action information object.\n\n An action information object holds all the necessary information,\n excluding the input data objects, required to perform an action."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct amd_comgr_action_info_s { + pub handle: u64, +} +#[doc = " @brief A handle to an action information object.\n\n An action information object holds all the necessary information,\n excluding the input data objects, required to perform an action."] +pub type amd_comgr_action_info_t = amd_comgr_action_info_s; +#[doc = " @brief A handle to a metadata node.\n\n A metadata node handle is used to traverse the metadata associated\n with a data node."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct amd_comgr_metadata_node_s { + pub handle: u64, +} +#[doc = " @brief A handle to a metadata node.\n\n A metadata node handle is used to traverse the metadata associated\n with a data node."] +pub type amd_comgr_metadata_node_t = amd_comgr_metadata_node_s; +#[doc = " @brief A handle to a machine code object symbol.\n\n A symbol handle is used to obtain the properties of symbols of a machine code\n object. A symbol handle is invalidated when the data object containing the\n symbol is destroyed."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct amd_comgr_symbol_s { + pub handle: u64, +} +#[doc = " @brief A handle to a machine code object symbol.\n\n A symbol handle is used to obtain the properties of symbols of a machine code\n object. A symbol handle is invalidated when the data object containing the\n symbol is destroyed."] +pub type amd_comgr_symbol_t = amd_comgr_symbol_s; +#[doc = " @brief A handle to a disassembly information object.\n\n A disassembly information object holds all the necessary information,\n excluding the input data, required to perform disassembly."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct amd_comgr_disassembly_info_s { + pub handle: u64, +} +#[doc = " @brief A handle to a disassembly information object.\n\n A disassembly information object holds all the necessary information,\n excluding the input data, required to perform disassembly."] +pub type amd_comgr_disassembly_info_t = amd_comgr_disassembly_info_s; +#[doc = " @brief A handle to a symbolizer information object.\n\n A symbolizer information object holds all the necessary information\n required to perform symbolization."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct amd_comgr_symbolizer_info_s { + pub handle: u64, +} +#[doc = " @brief A handle to a symbolizer information object.\n\n A symbolizer information object holds all the necessary information\n required to perform symbolization."] +pub type amd_comgr_symbolizer_info_t = amd_comgr_symbolizer_info_s; +extern "C" { + #[must_use] + #[doc = " @brief Return the number of isa names supported by this version of\n the code object manager library.\n\n The isa name specifies the instruction set architecture that should\n be used in the actions that involve machine code generation or\n inspection.\n\n @param[out] count The number of isa names supported.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n count is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources."] + pub fn amd_comgr_get_isa_count(count: *mut usize) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return the Nth isa name supported by this version of the\n code object manager library.\n\n @param[in] index The index of the isa name to be returned. The\n first isa name is index 0.\n\n @param[out] isa_name A null terminated string that is the isa name\n being requested.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n index is greater than the number of isa name supported by this\n version of the code object manager library. @p isa_name is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources."] + pub fn amd_comgr_get_isa_name( + index: usize, + isa_name: *mut *const ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get a handle to the metadata of an isa name.\n\n The structure of the returned metadata is isa name specific and versioned\n with details specified in\n https://llvm.org/docs/AMDGPUUsage.html#code-object-metadata.\n It can include information about the\n limits for resources such as registers and memory addressing.\n\n @param[in] isa_name The isa name to query.\n\n @param[out] metadata A handle to the metadata of the isa name. If\n the isa name has no metadata then the returned handle has a kind of\n @p AMD_COMGR_METADATA_KIND_NULL. The handle must be destroyed\n using @c amd_comgr_destroy_metadata.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n name is NULL or is not an isa name supported by this version of the\n code object manager library. @p metadata is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_get_isa_metadata( + isa_name: *const ::std::os::raw::c_char, + metadata: *mut amd_comgr_metadata_node_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Create a data object that can hold data of a specified kind.\n\n Data objects are reference counted and are destroyed when the\n reference count reaches 0. When a data object is created its\n reference count is 1, it has 0 bytes of data, it has an empty name,\n and it has no metadata.\n\n @param[in] kind The kind of data the object is intended to hold.\n\n @param[out] data A handle to the data object created. Its reference\n count is set to 1.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n kind is an invalid data kind, or @p\n AMD_COMGR_DATA_KIND_UNDEF. @p data is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to create the data object as out of resources."] + pub fn amd_comgr_create_data( + kind: amd_comgr_data_kind_t, + data: *mut amd_comgr_data_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Indicate that no longer using a data object handle.\n\n The reference count of the associated data object is\n decremented. If it reaches 0 it is destroyed.\n\n @param[in] data The data object to release.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object, or has kind @p\n AMD_COMGR_DATA_KIND_UNDEF.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_release_data(data: amd_comgr_data_t) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get the kind of the data object.\n\n @param[in] data The data object to query.\n\n @param[out] kind The kind of data the object.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object. @p kind is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to create the data object as out of resources."] + pub fn amd_comgr_get_data_kind( + data: amd_comgr_data_t, + kind: *mut amd_comgr_data_kind_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Set the data content of a data object to the specified\n bytes.\n\n Any previous value of the data object is overwritten. Any metadata\n associated with the data object is also replaced which invalidates\n all metadata handles to the old metadata.\n\n @param[in] data The data object to update.\n\n @param[in] size The number of bytes in the data specified by @p bytes.\n\n @param[in] bytes The bytes to set the data object to. The bytes are\n copied into the data object and can be freed after the call.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object, or has kind @p\n AMD_COMGR_DATA_KIND_UNDEF.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_set_data( + data: amd_comgr_data_t, + size: usize, + bytes: *const ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief For the given open posix file descriptor, map a slice of the\n file into the data object. The slice is specified by @p offset and @p size.\n Internally this API calls amd_comgr_set_data and resets data object's\n current state.\n\n @param[in, out] data The data object to update.\n\n @param[in] file_descriptor The native file descriptor for an open file.\n The @p file_descriptor must not be passed into a system I/O function\n by any other thread while this function is executing. The offset in\n the file descriptor may be updated based on the requested size and\n underlying platform. The @p file_descriptor may be closed immediately\n after this function returns.\n\n @param[in] offset position relative to the start of the file\n specifying the beginning of the slice in @p file_descriptor.\n\n @param[in] size Size in bytes of the slice.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The operation is successful.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data is an invalid or\n the map operation failed."] + pub fn amd_comgr_set_data_from_file_slice( + data: amd_comgr_data_t, + file_descriptor: ::std::os::raw::c_int, + offset: u64, + size: u64, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Set the name associated with a data object.\n\n When compiling, the full name of an include directive is used to\n reference the contents of the include data object with the same\n name. The name may also be used for other data objects in log and\n diagnostic output.\n\n @param[in] data The data object to update.\n\n @param[in] name A null terminated string that specifies the name to\n use for the data object. If NULL then the name is set to the empty\n string.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object, or has kind @p\n AMD_COMGR_DATA_KIND_UNDEF.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_set_data_name( + data: amd_comgr_data_t, + name: *const ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get the data contents, and/or the size of the data\n associated with a data object.\n\n @param[in] data The data object to query.\n\n @param[in, out] size On entry, the size of @p bytes. On return, if @p bytes\n is NULL, set to the size of the data object contents.\n\n @param[out] bytes If not NULL, then the first @p size bytes of the\n data object contents is copied. If NULL, no data is copied, and\n only @p size is updated (useful in order to find the size of buffer\n required to copy the data).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object, or has kind @p\n AMD_COMGR_DATA_KIND_UNDEF. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_get_data( + data: amd_comgr_data_t, + size: *mut usize, + bytes: *mut ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get the data object name and/or name length.\n\n @param[in] data The data object to query.\n\n @param[in, out] size On entry, the size of @p name. On return, the size of\n the data object name including the terminating null character.\n\n @param[out] name If not NULL, then the first @p size characters of the\n data object name are copied. If @p name is NULL, only @p size is updated\n (useful in order to find the size of buffer required to copy the name).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object, or has kind @p\n AMD_COMGR_DATA_KIND_UNDEF. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_get_data_name( + data: amd_comgr_data_t, + size: *mut usize, + name: *mut ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get the data object isa name and/or isa name length.\n\n @param[in] data The data object to query.\n\n @param[in, out] size On entry, the size of @p isa_name. On return, if @p\n isa_name is NULL, set to the size of the isa name including the terminating\n null character.\n\n @param[out] isa_name If not NULL, then the first @p size characters\n of the isa name are copied. If NULL, no isa name is copied, and\n only @p size is updated (useful in order to find the size of buffer\n required to copy the isa name).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object, has kind @p\n AMD_COMGR_DATA_KIND_UNDEF, or is not an isa specific\n kind. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_get_data_isa_name( + data: amd_comgr_data_t, + size: *mut usize, + isa_name: *mut ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Create a symbolizer info object.\n\n @param[in] code_object A data object denoting a code object for which\n symbolization should be performed. The kind of this object must be\n ::AMD_COMGR_DATA_KIND_RELOCATABLE, ::AMD_COMGR_DATA_KIND_EXECUTABLE,\n or ::AMD_COMGR_DATA_KIND_BYTES.\n\n @param[in] print_symbol_callback Function called by a successfull\n symbolize query. @p symbol is a null-terminated string containing the\n symbolization of the address and @p user_data is an arbitary user data.\n The callback does not own @p symbol, and it cannot be referenced once\n the callback returns.\n\n @param[out] symbolizer_info A handle to the symbolizer info object created.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT if @p code_object is\n invalid or @p print_symbol_callback is null.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to create @p symbolizer_info as out of resources."] + pub fn amd_comgr_create_symbolizer_info( + code_object: amd_comgr_data_t, + print_symbol_callback: ::std::option::Option< + unsafe extern "C" fn( + symbol: *const ::std::os::raw::c_char, + user_data: *mut ::std::os::raw::c_void, + ), + >, + symbolizer_info: *mut amd_comgr_symbolizer_info_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Destroy symbolizer info object.\n\n @param[in] symbolizer_info A handle to symbolizer info object to destroy.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS on successful execution.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT if @p\n symbolizer_info is invalid."] + pub fn amd_comgr_destroy_symbolizer_info( + symbolizer_info: amd_comgr_symbolizer_info_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Symbolize an address.\n\n The @p address is symbolized using the symbol definitions of the\n @p code_object specified when the @p symbolizer_info was created.\n The @p print_symbol_callback callback function specified when the\n @p symbolizer_info was created is called passing the\n symbolization result as @p symbol and @p user_data value.\n\n If symbolization is not possible ::AMD_COMGR_STATUS_SUCCESS is returned and\n the string passed to the @p symbol argument of the @p print_symbol_callback\n specified when the @p symbolizer_info was created contains the text\n \"\" or \"??\". This is consistent with `llvm-symbolizer` utility.\n\n @param[in] symbolizer_info A handle to symbolizer info object which should be\n used to symbolize the @p address.\n\n @param[in] address An unrelocated ELF address to which symbolization\n query should be performed.\n\n @param[in] is_code if true, the symbolizer symbolize the address as code\n and the symbolization result contains filename, function name, line number\n and column number, else the symbolizer symbolize the address as data and\n the symbolizaion result contains symbol name, symbol's starting address\n and symbol size.\n\n @param[in] user_data Arbitrary user-data passed to @p print_symbol_callback\n callback as described for @p symbolizer_info argument.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n symbolizer_info is an invalid data object."] + pub fn amd_comgr_symbolize( + symbolizer_info: amd_comgr_symbolizer_info_t, + address: u64, + is_code: bool, + user_data: *mut ::std::os::raw::c_void, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get a handle to the metadata of a data object.\n\n @param[in] data The data object to query.\n\n @param[out] metadata A handle to the metadata of the data\n object. If the data object has no metadata then the returned handle\n has a kind of @p AMD_COMGR_METADATA_KIND_NULL. The\n handle must be destroyed using @c amd_comgr_destroy_metadata.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n data is an invalid data object, or has kind @p\n AMD_COMGR_DATA_KIND_UNDEF. @p metadata is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_get_data_metadata( + data: amd_comgr_data_t, + metadata: *mut amd_comgr_metadata_node_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Destroy a metadata handle.\n\n @param[in] metadata A metadata handle to destroy.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p metadata is an invalid\n metadata handle.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to update metadata\n handle as out of resources."] + pub fn amd_comgr_destroy_metadata(metadata: amd_comgr_metadata_node_t) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Create a data set object.\n\n @param[out] data_set A handle to the data set created. Initially it\n contains no data objects.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data_set is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to create the data\n set object as out of resources."] + pub fn amd_comgr_create_data_set(data_set: *mut amd_comgr_data_set_t) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Destroy a data set object.\n\n The reference counts of any associated data objects are decremented. Any\n handles to the data set object become invalid.\n\n @param[in] data_set A handle to the data set object to destroy.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data_set is an invalid\n data set object.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to update data set\n object as out of resources."] + pub fn amd_comgr_destroy_data_set(data_set: amd_comgr_data_set_t) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Add a data object to a data set object if it is not already added.\n\n The reference count of the data object is incremented.\n\n @param[in] data_set A handle to the data set object to be updated.\n\n @param[in] data A handle to the data object to be added. If @p data_set\n already has the specified handle present, then it is not added. The order\n that data objects are added is preserved.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data_set is an invalid\n data set object. @p data is an invalid data object; has undef kind; has\n include kind but does not have a name.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to update data set\n object as out of resources."] + pub fn amd_comgr_data_set_add( + data_set: amd_comgr_data_set_t, + data: amd_comgr_data_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Remove all data objects of a specified kind from a data set object.\n\n The reference count of the removed data objects is decremented.\n\n @param[in] data_set A handle to the data set object to be updated.\n\n @param[in] data_kind The data kind of the data objects to be removed. If @p\n AMD_COMGR_DATA_KIND_UNDEF is specified then all data objects are removed.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data_set is an invalid\n data set object. @p data_kind is an invalid data kind.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to update data set\n object as out of resources."] + pub fn amd_comgr_data_set_remove( + data_set: amd_comgr_data_set_t, + data_kind: amd_comgr_data_kind_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return the number of data objects of a specified data kind that are\n added to a data set object.\n\n @param[in] data_set A handle to the data set object to be queried.\n\n @param[in] data_kind The data kind of the data objects to be counted.\n\n @param[out] count The number of data objects of data kind @p data_kind.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data_set is an invalid\n data set object. @p data_kind is an invalid data kind or @p\n AMD_COMGR_DATA_KIND_UNDEF. @p count is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to query data set\n object as out of resources."] + pub fn amd_comgr_action_data_count( + data_set: amd_comgr_data_set_t, + data_kind: amd_comgr_data_kind_t, + count: *mut usize, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return the Nth data object of a specified data kind that is added to a\n data set object.\n\n The reference count of the returned data object is incremented.\n\n @param[in] data_set A handle to the data set object to be queried.\n\n @param[in] data_kind The data kind of the data object to be returned.\n\n @param[in] index The index of the data object of data kind @data_kind to be\n returned. The first data object is index 0. The order of data objects matches\n the order that they were added to the data set object.\n\n @param[out] data The data object being requested.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data_set is an invalid\n data set object. @p data_kind is an invalid data kind or @p\n AMD_COMGR_DATA_KIND_UNDEF. @p index is greater than the number of data\n objects of kind @p data_kind. @p data is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to query data set\n object as out of resources."] + pub fn amd_comgr_action_data_get_data( + data_set: amd_comgr_data_set_t, + data_kind: amd_comgr_data_kind_t, + index: usize, + data: *mut amd_comgr_data_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Create an action info object.\n\n @param[out] action_info A handle to the action info object created.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to create the action info object as out of resources."] + pub fn amd_comgr_create_action_info( + action_info: *mut amd_comgr_action_info_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Destroy an action info object.\n\n @param[in] action_info A handle to the action info object to destroy.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources."] + pub fn amd_comgr_destroy_action_info( + action_info: amd_comgr_action_info_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Set the isa name of an action info object.\n\n When an action info object is created it has no isa name. Some\n actions require that the action info object has an isa name\n defined.\n\n @param[in] action_info A handle to the action info object to be\n updated.\n\n @param[in] isa_name A null terminated string that is the isa name. If NULL\n or the empty string then the isa name is cleared. The isa name is defined as\n the Code Object Target Identification string, described at\n https://llvm.org/docs/AMDGPUUsage.html#code-object-target-identification\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object. @p isa_name is not an\n isa name supported by this version of the code object manager\n library.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources."] + pub fn amd_comgr_action_info_set_isa_name( + action_info: amd_comgr_action_info_t, + isa_name: *const ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get the isa name and/or isa name length.\n\n @param[in] action_info The action info object to query.\n\n @param[in, out] size On entry, the size of @p isa_name. On return, if @p\n isa_name is NULL, set to the size of the isa name including the terminating\n null character.\n\n @param[out] isa_name If not NULL, then the first @p size characters of the\n isa name are copied into @p isa_name. If the isa name is not set then an\n empty string is copied into @p isa_name. If NULL, no name is copied, and\n only @p size is updated (useful in order to find the size of buffer required\n to copy the name).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_action_info_get_isa_name( + action_info: amd_comgr_action_info_t, + size: *mut usize, + isa_name: *mut ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Set the source language of an action info object.\n\n When an action info object is created it has no language defined\n which is represented by @p\n AMD_COMGR_LANGUAGE_NONE. Some actions require that\n the action info object has a source language defined.\n\n @param[in] action_info A handle to the action info object to be\n updated.\n\n @param[in] language The language to set. If @p\n AMD_COMGR_LANGUAGE_NONE then the language is cleared.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object. @p language is an\n invalid language.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources."] + pub fn amd_comgr_action_info_set_language( + action_info: amd_comgr_action_info_t, + language: amd_comgr_language_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get the language for an action info object.\n\n @param[in] action_info The action info object to query.\n\n @param[out] language The language of the action info opject. @p\n AMD_COMGR_LANGUAGE_NONE if not defined,\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object. @p language is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_action_info_get_language( + action_info: amd_comgr_action_info_t, + language: *mut amd_comgr_language_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Set the options string of an action info object.\n\n When an action info object is created it has an empty options string.\n\n This overrides any option strings or arrays previously set by calls to this\n function or @p amd_comgr_action_info_set_option_list.\n\n An @p action_info object which had its options set with this function can\n only have its option inspected with @p amd_comgr_action_info_get_options.\n\n @param[in] action_info A handle to the action info object to be\n updated.\n\n @param[in] options A null terminated string that is the options. If\n NULL or the empty string then the options are cleared.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources.\n\n @deprecated since 1.3\n @see amd_comgr_action_info_set_option_list"] + pub fn amd_comgr_action_info_set_options( + action_info: amd_comgr_action_info_t, + options: *const ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get the options string and/or options strings length of an action\n info object.\n\n The @p action_info object must have had its options set with @p\n amd_comgr_action_info_set_options.\n\n @param[in] action_info The action info object to query.\n\n @param[in, out] size On entry, the size of @p options. On return, if @p\n options is NULL, set to the size of the options including the terminating\n null character.\n\n @param[out] options If not NULL, then the first @p size characters of\n the options are copied. If the options are not set then an empty\n string is copied. If NULL, options is not copied, and only @p size\n is updated (useful inorder to find the size of buffer required to\n copy the options).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The options of @p action_info were not set\n with @p amd_comgr_action_info_set_options.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources.\n\n @deprecated since 1.3\n @see amd_comgr_action_info_get_option_list_count and\n amd_comgr_action_info_get_option_list_item"] + pub fn amd_comgr_action_info_get_options( + action_info: amd_comgr_action_info_t, + size: *mut usize, + options: *mut ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Set the options array of an action info object.\n\n This overrides any option strings or arrays previously set by calls to this\n function or @p amd_comgr_action_info_set_options.\n\n An @p action_info object which had its options set with this function can\n only have its option inspected with @p\n amd_comgr_action_info_get_option_list_count and @p\n amd_comgr_action_info_get_option_list_item.\n\n @param[in] action_info A handle to the action info object to be updated.\n\n @param[in] options An array of null terminated strings. May be NULL if @p\n count is zero, which will result in an empty options array.\n\n @param[in] count The number of null terminated strings in @p options.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p action_info is an\n invalid action info object, or @p options is NULL and @p count is non-zero.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to update action\n info object as out of resources."] + pub fn amd_comgr_action_info_set_option_list( + action_info: amd_comgr_action_info_t, + options: *mut *const ::std::os::raw::c_char, + count: usize, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return the number of options in the options array.\n\n The @p action_info object must have had its options set with @p\n amd_comgr_action_info_set_option_list.\n\n @param[in] action_info The action info object to query.\n\n @param[out] count The number of options in the options array.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The options of @p action_info were never\n set, or not set with @p amd_comgr_action_info_set_option_list.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p action_info is an\n invalid action info object, or @p count is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to query the data\n object as out of resources."] + pub fn amd_comgr_action_info_get_option_list_count( + action_info: amd_comgr_action_info_t, + count: *mut usize, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return the Nth option string in the options array and/or that\n option's length.\n\n The @p action_info object must have had its options set with @p\n amd_comgr_action_info_set_option_list.\n\n @param[in] action_info The action info object to query.\n\n @param[in] index The index of the option to be returned. The first option\n index is 0. The order is the same as the options when they were added in @p\n amd_comgr_action_info_set_options.\n\n @param[in, out] size On entry, the size of @p option. On return, if @option\n is NULL, set to the size of the Nth option string including the terminating\n null character.\n\n @param[out] option If not NULL, then the first @p size characters of the Nth\n option string are copied into @p option. If NULL, no option string is\n copied, and only @p size is updated (useful in order to find the size of\n buffer required to copy the option string).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The options of @p action_info were never\n set, or not set with @p amd_comgr_action_info_set_option_list.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p action_info is an\n invalid action info object, @p index is invalid, or @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to query the data\n object as out of resources."] + pub fn amd_comgr_action_info_get_option_list_item( + action_info: amd_comgr_action_info_t, + index: usize, + size: *mut usize, + option: *mut ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Set the working directory of an action info object.\n\n When an action info object is created it has an empty working\n directory. Some actions use the working directory to resolve\n relative file paths.\n\n @param[in] action_info A handle to the action info object to be\n updated.\n\n @param[in] path A null terminated string that is the working\n directory path. If NULL or the empty string then the working\n directory is cleared.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources."] + pub fn amd_comgr_action_info_set_working_directory_path( + action_info: amd_comgr_action_info_t, + path: *const ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get the working directory path and/or working directory path\n length of an action info object.\n\n @param[in] action_info The action info object to query.\n\n @param[in, out] size On entry, the size of @p path. On return, if @p path is\n NULL, set to the size of the working directory path including the\n terminating null character.\n\n @param[out] path If not NULL, then the first @p size characters of\n the working directory path is copied. If the working directory path\n is not set then an empty string is copied. If NULL, the working\n directory path is not copied, and only @p size is updated (useful\n in order to find the size of buffer required to copy the working\n directory path).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_action_info_get_working_directory_path( + action_info: amd_comgr_action_info_t, + size: *mut usize, + path: *mut ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Set whether logging is enabled for an action info object.\n\n @param[in] action_info A handle to the action info object to be\n updated.\n\n @param[in] logging Whether logging should be enabled or disable.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action info object as out of resources."] + pub fn amd_comgr_action_info_set_logging( + action_info: amd_comgr_action_info_t, + logging: bool, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get whether logging is enabled for an action info object.\n\n @param[in] action_info The action info object to query.\n\n @param[out] logging Whether logging is enabled.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n action_info is an invalid action info object. @p logging is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_action_info_get_logging( + action_info: amd_comgr_action_info_t, + logging: *mut bool, + ) -> amd_comgr_status_t; +} +impl amd_comgr_action_kind_s { + #[doc = " Preprocess each source data object in @p input in order. For each\n successful preprocessor invocation, add a source data object to @p result.\n Resolve any include source names using the names of include data objects\n in @p input. Resolve any include relative path names using the working\n directory path in @p info. Preprocess the source for the language in @p\n info.\n\n Return @p AMD_COMGR_STATUS_ERROR if any preprocessing fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name or language is not set in @p info."] + pub const AMD_COMGR_ACTION_SOURCE_TO_PREPROCESSOR: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(0); +} +impl amd_comgr_action_kind_s { + #[doc = " Copy all existing data objects in @p input to @p output, then add the\n device-specific and language-specific precompiled headers required for\n compilation.\n\n Currently the only supported languages are @p AMD_COMGR_LANGUAGE_OPENCL_1_2\n and @p AMD_COMGR_LANGUAGE_OPENCL_2_0.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT if isa name or language\n is not set in @p info, or the language is not supported."] + pub const AMD_COMGR_ACTION_ADD_PRECOMPILED_HEADERS: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(1); +} +impl amd_comgr_action_kind_s { + #[doc = " Compile each source data object in @p input in order. For each\n successful compilation add a bc data object to @p result. Resolve\n any include source names using the names of include data objects\n in @p input. Resolve any include relative path names using the\n working directory path in @p info. Produce bc for isa name in @p\n info. Compile the source for the language in @p info.\n\n Return @p AMD_COMGR_STATUS_ERROR if any compilation\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name or language is not set in @p info."] + pub const AMD_COMGR_ACTION_COMPILE_SOURCE_TO_BC: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(2); +} +impl amd_comgr_action_kind_s { + #[doc = " Copy all existing data objects in @p input to @p output, then add the\n device-specific and language-specific bitcode libraries required for\n compilation.\n\n Currently the only supported languages are @p AMD_COMGR_LANGUAGE_OPENCL_1_2,\n @p AMD_COMGR_LANGUAGE_OPENCL_2_0, and @p AMD_COMGR_LANGUAGE_HIP.\n\n The options in @p info should be set to a set of language-specific flags.\n For OpenCL and HIP these include:\n\n correctly_rounded_sqrt\n daz_opt\n finite_only\n unsafe_math\n wavefrontsize64\n\n For example, to enable daz_opt and unsafe_math, the options should be set\n as:\n\n const char *options[] = {\"daz_opt, \"unsafe_math\"};\n size_t optionsCount = sizeof(options) / sizeof(options[0]);\n amd_comgr_action_info_set_option_list(info, options, optionsCount);\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT if isa name or language\n is not set in @p info, the language is not supported, an unknown\n language-specific flag is supplied, or a language-specific flag is\n repeated.\n\n @deprecated since 1.7\n @warning This action, followed by @c AMD_COMGR_ACTION_LINK_BC_TO_BC, may\n result in subtle bugs due to incorrect linking of the device libraries.\n The @c AMD_COMGR_ACTION_COMPILE_SOURCE_WITH_DEVICE_LIBS_TO_BC action can\n be used as a workaround which ensures the link occurs correctly."] + pub const AMD_COMGR_ACTION_ADD_DEVICE_LIBRARIES: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(3); +} +impl amd_comgr_action_kind_s { + #[doc = " Link a collection of bitcodes, bundled bitcodes, and bundled bitcode\n archives in @p into a single composite (unbundled) bitcode @p.\n Any device library bc data object must be explicitly added to @p input if\n needed.\n\n Return @p AMD_COMGR_STATUS_ERROR if the link or unbundling fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if IsaName is not set in @p info and does not match the isa name\n of all bc data objects in @p input, or if the Name field is not set for\n any DataObject in the input set."] + pub const AMD_COMGR_ACTION_LINK_BC_TO_BC: amd_comgr_action_kind_s = amd_comgr_action_kind_s(4); +} +impl amd_comgr_action_kind_s { + #[doc = " Optimize each bc data object in @p input and create an optimized bc data\n object to @p result.\n\n Return @p AMD_COMGR_STATUS_ERROR if the optimization fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info and does not match the isa name\n of all bc data objects in @p input."] + pub const AMD_COMGR_ACTION_OPTIMIZE_BC_TO_BC: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(5); +} +impl amd_comgr_action_kind_s { + #[doc = " Perform code generation for each bc data object in @p input in\n order. For each successful code generation add a relocatable data\n object to @p result.\n\n Return @p AMD_COMGR_STATUS_ERROR if any code\n generation fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info and does not match the isa name\n of all bc data objects in @p input."] + pub const AMD_COMGR_ACTION_CODEGEN_BC_TO_RELOCATABLE: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(6); +} +impl amd_comgr_action_kind_s { + #[doc = " Perform code generation for each bc data object in @p input in\n order. For each successful code generation add an assembly source data\n object to @p result.\n\n Return @p AMD_COMGR_STATUS_ERROR if any code\n generation fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info and does not match the isa name\n of all bc data objects in @p input."] + pub const AMD_COMGR_ACTION_CODEGEN_BC_TO_ASSEMBLY: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(7); +} +impl amd_comgr_action_kind_s { + #[doc = " Link each relocatable data object in @p input together and add\n the linked relocatable data object to @p result. Any device\n library relocatable data object must be explicitly added to @p\n input if needed.\n\n Return @p AMD_COMGR_STATUS_ERROR if the link fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info and does not match the isa name\n of all relocatable data objects in @p input."] + pub const AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_RELOCATABLE: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(8); +} +impl amd_comgr_action_kind_s { + #[doc = " Link each relocatable data object in @p input together and add\n the linked executable data object to @p result. Any device\n library relocatable data object must be explicitly added to @p\n input if needed.\n\n Return @p AMD_COMGR_STATUS_ERROR if the link fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info and does not match the isa name\n of all relocatable data objects in @p input."] + pub const AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_EXECUTABLE: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(9); +} +impl amd_comgr_action_kind_s { + #[doc = " Assemble each source data object in @p input in order into machine code.\n For each successful assembly add a relocatable data object to @p result.\n Resolve any include source names using the names of include data objects in\n @p input. Resolve any include relative path names using the working\n directory path in @p info. Produce relocatable for isa name in @p info.\n\n Return @p AMD_COMGR_STATUS_ERROR if any assembly fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT if isa name is not set in\n @p info."] + pub const AMD_COMGR_ACTION_ASSEMBLE_SOURCE_TO_RELOCATABLE: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(10); +} +impl amd_comgr_action_kind_s { + #[doc = " Disassemble each relocatable data object in @p input in\n order. For each successful disassembly add a source data object to\n @p result.\n\n Return @p AMD_COMGR_STATUS_ERROR if any disassembly\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info and does not match the isa name\n of all relocatable data objects in @p input."] + pub const AMD_COMGR_ACTION_DISASSEMBLE_RELOCATABLE_TO_SOURCE: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(11); +} +impl amd_comgr_action_kind_s { + #[doc = " Disassemble each executable data object in @p input in order. For\n each successful disassembly add a source data object to @p result.\n\n Return @p AMD_COMGR_STATUS_ERROR if any disassembly\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info and does not match the isa name\n of all relocatable data objects in @p input."] + pub const AMD_COMGR_ACTION_DISASSEMBLE_EXECUTABLE_TO_SOURCE: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(12); +} +impl amd_comgr_action_kind_s { + #[doc = " Disassemble each bytes data object in @p input in order. For each\n successful disassembly add a source data object to @p\n result. Only simple assembly language commands are generate that\n corresponf to raw bytes are supported, not any directives that\n control the code object layout, or symbolic branch targets or\n names.\n\n Return @p AMD_COMGR_STATUS_ERROR if any disassembly\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name is not set in @p info"] + pub const AMD_COMGR_ACTION_DISASSEMBLE_BYTES_TO_SOURCE: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(13); +} +impl amd_comgr_action_kind_s { + #[doc = " Compile each source data object in @p input in order. For each\n successful compilation add a fat binary to @p result. Resolve\n any include source names using the names of include data objects\n in @p input. Resolve any include relative path names using the\n working directory path in @p info. Produce fat binary for isa name in @p\n info. Compile the source for the language in @p info.\n\n Return @p AMD_COMGR_STATUS_ERROR if any compilation\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name or language is not set in @p info.\n\n @deprecated since 2.5\n @see in-process compilation via AMD_COMGR_ACTION_COMPILE_SOURCE_TO_BC, etc.\n insteaad"] + pub const AMD_COMGR_ACTION_COMPILE_SOURCE_TO_FATBIN: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(14); +} +impl amd_comgr_action_kind_s { + #[doc = " Compile each source data object in @p input in order. For each\n successful compilation add a bc data object to @p result. Resolve\n any include source names using the names of include data objects\n in @p input. Resolve any include relative path names using the\n working directory path in @p info. Produce bc for isa name in @p\n info. Compile the source for the language in @p info. Link against\n the device-specific and language-specific bitcode device libraries\n required for compilation.\n\n Return @p AMD_COMGR_STATUS_ERROR if any compilation\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name or language is not set in @p info."] + pub const AMD_COMGR_ACTION_COMPILE_SOURCE_WITH_DEVICE_LIBS_TO_BC: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(15); +} +impl amd_comgr_action_kind_s { + #[doc = " Compile a single source data object in @p input in order. For each\n successful compilation add a relocatable data object to @p result.\n Resolve any include source names using the names of include data objects\n in @p input. Resolve any include relative path names using the\n working directory path in @p info. Produce relocatable for hip name in @p\n info. Compile the source for the language in @p info. Link against\n the device-specific and language-specific bitcode device libraries\n required for compilation. Currently only supports HIP language.\n\n Return @p AMD_COMGR_STATUS_ERROR if any compilation\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name or language is not set in @p info."] + pub const AMD_COMGR_ACTION_COMPILE_SOURCE_TO_RELOCATABLE: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(16); +} +impl amd_comgr_action_kind_s { + #[doc = " Compile each source data object in @p input and create a single executabele\n in @p result. Resolve any include source names using the names of include\n data objects in @p input. Resolve any include relative path names using the\n working directory path in @p info. Produce executable for isa name in @p\n info. Compile the source for the language in @p info. Link against\n the device-specific and language-specific bitcode device libraries\n required for compilation.\n\n Return @p AMD_COMGR_STATUS_ERROR if any compilation\n fails.\n\n Return @p AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT\n if isa name or language is not set in @p info."] + pub const AMD_COMGR_ACTION_COMPILE_SOURCE_TO_EXECUTABLE: amd_comgr_action_kind_s = + amd_comgr_action_kind_s(17); +} +impl amd_comgr_action_kind_s { + #[doc = " Marker for last valid action kind."] + pub const AMD_COMGR_ACTION_LAST: amd_comgr_action_kind_s = amd_comgr_action_kind_s(17); +} +#[repr(transparent)] +#[doc = " @brief The kinds of actions that can be performed."] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct amd_comgr_action_kind_s(pub ::std::os::raw::c_uint); +#[doc = " @brief The kinds of actions that can be performed."] +pub use self::amd_comgr_action_kind_s as amd_comgr_action_kind_t; +extern "C" { + #[must_use] + #[doc = " @brief Perform an action.\n\n Each action ignores any data objects in @p input that it does not\n use. If logging is enabled in @info then @p result will have a log\n data object added. Any diagnostic data objects produced by the\n action will be added to @p result. See the description of each\n action in @p amd_comgr_action_kind_t.\n\n @param[in] kind The action to perform.\n\n @param[in] info The action info to use when performing the action.\n\n @param[in] input The input data objects to the @p kind action.\n\n @param[out] result Any data objects are removed before performing\n the action which then adds all data objects produced by the action.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR An error was\n reported when executing the action.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n kind is an invalid action kind. @p input_data or @p result_data are\n invalid action data object handles. See the description of each\n action in @p amd_comgr_action_kind_t for other\n conditions that result in this status.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_do_action( + kind: amd_comgr_action_kind_t, + info: amd_comgr_action_info_t, + input: amd_comgr_data_set_t, + result: amd_comgr_data_set_t, + ) -> amd_comgr_status_t; +} +impl amd_comgr_metadata_kind_s { + #[doc = " The NULL metadata handle."] + pub const AMD_COMGR_METADATA_KIND_NULL: amd_comgr_metadata_kind_s = + amd_comgr_metadata_kind_s(0); +} +impl amd_comgr_metadata_kind_s { + #[doc = " A sting value."] + pub const AMD_COMGR_METADATA_KIND_STRING: amd_comgr_metadata_kind_s = + amd_comgr_metadata_kind_s(1); +} +impl amd_comgr_metadata_kind_s { + #[doc = " A map that consists of a set of key and value pairs."] + pub const AMD_COMGR_METADATA_KIND_MAP: amd_comgr_metadata_kind_s = amd_comgr_metadata_kind_s(2); +} +impl amd_comgr_metadata_kind_s { + #[doc = " A list that consists of a sequence of values."] + pub const AMD_COMGR_METADATA_KIND_LIST: amd_comgr_metadata_kind_s = + amd_comgr_metadata_kind_s(3); +} +impl amd_comgr_metadata_kind_s { + #[doc = " Marker for last valid metadata kind."] + pub const AMD_COMGR_METADATA_KIND_LAST: amd_comgr_metadata_kind_s = + amd_comgr_metadata_kind_s(3); +} +#[repr(transparent)] +#[doc = " @brief The kinds of metadata nodes."] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct amd_comgr_metadata_kind_s(pub ::std::os::raw::c_uint); +#[doc = " @brief The kinds of metadata nodes."] +pub use self::amd_comgr_metadata_kind_s as amd_comgr_metadata_kind_t; +extern "C" { + #[must_use] + #[doc = " @brief Get the kind of the metadata node.\n\n @param[in] metadata The metadata node to query.\n\n @param[out] kind The kind of the metadata node.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n metadata is an invalid metadata node. @p kind is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to create the data object as out of resources."] + pub fn amd_comgr_get_metadata_kind( + metadata: amd_comgr_metadata_node_t, + kind: *mut amd_comgr_metadata_kind_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get the string and/or string length from a metadata string\n node.\n\n @param[in] metadata The metadata node to query.\n\n @param[in, out] size On entry, the size of @p string. On return, if @p\n string is NULL, set to the size of the string including the terminating null\n character.\n\n @param[out] string If not NULL, then the first @p size characters\n of the string are copied. If NULL, no string is copied, and only @p\n size is updated (useful in order to find the size of buffer required\n to copy the string).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n metadata is an invalid metadata node, or does not have kind @p\n AMD_COMGR_METADATA_KIND_STRING. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_get_metadata_string( + metadata: amd_comgr_metadata_node_t, + size: *mut usize, + string: *mut ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get the map size from a metadata map node.\n\n @param[in] metadata The metadata node to query.\n\n @param[out] size The number of entries in the map.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n metadata is an invalid metadata node, or not of kind @p\n AMD_COMGR_METADATA_KIND_MAP. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_get_metadata_map_size( + metadata: amd_comgr_metadata_node_t, + size: *mut usize, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Iterate over the elements a metadata map node.\n\n @warning The metadata nodes which are passed to the callback are not owned\n by the callback, and are freed just after the callback returns. The callback\n must not save any references to its parameters between iterations.\n\n @param[in] metadata The metadata node to query.\n\n @param[in] callback The function to call for each entry in the map. The\n entry's key is passed in @p key, the entry's value is passed in @p value, and\n @p user_data is passed as @p user_data. If the function returns with a status\n other than @p AMD_COMGR_STATUS_SUCCESS then iteration is stopped.\n\n @param[in] user_data The value to pass to each invocation of @p\n callback. Allows context to be passed into the call back function.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR An error was\n reported by @p callback.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n metadata is an invalid metadata node, or not of kind @p\n AMD_COMGR_METADATA_KIND_MAP. @p callback is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to iterate the metadata as out of resources."] + pub fn amd_comgr_iterate_map_metadata( + metadata: amd_comgr_metadata_node_t, + callback: ::std::option::Option< + unsafe extern "C" fn( + key: amd_comgr_metadata_node_t, + value: amd_comgr_metadata_node_t, + user_data: *mut ::std::os::raw::c_void, + ) -> amd_comgr_status_t, + >, + user_data: *mut ::std::os::raw::c_void, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Use a string key to lookup an element of a metadata map\n node and return the entry value.\n\n @param[in] metadata The metadata node to query.\n\n @param[in] key A null terminated string that is the key to lookup.\n\n @param[out] value The metadata node of the @p key element of the\n @p metadata map metadata node. The handle must be destroyed\n using @c amd_comgr_destroy_metadata.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The map has no entry\n with a string key with the value @p key.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n metadata is an invalid metadata node, or not of kind @p\n AMD_COMGR_METADATA_KIND_MAP. @p key or @p value is\n NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to lookup metadata as out of resources."] + pub fn amd_comgr_metadata_lookup( + metadata: amd_comgr_metadata_node_t, + key: *const ::std::os::raw::c_char, + value: *mut amd_comgr_metadata_node_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get the list size from a metadata list node.\n\n @param[in] metadata The metadata node to query.\n\n @param[out] size The number of entries in the list.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n metadata is an invalid metadata node, or does nopt have kind @p\n AMD_COMGR_METADATA_KIND_LIST. @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update the data object as out of resources."] + pub fn amd_comgr_get_metadata_list_size( + metadata: amd_comgr_metadata_node_t, + size: *mut usize, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return the Nth metadata node of a list metadata node.\n\n @param[in] metadata The metadata node to query.\n\n @param[in] index The index being requested. The first list element\n is index 0.\n\n @param[out] value The metadata node of the @p index element of the\n @p metadata list metadata node. The handle must be destroyed\n using @c amd_comgr_destroy_metadata.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p\n metadata is an invalid metadata node or not of kind @p\n AMD_COMGR_METADATA_INFO_LIST. @p index is greater\n than the number of list elements. @p value is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to update action data object as out of resources."] + pub fn amd_comgr_index_list_metadata( + metadata: amd_comgr_metadata_node_t, + index: usize, + value: *mut amd_comgr_metadata_node_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Iterate over the symbols of a machine code object.\n\n For a AMD_COMGR_DATA_KIND_RELOCATABLE the symbols in the ELF symtab section\n are iterated. For a AMD_COMGR_DATA_KIND_EXECUTABLE the symbols in the ELF\n dynsymtab are iterated.\n\n @param[in] data The data object to query.\n\n @param[in] callback The function to call for each symbol in the machine code\n data object. The symbol handle is passed in @p symbol and @p user_data is\n passed as @p user_data. If the function returns with a status other than @p\n AMD_COMGR_STATUS_SUCCESS then iteration is stopped.\n\n @param[in] user_data The value to pass to each invocation of @p\n callback. Allows context to be passed into the call back function.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR An error was\n reported by @p callback.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data is an invalid data\n object, or not of kind @p AMD_COMGR_DATA_KIND_RELOCATABLE or\n AMD_COMGR_DATA_KIND_EXECUTABLE. @p callback is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to iterate the data object as out of resources."] + pub fn amd_comgr_iterate_symbols( + data: amd_comgr_data_t, + callback: ::std::option::Option< + unsafe extern "C" fn( + symbol: amd_comgr_symbol_t, + user_data: *mut ::std::os::raw::c_void, + ) -> amd_comgr_status_t, + >, + user_data: *mut ::std::os::raw::c_void, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Lookup a symbol in a machine code object by name.\n\n For a AMD_COMGR_DATA_KIND_RELOCATABLE the symbols in the ELF symtab section\n are inspected. For a AMD_COMGR_DATA_KIND_EXECUTABLE the symbols in the ELF\n dynsymtab are inspected.\n\n @param[in] data The data object to query.\n\n @param[in] name A null terminated string that is the symbol name to lookup.\n\n @param[out] symbol The symbol with the @p name.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The machine code object has no symbol\n with @p name.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data is an invalid data\n object, or not of kind @p AMD_COMGR_DATA_KIND_RELOCATABLE or\n AMD_COMGR_DATA_KIND_EXECUTABLE.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to lookup symbol as out of resources."] + pub fn amd_comgr_symbol_lookup( + data: amd_comgr_data_t, + name: *const ::std::os::raw::c_char, + symbol: *mut amd_comgr_symbol_t, + ) -> amd_comgr_status_t; +} +impl amd_comgr_symbol_type_s { + #[doc = " The symbol's type is unknown.\n\n The user should not infer any specific type for symbols which return\n `AMD_COMGR_SYMBOL_TYPE_UNKNOWN`, and these symbols may return different\n types in future releases."] + pub const AMD_COMGR_SYMBOL_TYPE_UNKNOWN: amd_comgr_symbol_type_s = amd_comgr_symbol_type_s(-1); +} +impl amd_comgr_symbol_type_s { + #[doc = " The symbol's type is not specified."] + pub const AMD_COMGR_SYMBOL_TYPE_NOTYPE: amd_comgr_symbol_type_s = amd_comgr_symbol_type_s(0); +} +impl amd_comgr_symbol_type_s { + #[doc = " The symbol is associated with a data object, such as a variable, an array,\n and so on."] + pub const AMD_COMGR_SYMBOL_TYPE_OBJECT: amd_comgr_symbol_type_s = amd_comgr_symbol_type_s(1); +} +impl amd_comgr_symbol_type_s { + #[doc = " The symbol is associated with a function or other executable code."] + pub const AMD_COMGR_SYMBOL_TYPE_FUNC: amd_comgr_symbol_type_s = amd_comgr_symbol_type_s(2); +} +impl amd_comgr_symbol_type_s { + #[doc = " The symbol is associated with a section. Symbol table entries of this type\n exist primarily for relocation."] + pub const AMD_COMGR_SYMBOL_TYPE_SECTION: amd_comgr_symbol_type_s = amd_comgr_symbol_type_s(3); +} +impl amd_comgr_symbol_type_s { + #[doc = " Conventionally, the symbol's name gives the name of the source file\n associated with the object file."] + pub const AMD_COMGR_SYMBOL_TYPE_FILE: amd_comgr_symbol_type_s = amd_comgr_symbol_type_s(4); +} +impl amd_comgr_symbol_type_s { + #[doc = " The symbol labels an uninitialized common block."] + pub const AMD_COMGR_SYMBOL_TYPE_COMMON: amd_comgr_symbol_type_s = amd_comgr_symbol_type_s(5); +} +impl amd_comgr_symbol_type_s { + #[doc = " The symbol is associated with an AMDGPU Code Object V2 kernel function."] + pub const AMD_COMGR_SYMBOL_TYPE_AMDGPU_HSA_KERNEL: amd_comgr_symbol_type_s = + amd_comgr_symbol_type_s(10); +} +#[repr(transparent)] +#[doc = " @brief Machine code object symbol type."] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct amd_comgr_symbol_type_s(pub ::std::os::raw::c_int); +#[doc = " @brief Machine code object symbol type."] +pub use self::amd_comgr_symbol_type_s as amd_comgr_symbol_type_t; +impl amd_comgr_symbol_info_s { + #[doc = " The length of the symbol name in bytes. Does not include the NUL\n terminator. The type of this attribute is uint64_t."] + pub const AMD_COMGR_SYMBOL_INFO_NAME_LENGTH: amd_comgr_symbol_info_s = + amd_comgr_symbol_info_s(0); +} +impl amd_comgr_symbol_info_s { + #[doc = " The name of the symbol. The type of this attribute is character array with\n the length equal to the value of the @p AMD_COMGR_SYMBOL_INFO_NAME_LENGTH\n attribute plus 1 for a NUL terminator."] + pub const AMD_COMGR_SYMBOL_INFO_NAME: amd_comgr_symbol_info_s = amd_comgr_symbol_info_s(1); +} +impl amd_comgr_symbol_info_s { + #[doc = " The kind of the symbol. The type of this attribute is @p\n amd_comgr_symbol_type_t."] + pub const AMD_COMGR_SYMBOL_INFO_TYPE: amd_comgr_symbol_info_s = amd_comgr_symbol_info_s(2); +} +impl amd_comgr_symbol_info_s { + #[doc = " Size of the variable. The value of this attribute is undefined if the\n symbol is not a variable. The type of this attribute is uint64_t."] + pub const AMD_COMGR_SYMBOL_INFO_SIZE: amd_comgr_symbol_info_s = amd_comgr_symbol_info_s(3); +} +impl amd_comgr_symbol_info_s { + #[doc = " Indicates whether the symbol is undefined. The type of this attribute is\n bool."] + pub const AMD_COMGR_SYMBOL_INFO_IS_UNDEFINED: amd_comgr_symbol_info_s = + amd_comgr_symbol_info_s(4); +} +impl amd_comgr_symbol_info_s { + #[doc = " The value of the symbol. The type of this attribute is uint64_t."] + pub const AMD_COMGR_SYMBOL_INFO_VALUE: amd_comgr_symbol_info_s = amd_comgr_symbol_info_s(5); +} +impl amd_comgr_symbol_info_s { + #[doc = " Marker for last valid symbol info."] + pub const AMD_COMGR_SYMBOL_INFO_LAST: amd_comgr_symbol_info_s = amd_comgr_symbol_info_s(5); +} +#[repr(transparent)] +#[doc = " @brief Machine code object symbol attributes."] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct amd_comgr_symbol_info_s(pub ::std::os::raw::c_uint); +#[doc = " @brief Machine code object symbol attributes."] +pub use self::amd_comgr_symbol_info_s as amd_comgr_symbol_info_t; +extern "C" { + #[must_use] + #[doc = " @brief Query information about a machine code object symbol.\n\n @param[in] symbol The symbol to query.\n\n @param[in] attribute Attribute to query.\n\n @param[out] value Pointer to an application-allocated buffer where to store\n the value of the attribute. If the buffer passed by the application is not\n large enough to hold the value of attribute, the behavior is undefined. The\n type of value returned is specified by @p amd_comgr_symbol_info_t.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has\n been executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The @p symbol does not have the requested @p\n attribute.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p symbol is an invalid\n symbol. @p attribute is an invalid value. @p value is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES\n Unable to query symbol as out of resources."] + pub fn amd_comgr_symbol_get_info( + symbol: amd_comgr_symbol_t, + attribute: amd_comgr_symbol_info_t, + value: *mut ::std::os::raw::c_void, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Create a disassembly info object.\n\n @param[in] isa_name A null terminated string that is the isa name of the\n target to disassemble for. The isa name is defined as the Code Object Target\n Identification string, described at\n https://llvm.org/docs/AMDGPUUsage.html#code-object-target-identification\n\n @param[in] read_memory_callback Function called to request @p size bytes\n from the program address space at @p from be read into @p to. The requested\n @p size is never zero. Returns the number of bytes which could be read, with\n the guarantee that no additional bytes will be available in any subsequent\n call.\n\n @param[in] print_instruction_callback Function called after a successful\n disassembly. @p instruction is a null terminated string containing the\n disassembled instruction. The callback does not own @p instruction, and it\n cannot be referenced once the callback returns.\n\n @param[in] print_address_annotation_callback Function called after @c\n print_instruction_callback returns, once for each instruction operand which\n was resolved to an absolute address. @p address is the absolute address in\n the program address space. It is intended to append a symbolic\n form of the address, perhaps as a comment, after the instruction disassembly\n produced by @c print_instruction_callback.\n\n @param[out] disassembly_info A handle to the disassembly info object\n created.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The disassembly info object was created.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p isa_name is NULL or\n invalid; or @p read_memory_callback, @p print_instruction_callback,\n or @p print_address_annotation_callback is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to create the\n disassembly info object as out of resources."] + pub fn amd_comgr_create_disassembly_info( + isa_name: *const ::std::os::raw::c_char, + read_memory_callback: ::std::option::Option< + unsafe extern "C" fn( + from: u64, + to: *mut ::std::os::raw::c_char, + size: u64, + user_data: *mut ::std::os::raw::c_void, + ) -> u64, + >, + print_instruction_callback: ::std::option::Option< + unsafe extern "C" fn( + instruction: *const ::std::os::raw::c_char, + user_data: *mut ::std::os::raw::c_void, + ), + >, + print_address_annotation_callback: ::std::option::Option< + unsafe extern "C" fn(address: u64, user_data: *mut ::std::os::raw::c_void), + >, + disassembly_info: *mut amd_comgr_disassembly_info_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Destroy a disassembly info object.\n\n @param[in] disassembly_info A handle to the disassembly info object to\n destroy.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The disassembly info object was\n destroyed.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p disassembly_info is an\n invalid disassembly info object.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to destroy the\n disassembly info object as out of resources."] + pub fn amd_comgr_destroy_disassembly_info( + disassembly_info: amd_comgr_disassembly_info_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Disassemble a single instruction.\n\n @param[in] address The address of the first byte of the instruction in the\n program address space.\n\n @param[in] user_data Arbitrary user-data passed to each callback function\n during disassembly.\n\n @param[out] size The number of bytes consumed to decode the\n instruction, or consumed while failing to decode an invalid instruction.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The disassembly was successful.\n\n @retval ::AMD_COMGR_STATUS_ERROR The disassembly failed.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p disassembly_info is\n invalid or @p size is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Unable to disassemble the\n instruction as out of resources."] + pub fn amd_comgr_disassemble_instruction( + disassembly_info: amd_comgr_disassembly_info_t, + address: u64, + user_data: *mut ::std::os::raw::c_void, + size: *mut u64, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Demangle a symbol name.\n\n @param[in] mangled_symbol_name A data object of kind @p\n AMD_COMGR_DATA_KIND_BYTES containing the mangled symbol name.\n\n @param[out] demangled_symbol_name A handle to the data object of kind @p\n AMD_COMGR_DATA_KIND_BYTES created and set to contain the demangled symbol\n name in case of successful completion. The handle must be released using\n @c amd_comgr_release_data. @p demangled_symbol_name is not updated for\n an error case.\n\n @note If the @p mangled_symbol_name cannot be demangled, it will be copied\n without changes to the @p demangled_symbol_name and AMD_COMGR_STATUS_SUCCESS\n is returned.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p mangled_symbol_name is\n an invalid data object or not of kind @p AMD_COMGR_DATA_KIND_BYTES or\n @p demangled_symbol_name is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES Out of resources."] + pub fn amd_comgr_demangle_symbol_name( + mangled_symbol_name: amd_comgr_data_t, + demangled_symbol_name: *mut amd_comgr_data_t, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Fetch mangled symbol names from a code object.\n\n @param[in] data A data object of kind @p\n AMD_COMGR_DATA_KIND_EXECUTABLE or @p AMD_COMGR_DATA_KIND_BC\n\n @param[out] count The number of mangled names retrieved. This value\n can be used as an upper bound to the Index provided to the corresponding\n amd_comgr_get_mangled_name() call.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data is\n an invalid data object or not of kind @p AMD_COMGR_DATA_KIND_EXECUTABLE or\n @p AMD_COMGR_DATA_KIND_BC.\n"] + pub fn amd_comgr_populate_mangled_names( + data: amd_comgr_data_t, + count: *mut usize, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Fetch the Nth specific mangled name from a set of populated names or\n that name's length.\n\n The @p data must have had its mangled names populated with @p\n amd_comgr_populate_mangled_names.\n\n @param[in] data A data object of kind @p\n AMD_COMGR_DATA_KIND_EXECUTABLE or @p AMD_COMGR_DATA_KIND_BC used to\n identify which set of mangled names to retrive from.\n\n @param[in] index The index of the mangled name to be returned.\n\n @param[in, out] size For out, the size of @p mangled_name. For in,\n if @mangled_name is NULL, set to the size of the Nth option string including\n the terminating null character.\n\n @param[out] mangled_name If not NULL, then the first @p size characters of\n the Nth mangled name string are copied into @p mangled_name. If NULL, no\n mangled name string is copied, and only @p size is updated (useful in order\n to find the size of the buffer requried to copy the mangled_name string).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR @p data has not been used to\n populate a set of mangled names, or index is greater than the count of\n mangled names for that data object\n"] + pub fn amd_comgr_get_mangled_name( + data: amd_comgr_data_t, + index: usize, + size: *mut usize, + mangled_name: *mut ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Populate a name expression map from a given code object.\n\n Used to map stub names *__amdgcn_name_expr_* in bitcodes and code\n objects generated by hip runtime to an associated (unmangled) name\n expression and (mangled) symbol name.\n\n @param[in] data A data object of kind @p\n AMD_COMGR_DATA_KIND_EXECUTABLE or @p AMD_COMGR_DATA_KIND_BC\n\n @param[out] count The number of name expressions mapped. This value\n can be used as an upper bound to the Index provided to the corresponding\n amd_comgr_map_name_expression_to_symbol_name() call.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data is\n an invalid data object or not of kind @p AMD_COMGR_DATA_KIND_EXECUTABLE or\n @p AMD_COMGR_DATA_KIND_BC.\n\n @retval ::AMD_COMGR_STATUS_ERROR LLVM API failure, which should be\n accompanied by an LLVM error message to stderr\n"] + pub fn amd_comgr_populate_name_expression_map( + data: amd_comgr_data_t, + count: *mut usize, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Fetch a related symbol name for a given name expression;\n or that name's length.\n\n The @p data must have had its name expression map populated with @p\n amd_comgr_populate_name_expression_map.\n\n @param[in] data A data object of kind @p\n AMD_COMGR_DATA_KIND_EXECUTABLE or @p AMD_COMGR_DATA_KIND_BC used to\n identify which map of name expressions to retrieve from.\n\n @param[in, out] size For out, the size of @p symbol_name. For in,\n if @symbol_name is NULL, set to the size of the Nth option string including\n the terminating null character.\n\n @param[in] name_expression A character array of a name expression. This name\n is used as the key to the name expression map in order to locate the desired\n @symbol_name.\n\n @param[out] symbol_name If not NULL, then the first @p size characters of\n the symbol name string mapped from @name_expression are copied into @p\n symbol_name. If NULL, no symbol name string is copied, and only @p size is\n updated (useful in order to find the size of the buffer required to copy the\n symbol_name string).\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function executed successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR @p data object is not valid (NULL or not of\n type bitcode or code object)\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p name_expression is not\n present in the name expression map.\n"] + pub fn amd_comgr_map_name_expression_to_symbol_name( + data: amd_comgr_data_t, + size: *mut usize, + name_expression: *mut ::std::os::raw::c_char, + symbol_name: *mut ::std::os::raw::c_char, + ) -> amd_comgr_status_t; +} +#[doc = " @brief A data structure for Code object information."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct code_object_info_s { + #[doc = " ISA name representing the code object."] + pub isa: *const ::std::os::raw::c_char, + #[doc = " The size of the code object."] + pub size: usize, + pub offset: u64, +} +#[doc = " @brief A data structure for Code object information."] +pub type amd_comgr_code_object_info_t = code_object_info_s; +extern "C" { + #[must_use] + #[doc = " @ brief Given a bundled code object and list of target id strings, extract\n correponding code object information.\n\n @param[in] data The data object for bundled code object. This should be\n of kind AMD_COMGR_DATA_KIND_FATBIN or AMD_COMGR_DATA_KIND_EXECUTABLE or\n AMD_COMGR_DATA_KIND_BYTES. The API interprets the data object of kind\n AMD_COMGR_DATA_KIND_FATBIN as a clang offload bundle and of kind\n AMD_COMGR_DATA_KIND_EXECUTABLE as an executable shared object. For a data\n object of type AMD_COMGR_DATA_KIND_BYTES the API first inspects the data\n passed to determine if it is a fatbin or an executable and performs\n the lookup.\n\n @param[in, out] info_list A list of code object information structure\n initialized with null terminated target id strings. If the target id\n is matched in the code object bundle the corresponding code object\n information is updated with offset and size of the code object. If the\n target id is not found the offset and size are set to 0.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The code object bundle header is incorrect\n or reading bundle entries failed.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data is not of\n kind AMD_COMGR_DATA_KIND_FATBIN, or AMD_COMGR_DATA_KIND_BYTES or\n AMD_COMGR_DATA_KIND_EXECUTABLE or either @p info_list is NULL.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT if the @p data has\n invalid data."] + pub fn amd_comgr_lookup_code_object( + data: amd_comgr_data_t, + info_list: *mut amd_comgr_code_object_info_t, + info_list_size: usize, + ) -> amd_comgr_status_t; +} +extern "C" { + #[must_use] + #[doc = " @ brief Given a code object and an ELF virtual address, map the ELF virtual\n address to a code object offset. Also, determine if the ELF virtual address\n maps to an offset in a data region that is defined by the ELF file, but that\n does not occupy bytes in the ELF file. This is typically true of offsets that\n that refer to runtime or heap allocated memory. For ELF files with defined\n sections, these data regions are referred to as NOBITS or .bss sections.\n\n @param[in] data The data object to be inspected for the given ELF virtual\n address. This should be of kind AMD_COMGR_DATA_KIND_EXECUTABLE.\n\n @param[in] elf_virtual_address The address used to calculate the code object\n offset.\n\n @param[out] code_object_offset The code object offset returned to the caller\n based on the given ELF virtual address.\n\n @param[out] slice_size For nobits regions: the size in bytes, starting from\n the provided virtual address up to the end of the segment. In this case, the\n slice size represents the number of contiguous unreadable addresses following\n the provided address.\n\n For bits regions: the size in bytes, starting from the provided virtual\n address up to either the end of the segment, or the start of a NOBITS region.\n In this case, slice size represents the number of contiguous readable\n addresses following the provided address.\n\n @param[out] nobits Set to true if the code object offset points to a location\n in a data region that does not occupy bytes in the ELF file, as described\n above.\n\n @retval ::AMD_COMGR_STATUS_SUCCESS The function has been executed\n successfully.\n\n @retval ::AMD_COMGR_STATUS_ERROR The provided code object has an invalid\n header due to a mismatch in magic, class, data, version, abi, type, or\n machine.\n\n @retval ::AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT @p data is not of\n kind AMD_COMGR_DATA_KIND_EXECUTABLE or invalid, or that the provided @p\n elf_virtual_address is not within the ranges covered by the object's\n load-type program headers."] + pub fn amd_comgr_map_elf_virtual_address_to_code_object_offset( + data: amd_comgr_data_t, + elf_virtual_address: u64, + code_object_offset: *mut u64, + slice_size: *mut u64, + nobits: *mut bool, + ) -> amd_comgr_status_t; +} diff --git a/amd_comgr-sys/src/lib.rs b/amd_comgr-sys/src/lib.rs new file mode 100644 index 00000000..c7c144a7 --- /dev/null +++ b/amd_comgr-sys/src/lib.rs @@ -0,0 +1,3 @@ +#![allow(warnings)] +pub mod amd_comgr; +pub use amd_comgr::*; \ No newline at end of file diff --git a/hip_runtime-sys/Cargo.toml b/hip_runtime-sys/Cargo.toml index 3d1241f8..50b807fc 100644 --- a/hip_runtime-sys/Cargo.toml +++ b/hip_runtime-sys/Cargo.toml @@ -2,7 +2,7 @@ name = "hip_runtime-sys" version = "0.0.0" authors = ["Andrzej Janik "] -edition = "2018" +edition = "2021" links = "amdhip" [lib] \ No newline at end of file diff --git a/hip_runtime-sys/README b/hip_runtime-sys/README index d1b2e3b6..d80b30aa 100644 --- a/hip_runtime-sys/README +++ b/hip_runtime-sys/README @@ -1,2 +1 @@ -bindgen include/hip_runtime_api.h -o src/hip_runtime_api.rs --no-layout-tests --size_t-is-usize --default-enum-style=newtype --whitelist-function "hip.*" --whitelist-type "hip.*" -- -I/home/vosen/HIP/include -I/home/vosen/hipamd/include -I/opt/rocm/include -sed -i 's/pub struct hipError_t/#[must_use]\npub struct hipError_t/g' src/hip_runtime_api.rs +bindgen --rust-target 1.77 /opt/rocm/include/hip/hip_runtime_api.h -o hip_runtime_api.rs --no-layout-tests --default-enum-style=newtype --allowlist-function "hip.*" --allowlist-type "hip.*" --no-derive-debug --must-use-type hipError_t --new-type-alias "^hipDeviceptr_t$" --allowlist-var "^hip.*$" -- -I/opt/rocm/include -D__HIP_PLATFORM_AMD__ diff --git a/hip_runtime-sys/build.rs b/hip_runtime-sys/build.rs index 3bc12501..c63b5264 100644 --- a/hip_runtime-sys/build.rs +++ b/hip_runtime-sys/build.rs @@ -2,8 +2,8 @@ use std::env::VarError; use std::{env, path::PathBuf}; fn main() -> Result<(), VarError> { - println!("cargo:rustc-link-lib=dylib=amdhip64"); if cfg!(windows) { + println!("cargo:rustc-link-lib=dylib=amdhip64_6"); let env = env::var("CARGO_CFG_TARGET_ENV")?; if env == "msvc" { let mut path = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?); @@ -13,9 +13,8 @@ fn main() -> Result<(), VarError> { println!("cargo:rustc-link-search=native=C:\\Windows\\System32"); }; } else { - //println!("cargo:rustc-link-search=native=/opt/rocm/lib/"); - println!("cargo:rustc-link-search=native=/home/ubuntu/hipamd/build/lib"); - println!("cargo:rustc-link-search=native=/home/vosen/hipamd/build/lib"); + println!("cargo:rustc-link-lib=dylib=amdhip64"); + println!("cargo:rustc-link-search=native=/opt/rocm/lib/"); } Ok(()) } diff --git a/hip_runtime-sys/lib/amdhip64.def b/hip_runtime-sys/lib/amdhip64.def deleted file mode 100644 index 515d5c66..00000000 --- a/hip_runtime-sys/lib/amdhip64.def +++ /dev/null @@ -1,308 +0,0 @@ -LIBRARY AMDHIP64 -EXPORTS -__hipPopCallConfiguration -__hipPushCallConfiguration -__hipRegisterFatBinary -__hipRegisterFunction -__hipRegisterManagedVar -__hipRegisterSurface -__hipRegisterTexture -__hipRegisterVar -__hipUnregisterFatBinary -hipApiName -hipArray3DCreate -hipArrayCreate -hipArrayDestroy -hipBindTexture -hipBindTexture2D -hipBindTextureToArray -hipBindTextureToMipmappedArray -hipChooseDevice -hipConfigureCall -hipCreateChannelDesc -hipCreateSurfaceObject -hipCreateTextureObject -hipCtxCreate -hipCtxDestroy -hipCtxDisablePeerAccess -hipCtxEnablePeerAccess -hipCtxGetApiVersion -hipCtxGetCacheConfig -hipCtxGetCurrent -hipCtxGetDevice -hipCtxGetFlags -hipCtxGetSharedMemConfig -hipCtxPopCurrent -hipCtxPushCurrent -hipCtxSetCacheConfig -hipCtxSetCurrent -hipCtxSetSharedMemConfig -hipCtxSynchronize -hipDestroyExternalMemory -hipDestroyExternalSemaphore -hipDestroySurfaceObject -hipDestroyTextureObject -hipDeviceCanAccessPeer -hipDeviceComputeCapability -hipDeviceDisablePeerAccess -hipDeviceEnablePeerAccess -hipDeviceGet -hipDeviceGetAttribute -hipDeviceGetByPCIBusId -hipDeviceGetCacheConfig -hipDeviceGetLimit -hipDeviceGetName -hipDeviceGetP2PAttribute -hipDeviceGetPCIBusId -hipDeviceGetSharedMemConfig -hipDeviceGetStreamPriorityRange -hipDevicePrimaryCtxGetState -hipDevicePrimaryCtxRelease -hipDevicePrimaryCtxReset -hipDevicePrimaryCtxRetain -hipDevicePrimaryCtxSetFlags -hipDeviceReset -hipDeviceSetCacheConfig -hipDeviceSetSharedMemConfig -hipDeviceSynchronize -hipDeviceTotalMem -hipDriverGetVersion -hipDrvMemcpy2DUnaligned -hipDrvMemcpy3D -hipDrvMemcpy3DAsync -hipEnableActivityCallback -hipEventCreate -hipEventCreateWithFlags -hipEventDestroy -hipEventElapsedTime -hipEventQuery -hipEventRecord -hipEventSynchronize -hipExtGetLinkTypeAndHopCount -hipExtLaunchKernel -hipExtLaunchMultiKernelMultiDevice -hipExtMallocWithFlags -hipExtModuleLaunchKernel -hipExtStreamCreateWithCUMask -hipExtStreamGetCUMask -hipExternalMemoryGetMappedBuffer -hipFree -hipFreeArray -hipFreeHost -hipFreeMipmappedArray -hipFuncGetAttribute -hipFuncGetAttributes -hipFuncSetAttribute -hipFuncSetCacheConfig -hipFuncSetSharedMemConfig -hipGLGetDevices -hipGetChannelDesc -hipGetCmdName -hipGetDevice -hipGetDeviceCount -hipGetDeviceFlags -hipGetDeviceProperties -hipGetErrorName -hipGetErrorString -hipGetLastError -hipGetMipmappedArrayLevel -hipGetSymbolAddress -hipGetSymbolSize -hipGetTextureAlignmentOffset -hipGetTextureObjectResourceDesc -hipGetTextureObjectResourceViewDesc -hipGetTextureObjectTextureDesc -hipGetTextureReference -hipGraphAddDependencies -hipGraphAddEmptyNode -hipGraphAddKernelNode -hipGraphAddMemcpyNode -hipGraphAddMemcpyNode1D -hipGraphAddMemsetNode -hipGraphCreate -hipGraphDestroy -hipGraphExecDestroy -hipGraphExecKernelNodeSetParams -hipGraphGetNodes -hipGraphGetRootNodes -hipGraphInstantiate -hipGraphKernelNodeGetParams -hipGraphKernelNodeSetParams -hipGraphLaunch -hipGraphMemcpyNodeGetParams -hipGraphMemcpyNodeSetParams -hipGraphMemsetNodeGetParams -hipGraphMemsetNodeSetParams -hipGraphicsGLRegisterBuffer -hipGraphicsMapResources -hipGraphicsResourceGetMappedPointer -hipGraphicsUnmapResources -hipGraphicsUnregisterResource -hipHccModuleLaunchKernel -hipHostAlloc -hipHostFree -hipHostGetDevicePointer -hipHostGetFlags -hipHostMalloc -hipHostRegister -hipHostUnregister -hipImportExternalMemory -hipImportExternalSemaphore -hipInit -hipInitActivityCallback -hipIpcCloseMemHandle -hipIpcGetEventHandle -hipIpcGetMemHandle -hipIpcOpenEventHandle -hipIpcOpenMemHandle -hipKernelNameRef -hipLaunchByPtr -hipLaunchCooperativeKernel -hipLaunchCooperativeKernelMultiDevice -hipLaunchKernel -hipMalloc -hipMalloc3D -hipMalloc3DArray -hipMallocArray -hipMallocHost -hipMallocManaged -hipMallocMipmappedArray -hipMallocPitch -hipMemAdvise -hipMemAllocHost -hipMemAllocPitch -hipMemGetAddressRange -hipMemGetInfo -hipMemPrefetchAsync -hipMemPtrGetInfo -hipMemRangeGetAttribute -hipMemRangeGetAttributes -hipMemcpy -hipMemcpy2D -hipMemcpy2DAsync -hipMemcpy2DFromArray -hipMemcpy2DFromArrayAsync -hipMemcpy2DToArray -hipMemcpy2DToArrayAsync -hipMemcpy3D -hipMemcpy3DAsync -hipMemcpyAsync -hipMemcpyAtoH -hipMemcpyDtoD -hipMemcpyDtoDAsync -hipMemcpyDtoH -hipMemcpyDtoHAsync -hipMemcpyFromArray -hipMemcpyFromSymbol -hipMemcpyFromSymbolAsync -hipMemcpyHtoA -hipMemcpyHtoD -hipMemcpyHtoDAsync -hipMemcpyParam2D -hipMemcpyParam2DAsync -hipMemcpyPeer -hipMemcpyPeerAsync -hipMemcpyToArray -hipMemcpyToSymbol -hipMemcpyToSymbolAsync -hipMemcpyWithStream -hipMemset -hipMemset2D -hipMemset2DAsync -hipMemset3D -hipMemset3DAsync -hipMemsetAsync -hipMemsetD16 -hipMemsetD16Async -hipMemsetD32 -hipMemsetD32Async -hipMemsetD8 -hipMemsetD8Async -hipMipmappedArrayCreate -hipMipmappedArrayDestroy -hipMipmappedArrayGetLevel -hipModuleGetFunction -hipModuleGetGlobal -hipModuleGetTexRef -hipModuleLaunchKernel -hipModuleLaunchKernelExt -hipModuleLoad -hipModuleLoadData -hipModuleLoadDataEx -hipModuleOccupancyMaxActiveBlocksPerMultiprocessor -hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags -hipModuleOccupancyMaxPotentialBlockSize -hipModuleOccupancyMaxPotentialBlockSizeWithFlags -hipModuleUnload -hipOccupancyMaxActiveBlocksPerMultiprocessor -hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags -hipOccupancyMaxPotentialBlockSize -hipPeekAtLastError -hipPointerGetAttributes -hipProfilerStart -hipProfilerStop -hipRegisterActivityCallback -hipRegisterApiCallback -hipRemoveActivityCallback -hipRemoveApiCallback -hipRuntimeGetVersion -hipSetDevice -hipSetDeviceFlags -hipSetupArgument -hipSignalExternalSemaphoresAsync -hipStreamAddCallback -hipStreamAttachMemAsync -hipStreamBeginCapture -hipStreamCreate -hipStreamCreateWithFlags -hipStreamCreateWithPriority -hipStreamDestroy -hipStreamEndCapture -hipStreamGetFlags -hipStreamGetPriority -hipStreamIsCapturing -hipStreamQuery -hipStreamSynchronize -hipStreamWaitEvent -hipTexObjectCreate -hipTexObjectDestroy -hipTexObjectGetResourceDesc -hipTexObjectGetResourceViewDesc -hipTexObjectGetTextureDesc -hipTexRefGetAddress -hipTexRefGetAddressMode -hipTexRefGetArray -hipTexRefGetBorderColor -hipTexRefGetFilterMode -hipTexRefGetFlags -hipTexRefGetFormat -hipTexRefGetMaxAnisotropy -hipTexRefGetMipmapFilterMode -hipTexRefGetMipmapLevelBias -hipTexRefGetMipmapLevelClamp -hipTexRefGetMipmappedArray -hipTexRefSetAddress -hipTexRefSetAddress2D -hipTexRefSetAddressMode -hipTexRefSetArray -hipTexRefSetBorderColor -hipTexRefSetFilterMode -hipTexRefSetFlags -hipTexRefSetFormat -hipTexRefSetMaxAnisotropy -hipTexRefSetMipmapFilterMode -hipTexRefSetMipmapLevelBias -hipTexRefSetMipmapLevelClamp -hipTexRefSetMipmappedArray -hipUnbindTexture -hipWaitExternalSemaphoresAsync -hiprtcAddNameExpression -hiprtcCompileProgram -hiprtcCreateProgram -hiprtcDestroyProgram -hiprtcGetCode -hiprtcGetCodeSize -hiprtcGetErrorString -hiprtcGetLoweredName -hiprtcGetProgramLog -hiprtcGetProgramLogSize diff --git a/hip_runtime-sys/lib/amdhip64.lib b/hip_runtime-sys/lib/amdhip64.lib deleted file mode 100644 index 1d7df961e35d5ae012398e42d2e2b286facdfc58..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 71480 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 YI+r8r*3w^Z*Vc6EEO}lWF;bWR2YLVQV*mgE diff --git a/hip_runtime-sys/lib/amdhip64_6.def b/hip_runtime-sys/lib/amdhip64_6.def new file mode 100644 index 00000000..573ec3f0 --- /dev/null +++ b/hip_runtime-sys/lib/amdhip64_6.def @@ -0,0 +1,567 @@ +; +; Definition file of amdhip64_6.dll +; Automatic generated by gendef +; written by Kai Tietz 2008 +; +LIBRARY "amdhip64_6.dll" +EXPORTS +; enum hipError_t __cdecl hipExtModuleLaunchKernel(struct ihipModuleSymbol_t *__ptr64,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned __int64,struct ihipStream_t *__ptr64,void *__ptr64 *__ptr64,void *__ptr64 *__ptr64,struct ihipEvent_t *__ptr64,struct ihipEvent_t *__ptr64,unsigned int) +?hipExtModuleLaunchKernel@@YA?AW4hipError_t@@PEAUihipModuleSymbol_t@@IIIIII_KPEAUihipStream_t@@PEAPEAX3PEAUihipEvent_t@@4I@Z +hipExternalMemoryGetMappedMipmappedArray +hipGraphAddExternalSemaphoresSignalNode +hipGraphAddExternalSemaphoresWaitNode +hipGraphExecExternalSemaphoresSignalNodeSetParams +hipGraphExecExternalSemaphoresWaitNodeSetParams +hipGraphExternalSemaphoresSignalNodeGetParams +hipGraphExternalSemaphoresSignalNodeSetParams +hipGraphExternalSemaphoresWaitNodeGetParams +hipGraphExternalSemaphoresWaitNodeSetParams +; enum hipError_t __cdecl hipHccModuleLaunchKernel(struct ihipModuleSymbol_t *__ptr64,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned __int64,struct ihipStream_t *__ptr64,void *__ptr64 *__ptr64,void *__ptr64 *__ptr64,struct ihipEvent_t *__ptr64,struct ihipEvent_t *__ptr64) +?hipHccModuleLaunchKernel@@YA?AW4hipError_t@@PEAUihipModuleSymbol_t@@IIIIII_KPEAUihipStream_t@@PEAPEAX3PEAUihipEvent_t@@4@Z +hipTexRefGetArray +hipTexRefGetBorderColor +AMD_CPU_AFFINITY DATA +AMD_DIRECT_DISPATCH DATA +AMD_GPU_FORCE_SINGLE_FP_DENORM DATA +AMD_LOG_LEVEL DATA +AMD_LOG_LEVEL_FILE DATA +AMD_LOG_MASK DATA +AMD_OCL_BUILD_OPTIONS DATA +AMD_OCL_BUILD_OPTIONS_APPEND DATA +AMD_OCL_LINK_OPTIONS DATA +AMD_OCL_LINK_OPTIONS_APPEND DATA +AMD_OCL_WAIT_COMMAND DATA +AMD_OPT_FLUSH DATA +AMD_SERIALIZE_COPY DATA +AMD_SERIALIZE_KERNEL DATA +AMD_THREAD_TRACE_ENABLE DATA +CL_KHR_FP64 DATA +CQ_THREAD_STACK_SIZE DATA +CUDA_VISIBLE_DEVICES DATA +DEBUG_CLR_GRAPH_PACKET_CAPTURE DATA +DEBUG_CLR_LIMIT_BLIT_WG DATA +DEBUG_HIP_GRAPH_DOT_PRINT DATA +DISABLE_DEFERRED_ALLOC DATA +GPU_ADD_HBCC_SIZE DATA +GPU_ANALYZE_HANG DATA +GPU_BLIT_ENGINE_TYPE DATA +GPU_CP_DMA_COPY_SIZE DATA +GPU_DEBUG_ENABLE DATA +GPU_DEVICE_ORDINAL DATA +GPU_DUMP_BLIT_KERNELS DATA +GPU_DUMP_CODE_OBJECT DATA +GPU_ENABLE_COOP_GROUPS DATA +GPU_ENABLE_HW_P2P DATA +GPU_ENABLE_LC DATA +GPU_ENABLE_PAL DATA +GPU_ENABLE_WAVE32_MODE DATA +GPU_ENABLE_WGP_MODE DATA +GPU_FLUSH_ON_EXECUTION DATA +GPU_FORCE_BLIT_COPY_SIZE DATA +GPU_FORCE_QUEUE_PROFILING DATA +GPU_IMAGE_BUFFER_WAR DATA +GPU_IMAGE_DMA DATA +GPU_MAX_COMMAND_BUFFERS DATA +GPU_MAX_HEAP_SIZE DATA +GPU_MAX_HW_QUEUES DATA +GPU_MAX_REMOTE_MEM_SIZE DATA +GPU_MAX_SUBALLOC_SIZE DATA +GPU_MAX_USWC_ALLOC_SIZE DATA +GPU_MAX_WORKGROUP_SIZE DATA +GPU_MIPMAP DATA +GPU_NUM_COMPUTE_RINGS DATA +GPU_NUM_MEM_DEPENDENCY DATA +GPU_PINNED_MIN_XFER_SIZE DATA +GPU_PINNED_XFER_SIZE DATA +GPU_PRINT_CHILD_KERNEL DATA +GPU_RESOURCE_CACHE_SIZE DATA +GPU_SINGLE_ALLOC_PERCENT DATA +GPU_STAGING_BUFFER_SIZE DATA +GPU_STREAMOPS_CP_WAIT DATA +GPU_USE_DEVICE_QUEUE DATA +GPU_WAVES_PER_SIMD DATA +GPU_XFER_BUFFER_SIZE DATA +HIPRTC_COMPILE_OPTIONS_APPEND DATA +HIPRTC_LINK_OPTIONS_APPEND DATA +HIPRTC_USE_RUNTIME_UNBUNDLER DATA +HIP_FORCE_DEV_KERNARG DATA +HIP_HIDDEN_FREE_MEM DATA +HIP_HOST_COHERENT DATA +HIP_INITIAL_DM_SIZE DATA +HIP_LAUNCH_BLOCKING DATA +HIP_MEM_POOL_SUPPORT DATA +HIP_MEM_POOL_USE_VM DATA +HIP_USE_RUNTIME_UNBUNDLER DATA +HIP_VISIBLE_DEVICES DATA +HIP_VMEM_MANAGE_SUPPORT DATA +HSA_KERNARG_POOL_SIZE DATA +HSA_LOCAL_MEMORY_ENABLE DATA +OCL_SET_SVM_SIZE DATA +OCL_STUB_PROGRAMS DATA +OPENCL_VERSION DATA +PAL_ALWAYS_RESIDENT DATA +PAL_DISABLE_SDMA DATA +PAL_EMBED_KERNEL_MD DATA +PAL_FORCE_ASIC_REVISION DATA +PAL_HIP_IPC_FLAG DATA +PAL_MALL_POLICY DATA +PAL_PREPINNED_MEMORY_SIZE DATA +PAL_RGP_DISP_COUNT DATA +REMOTE_ALLOC DATA +ROC_ACTIVE_WAIT_TIMEOUT DATA +ROC_AQL_QUEUE_SIZE DATA +ROC_CPU_WAIT_FOR_SIGNAL DATA +ROC_ENABLE_LARGE_BAR DATA +ROC_GLOBAL_CU_MASK DATA +ROC_HMM_FLAGS DATA +ROC_P2P_SDMA_SIZE DATA +ROC_SIGNAL_POOL_SIZE DATA +ROC_SKIP_KERNEL_ARG_COPY DATA +ROC_SYSTEM_SCOPE_SIGNAL DATA +ROC_USE_FGS_KERNARG DATA +__gnu_f2h_ieee +__gnu_h2f_ieee +__hipPopCallConfiguration +__hipPushCallConfiguration +__hipRegisterFatBinary +__hipRegisterFunction +__hipRegisterManagedVar +__hipRegisterSurface +__hipRegisterTexture +__hipRegisterVar +__hipUnregisterFatBinary +amd_dbgapi_get_build_id +amd_dbgapi_get_build_name +amd_dbgapi_get_git_hash +hipApiName +hipArray3DCreate +hipArray3DGetDescriptor +hipArrayCreate +hipArrayDestroy +hipArrayGetDescriptor +hipArrayGetInfo +hipBindTexture +hipBindTexture2D +hipBindTextureToArray +hipBindTextureToMipmappedArray +hipChooseDevice +hipChooseDeviceR0000 +hipChooseDeviceR0600 +hipConfigureCall +hipCreateChannelDesc +hipCreateSurfaceObject +hipCreateTextureObject +hipCtxCreate +hipCtxDestroy +hipCtxDisablePeerAccess +hipCtxEnablePeerAccess +hipCtxGetApiVersion +hipCtxGetCacheConfig +hipCtxGetCurrent +hipCtxGetDevice +hipCtxGetFlags +hipCtxGetSharedMemConfig +hipCtxPopCurrent +hipCtxPushCurrent +hipCtxSetCacheConfig +hipCtxSetCurrent +hipCtxSetSharedMemConfig +hipCtxSynchronize +hipDestroyExternalMemory +hipDestroyExternalSemaphore +hipDestroySurfaceObject +hipDestroyTextureObject +hipDeviceCanAccessPeer +hipDeviceComputeCapability +hipDeviceDisablePeerAccess +hipDeviceEnablePeerAccess +hipDeviceGet +hipDeviceGetAttribute +hipDeviceGetByPCIBusId +hipDeviceGetCacheConfig +hipDeviceGetDefaultMemPool +hipDeviceGetGraphMemAttribute +hipDeviceGetLimit +hipDeviceGetMemPool +hipDeviceGetName +hipDeviceGetP2PAttribute +hipDeviceGetPCIBusId +hipDeviceGetSharedMemConfig +hipDeviceGetStreamPriorityRange +hipDeviceGetUuid +hipDeviceGraphMemTrim +hipDevicePrimaryCtxGetState +hipDevicePrimaryCtxRelease +hipDevicePrimaryCtxReset +hipDevicePrimaryCtxRetain +hipDevicePrimaryCtxSetFlags +hipDeviceReset +hipDeviceSetCacheConfig +hipDeviceSetGraphMemAttribute +hipDeviceSetLimit +hipDeviceSetMemPool +hipDeviceSetSharedMemConfig +hipDeviceSynchronize +hipDeviceTotalMem +hipDriverGetVersion +hipDrvGetErrorName +hipDrvGetErrorString +hipDrvGraphAddMemcpyNode +hipDrvGraphAddMemsetNode +hipDrvMemcpy2DUnaligned +hipDrvMemcpy3D +hipDrvMemcpy3DAsync +hipDrvPointerGetAttributes +hipEventCreate +hipEventCreateWithFlags +hipEventDestroy +hipEventElapsedTime +hipEventQuery +hipEventRecord +hipEventRecord_spt +hipEventSynchronize +hipExtGetLastError +hipExtGetLinkTypeAndHopCount +hipExtLaunchKernel +hipExtLaunchMultiKernelMultiDevice +hipExtMallocWithFlags +hipExtModuleLaunchKernel +hipExtStreamCreateWithCUMask +hipExtStreamGetCUMask +hipExternalMemoryGetMappedBuffer +hipFree +hipFreeArray +hipFreeAsync +hipFreeHost +hipFreeMipmappedArray +hipFuncGetAttribute +hipFuncGetAttributes +hipFuncSetAttribute +hipFuncSetCacheConfig +hipFuncSetSharedMemConfig +hipGLGetDevices +hipGetChannelDesc +hipGetCmdName +hipGetDevice +hipGetDeviceCount +hipGetDeviceFlags +hipGetDeviceProperties +hipGetDevicePropertiesR0000 +hipGetDevicePropertiesR0600 +hipGetErrorName +hipGetErrorString +hipGetLastError +hipGetMipmappedArrayLevel +hipGetStreamDeviceId +hipGetSymbolAddress +hipGetSymbolSize +hipGetTextureAlignmentOffset +hipGetTextureObjectResourceDesc +hipGetTextureObjectResourceViewDesc +hipGetTextureObjectTextureDesc +hipGetTextureReference +hipGraphAddChildGraphNode +hipGraphAddDependencies +hipGraphAddEmptyNode +hipGraphAddEventRecordNode +hipGraphAddEventWaitNode +hipGraphAddHostNode +hipGraphAddKernelNode +hipGraphAddMemAllocNode +hipGraphAddMemFreeNode +hipGraphAddMemcpyNode +hipGraphAddMemcpyNode1D +hipGraphAddMemcpyNodeFromSymbol +hipGraphAddMemcpyNodeToSymbol +hipGraphAddMemsetNode +hipGraphChildGraphNodeGetGraph +hipGraphClone +hipGraphCreate +hipGraphDebugDotPrint +hipGraphDestroy +hipGraphDestroyNode +hipGraphEventRecordNodeGetEvent +hipGraphEventRecordNodeSetEvent +hipGraphEventWaitNodeGetEvent +hipGraphEventWaitNodeSetEvent +hipGraphExecChildGraphNodeSetParams +hipGraphExecDestroy +hipGraphExecEventRecordNodeSetEvent +hipGraphExecEventWaitNodeSetEvent +hipGraphExecHostNodeSetParams +hipGraphExecKernelNodeSetParams +hipGraphExecMemcpyNodeSetParams +hipGraphExecMemcpyNodeSetParams1D +hipGraphExecMemcpyNodeSetParamsFromSymbol +hipGraphExecMemcpyNodeSetParamsToSymbol +hipGraphExecMemsetNodeSetParams +hipGraphExecUpdate +hipGraphGetEdges +hipGraphGetNodes +hipGraphGetRootNodes +hipGraphHostNodeGetParams +hipGraphHostNodeSetParams +hipGraphInstantiate +hipGraphInstantiateWithFlags +hipGraphKernelNodeCopyAttributes +hipGraphKernelNodeGetAttribute +hipGraphKernelNodeGetParams +hipGraphKernelNodeSetAttribute +hipGraphKernelNodeSetParams +hipGraphLaunch +hipGraphLaunch_spt +hipGraphMemAllocNodeGetParams +hipGraphMemFreeNodeGetParams +hipGraphMemcpyNodeGetParams +hipGraphMemcpyNodeSetParams +hipGraphMemcpyNodeSetParams1D +hipGraphMemcpyNodeSetParamsFromSymbol +hipGraphMemcpyNodeSetParamsToSymbol +hipGraphMemsetNodeGetParams +hipGraphMemsetNodeSetParams +hipGraphNodeFindInClone +hipGraphNodeGetDependencies +hipGraphNodeGetDependentNodes +hipGraphNodeGetEnabled +hipGraphNodeGetType +hipGraphNodeSetEnabled +hipGraphReleaseUserObject +hipGraphRemoveDependencies +hipGraphRetainUserObject +hipGraphUpload +hipGraphicsGLRegisterBuffer +hipGraphicsGLRegisterImage +hipGraphicsMapResources +hipGraphicsResourceGetMappedPointer +hipGraphicsSubResourceGetMappedArray +hipGraphicsUnmapResources +hipGraphicsUnregisterResource +hipHccModuleLaunchKernel +hipHostAlloc +hipHostFree +hipHostGetDevicePointer +hipHostGetFlags +hipHostMalloc +hipHostRegister +hipHostUnregister +hipImportExternalMemory +hipImportExternalSemaphore +hipInit +hipIpcCloseMemHandle +hipIpcGetEventHandle +hipIpcGetMemHandle +hipIpcOpenEventHandle +hipIpcOpenMemHandle +hipKernelNameRef +hipLaunchByPtr +hipLaunchCooperativeKernel +hipLaunchCooperativeKernelMultiDevice +hipLaunchCooperativeKernel_spt +hipLaunchHostFunc +hipLaunchHostFunc_spt +hipLaunchKernel +hipLaunchKernel_spt +hipMalloc +hipMalloc3D +hipMalloc3DArray +hipMallocArray +hipMallocAsync +hipMallocFromPoolAsync +hipMallocHost +hipMallocManaged +hipMallocMipmappedArray +hipMallocPitch +hipMemAddressFree +hipMemAddressReserve +hipMemAdvise +hipMemAllocHost +hipMemAllocPitch +hipMemCreate +hipMemExportToShareableHandle +hipMemGetAccess +hipMemGetAddressRange +hipMemGetAllocationGranularity +hipMemGetAllocationPropertiesFromHandle +hipMemGetInfo +hipMemImportFromShareableHandle +hipMemMap +hipMemMapArrayAsync +hipMemPoolCreate +hipMemPoolDestroy +hipMemPoolExportPointer +hipMemPoolExportToShareableHandle +hipMemPoolGetAccess +hipMemPoolGetAttribute +hipMemPoolImportFromShareableHandle +hipMemPoolImportPointer +hipMemPoolSetAccess +hipMemPoolSetAttribute +hipMemPoolTrimTo +hipMemPrefetchAsync +hipMemPtrGetInfo +hipMemRangeGetAttribute +hipMemRangeGetAttributes +hipMemRelease +hipMemRetainAllocationHandle +hipMemSetAccess +hipMemUnmap +hipMemcpy +hipMemcpy2D +hipMemcpy2DAsync +hipMemcpy2DAsync_spt +hipMemcpy2DFromArray +hipMemcpy2DFromArrayAsync +hipMemcpy2DFromArrayAsync_spt +hipMemcpy2DFromArray_spt +hipMemcpy2DToArray +hipMemcpy2DToArrayAsync +hipMemcpy2DToArrayAsync_spt +hipMemcpy2DToArray_spt +hipMemcpy2D_spt +hipMemcpy3D +hipMemcpy3DAsync +hipMemcpy3DAsync_spt +hipMemcpy3D_spt +hipMemcpyAsync +hipMemcpyAsync_spt +hipMemcpyAtoH +hipMemcpyDtoD +hipMemcpyDtoDAsync +hipMemcpyDtoH +hipMemcpyDtoHAsync +hipMemcpyFromArray +hipMemcpyFromArray_spt +hipMemcpyFromSymbol +hipMemcpyFromSymbolAsync +hipMemcpyFromSymbolAsync_spt +hipMemcpyFromSymbol_spt +hipMemcpyHtoA +hipMemcpyHtoD +hipMemcpyHtoDAsync +hipMemcpyParam2D +hipMemcpyParam2DAsync +hipMemcpyPeer +hipMemcpyPeerAsync +hipMemcpyToArray +hipMemcpyToSymbol +hipMemcpyToSymbolAsync +hipMemcpyToSymbolAsync_spt +hipMemcpyToSymbol_spt +hipMemcpyWithStream +hipMemcpy_spt +hipMemset +hipMemset2D +hipMemset2DAsync +hipMemset2DAsync_spt +hipMemset2D_spt +hipMemset3D +hipMemset3DAsync +hipMemset3DAsync_spt +hipMemset3D_spt +hipMemsetAsync +hipMemsetAsync_spt +hipMemsetD16 +hipMemsetD16Async +hipMemsetD32 +hipMemsetD32Async +hipMemsetD8 +hipMemsetD8Async +hipMemset_spt +hipMipmappedArrayCreate +hipMipmappedArrayDestroy +hipMipmappedArrayGetLevel +hipModuleGetFunction +hipModuleGetGlobal +hipModuleGetTexRef +hipModuleLaunchCooperativeKernel +hipModuleLaunchCooperativeKernelMultiDevice +hipModuleLaunchKernel +hipModuleLoad +hipModuleLoadData +hipModuleLoadDataEx +hipModuleOccupancyMaxActiveBlocksPerMultiprocessor +hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags +hipModuleOccupancyMaxPotentialBlockSize +hipModuleOccupancyMaxPotentialBlockSizeWithFlags +hipModuleUnload +hipOccupancyMaxActiveBlocksPerMultiprocessor +hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags +hipOccupancyMaxPotentialBlockSize +hipPeekAtLastError +hipPointerGetAttribute +hipPointerGetAttributes +hipProfilerStart +hipProfilerStop +hipRegisterTracerCallback +hipRuntimeGetVersion +hipSetDevice +hipSetDeviceFlags +hipSetupArgument +hipSignalExternalSemaphoresAsync +hipStreamAddCallback +hipStreamAddCallback_spt +hipStreamAttachMemAsync +hipStreamBeginCapture +hipStreamBeginCapture_spt +hipStreamCreate +hipStreamCreateWithFlags +hipStreamCreateWithPriority +hipStreamDestroy +hipStreamEndCapture +hipStreamEndCapture_spt +hipStreamGetCaptureInfo +hipStreamGetCaptureInfo_spt +hipStreamGetCaptureInfo_v2 +hipStreamGetCaptureInfo_v2_spt +hipStreamGetDevice +hipStreamGetFlags +hipStreamGetFlags_spt +hipStreamGetPriority +hipStreamGetPriority_spt +hipStreamIsCapturing +hipStreamIsCapturing_spt +hipStreamQuery +hipStreamQuery_spt +hipStreamSynchronize +hipStreamSynchronize_spt +hipStreamUpdateCaptureDependencies +hipStreamWaitEvent +hipStreamWaitEvent_spt +hipStreamWaitValue32 +hipStreamWaitValue64 +hipStreamWriteValue32 +hipStreamWriteValue64 +hipTexObjectCreate +hipTexObjectDestroy +hipTexObjectGetResourceDesc +hipTexObjectGetResourceViewDesc +hipTexObjectGetTextureDesc +hipTexRefGetAddress +hipTexRefGetAddressMode +hipTexRefGetFilterMode +hipTexRefGetFlags +hipTexRefGetFormat +hipTexRefGetMaxAnisotropy +hipTexRefGetMipMappedArray +hipTexRefGetMipmapFilterMode +hipTexRefGetMipmapLevelBias +hipTexRefGetMipmapLevelClamp +hipTexRefSetAddress +hipTexRefSetAddress2D +hipTexRefSetAddressMode +hipTexRefSetArray +hipTexRefSetBorderColor +hipTexRefSetFilterMode +hipTexRefSetFlags +hipTexRefSetFormat +hipTexRefSetMaxAnisotropy +hipTexRefSetMipmapFilterMode +hipTexRefSetMipmapLevelBias +hipTexRefSetMipmapLevelClamp +hipTexRefSetMipmappedArray +hipThreadExchangeStreamCaptureMode +hipUnbindTexture +hipUserObjectCreate +hipUserObjectRelease +hipUserObjectRetain +hipWaitExternalSemaphoresAsync diff --git a/hip_runtime-sys/lib/amdhip64_6.lib b/hip_runtime-sys/lib/amdhip64_6.lib new file mode 100644 index 0000000000000000000000000000000000000000..5d2966bea3df868bec33b478ca0075db92e72ece GIT binary patch literal 129670 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 Rw&3KeU_0z<=)JG0{~w4^i{k(Q literal 0 HcmV?d00001 diff --git a/hip_runtime-sys/src/hip_runtime_api.rs b/hip_runtime-sys/src/hip_runtime_api.rs index b6765ce4..edc367a3 100644 --- a/hip_runtime-sys/src/hip_runtime_api.rs +++ b/hip_runtime-sys/src/hip_runtime_api.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.59.1 */ +/* automatically generated by rust-bindgen 0.70.1 */ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] @@ -80,9 +80,69 @@ where } } } +pub const hipTextureType1D: u32 = 1; +pub const hipTextureType2D: u32 = 2; +pub const hipTextureType3D: u32 = 3; +pub const hipTextureTypeCubemap: u32 = 12; +pub const hipTextureType1DLayered: u32 = 241; +pub const hipTextureType2DLayered: u32 = 242; +pub const hipTextureTypeCubemapLayered: u32 = 252; +pub const hipIpcMemLazyEnablePeerAccess: u32 = 1; +pub const hipStreamDefault: u32 = 0; +pub const hipStreamNonBlocking: u32 = 1; +pub const hipEventDefault: u32 = 0; +pub const hipEventBlockingSync: u32 = 1; +pub const hipEventDisableTiming: u32 = 2; +pub const hipEventInterprocess: u32 = 4; +pub const hipEventDisableSystemFence: u32 = 536870912; +pub const hipEventReleaseToDevice: u32 = 1073741824; +pub const hipEventReleaseToSystem: u32 = 2147483648; +pub const hipHostMallocDefault: u32 = 0; +pub const hipHostMallocPortable: u32 = 1; +pub const hipHostMallocMapped: u32 = 2; +pub const hipHostMallocWriteCombined: u32 = 4; +pub const hipHostMallocNumaUser: u32 = 536870912; +pub const hipHostMallocCoherent: u32 = 1073741824; +pub const hipHostMallocNonCoherent: u32 = 2147483648; +pub const hipMemAttachGlobal: u32 = 1; +pub const hipMemAttachHost: u32 = 2; +pub const hipMemAttachSingle: u32 = 4; +pub const hipDeviceMallocDefault: u32 = 0; +pub const hipDeviceMallocFinegrained: u32 = 1; +pub const hipMallocSignalMemory: u32 = 2; +pub const hipDeviceMallocUncached: u32 = 3; +pub const hipHostRegisterDefault: u32 = 0; +pub const hipHostRegisterPortable: u32 = 1; +pub const hipHostRegisterMapped: u32 = 2; +pub const hipHostRegisterIoMemory: u32 = 4; +pub const hipHostRegisterReadOnly: u32 = 8; +pub const hipExtHostRegisterCoarseGrained: u32 = 8; +pub const hipDeviceScheduleAuto: u32 = 0; +pub const hipDeviceScheduleSpin: u32 = 1; +pub const hipDeviceScheduleYield: u32 = 2; +pub const hipDeviceScheduleBlockingSync: u32 = 4; +pub const hipDeviceScheduleMask: u32 = 7; +pub const hipDeviceMapHost: u32 = 8; +pub const hipDeviceLmemResizeToMax: u32 = 16; +pub const hipArrayDefault: u32 = 0; +pub const hipArrayLayered: u32 = 1; +pub const hipArraySurfaceLoadStore: u32 = 2; +pub const hipArrayCubemap: u32 = 4; +pub const hipArrayTextureGather: u32 = 8; +pub const hipOccupancyDefault: u32 = 0; +pub const hipOccupancyDisableCachingOverride: u32 = 1; +pub const hipCooperativeLaunchMultiDeviceNoPreSync: u32 = 1; +pub const hipCooperativeLaunchMultiDeviceNoPostSync: u32 = 2; +pub const hipExtAnyOrderLaunch: u32 = 1; +pub const hipStreamWaitValueGte: u32 = 0; +pub const hipStreamWaitValueEq: u32 = 1; +pub const hipStreamWaitValueAnd: u32 = 2; +pub const hipStreamWaitValueNor: u32 = 3; +pub const hipExternalMemoryDedicated: u32 = 1; +#[doc = " @defgroup GlobalDefs Global enum and defines\n @{\n\n/\n/**\n hipDeviceArch_t\n"] #[repr(C)] #[repr(align(4))] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct hipDeviceArch_t { pub _bitfield_align_1: [u8; 0], pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize]>, @@ -375,13 +435,24 @@ impl hipDeviceArch_t { __bindgen_bitfield_unit } } -#[doc = " hipDeviceProp"] -#[doc = ""] #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct hipDeviceProp_t { +#[derive(Copy, Clone)] +pub struct hipUUID_t { + pub bytes: [::std::os::raw::c_char; 16usize], +} +pub type hipUUID = hipUUID_t; +#[doc = " hipDeviceProp\n"] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipDeviceProp_tR0600 { #[doc = "< Device name."] pub name: [::std::os::raw::c_char; 256usize], + #[doc = "< UUID of a device"] + pub uuid: hipUUID, + #[doc = "< 8-byte unique identifier. Only valid on windows"] + pub luid: [::std::os::raw::c_char; 8usize], + #[doc = "< LUID node mask"] + pub luidDeviceNodeMask: ::std::os::raw::c_uint, #[doc = "< Size of global memory region (in bytes)."] pub totalGlobalMem: usize, #[doc = "< Size of shared memory region (in bytes)."] @@ -390,6 +461,8 @@ pub struct hipDeviceProp_t { pub regsPerBlock: ::std::os::raw::c_int, #[doc = "< Warp size."] pub warpSize: ::std::os::raw::c_int, + #[doc = "< Maximum pitch in bytes allowed by memory copies\n< pitched memory"] + pub memPitch: usize, #[doc = "< Max work items per work group or workgroup max size."] pub maxThreadsPerBlock: ::std::os::raw::c_int, #[doc = "< Max number of threads in each dimension (XYZ) of a block."] @@ -398,416 +471,530 @@ pub struct hipDeviceProp_t { pub maxGridSize: [::std::os::raw::c_int; 3usize], #[doc = "< Max clock frequency of the multiProcessors in khz."] pub clockRate: ::std::os::raw::c_int, - #[doc = "< Max global memory clock frequency in khz."] - pub memoryClockRate: ::std::os::raw::c_int, - #[doc = "< Global memory bus width in bits."] - pub memoryBusWidth: ::std::os::raw::c_int, #[doc = "< Size of shared memory region (in bytes)."] pub totalConstMem: usize, - #[doc = "< Major compute capability. On HCC, this is an approximation and features may"] - #[doc = "< differ from CUDA CC. See the arch feature flags for portable ways to query"] - #[doc = "< feature caps."] + #[doc = "< Major compute capability. On HCC, this is an approximation and features may\n< differ from CUDA CC. See the arch feature flags for portable ways to query\n< feature caps."] pub major: ::std::os::raw::c_int, - #[doc = "< Minor compute capability. On HCC, this is an approximation and features may"] - #[doc = "< differ from CUDA CC. See the arch feature flags for portable ways to query"] - #[doc = "< feature caps."] + #[doc = "< Minor compute capability. On HCC, this is an approximation and features may\n< differ from CUDA CC. See the arch feature flags for portable ways to query\n< feature caps."] pub minor: ::std::os::raw::c_int, + #[doc = "< Alignment requirement for textures"] + pub textureAlignment: usize, + #[doc = "< Pitch alignment requirement for texture references bound to"] + pub texturePitchAlignment: usize, + #[doc = "< Deprecated. Use asyncEngineCount instead"] + pub deviceOverlap: ::std::os::raw::c_int, #[doc = "< Number of multi-processors (compute units)."] pub multiProcessorCount: ::std::os::raw::c_int, - #[doc = "< L2 cache size."] - pub l2CacheSize: ::std::os::raw::c_int, - #[doc = "< Maximum resident threads per multi-processor."] - pub maxThreadsPerMultiProcessor: ::std::os::raw::c_int, + #[doc = "< Run time limit for kernels executed on the device"] + pub kernelExecTimeoutEnabled: ::std::os::raw::c_int, + #[doc = "< APU vs dGPU"] + pub integrated: ::std::os::raw::c_int, + #[doc = "< Check whether HIP can map host memory"] + pub canMapHostMemory: ::std::os::raw::c_int, #[doc = "< Compute mode."] pub computeMode: ::std::os::raw::c_int, - #[doc = "< Frequency in khz of the timer used by the device-side \"clock*\""] - #[doc = "< instructions. New for HIP."] - pub clockInstructionRate: ::std::os::raw::c_int, - #[doc = "< Architectural feature flags. New for HIP."] - pub arch: hipDeviceArch_t, + #[doc = "< Maximum number of elements in 1D images"] + pub maxTexture1D: ::std::os::raw::c_int, + #[doc = "< Maximum 1D mipmap texture size"] + pub maxTexture1DMipmap: ::std::os::raw::c_int, + #[doc = "< Maximum size for 1D textures bound to linear memory"] + pub maxTexture1DLinear: ::std::os::raw::c_int, + #[doc = "< Maximum dimensions (width, height) of 2D images, in image elements"] + pub maxTexture2D: [::std::os::raw::c_int; 2usize], + #[doc = "< Maximum number of elements in 2D array mipmap of images"] + pub maxTexture2DMipmap: [::std::os::raw::c_int; 2usize], + #[doc = "< Maximum 2D tex dimensions if tex are bound to pitched memory"] + pub maxTexture2DLinear: [::std::os::raw::c_int; 3usize], + #[doc = "< Maximum 2D tex dimensions if gather has to be performed"] + pub maxTexture2DGather: [::std::os::raw::c_int; 2usize], + #[doc = "< Maximum dimensions (width, height, depth) of 3D images, in image\n< elements"] + pub maxTexture3D: [::std::os::raw::c_int; 3usize], + #[doc = "< Maximum alternate 3D texture dims"] + pub maxTexture3DAlt: [::std::os::raw::c_int; 3usize], + #[doc = "< Maximum cubemap texture dims"] + pub maxTextureCubemap: ::std::os::raw::c_int, + #[doc = "< Maximum number of elements in 1D array images"] + pub maxTexture1DLayered: [::std::os::raw::c_int; 2usize], + #[doc = "< Maximum number of elements in 2D array images"] + pub maxTexture2DLayered: [::std::os::raw::c_int; 3usize], + #[doc = "< Maximum cubemaps layered texture dims"] + pub maxTextureCubemapLayered: [::std::os::raw::c_int; 2usize], + #[doc = "< Maximum 1D surface size"] + pub maxSurface1D: ::std::os::raw::c_int, + #[doc = "< Maximum 2D surface size"] + pub maxSurface2D: [::std::os::raw::c_int; 2usize], + #[doc = "< Maximum 3D surface size"] + pub maxSurface3D: [::std::os::raw::c_int; 3usize], + #[doc = "< Maximum 1D layered surface size"] + pub maxSurface1DLayered: [::std::os::raw::c_int; 2usize], + #[doc = "< Maximum 2D layared surface size"] + pub maxSurface2DLayered: [::std::os::raw::c_int; 3usize], + #[doc = "< Maximum cubemap surface size"] + pub maxSurfaceCubemap: ::std::os::raw::c_int, + #[doc = "< Maximum cubemap layered surface size"] + pub maxSurfaceCubemapLayered: [::std::os::raw::c_int; 2usize], + #[doc = "< Alignment requirement for surface"] + pub surfaceAlignment: usize, #[doc = "< Device can possibly execute multiple kernels concurrently."] pub concurrentKernels: ::std::os::raw::c_int, - #[doc = "< PCI Domain ID"] - pub pciDomainID: ::std::os::raw::c_int, + #[doc = "< Device has ECC support enabled"] + pub ECCEnabled: ::std::os::raw::c_int, #[doc = "< PCI Bus ID."] pub pciBusID: ::std::os::raw::c_int, #[doc = "< PCI Device ID."] pub pciDeviceID: ::std::os::raw::c_int, - #[doc = "< Maximum Shared Memory Per Multiprocessor."] - pub maxSharedMemoryPerMultiProcessor: usize, + #[doc = "< PCI Domain ID"] + pub pciDomainID: ::std::os::raw::c_int, + #[doc = "< 1:If device is Tesla device using TCC driver, else 0"] + pub tccDriver: ::std::os::raw::c_int, + #[doc = "< Number of async engines"] + pub asyncEngineCount: ::std::os::raw::c_int, + #[doc = "< Does device and host share unified address space"] + pub unifiedAddressing: ::std::os::raw::c_int, + #[doc = "< Max global memory clock frequency in khz."] + pub memoryClockRate: ::std::os::raw::c_int, + #[doc = "< Global memory bus width in bits."] + pub memoryBusWidth: ::std::os::raw::c_int, + #[doc = "< L2 cache size."] + pub l2CacheSize: ::std::os::raw::c_int, + #[doc = "< Device's max L2 persisting lines in bytes"] + pub persistingL2CacheMaxSize: ::std::os::raw::c_int, + #[doc = "< Maximum resident threads per multi-processor."] + pub maxThreadsPerMultiProcessor: ::std::os::raw::c_int, + #[doc = "< Device supports stream priority"] + pub streamPrioritiesSupported: ::std::os::raw::c_int, + #[doc = "< Indicates globals are cached in L1"] + pub globalL1CacheSupported: ::std::os::raw::c_int, + #[doc = "< Locals are cahced in L1"] + pub localL1CacheSupported: ::std::os::raw::c_int, + #[doc = "< Amount of shared memory available per multiprocessor."] + pub sharedMemPerMultiprocessor: usize, + #[doc = "< registers available per multiprocessor"] + pub regsPerMultiprocessor: ::std::os::raw::c_int, + #[doc = "< Device supports allocating managed memory on this system"] + pub managedMemory: ::std::os::raw::c_int, #[doc = "< 1 if device is on a multi-GPU board, 0 if not."] pub isMultiGpuBoard: ::std::os::raw::c_int, - #[doc = "< Check whether HIP can map host memory"] - pub canMapHostMemory: ::std::os::raw::c_int, - #[doc = "< DEPRECATED: use gcnArchName instead"] - pub gcnArch: ::std::os::raw::c_int, - #[doc = "< AMD GCN Arch Name."] - pub gcnArchName: [::std::os::raw::c_char; 256usize], - #[doc = "< APU vs dGPU"] - pub integrated: ::std::os::raw::c_int, + #[doc = "< Unique identifier for a group of devices on same multiboard GPU"] + pub multiGpuBoardGroupID: ::std::os::raw::c_int, + #[doc = "< Link between host and device supports native atomics"] + pub hostNativeAtomicSupported: ::std::os::raw::c_int, + #[doc = "< Deprecated. CUDA only."] + pub singleToDoublePrecisionPerfRatio: ::std::os::raw::c_int, + #[doc = "< Device supports coherently accessing pageable memory\n< without calling hipHostRegister on it"] + pub pageableMemoryAccess: ::std::os::raw::c_int, + #[doc = "< Device can coherently access managed memory concurrently with\n< the CPU"] + pub concurrentManagedAccess: ::std::os::raw::c_int, + #[doc = "< Is compute preemption supported on the device"] + pub computePreemptionSupported: ::std::os::raw::c_int, + #[doc = "< Device can access host registered memory with same\n< address as the host"] + pub canUseHostPointerForRegisteredMem: ::std::os::raw::c_int, #[doc = "< HIP device supports cooperative launch"] pub cooperativeLaunch: ::std::os::raw::c_int, - #[doc = "< HIP device supports cooperative launch on multiple devices"] + #[doc = "< HIP device supports cooperative launch on multiple\n< devices"] pub cooperativeMultiDeviceLaunch: ::std::os::raw::c_int, - #[doc = "< Maximum size for 1D textures bound to linear memory"] - pub maxTexture1DLinear: ::std::os::raw::c_int, - #[doc = "< Maximum number of elements in 1D images"] - pub maxTexture1D: ::std::os::raw::c_int, - #[doc = "< Maximum dimensions (width, height) of 2D images, in image elements"] - pub maxTexture2D: [::std::os::raw::c_int; 2usize], - #[doc = "< Maximum dimensions (width, height, depth) of 3D images, in image elements"] - pub maxTexture3D: [::std::os::raw::c_int; 3usize], + #[doc = "< Per device m ax shared mem per block usable by special opt in"] + pub sharedMemPerBlockOptin: usize, + #[doc = "< Device accesses pageable memory via the host's\n< page tables"] + pub pageableMemoryAccessUsesHostPageTables: ::std::os::raw::c_int, + #[doc = "< Host can directly access managed memory on the device\n< without migration"] + pub directManagedMemAccessFromHost: ::std::os::raw::c_int, + #[doc = "< Max number of blocks on CU"] + pub maxBlocksPerMultiProcessor: ::std::os::raw::c_int, + #[doc = "< Max value of access policy window"] + pub accessPolicyMaxWindowSize: ::std::os::raw::c_int, + #[doc = "< Shared memory reserved by driver per block"] + pub reservedSharedMemPerBlock: usize, + #[doc = "< Device supports hipHostRegister"] + pub hostRegisterSupported: ::std::os::raw::c_int, + #[doc = "< Indicates if device supports sparse hip arrays"] + pub sparseHipArraySupported: ::std::os::raw::c_int, + #[doc = "< Device supports using the hipHostRegisterReadOnly flag\n< with hipHostRegistger"] + pub hostRegisterReadOnlySupported: ::std::os::raw::c_int, + #[doc = "< Indicates external timeline semaphore support"] + pub timelineSemaphoreInteropSupported: ::std::os::raw::c_int, + #[doc = "< Indicates if device supports hipMallocAsync and hipMemPool APIs"] + pub memoryPoolsSupported: ::std::os::raw::c_int, + #[doc = "< Indicates device support of RDMA APIs"] + pub gpuDirectRDMASupported: ::std::os::raw::c_int, + #[doc = "< Bitmask to be interpreted according to\n< hipFlushGPUDirectRDMAWritesOptions"] + pub gpuDirectRDMAFlushWritesOptions: ::std::os::raw::c_uint, + #[doc = "< value of hipGPUDirectRDMAWritesOrdering"] + pub gpuDirectRDMAWritesOrdering: ::std::os::raw::c_int, + #[doc = "< Bitmask of handle types support with mempool based IPC"] + pub memoryPoolSupportedHandleTypes: ::std::os::raw::c_uint, + #[doc = "< Device supports deferred mapping HIP arrays and HIP\n< mipmapped arrays"] + pub deferredMappingHipArraySupported: ::std::os::raw::c_int, + #[doc = "< Device supports IPC events"] + pub ipcEventSupported: ::std::os::raw::c_int, + #[doc = "< Device supports cluster launch"] + pub clusterLaunch: ::std::os::raw::c_int, + #[doc = "< Indicates device supports unified function pointers"] + pub unifiedFunctionPointers: ::std::os::raw::c_int, + #[doc = "< CUDA Reserved."] + pub reserved: [::std::os::raw::c_int; 63usize], + #[doc = "< Reserved for adding new entries for HIP/CUDA."] + pub hipReserved: [::std::os::raw::c_int; 32usize], + #[doc = "< AMD GCN Arch Name. HIP Only."] + pub gcnArchName: [::std::os::raw::c_char; 256usize], + #[doc = "< Maximum Shared Memory Per CU. HIP Only."] + pub maxSharedMemoryPerMultiProcessor: usize, + #[doc = "< Frequency in khz of the timer used by the device-side \"clock*\"\n< instructions. New for HIP."] + pub clockInstructionRate: ::std::os::raw::c_int, + #[doc = "< Architectural feature flags. New for HIP."] + pub arch: hipDeviceArch_t, #[doc = "< Addres of HDP_MEM_COHERENCY_FLUSH_CNTL register"] pub hdpMemFlushCntl: *mut ::std::os::raw::c_uint, #[doc = "< Addres of HDP_REG_COHERENCY_FLUSH_CNTL register"] pub hdpRegFlushCntl: *mut ::std::os::raw::c_uint, - #[doc = "; + impl hipDeviceAttribute_t { pub const hipDeviceAttributeCudaCompatibleBegin: hipDeviceAttribute_t = hipDeviceAttribute_t(0); } @@ -821,7 +1008,7 @@ impl hipDeviceAttribute_t { hipDeviceAttribute_t(1); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Asynchronous engines number."] + #[doc = "< Asynchronous engines number."] pub const hipDeviceAttributeAsyncEngineCount: hipDeviceAttribute_t = hipDeviceAttribute_t(2); } impl hipDeviceAttribute_t { @@ -829,8 +1016,7 @@ impl hipDeviceAttribute_t { pub const hipDeviceAttributeCanMapHostMemory: hipDeviceAttribute_t = hipDeviceAttribute_t(3); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Device can access host registered memory"] - #[doc = "< at the same virtual address as the CPU"] + #[doc = "< Device can access host registered memory\n< at the same virtual address as the CPU"] pub const hipDeviceAttributeCanUseHostPointerForRegisteredMem: hipDeviceAttribute_t = hipDeviceAttribute_t(4); } @@ -843,7 +1029,7 @@ impl hipDeviceAttribute_t { pub const hipDeviceAttributeComputeMode: hipDeviceAttribute_t = hipDeviceAttribute_t(6); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Device supports Compute Preemption."] + #[doc = "< Device supports Compute Preemption."] pub const hipDeviceAttributeComputePreemptionSupported: hipDeviceAttribute_t = hipDeviceAttribute_t(7); } @@ -866,23 +1052,21 @@ impl hipDeviceAttribute_t { hipDeviceAttribute_t(11); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Device can concurrently copy memory and execute a kernel."] - #[doc = "< Deprecated. Use instead asyncEngineCount."] + #[doc = "< Device can concurrently copy memory and execute a kernel.\n< Deprecated. Use instead asyncEngineCount."] pub const hipDeviceAttributeDeviceOverlap: hipDeviceAttribute_t = hipDeviceAttribute_t(12); } impl hipDeviceAttribute_t { - #[doc = "< Host can directly access managed memory on"] - #[doc = "< the device without migration"] + #[doc = "< Host can directly access managed memory on\n< the device without migration"] pub const hipDeviceAttributeDirectManagedMemAccessFromHost: hipDeviceAttribute_t = hipDeviceAttribute_t(13); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Device supports caching globals in L1"] + #[doc = "< Device supports caching globals in L1"] pub const hipDeviceAttributeGlobalL1CacheSupported: hipDeviceAttribute_t = hipDeviceAttribute_t(14); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Link between the device and the host supports native atomic operations"] + #[doc = "< Link between the device and the host supports native atomic operations"] pub const hipDeviceAttributeHostNativeAtomicSupported: hipDeviceAttribute_t = hipDeviceAttribute_t(15); } @@ -908,11 +1092,11 @@ impl hipDeviceAttribute_t { hipDeviceAttribute_t(20); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. 8-byte locally unique identifier in 8 bytes. Undefined on TCC and non-Windows platforms"] + #[doc = "< 8-byte locally unique identifier in 8 bytes. Undefined on TCC and non-Windows platforms"] pub const hipDeviceAttributeLuid: hipDeviceAttribute_t = hipDeviceAttribute_t(21); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Luid device node mask. Undefined on TCC and non-Windows platforms"] + #[doc = "< Luid device node mask. Undefined on TCC and non-Windows platforms"] pub const hipDeviceAttributeLuidDeviceNodeMask: hipDeviceAttribute_t = hipDeviceAttribute_t(22); } impl hipDeviceAttribute_t { @@ -925,7 +1109,7 @@ impl hipDeviceAttribute_t { pub const hipDeviceAttributeManagedMemory: hipDeviceAttribute_t = hipDeviceAttribute_t(24); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Max block size per multiprocessor"] + #[doc = "< Max block size per multiprocessor"] pub const hipDeviceAttributeMaxBlocksPerMultiProcessor: hipDeviceAttribute_t = hipDeviceAttribute_t(25); } @@ -989,17 +1173,16 @@ impl hipDeviceAttribute_t { pub const hipDeviceAttributeMaxTexture1DWidth: hipDeviceAttribute_t = hipDeviceAttribute_t(39); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Maximum dimensions of 1D layered texture."] + #[doc = "< Maximum dimensions of 1D layered texture."] pub const hipDeviceAttributeMaxTexture1DLayered: hipDeviceAttribute_t = hipDeviceAttribute_t(40); } impl hipDeviceAttribute_t { - #[doc = "< Maximum number of elements allocatable in a 1D linear texture."] - #[doc = "< Use cudaDeviceGetTexture1DLinearMaxWidth() instead on Cuda."] + #[doc = "< Maximum number of elements allocatable in a 1D linear texture.\n< Use cudaDeviceGetTexture1DLinearMaxWidth() instead on Cuda."] pub const hipDeviceAttributeMaxTexture1DLinear: hipDeviceAttribute_t = hipDeviceAttribute_t(41); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Maximum size of 1D mipmapped texture."] + #[doc = "< Maximum size of 1D mipmapped texture."] pub const hipDeviceAttributeMaxTexture1DMipmap: hipDeviceAttribute_t = hipDeviceAttribute_t(42); } impl hipDeviceAttribute_t { @@ -1011,20 +1194,20 @@ impl hipDeviceAttribute_t { pub const hipDeviceAttributeMaxTexture2DHeight: hipDeviceAttribute_t = hipDeviceAttribute_t(44); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Maximum dimensions of 2D texture if gather operations performed."] + #[doc = "< Maximum dimensions of 2D texture if gather operations performed."] pub const hipDeviceAttributeMaxTexture2DGather: hipDeviceAttribute_t = hipDeviceAttribute_t(45); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Maximum dimensions of 2D layered texture."] + #[doc = "< Maximum dimensions of 2D layered texture."] pub const hipDeviceAttributeMaxTexture2DLayered: hipDeviceAttribute_t = hipDeviceAttribute_t(46); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Maximum dimensions (width, height, pitch) of 2D textures bound to pitched memory."] + #[doc = "< Maximum dimensions (width, height, pitch) of 2D textures bound to pitched memory."] pub const hipDeviceAttributeMaxTexture2DLinear: hipDeviceAttribute_t = hipDeviceAttribute_t(47); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Maximum dimensions of 2D mipmapped texture."] + #[doc = "< Maximum dimensions of 2D mipmapped texture."] pub const hipDeviceAttributeMaxTexture2DMipmap: hipDeviceAttribute_t = hipDeviceAttribute_t(48); } impl hipDeviceAttribute_t { @@ -1040,15 +1223,15 @@ impl hipDeviceAttribute_t { pub const hipDeviceAttributeMaxTexture3DDepth: hipDeviceAttribute_t = hipDeviceAttribute_t(51); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Maximum dimensions of alternate 3D texture."] + #[doc = "< Maximum dimensions of alternate 3D texture."] pub const hipDeviceAttributeMaxTexture3DAlt: hipDeviceAttribute_t = hipDeviceAttribute_t(52); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Maximum dimensions of Cubemap texture"] + #[doc = "< Maximum dimensions of Cubemap texture"] pub const hipDeviceAttributeMaxTextureCubemap: hipDeviceAttribute_t = hipDeviceAttribute_t(53); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Maximum dimensions of Cubemap layered texture."] + #[doc = "< Maximum dimensions of Cubemap layered texture."] pub const hipDeviceAttributeMaxTextureCubemapLayered: hipDeviceAttribute_t = hipDeviceAttribute_t(54); } @@ -1083,7 +1266,7 @@ impl hipDeviceAttribute_t { hipDeviceAttribute_t(61); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Unique ID of device group on the same multi-GPU board"] + #[doc = "< Unique ID of device group on the same multi-GPU board"] pub const hipDeviceAttributeMultiGpuBoardGroupID: hipDeviceAttribute_t = hipDeviceAttribute_t(62); } @@ -1093,12 +1276,11 @@ impl hipDeviceAttribute_t { hipDeviceAttribute_t(63); } impl hipDeviceAttribute_t { - #[doc = "< Device name."] - pub const hipDeviceAttributeName: hipDeviceAttribute_t = hipDeviceAttribute_t(64); + #[doc = "< Previously hipDeviceAttributeName"] + pub const hipDeviceAttributeUnused1: hipDeviceAttribute_t = hipDeviceAttribute_t(64); } impl hipDeviceAttribute_t { - #[doc = "< Device supports coherently accessing pageable memory"] - #[doc = "< without calling hipHostRegister on it"] + #[doc = "< Device supports coherently accessing pageable memory\n< without calling hipHostRegister on it"] pub const hipDeviceAttributePageableMemoryAccess: hipDeviceAttribute_t = hipDeviceAttribute_t(65); } @@ -1120,13 +1302,12 @@ impl hipDeviceAttribute_t { pub const hipDeviceAttributePciDomainID: hipDeviceAttribute_t = hipDeviceAttribute_t(69); } impl hipDeviceAttribute_t { - #[doc = "< Cuda11 only. Maximum l2 persisting lines capacity in bytes"] + #[doc = "< Maximum l2 persisting lines capacity in bytes"] pub const hipDeviceAttributePersistingL2CacheMaxSize: hipDeviceAttribute_t = hipDeviceAttribute_t(70); } impl hipDeviceAttribute_t { - #[doc = "< 32-bit registers available to a thread block. This number is shared"] - #[doc = "< by all thread blocks simultaneously resident on a multiprocessor."] + #[doc = "< 32-bit registers available to a thread block. This number is shared\n< by all thread blocks simultaneously resident on a multiprocessor."] pub const hipDeviceAttributeMaxRegistersPerBlock: hipDeviceAttribute_t = hipDeviceAttribute_t(71); } @@ -1136,7 +1317,7 @@ impl hipDeviceAttribute_t { hipDeviceAttribute_t(72); } impl hipDeviceAttribute_t { - #[doc = "< Cuda11 only. Shared memory reserved by CUDA driver per block."] + #[doc = "< Shared memory reserved by CUDA driver per block."] pub const hipDeviceAttributeReservedSharedMemPerBlock: hipDeviceAttribute_t = hipDeviceAttribute_t(73); } @@ -1146,12 +1327,12 @@ impl hipDeviceAttribute_t { hipDeviceAttribute_t(74); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Maximum shared memory per block usable by special opt in."] + #[doc = "< Maximum shared memory per block usable by special opt in."] pub const hipDeviceAttributeSharedMemPerBlockOptin: hipDeviceAttribute_t = hipDeviceAttribute_t(75); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Shared memory available per multiprocessor."] + #[doc = "< Shared memory available per multiprocessor."] pub const hipDeviceAttributeSharedMemPerMultiprocessor: hipDeviceAttribute_t = hipDeviceAttribute_t(76); } @@ -1161,12 +1342,12 @@ impl hipDeviceAttribute_t { hipDeviceAttribute_t(77); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Whether to support stream priorities."] + #[doc = "< Whether to support stream priorities."] pub const hipDeviceAttributeStreamPrioritiesSupported: hipDeviceAttribute_t = hipDeviceAttribute_t(78); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Alignment requirement for surfaces"] + #[doc = "< Alignment requirement for surfaces"] pub const hipDeviceAttributeSurfaceAlignment: hipDeviceAttribute_t = hipDeviceAttribute_t(79); } impl hipDeviceAttribute_t { @@ -1196,13 +1377,33 @@ impl hipDeviceAttribute_t { pub const hipDeviceAttributeUnifiedAddressing: hipDeviceAttribute_t = hipDeviceAttribute_t(85); } impl hipDeviceAttribute_t { - #[doc = "< Cuda only. Unique ID in 16 byte."] - pub const hipDeviceAttributeUuid: hipDeviceAttribute_t = hipDeviceAttribute_t(86); + #[doc = "< Previously hipDeviceAttributeUuid"] + pub const hipDeviceAttributeUnused2: hipDeviceAttribute_t = hipDeviceAttribute_t(86); } impl hipDeviceAttribute_t { #[doc = "< Warp size in threads."] pub const hipDeviceAttributeWarpSize: hipDeviceAttribute_t = hipDeviceAttribute_t(87); } +impl hipDeviceAttribute_t { + #[doc = "< Device supports HIP Stream Ordered Memory Allocator"] + pub const hipDeviceAttributeMemoryPoolsSupported: hipDeviceAttribute_t = + hipDeviceAttribute_t(88); +} +impl hipDeviceAttribute_t { + #[doc = "< Device supports HIP virtual memory management"] + pub const hipDeviceAttributeVirtualMemoryManagementSupported: hipDeviceAttribute_t = + hipDeviceAttribute_t(89); +} +impl hipDeviceAttribute_t { + #[doc = "< Can device support host memory registration via hipHostRegister"] + pub const hipDeviceAttributeHostRegisterSupported: hipDeviceAttribute_t = + hipDeviceAttribute_t(90); +} +impl hipDeviceAttribute_t { + #[doc = "< Supported handle mask for HIP Stream Ordered Memory Allocator"] + pub const hipDeviceAttributeMemoryPoolSupportedHandleTypes: hipDeviceAttribute_t = + hipDeviceAttribute_t(91); +} impl hipDeviceAttribute_t { pub const hipDeviceAttributeCudaCompatibleEnd: hipDeviceAttribute_t = hipDeviceAttribute_t(9999); @@ -1217,8 +1418,8 @@ impl hipDeviceAttribute_t { hipDeviceAttribute_t(10000); } impl hipDeviceAttribute_t { - #[doc = "< Device architecture"] - pub const hipDeviceAttributeArch: hipDeviceAttribute_t = hipDeviceAttribute_t(10001); + #[doc = "< Previously hipDeviceAttributeArch"] + pub const hipDeviceAttributeUnused3: hipDeviceAttribute_t = hipDeviceAttribute_t(10001); } impl hipDeviceAttribute_t { #[doc = "< Maximum Shared Memory PerMultiprocessor."] @@ -1226,12 +1427,12 @@ impl hipDeviceAttribute_t { hipDeviceAttribute_t(10002); } impl hipDeviceAttribute_t { - #[doc = "< Device gcn architecture"] - pub const hipDeviceAttributeGcnArch: hipDeviceAttribute_t = hipDeviceAttribute_t(10003); + #[doc = "< Previously hipDeviceAttributeGcnArch"] + pub const hipDeviceAttributeUnused4: hipDeviceAttribute_t = hipDeviceAttribute_t(10003); } impl hipDeviceAttribute_t { - #[doc = "< Device gcnArch name in 256 bytes"] - pub const hipDeviceAttributeGcnArchName: hipDeviceAttribute_t = hipDeviceAttribute_t(10004); + #[doc = "< Previously hipDeviceAttributeGcnArchName"] + pub const hipDeviceAttributeUnused5: hipDeviceAttribute_t = hipDeviceAttribute_t(10004); } impl hipDeviceAttribute_t { #[doc = "< Address of the HDP_MEM_COHERENCY_FLUSH_CNTL register"] @@ -1242,26 +1443,22 @@ impl hipDeviceAttribute_t { pub const hipDeviceAttributeHdpRegFlushCntl: hipDeviceAttribute_t = hipDeviceAttribute_t(10006); } impl hipDeviceAttribute_t { - #[doc = "< Supports cooperative launch on multiple"] - #[doc = "< devices with unmatched functions"] + #[doc = "< Supports cooperative launch on multiple\n< devices with unmatched functions"] pub const hipDeviceAttributeCooperativeMultiDeviceUnmatchedFunc: hipDeviceAttribute_t = hipDeviceAttribute_t(10007); } impl hipDeviceAttribute_t { - #[doc = "< Supports cooperative launch on multiple"] - #[doc = "< devices with unmatched grid dimensions"] + #[doc = "< Supports cooperative launch on multiple\n< devices with unmatched grid dimensions"] pub const hipDeviceAttributeCooperativeMultiDeviceUnmatchedGridDim: hipDeviceAttribute_t = hipDeviceAttribute_t(10008); } impl hipDeviceAttribute_t { - #[doc = "< Supports cooperative launch on multiple"] - #[doc = "< devices with unmatched block dimensions"] + #[doc = "< Supports cooperative launch on multiple\n< devices with unmatched block dimensions"] pub const hipDeviceAttributeCooperativeMultiDeviceUnmatchedBlockDim: hipDeviceAttribute_t = hipDeviceAttribute_t(10009); } impl hipDeviceAttribute_t { - #[doc = "< Supports cooperative launch on multiple"] - #[doc = "< devices with unmatched shared memories"] + #[doc = "< Supports cooperative launch on multiple\n< devices with unmatched shared memories"] pub const hipDeviceAttributeCooperativeMultiDeviceUnmatchedSharedMem: hipDeviceAttribute_t = hipDeviceAttribute_t(10010); } @@ -1274,11 +1471,28 @@ impl hipDeviceAttribute_t { pub const hipDeviceAttributeAsicRevision: hipDeviceAttribute_t = hipDeviceAttribute_t(10012); } impl hipDeviceAttribute_t { - #[doc = "< '1' if Device supports hipStreamWaitValue32() and"] - #[doc = "< hipStreamWaitValue64() , '0' otherwise."] + #[doc = "< '1' if Device supports hipStreamWaitValue32() and\n< hipStreamWaitValue64(), '0' otherwise."] pub const hipDeviceAttributeCanUseStreamWaitValue: hipDeviceAttribute_t = hipDeviceAttribute_t(10013); } +impl hipDeviceAttribute_t { + #[doc = "< '1' if Device supports image, '0' otherwise."] + pub const hipDeviceAttributeImageSupport: hipDeviceAttribute_t = hipDeviceAttribute_t(10014); +} +impl hipDeviceAttribute_t { + #[doc = "< All available physical compute\n< units for the device"] + pub const hipDeviceAttributePhysicalMultiProcessorCount: hipDeviceAttribute_t = + hipDeviceAttribute_t(10015); +} +impl hipDeviceAttribute_t { + #[doc = "< '1' if Device supports fine grain, '0' otherwise"] + pub const hipDeviceAttributeFineGrainSupport: hipDeviceAttribute_t = + hipDeviceAttribute_t(10016); +} +impl hipDeviceAttribute_t { + #[doc = "< Constant frequency of wall clock in kilohertz."] + pub const hipDeviceAttributeWallClockRate: hipDeviceAttribute_t = hipDeviceAttribute_t(10017); +} impl hipDeviceAttribute_t { pub const hipDeviceAttributeAmdSpecificEnd: hipDeviceAttribute_t = hipDeviceAttribute_t(19999); } @@ -1287,7 +1501,8 @@ impl hipDeviceAttribute_t { hipDeviceAttribute_t(20000); } #[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[doc = " hipDeviceAttribute_t\n hipDeviceAttributeUnused number: 5"] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] pub struct hipDeviceAttribute_t(pub ::std::os::raw::c_uint); impl hipComputeMode { pub const hipComputeModeDefault: hipComputeMode = hipComputeMode(0); @@ -1302,11 +1517,37 @@ impl hipComputeMode { pub const hipComputeModeExclusiveProcess: hipComputeMode = hipComputeMode(3); } #[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] pub struct hipComputeMode(pub ::std::os::raw::c_uint); -pub type __uint32_t = ::std::os::raw::c_uint; -pub type __uint64_t = ::std::os::raw::c_ulong; -pub type hipDeviceptr_t = *mut ::std::os::raw::c_void; +impl hipFlushGPUDirectRDMAWritesOptions { + pub const hipFlushGPUDirectRDMAWritesOptionHost: hipFlushGPUDirectRDMAWritesOptions = + hipFlushGPUDirectRDMAWritesOptions(1); +} +impl hipFlushGPUDirectRDMAWritesOptions { + pub const hipFlushGPUDirectRDMAWritesOptionMemOps: hipFlushGPUDirectRDMAWritesOptions = + hipFlushGPUDirectRDMAWritesOptions(2); +} +#[repr(transparent)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipFlushGPUDirectRDMAWritesOptions(pub ::std::os::raw::c_uint); +impl hipGPUDirectRDMAWritesOrdering { + pub const hipGPUDirectRDMAWritesOrderingNone: hipGPUDirectRDMAWritesOrdering = + hipGPUDirectRDMAWritesOrdering(0); +} +impl hipGPUDirectRDMAWritesOrdering { + pub const hipGPUDirectRDMAWritesOrderingOwner: hipGPUDirectRDMAWritesOrdering = + hipGPUDirectRDMAWritesOrdering(100); +} +impl hipGPUDirectRDMAWritesOrdering { + pub const hipGPUDirectRDMAWritesOrderingAllDevices: hipGPUDirectRDMAWritesOrdering = + hipGPUDirectRDMAWritesOrdering(200); +} +#[repr(transparent)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipGPUDirectRDMAWritesOrdering(pub ::std::os::raw::c_uint); +#[repr(transparent)] +#[derive(Copy, Clone)] +pub struct hipDeviceptr_t(pub *mut ::std::os::raw::c_void); impl hipChannelFormatKind { pub const hipChannelFormatKindSigned: hipChannelFormatKind = hipChannelFormatKind(0); } @@ -1320,10 +1561,10 @@ impl hipChannelFormatKind { pub const hipChannelFormatKindNone: hipChannelFormatKind = hipChannelFormatKind(3); } #[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] pub struct hipChannelFormatKind(pub ::std::os::raw::c_uint); #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct hipChannelFormatDesc { pub x: ::std::os::raw::c_int, pub y: ::std::os::raw::c_int, @@ -1331,6 +1572,13 @@ pub struct hipChannelFormatDesc { pub w: ::std::os::raw::c_int, pub f: hipChannelFormatKind, } +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipArray { + _unused: [u8; 0], +} +pub type hipArray_t = *mut hipArray; +pub type hipArray_const_t = *const hipArray; impl hipArray_Format { pub const HIP_AD_FORMAT_UNSIGNED_INT8: hipArray_Format = hipArray_Format(1); } @@ -1356,10 +1604,10 @@ impl hipArray_Format { pub const HIP_AD_FORMAT_FLOAT: hipArray_Format = hipArray_Format(32); } #[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] pub struct hipArray_Format(pub ::std::os::raw::c_uint); #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct HIP_ARRAY_DESCRIPTOR { pub Width: usize, pub Height: usize, @@ -1367,7 +1615,7 @@ pub struct HIP_ARRAY_DESCRIPTOR { pub NumChannels: ::std::os::raw::c_uint, } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct HIP_ARRAY3D_DESCRIPTOR { pub Width: usize, pub Height: usize, @@ -1377,44 +1625,27 @@ pub struct HIP_ARRAY3D_DESCRIPTOR { pub Flags: ::std::os::raw::c_uint, } #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct hipArray { - pub data: *mut ::std::os::raw::c_void, - pub desc: hipChannelFormatDesc, - pub type_: ::std::os::raw::c_uint, - pub width: ::std::os::raw::c_uint, - pub height: ::std::os::raw::c_uint, - pub depth: ::std::os::raw::c_uint, - pub Format: hipArray_Format, - pub NumChannels: ::std::os::raw::c_uint, - pub isDrv: bool, - pub textureType: ::std::os::raw::c_uint, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct hip_Memcpy2D { pub srcXInBytes: usize, pub srcY: usize, pub srcMemoryType: hipMemoryType, pub srcHost: *const ::std::os::raw::c_void, pub srcDevice: hipDeviceptr_t, - pub srcArray: *mut hipArray, + pub srcArray: hipArray_t, pub srcPitch: usize, pub dstXInBytes: usize, pub dstY: usize, pub dstMemoryType: hipMemoryType, pub dstHost: *mut ::std::os::raw::c_void, pub dstDevice: hipDeviceptr_t, - pub dstArray: *mut hipArray, + pub dstArray: hipArray_t, pub dstPitch: usize, pub WidthInBytes: usize, pub Height: usize, } -pub type hipArray_t = *mut hipArray; -pub type hiparray = hipArray_t; -pub type hipArray_const_t = *const hipArray; #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct hipMipmappedArray { pub data: *mut ::std::os::raw::c_void, pub desc: hipChannelFormatDesc, @@ -1426,8 +1657,10 @@ pub struct hipMipmappedArray { pub max_mipmap_level: ::std::os::raw::c_uint, pub flags: ::std::os::raw::c_uint, pub format: hipArray_Format, + pub num_channels: ::std::os::raw::c_uint, } pub type hipMipmappedArray_t = *mut hipMipmappedArray; +pub type hipmipmappedArray = hipMipmappedArray_t; pub type hipMipmappedArray_const_t = *const hipMipmappedArray; impl hipResourceType { pub const hipResourceTypeArray: hipResourceType = hipResourceType(0); @@ -1443,7 +1676,7 @@ impl hipResourceType { } #[repr(transparent)] #[doc = " hip resource types"] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] pub struct hipResourceType(pub ::std::os::raw::c_uint); impl HIPresourcetype_enum { #[doc = "< Array resoure"] @@ -1462,9 +1695,10 @@ impl HIPresourcetype_enum { pub const HIP_RESOURCE_TYPE_PITCH2D: HIPresourcetype_enum = HIPresourcetype_enum(3); } #[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] pub struct HIPresourcetype_enum(pub ::std::os::raw::c_uint); pub use self::HIPresourcetype_enum as HIPresourcetype; +pub use self::HIPresourcetype_enum as hipResourcetype; impl HIPaddress_mode_enum { pub const HIP_TR_ADDRESS_MODE_WRAP: HIPaddress_mode_enum = HIPaddress_mode_enum(0); } @@ -1479,7 +1713,7 @@ impl HIPaddress_mode_enum { } #[repr(transparent)] #[doc = " hip address modes"] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] pub struct HIPaddress_mode_enum(pub ::std::os::raw::c_uint); #[doc = " hip address modes"] pub use self::HIPaddress_mode_enum as HIPaddress_mode; @@ -1491,13 +1725,13 @@ impl HIPfilter_mode_enum { } #[repr(transparent)] #[doc = " hip filter modes"] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] pub struct HIPfilter_mode_enum(pub ::std::os::raw::c_uint); #[doc = " hip filter modes"] pub use self::HIPfilter_mode_enum as HIPfilter_mode; #[doc = " Texture descriptor"] #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct HIP_TEXTURE_DESC_st { #[doc = "< Address modes"] pub addressMode: [HIPaddress_mode; 3usize], @@ -1638,7 +1872,7 @@ impl hipResourceViewFormat { } #[repr(transparent)] #[doc = " hip texture resource view formats"] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] pub struct hipResourceViewFormat(pub ::std::os::raw::c_uint); impl HIPresourceViewFormat_enum { #[doc = "< No resource view format (use underlying resource format)"] @@ -1815,7 +2049,7 @@ impl HIPresourceViewFormat_enum { HIPresourceViewFormat_enum(34); } #[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] pub struct HIPresourceViewFormat_enum(pub ::std::os::raw::c_uint); pub use self::HIPresourceViewFormat_enum as HIPresourceViewFormat; #[doc = " HIP resource descriptor"] @@ -1834,24 +2068,24 @@ pub union hipResourceDesc__bindgen_ty_1 { pub pitch2D: hipResourceDesc__bindgen_ty_1__bindgen_ty_4, } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct hipResourceDesc__bindgen_ty_1__bindgen_ty_1 { pub array: hipArray_t, } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct hipResourceDesc__bindgen_ty_1__bindgen_ty_2 { pub mipmap: hipMipmappedArray_t, } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct hipResourceDesc__bindgen_ty_1__bindgen_ty_3 { pub devPtr: *mut ::std::os::raw::c_void, pub desc: hipChannelFormatDesc, pub sizeInBytes: usize, } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct hipResourceDesc__bindgen_ty_1__bindgen_ty_4 { pub devPtr: *mut ::std::os::raw::c_void, pub desc: hipChannelFormatDesc, @@ -1878,19 +2112,19 @@ pub union HIP_RESOURCE_DESC_st__bindgen_ty_1 { pub reserved: HIP_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_5, } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct HIP_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_1 { #[doc = "< HIP array"] pub hArray: hipArray_t, } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct HIP_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_2 { #[doc = "< HIP mipmapped array"] pub hMipmappedArray: hipMipmappedArray_t, } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct HIP_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_3 { #[doc = "< Device pointer"] pub devPtr: hipDeviceptr_t, @@ -1902,7 +2136,7 @@ pub struct HIP_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_3 { pub sizeInBytes: usize, } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct HIP_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_4 { #[doc = "< Device pointer"] pub devPtr: hipDeviceptr_t, @@ -1918,14 +2152,14 @@ pub struct HIP_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_4 { pub pitchInBytes: usize, } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct HIP_RESOURCE_DESC_st__bindgen_ty_1__bindgen_ty_5 { pub reserved: [::std::os::raw::c_int; 32usize], } pub type HIP_RESOURCE_DESC = HIP_RESOURCE_DESC_st; #[doc = " hip resource view descriptor"] #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct hipResourceViewDesc { pub format: hipResourceViewFormat, pub width: usize, @@ -1938,7 +2172,7 @@ pub struct hipResourceViewDesc { } #[doc = " Resource view descriptor"] #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct HIP_RESOURCE_VIEW_DESC_st { #[doc = "< Resource view format"] pub format: HIPresourceViewFormat, @@ -1977,13 +2211,18 @@ impl hipMemcpyKind { pub const hipMemcpyDeviceToDevice: hipMemcpyKind = hipMemcpyKind(3); } impl hipMemcpyKind { + #[doc = "< Runtime will automatically determine\n hipError_t; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ihipGraph { + _unused: [u8; 0], } -extern "C" { - #[doc = " @brief Returns the approximate HIP driver version."] - #[doc = ""] - #[doc = " @param [out] driverVersion"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInavlidValue"] - #[doc = ""] - #[doc = " @warning The HIP feature set does not correspond to an exact CUDA SDK driver revision."] - #[doc = " This function always set *driverVersion to 4 as an approximation though HIP supports"] - #[doc = " some features which were introduced in later CUDA SDK revisions."] - #[doc = " HIP apps code should not rely on the driver revision number here and should"] - #[doc = " use arch feature flags to test device capabilities or conditional compilation."] - #[doc = ""] - #[doc = " @see hipRuntimeGetVersion"] - pub fn hipDriverGetVersion(driverVersion: *mut ::std::os::raw::c_int) -> hipError_t; +#[doc = " An opaque value that represents a hip graph"] +pub type hipGraph_t = *mut ihipGraph; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipGraphNode { + _unused: [u8; 0], } -extern "C" { - #[doc = " @brief Returns the approximate HIP Runtime version."] - #[doc = ""] - #[doc = " @param [out] runtimeVersion"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInavlidValue"] - #[doc = ""] - #[doc = " @warning On HIP/HCC path this function returns HIP runtime patch version however on"] - #[doc = " HIP/NVCC path this function return CUDA runtime version."] - #[doc = ""] - #[doc = " @see hipDriverGetVersion"] - pub fn hipRuntimeGetVersion(runtimeVersion: *mut ::std::os::raw::c_int) -> hipError_t; +#[doc = " An opaque value that represents a hip graph node"] +pub type hipGraphNode_t = *mut hipGraphNode; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipGraphExec { + _unused: [u8; 0], } -extern "C" { - #[doc = " @brief Returns a handle to a compute device"] - #[doc = " @param [out] device"] - #[doc = " @param [in] ordinal"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInavlidDevice"] - pub fn hipDeviceGet(device: *mut hipDevice_t, ordinal: ::std::os::raw::c_int) -> hipError_t; +#[doc = " An opaque value that represents a hip graph Exec"] +pub type hipGraphExec_t = *mut hipGraphExec; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipUserObject { + _unused: [u8; 0], } -extern "C" { - #[doc = " @brief Returns the compute capability of the device"] - #[doc = " @param [out] major"] - #[doc = " @param [out] minor"] - #[doc = " @param [in] device"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInavlidDevice"] - pub fn hipDeviceComputeCapability( - major: *mut ::std::os::raw::c_int, - minor: *mut ::std::os::raw::c_int, - device: hipDevice_t, - ) -> hipError_t; +#[doc = " An opaque value that represents a user obj"] +pub type hipUserObject_t = *mut hipUserObject; +impl hipGraphNodeType { + #[doc = "< GPU kernel node"] + pub const hipGraphNodeTypeKernel: hipGraphNodeType = hipGraphNodeType(0); } -extern "C" { - #[doc = " @brief Returns an identifer string for the device."] - #[doc = " @param [out] name"] - #[doc = " @param [in] len"] - #[doc = " @param [in] device"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInavlidDevice"] - pub fn hipDeviceGetName( - name: *mut ::std::os::raw::c_char, - len: ::std::os::raw::c_int, - device: hipDevice_t, - ) -> hipError_t; +impl hipGraphNodeType { + #[doc = "< Memcpy node"] + pub const hipGraphNodeTypeMemcpy: hipGraphNodeType = hipGraphNodeType(1); } -extern "C" { - #[doc = " @brief Returns a value for attr of link between two devices"] - #[doc = " @param [out] value"] - #[doc = " @param [in] attr"] - #[doc = " @param [in] srcDevice"] - #[doc = " @param [in] dstDevice"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInavlidDevice"] - pub fn hipDeviceGetP2PAttribute( - value: *mut ::std::os::raw::c_int, - attr: hipDeviceP2PAttr, - srcDevice: ::std::os::raw::c_int, - dstDevice: ::std::os::raw::c_int, - ) -> hipError_t; +impl hipGraphNodeType { + #[doc = "< Memset node"] + pub const hipGraphNodeTypeMemset: hipGraphNodeType = hipGraphNodeType(2); } -extern "C" { - #[doc = " @brief Returns a PCI Bus Id string for the device, overloaded to take int device ID."] - #[doc = " @param [out] pciBusId"] - #[doc = " @param [in] len"] - #[doc = " @param [in] device"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInavlidDevice"] - pub fn hipDeviceGetPCIBusId( - pciBusId: *mut ::std::os::raw::c_char, - len: ::std::os::raw::c_int, - device: ::std::os::raw::c_int, - ) -> hipError_t; +impl hipGraphNodeType { + #[doc = "< Host (executable) node"] + pub const hipGraphNodeTypeHost: hipGraphNodeType = hipGraphNodeType(3); } -extern "C" { - #[doc = " @brief Returns a handle to a compute device."] - #[doc = " @param [out] device handle"] - #[doc = " @param [in] PCI Bus ID"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInavlidDevice, #hipErrorInvalidValue"] - pub fn hipDeviceGetByPCIBusId( - device: *mut ::std::os::raw::c_int, - pciBusId: *const ::std::os::raw::c_char, - ) -> hipError_t; +impl hipGraphNodeType { + #[doc = "< Node which executes an embedded graph"] + pub const hipGraphNodeTypeGraph: hipGraphNodeType = hipGraphNodeType(4); } -extern "C" { - #[doc = " @brief Returns the total amount of memory on the device."] - #[doc = " @param [out] bytes"] - #[doc = " @param [in] device"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInavlidDevice"] - pub fn hipDeviceTotalMem(bytes: *mut usize, device: hipDevice_t) -> hipError_t; +impl hipGraphNodeType { + #[doc = "< Empty (no-op) node"] + pub const hipGraphNodeTypeEmpty: hipGraphNodeType = hipGraphNodeType(5); } -extern "C" { - #[doc = " @}"] - #[doc = " @defgroup Device Device Management"] - #[doc = " @{"] - #[doc = " This section describes the device management functions of HIP runtime API."] - #[doc = " @brief Waits on all active streams on current device"] - #[doc = ""] - #[doc = " When this command is invoked, the host thread gets blocked until all the commands associated"] - #[doc = " with streams associated with the device. HIP does not support multiple blocking modes (yet!)."] - #[doc = ""] - #[doc = " @returns #hipSuccess"] - #[doc = ""] - #[doc = " @see hipSetDevice, hipDeviceReset"] - pub fn hipDeviceSynchronize() -> hipError_t; +impl hipGraphNodeType { + #[doc = "< External event wait node"] + pub const hipGraphNodeTypeWaitEvent: hipGraphNodeType = hipGraphNodeType(6); } -extern "C" { - #[doc = " @brief The state of current device is discarded and updated to a fresh state."] - #[doc = ""] - #[doc = " Calling this function deletes all streams created, memory allocated, kernels running, events"] - #[doc = " created. Make sure that no other thread is using the device or streams, memory, kernels, events"] - #[doc = " associated with the current device."] - #[doc = ""] - #[doc = " @returns #hipSuccess"] - #[doc = ""] - #[doc = " @see hipDeviceSynchronize"] - pub fn hipDeviceReset() -> hipError_t; +impl hipGraphNodeType { + #[doc = "< External event record node"] + pub const hipGraphNodeTypeEventRecord: hipGraphNodeType = hipGraphNodeType(7); } -extern "C" { - #[doc = " @brief Set default device to be used for subsequent hip API calls from this thread."] - #[doc = ""] - #[doc = " @param[in] deviceId Valid device in range 0...hipGetDeviceCount()."] - #[doc = ""] - #[doc = " Sets @p device as the default device for the calling host thread. Valid device id's are 0..."] - #[doc = " (hipGetDeviceCount()-1)."] - #[doc = ""] - #[doc = " Many HIP APIs implicitly use the \"default device\" :"] - #[doc = ""] - #[doc = " - Any device memory subsequently allocated from this host thread (using hipMalloc) will be"] - #[doc = " allocated on device."] - #[doc = " - Any streams or events created from this host thread will be associated with device."] - #[doc = " - Any kernels launched from this host thread (using hipLaunchKernel) will be executed on device"] - #[doc = " (unless a specific stream is specified, in which case the device associated with that stream will"] - #[doc = " be used)."] - #[doc = ""] - #[doc = " This function may be called from any host thread. Multiple host threads may use the same device."] - #[doc = " This function does no synchronization with the previous or new device, and has very little"] - #[doc = " runtime overhead. Applications can use hipSetDevice to quickly switch the default device before"] - #[doc = " making a HIP runtime call which uses the default device."] - #[doc = ""] - #[doc = " The default device is stored in thread-local-storage for each thread."] - #[doc = " Thread-pool implementations may inherit the default device of the previous thread. A good"] - #[doc = " practice is to always call hipSetDevice at the start of HIP coding sequency to establish a known"] - #[doc = " standard device."] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorDeviceAlreadyInUse"] - #[doc = ""] - #[doc = " @see hipGetDevice, hipGetDeviceCount"] - pub fn hipSetDevice(deviceId: ::std::os::raw::c_int) -> hipError_t; +impl hipGraphNodeType { + #[doc = "< External Semaphore signal node"] + pub const hipGraphNodeTypeExtSemaphoreSignal: hipGraphNodeType = hipGraphNodeType(8); } -extern "C" { - #[doc = " @brief Return the default device id for the calling host thread."] - #[doc = ""] - #[doc = " @param [out] device *device is written with the default device"] - #[doc = ""] - #[doc = " HIP maintains an default device for each thread using thread-local-storage."] - #[doc = " This device is used implicitly for HIP runtime APIs called by this thread."] - #[doc = " hipGetDevice returns in * @p device the default device for the calling host thread."] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see hipSetDevice, hipGetDevicesizeBytes"] - pub fn hipGetDevice(deviceId: *mut ::std::os::raw::c_int) -> hipError_t; +impl hipGraphNodeType { + #[doc = "< External Semaphore wait node"] + pub const hipGraphNodeTypeExtSemaphoreWait: hipGraphNodeType = hipGraphNodeType(9); } -extern "C" { - #[doc = " @brief Return number of compute-capable devices."] - #[doc = ""] - #[doc = " @param [output] count Returns number of compute-capable devices."] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorNoDevice"] - #[doc = ""] - #[doc = ""] - #[doc = " Returns in @p *count the number of devices that have ability to run compute commands. If there"] - #[doc = " are no such devices, then @ref hipGetDeviceCount will return #hipErrorNoDevice. If 1 or more"] - #[doc = " devices can be found, then hipGetDeviceCount returns #hipSuccess."] - pub fn hipGetDeviceCount(count: *mut ::std::os::raw::c_int) -> hipError_t; +impl hipGraphNodeType { + #[doc = "< Memory alloc node"] + pub const hipGraphNodeTypeMemAlloc: hipGraphNodeType = hipGraphNodeType(10); } -extern "C" { - #[doc = " @brief Query for a specific device attribute."] - #[doc = ""] - #[doc = " @param [out] pi pointer to value to return"] - #[doc = " @param [in] attr attribute to query"] - #[doc = " @param [in] deviceId which device to query for information"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] - pub fn hipDeviceGetAttribute( - pi: *mut ::std::os::raw::c_int, - attr: hipDeviceAttribute_t, - deviceId: ::std::os::raw::c_int, - ) -> hipError_t; +impl hipGraphNodeType { + #[doc = "< Memory free node"] + pub const hipGraphNodeTypeMemFree: hipGraphNodeType = hipGraphNodeType(11); } -extern "C" { - #[doc = " @brief Returns device properties."] - #[doc = ""] - #[doc = " @param [out] prop written with device properties"] - #[doc = " @param [in] deviceId which device to query for information"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidDevice"] - #[doc = " @bug HCC always returns 0 for maxThreadsPerMultiProcessor"] - #[doc = " @bug HCC always returns 0 for regsPerBlock"] - #[doc = " @bug HCC always returns 0 for l2CacheSize"] - #[doc = ""] - #[doc = " Populates hipGetDeviceProperties with information for the specified device."] - pub fn hipGetDeviceProperties( - prop: *mut hipDeviceProp_t, - deviceId: ::std::os::raw::c_int, - ) -> hipError_t; +impl hipGraphNodeType { + #[doc = "< MemcpyFromSymbol node"] + pub const hipGraphNodeTypeMemcpyFromSymbol: hipGraphNodeType = hipGraphNodeType(12); } -extern "C" { - #[doc = " @brief Set L1/Shared cache partition."] - #[doc = ""] - #[doc = " @param [in] cacheConfig"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorNotInitialized"] - #[doc = " Note: AMD devices and some Nvidia GPUS do not support reconfigurable cache. This hint is ignored"] - #[doc = " on those architectures."] - #[doc = ""] - pub fn hipDeviceSetCacheConfig(cacheConfig: hipFuncCache_t) -> hipError_t; +impl hipGraphNodeType { + #[doc = "< MemcpyToSymbol node"] + pub const hipGraphNodeTypeMemcpyToSymbol: hipGraphNodeType = hipGraphNodeType(13); } -extern "C" { - #[doc = " @brief Set Cache configuration for a specific function"] - #[doc = ""] - #[doc = " @param [in] cacheConfig"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorNotInitialized"] - #[doc = " Note: AMD devices and some Nvidia GPUS do not support reconfigurable cache. This hint is ignored"] - #[doc = " on those architectures."] - #[doc = ""] - pub fn hipDeviceGetCacheConfig(cacheConfig: *mut hipFuncCache_t) -> hipError_t; +impl hipGraphNodeType { + pub const hipGraphNodeTypeCount: hipGraphNodeType = hipGraphNodeType(14); } -extern "C" { - #[doc = " @brief Get Resource limits of current device"] - #[doc = ""] - #[doc = " @param [out] pValue"] - #[doc = " @param [in] limit"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorUnsupportedLimit, #hipErrorInvalidValue"] - #[doc = " Note: Currently, only hipLimitMallocHeapSize is available"] - #[doc = ""] - pub fn hipDeviceGetLimit(pValue: *mut usize, limit: hipLimit_t) -> hipError_t; +#[repr(transparent)] +#[doc = " hipGraphNodeType"] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipGraphNodeType(pub ::std::os::raw::c_uint); +pub type hipHostFn_t = + ::std::option::Option; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipHostNodeParams { + pub fn_: hipHostFn_t, + pub userData: *mut ::std::os::raw::c_void, } -extern "C" { - #[doc = " @brief Returns bank width of shared memory for current device"] - #[doc = ""] - #[doc = " @param [out] pConfig"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] - #[doc = ""] - #[doc = " Note: AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is"] - #[doc = " ignored on those architectures."] - #[doc = ""] - pub fn hipDeviceGetSharedMemConfig(pConfig: *mut hipSharedMemConfig) -> hipError_t; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipKernelNodeParams { + pub blockDim: dim3, + pub extra: *mut *mut ::std::os::raw::c_void, + pub func: *mut ::std::os::raw::c_void, + pub gridDim: dim3, + pub kernelParams: *mut *mut ::std::os::raw::c_void, + pub sharedMemBytes: ::std::os::raw::c_uint, } -extern "C" { - #[doc = " @brief Gets the flags set for current device"] - #[doc = ""] - #[doc = " @param [out] flags"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] - pub fn hipGetDeviceFlags(flags: *mut ::std::os::raw::c_uint) -> hipError_t; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipMemsetParams { + pub dst: *mut ::std::os::raw::c_void, + pub elementSize: ::std::os::raw::c_uint, + pub height: usize, + pub pitch: usize, + pub value: ::std::os::raw::c_uint, + pub width: usize, } -extern "C" { - #[doc = " @brief The bank width of shared memory on current device is set"] - #[doc = ""] - #[doc = " @param [in] config"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] - #[doc = ""] - #[doc = " Note: AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is"] - #[doc = " ignored on those architectures."] - #[doc = ""] - pub fn hipDeviceSetSharedMemConfig(config: hipSharedMemConfig) -> hipError_t; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipMemAllocNodeParams { + #[doc = "< Pool properties, which contain where\n< the location should reside"] + pub poolProps: hipMemPoolProps, + #[doc = "< The number of memory access descriptors.\n< Must not be bigger than the number of GPUs"] + pub accessDescs: *const hipMemAccessDesc, + #[doc = "< The number of access descriptors"] + pub accessDescCount: usize, + #[doc = "< The size of the requested allocation in bytes"] + pub bytesize: usize, + #[doc = "< Returned device address of the allocation"] + pub dptr: *mut ::std::os::raw::c_void, +} +impl hipKernelNodeAttrID { + pub const hipKernelNodeAttributeAccessPolicyWindow: hipKernelNodeAttrID = + hipKernelNodeAttrID(1); +} +impl hipKernelNodeAttrID { + pub const hipKernelNodeAttributeCooperative: hipKernelNodeAttrID = hipKernelNodeAttrID(2); } -extern "C" { - #[doc = " @brief The current device behavior is changed according the flags passed."] - #[doc = ""] - #[doc = " @param [in] flags"] - #[doc = ""] - #[doc = " The schedule flags impact how HIP waits for the completion of a command running on a device."] - #[doc = " hipDeviceScheduleSpin : HIP runtime will actively spin in the thread which submitted the"] - #[doc = " work until the command completes. This offers the lowest latency, but will consume a CPU core"] - #[doc = " and may increase power. hipDeviceScheduleYield : The HIP runtime will yield the CPU to"] - #[doc = " system so that other tasks can use it. This may increase latency to detect the completion but"] - #[doc = " will consume less power and is friendlier to other tasks in the system."] - #[doc = " hipDeviceScheduleBlockingSync : On ROCm platform, this is a synonym for hipDeviceScheduleYield."] - #[doc = " hipDeviceScheduleAuto : Use a hueristic to select between Spin and Yield modes. If the"] - #[doc = " number of HIP contexts is greater than the number of logical processors in the system, use Spin"] - #[doc = " scheduling. Else use Yield scheduling."] - #[doc = ""] - #[doc = ""] - #[doc = " hipDeviceMapHost : Allow mapping host memory. On ROCM, this is always allowed and"] - #[doc = " the flag is ignored. hipDeviceLmemResizeToMax : @warning ROCm silently ignores this flag."] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorSetOnActiveProcess"] - #[doc = ""] - #[doc = ""] - pub fn hipSetDeviceFlags(flags: ::std::os::raw::c_uint) -> hipError_t; +#[repr(transparent)] +#[doc = " Kernel node attributeID"] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipKernelNodeAttrID(pub ::std::os::raw::c_uint); +impl hipAccessProperty { + pub const hipAccessPropertyNormal: hipAccessProperty = hipAccessProperty(0); } -extern "C" { - #[doc = " @brief Device which matches hipDeviceProp_t is returned"] - #[doc = ""] - #[doc = " @param [out] device ID"] - #[doc = " @param [in] device properties pointer"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - pub fn hipChooseDevice( - device: *mut ::std::os::raw::c_int, - prop: *const hipDeviceProp_t, - ) -> hipError_t; +impl hipAccessProperty { + pub const hipAccessPropertyStreaming: hipAccessProperty = hipAccessProperty(1); } -extern "C" { - #[doc = " @brief Returns the link type and hop count between two devices"] - #[doc = ""] - #[doc = " @param [in] device1 Ordinal for device1"] - #[doc = " @param [in] device2 Ordinal for device2"] - #[doc = " @param [out] linktype Returns the link type (See hsa_amd_link_info_type_t) between the two devices"] - #[doc = " @param [out] hopcount Returns the hop count between the two devices"] - #[doc = ""] - #[doc = " Queries and returns the HSA link type and the hop count between the two specified devices."] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipInvalidDevice, #hipErrorRuntimeOther"] - pub fn hipExtGetLinkTypeAndHopCount( - device1: ::std::os::raw::c_int, - device2: ::std::os::raw::c_int, - linktype: *mut u32, - hopcount: *mut u32, - ) -> hipError_t; +impl hipAccessProperty { + pub const hipAccessPropertyPersisting: hipAccessProperty = hipAccessProperty(2); } -extern "C" { - #[doc = " @brief Gets an interprocess memory handle for an existing device memory"] - #[doc = " allocation"] - #[doc = ""] - #[doc = " Takes a pointer to the base of an existing device memory allocation created"] - #[doc = " with hipMalloc and exports it for use in another process. This is a"] - #[doc = " lightweight operation and may be called multiple times on an allocation"] - #[doc = " without adverse effects."] - #[doc = ""] - #[doc = " If a region of memory is freed with hipFree and a subsequent call"] - #[doc = " to hipMalloc returns memory with the same device address,"] - #[doc = " hipIpcGetMemHandle will return a unique handle for the"] - #[doc = " new memory."] - #[doc = ""] - #[doc = " @param handle - Pointer to user allocated hipIpcMemHandle to return"] - #[doc = " the handle in."] - #[doc = " @param devPtr - Base pointer to previously allocated device memory"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " hipSuccess,"] - #[doc = " hipErrorInvalidHandle,"] - #[doc = " hipErrorOutOfMemory,"] - #[doc = " hipErrorMapFailed,"] - #[doc = ""] - pub fn hipIpcGetMemHandle( - handle: *mut hipIpcMemHandle_t, - devPtr: *mut ::std::os::raw::c_void, - ) -> hipError_t; +#[repr(transparent)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipAccessProperty(pub ::std::os::raw::c_uint); +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipAccessPolicyWindow { + pub base_ptr: *mut ::std::os::raw::c_void, + pub hitProp: hipAccessProperty, + pub hitRatio: f32, + pub missProp: hipAccessProperty, + pub num_bytes: usize, } -extern "C" { - #[doc = " @brief Opens an interprocess memory handle exported from another process"] - #[doc = " and returns a device pointer usable in the local process."] - #[doc = ""] - #[doc = " Maps memory exported from another process with hipIpcGetMemHandle into"] - #[doc = " the current device address space. For contexts on different devices"] - #[doc = " hipIpcOpenMemHandle can attempt to enable peer access between the"] - #[doc = " devices as if the user called hipDeviceEnablePeerAccess. This behavior is"] - #[doc = " controlled by the hipIpcMemLazyEnablePeerAccess flag."] - #[doc = " hipDeviceCanAccessPeer can determine if a mapping is possible."] - #[doc = ""] - #[doc = " Contexts that may open hipIpcMemHandles are restricted in the following way."] - #[doc = " hipIpcMemHandles from each device in a given process may only be opened"] - #[doc = " by one context per device per other process."] - #[doc = ""] - #[doc = " Memory returned from hipIpcOpenMemHandle must be freed with"] - #[doc = " hipIpcCloseMemHandle."] - #[doc = ""] - #[doc = " Calling hipFree on an exported memory region before calling"] - #[doc = " hipIpcCloseMemHandle in the importing context will result in undefined"] - #[doc = " behavior."] - #[doc = ""] - #[doc = " @param devPtr - Returned device pointer"] - #[doc = " @param handle - hipIpcMemHandle to open"] - #[doc = " @param flags - Flags for this operation. Must be specified as hipIpcMemLazyEnablePeerAccess"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " hipSuccess,"] - #[doc = " hipErrorMapFailed,"] - #[doc = " hipErrorInvalidHandle,"] - #[doc = " hipErrorTooManyPeers"] - #[doc = ""] - #[doc = " @note No guarantees are made about the address returned in @p *devPtr."] - #[doc = " In particular, multiple processes may not receive the same address for the same @p handle."] - #[doc = ""] - pub fn hipIpcOpenMemHandle( - devPtr: *mut *mut ::std::os::raw::c_void, - handle: hipIpcMemHandle_t, - flags: ::std::os::raw::c_uint, - ) -> hipError_t; +#[repr(C)] +#[derive(Copy, Clone)] +pub union hipKernelNodeAttrValue { + pub accessPolicyWindow: hipAccessPolicyWindow, + pub cooperative: ::std::os::raw::c_int, } -extern "C" { - #[doc = " @brief Close memory mapped with hipIpcOpenMemHandle"] - #[doc = ""] - #[doc = " Unmaps memory returnd by hipIpcOpenMemHandle. The original allocation"] - #[doc = " in the exporting process as well as imported mappings in other processes"] - #[doc = " will be unaffected."] - #[doc = ""] - #[doc = " Any resources used to enable peer access will be freed if this is the"] - #[doc = " last mapping using them."] - #[doc = ""] - #[doc = " @param devPtr - Device pointer returned by hipIpcOpenMemHandle"] - #[doc = ""] - #[doc = " @returns"] - #[doc = " hipSuccess,"] - #[doc = " hipErrorMapFailed,"] - #[doc = " hipErrorInvalidHandle,"] - #[doc = ""] - pub fn hipIpcCloseMemHandle(devPtr: *mut ::std::os::raw::c_void) -> hipError_t; +#[doc = " Memset node params"] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct HIP_MEMSET_NODE_PARAMS { + #[doc = "< Destination pointer on device"] + pub dst: hipDeviceptr_t, + #[doc = "< Destination device pointer pitch. Unused if height equals 1"] + pub pitch: usize, + #[doc = "< Value of memset to be set"] + pub value: ::std::os::raw::c_uint, + #[doc = "< Element in bytes. Must be 1, 2, or 4."] + pub elementSize: ::std::os::raw::c_uint, + #[doc = "< Width of a row"] + pub width: usize, + #[doc = "< Number of rows"] + pub height: usize, } -extern "C" { - #[doc = " @brief Gets an opaque interprocess handle for an event."] - #[doc = ""] - #[doc = " This opaque handle may be copied into other processes and opened with cudaIpcOpenEventHandle."] - #[doc = " Then cudaEventRecord, cudaEventSynchronize, cudaStreamWaitEvent and cudaEventQuery may be used in"] - #[doc = " either process. Operations on the imported event after the exported event has been freed with hipEventDestroy"] - #[doc = " will result in undefined behavior."] - #[doc = ""] - #[doc = " @param[out] handle Pointer to cudaIpcEventHandle to return the opaque event handle"] - #[doc = " @param[in] event Event allocated with cudaEventInterprocess and cudaEventDisableTiming flags"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidConfiguration, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipIpcGetEventHandle(handle: *mut hipIpcEventHandle_t, event: hipEvent_t) -> hipError_t; +impl hipGraphExecUpdateResult { + #[doc = "< The update succeeded"] + pub const hipGraphExecUpdateSuccess: hipGraphExecUpdateResult = hipGraphExecUpdateResult(0); } -extern "C" { - #[doc = " @brief Opens an interprocess event handles."] - #[doc = ""] - #[doc = " Opens an interprocess event handle exported from another process with cudaIpcGetEventHandle. The returned"] - #[doc = " hipEvent_t behaves like a locally created event with the hipEventDisableTiming flag specified. This event"] - #[doc = " need be freed with hipEventDestroy. Operations on the imported event after the exported event has been freed"] - #[doc = " with hipEventDestroy will result in undefined behavior. If the function is called within the same process where"] - #[doc = " handle is returned by hipIpcGetEventHandle, it will return hipErrorInvalidContext."] - #[doc = ""] - #[doc = " @param[out] event Pointer to hipEvent_t to return the event"] - #[doc = " @param[in] handle The opaque interprocess handle to open"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidContext"] - #[doc = ""] - pub fn hipIpcOpenEventHandle(event: *mut hipEvent_t, handle: hipIpcEventHandle_t) - -> hipError_t; +impl hipGraphExecUpdateResult { + #[doc = "< The update failed for an unexpected reason which is described\n< in the return value of the function"] + pub const hipGraphExecUpdateError: hipGraphExecUpdateResult = hipGraphExecUpdateResult(1); } -extern "C" { - #[doc = " @}"] - #[doc = ""] - #[doc = " @defgroup Execution Execution Control"] - #[doc = " @{"] - #[doc = " This section describes the execution control functions of HIP runtime API."] - #[doc = ""] - #[doc = " @brief Set attribute for a specific function"] - #[doc = ""] - #[doc = " @param [in] func;"] - #[doc = " @param [in] attr;"] - #[doc = " @param [in] value;"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidDeviceFunction, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " Note: AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is"] - #[doc = " ignored on those architectures."] - #[doc = ""] - pub fn hipFuncSetAttribute( - func: *const ::std::os::raw::c_void, - attr: hipFuncAttribute, - value: ::std::os::raw::c_int, - ) -> hipError_t; +impl hipGraphExecUpdateResult { + #[doc = "< The update failed because the topology changed"] + pub const hipGraphExecUpdateErrorTopologyChanged: hipGraphExecUpdateResult = + hipGraphExecUpdateResult(2); } -extern "C" { - #[doc = " @brief Set Cache configuration for a specific function"] - #[doc = ""] - #[doc = " @param [in] config;"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorNotInitialized"] - #[doc = " Note: AMD devices and some Nvidia GPUS do not support reconfigurable cache. This hint is ignored"] - #[doc = " on those architectures."] - #[doc = ""] - pub fn hipFuncSetCacheConfig( - func: *const ::std::os::raw::c_void, - config: hipFuncCache_t, - ) -> hipError_t; +impl hipGraphExecUpdateResult { + #[doc = "< The update failed because a node type changed"] + pub const hipGraphExecUpdateErrorNodeTypeChanged: hipGraphExecUpdateResult = + hipGraphExecUpdateResult(3); } -extern "C" { - #[doc = " @brief Set shared memory configuation for a specific function"] - #[doc = ""] - #[doc = " @param [in] func"] - #[doc = " @param [in] config"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidDeviceFunction, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " Note: AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is"] - #[doc = " ignored on those architectures."] - #[doc = ""] - pub fn hipFuncSetSharedMemConfig( - func: *const ::std::os::raw::c_void, +impl hipGraphExecUpdateResult { + pub const hipGraphExecUpdateErrorFunctionChanged: hipGraphExecUpdateResult = + hipGraphExecUpdateResult(4); +} +impl hipGraphExecUpdateResult { + pub const hipGraphExecUpdateErrorParametersChanged: hipGraphExecUpdateResult = + hipGraphExecUpdateResult(5); +} +impl hipGraphExecUpdateResult { + pub const hipGraphExecUpdateErrorNotSupported: hipGraphExecUpdateResult = + hipGraphExecUpdateResult(6); +} +impl hipGraphExecUpdateResult { + pub const hipGraphExecUpdateErrorUnsupportedFunctionChange: hipGraphExecUpdateResult = + hipGraphExecUpdateResult(7); +} +#[repr(transparent)] +#[doc = " Graph execution update result"] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipGraphExecUpdateResult(pub ::std::os::raw::c_uint); +impl hipStreamCaptureMode { + pub const hipStreamCaptureModeGlobal: hipStreamCaptureMode = hipStreamCaptureMode(0); +} +impl hipStreamCaptureMode { + pub const hipStreamCaptureModeThreadLocal: hipStreamCaptureMode = hipStreamCaptureMode(1); +} +impl hipStreamCaptureMode { + pub const hipStreamCaptureModeRelaxed: hipStreamCaptureMode = hipStreamCaptureMode(2); +} +#[repr(transparent)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipStreamCaptureMode(pub ::std::os::raw::c_uint); +impl hipStreamCaptureStatus { + #[doc = "< Stream is not capturing"] + pub const hipStreamCaptureStatusNone: hipStreamCaptureStatus = hipStreamCaptureStatus(0); +} +impl hipStreamCaptureStatus { + #[doc = "< Stream is actively capturing"] + pub const hipStreamCaptureStatusActive: hipStreamCaptureStatus = hipStreamCaptureStatus(1); +} +impl hipStreamCaptureStatus { + #[doc = "< Stream is part of a capture sequence that has been\n< invalidated, but not terminated"] + pub const hipStreamCaptureStatusInvalidated: hipStreamCaptureStatus = hipStreamCaptureStatus(2); +} +#[repr(transparent)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipStreamCaptureStatus(pub ::std::os::raw::c_uint); +impl hipStreamUpdateCaptureDependenciesFlags { + #[doc = "< Add new nodes to the dependency set"] + pub const hipStreamAddCaptureDependencies: hipStreamUpdateCaptureDependenciesFlags = + hipStreamUpdateCaptureDependenciesFlags(0); +} +impl hipStreamUpdateCaptureDependenciesFlags { + #[doc = "< Replace the dependency set with the new nodes"] + pub const hipStreamSetCaptureDependencies: hipStreamUpdateCaptureDependenciesFlags = + hipStreamUpdateCaptureDependenciesFlags(1); +} +#[repr(transparent)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipStreamUpdateCaptureDependenciesFlags(pub ::std::os::raw::c_uint); +impl hipGraphMemAttributeType { + #[doc = "< Amount of memory, in bytes, currently associated with graphs"] + pub const hipGraphMemAttrUsedMemCurrent: hipGraphMemAttributeType = hipGraphMemAttributeType(0); +} +impl hipGraphMemAttributeType { + #[doc = "< High watermark of memory, in bytes, associated with graphs since the last time."] + pub const hipGraphMemAttrUsedMemHigh: hipGraphMemAttributeType = hipGraphMemAttributeType(1); +} +impl hipGraphMemAttributeType { + #[doc = "< Amount of memory, in bytes, currently allocated for graphs."] + pub const hipGraphMemAttrReservedMemCurrent: hipGraphMemAttributeType = + hipGraphMemAttributeType(2); +} +impl hipGraphMemAttributeType { + #[doc = "< High watermark of memory, in bytes, currently allocated for graphs"] + pub const hipGraphMemAttrReservedMemHigh: hipGraphMemAttributeType = + hipGraphMemAttributeType(3); +} +#[repr(transparent)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipGraphMemAttributeType(pub ::std::os::raw::c_uint); +impl hipUserObjectFlags { + #[doc = "< Destructor execution is not synchronized."] + pub const hipUserObjectNoDestructorSync: hipUserObjectFlags = hipUserObjectFlags(1); +} +#[repr(transparent)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipUserObjectFlags(pub ::std::os::raw::c_uint); +impl hipUserObjectRetainFlags { + #[doc = "< Add new reference or retain."] + pub const hipGraphUserObjectMove: hipUserObjectRetainFlags = hipUserObjectRetainFlags(1); +} +#[repr(transparent)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipUserObjectRetainFlags(pub ::std::os::raw::c_uint); +impl hipGraphInstantiateFlags { + pub const hipGraphInstantiateFlagAutoFreeOnLaunch: hipGraphInstantiateFlags = + hipGraphInstantiateFlags(1); +} +impl hipGraphInstantiateFlags { + pub const hipGraphInstantiateFlagUpload: hipGraphInstantiateFlags = hipGraphInstantiateFlags(2); +} +impl hipGraphInstantiateFlags { + pub const hipGraphInstantiateFlagDeviceLaunch: hipGraphInstantiateFlags = + hipGraphInstantiateFlags(4); +} +impl hipGraphInstantiateFlags { + pub const hipGraphInstantiateFlagUseNodePriority: hipGraphInstantiateFlags = + hipGraphInstantiateFlags(8); +} +#[repr(transparent)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipGraphInstantiateFlags(pub ::std::os::raw::c_uint); +impl hipGraphDebugDotFlags { + pub const hipGraphDebugDotFlagsVerbose: hipGraphDebugDotFlags = hipGraphDebugDotFlags(1); +} +impl hipGraphDebugDotFlags { + #[doc = "< Adds hipKernelNodeParams to output"] + pub const hipGraphDebugDotFlagsKernelNodeParams: hipGraphDebugDotFlags = + hipGraphDebugDotFlags(4); +} +impl hipGraphDebugDotFlags { + #[doc = "< Adds hipMemcpy3DParms to output"] + pub const hipGraphDebugDotFlagsMemcpyNodeParams: hipGraphDebugDotFlags = + hipGraphDebugDotFlags(8); +} +impl hipGraphDebugDotFlags { + #[doc = "< Adds hipMemsetParams to output"] + pub const hipGraphDebugDotFlagsMemsetNodeParams: hipGraphDebugDotFlags = + hipGraphDebugDotFlags(16); +} +impl hipGraphDebugDotFlags { + #[doc = "< Adds hipHostNodeParams to output"] + pub const hipGraphDebugDotFlagsHostNodeParams: hipGraphDebugDotFlags = + hipGraphDebugDotFlags(32); +} +impl hipGraphDebugDotFlags { + pub const hipGraphDebugDotFlagsEventNodeParams: hipGraphDebugDotFlags = + hipGraphDebugDotFlags(64); +} +impl hipGraphDebugDotFlags { + pub const hipGraphDebugDotFlagsExtSemasSignalNodeParams: hipGraphDebugDotFlags = + hipGraphDebugDotFlags(128); +} +impl hipGraphDebugDotFlags { + pub const hipGraphDebugDotFlagsExtSemasWaitNodeParams: hipGraphDebugDotFlags = + hipGraphDebugDotFlags(256); +} +impl hipGraphDebugDotFlags { + pub const hipGraphDebugDotFlagsKernelNodeAttributes: hipGraphDebugDotFlags = + hipGraphDebugDotFlags(512); +} +impl hipGraphDebugDotFlags { + pub const hipGraphDebugDotFlagsHandles: hipGraphDebugDotFlags = hipGraphDebugDotFlags(1024); +} +#[repr(transparent)] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipGraphDebugDotFlags(pub ::std::os::raw::c_uint); +#[doc = " Memory allocation properties"] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipMemAllocationProp { + #[doc = "< Memory allocation type"] + pub type_: hipMemAllocationType, + #[doc = "< Requested handle type"] + pub requestedHandleType: hipMemAllocationHandleType, + #[doc = "< Memory location"] + pub location: hipMemLocation, + #[doc = "< Metadata for Win32 handles"] + pub win32HandleMetaData: *mut ::std::os::raw::c_void, + pub allocFlags: hipMemAllocationProp__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipMemAllocationProp__bindgen_ty_1 { + #[doc = "< Compression type"] + pub compressionType: ::std::os::raw::c_uchar, + #[doc = "< RDMA capable"] + pub gpuDirectRDMACapable: ::std::os::raw::c_uchar, + #[doc = "< Usage"] + pub usage: ::std::os::raw::c_ushort, +} +#[doc = " External semaphore signal node parameters"] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipExternalSemaphoreSignalNodeParams { + pub extSemArray: *mut hipExternalSemaphore_t, + pub paramsArray: *const hipExternalSemaphoreSignalParams, + pub numExtSems: ::std::os::raw::c_uint, +} +#[doc = " External semaphore wait node parameters"] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipExternalSemaphoreWaitNodeParams { + pub extSemArray: *mut hipExternalSemaphore_t, + pub paramsArray: *const hipExternalSemaphoreWaitParams, + pub numExtSems: ::std::os::raw::c_uint, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ihipMemGenericAllocationHandle { + _unused: [u8; 0], +} +#[doc = " Generic handle for memory allocation"] +pub type hipMemGenericAllocationHandle_t = *mut ihipMemGenericAllocationHandle; +impl hipMemAllocationGranularity_flags { + #[doc = "< Minimum granularity"] + pub const hipMemAllocationGranularityMinimum: hipMemAllocationGranularity_flags = + hipMemAllocationGranularity_flags(0); +} +impl hipMemAllocationGranularity_flags { + #[doc = "< Recommended granularity for performance"] + pub const hipMemAllocationGranularityRecommended: hipMemAllocationGranularity_flags = + hipMemAllocationGranularity_flags(1); +} +#[repr(transparent)] +#[doc = " Flags for granularity"] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipMemAllocationGranularity_flags(pub ::std::os::raw::c_uint); +impl hipMemHandleType { + #[doc = "< Generic handle type"] + pub const hipMemHandleTypeGeneric: hipMemHandleType = hipMemHandleType(0); +} +#[repr(transparent)] +#[doc = " Memory handle type"] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipMemHandleType(pub ::std::os::raw::c_uint); +impl hipMemOperationType { + #[doc = "< Map operation"] + pub const hipMemOperationTypeMap: hipMemOperationType = hipMemOperationType(1); +} +impl hipMemOperationType { + #[doc = "< Unmap operation"] + pub const hipMemOperationTypeUnmap: hipMemOperationType = hipMemOperationType(2); +} +#[repr(transparent)] +#[doc = " Memory operation types"] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipMemOperationType(pub ::std::os::raw::c_uint); +impl hipArraySparseSubresourceType { + #[doc = "< Sparse level"] + pub const hipArraySparseSubresourceTypeSparseLevel: hipArraySparseSubresourceType = + hipArraySparseSubresourceType(0); +} +impl hipArraySparseSubresourceType { + #[doc = "< Miptail"] + pub const hipArraySparseSubresourceTypeMiptail: hipArraySparseSubresourceType = + hipArraySparseSubresourceType(1); +} +#[repr(transparent)] +#[doc = " Subresource types for sparse arrays"] +#[derive(Copy, Clone, Hash, PartialEq, Eq)] +pub struct hipArraySparseSubresourceType(pub ::std::os::raw::c_uint); +#[doc = " Map info for arrays"] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipArrayMapInfo { + #[doc = "< Resource type"] + pub resourceType: hipResourceType, + pub resource: hipArrayMapInfo__bindgen_ty_1, + #[doc = "< Sparse subresource type"] + pub subresourceType: hipArraySparseSubresourceType, + pub subresource: hipArrayMapInfo__bindgen_ty_2, + #[doc = "< Memory operation type"] + pub memOperationType: hipMemOperationType, + #[doc = "< Memory handle type"] + pub memHandleType: hipMemHandleType, + pub memHandle: hipArrayMapInfo__bindgen_ty_3, + #[doc = "< Offset within the memory"] + pub offset: ::std::os::raw::c_ulonglong, + #[doc = "< Device ordinal bit mask"] + pub deviceBitMask: ::std::os::raw::c_uint, + #[doc = "< flags for future use, must be zero now."] + pub flags: ::std::os::raw::c_uint, + #[doc = "< Reserved for future use, must be zero now."] + pub reserved: [::std::os::raw::c_uint; 2usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union hipArrayMapInfo__bindgen_ty_1 { + pub mipmap: hipMipmappedArray, + pub array: hipArray_t, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union hipArrayMapInfo__bindgen_ty_2 { + pub sparseLevel: hipArrayMapInfo__bindgen_ty_2__bindgen_ty_1, + pub miptail: hipArrayMapInfo__bindgen_ty_2__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipArrayMapInfo__bindgen_ty_2__bindgen_ty_1 { + #[doc = "< For mipmapped arrays must be a valid mipmap level. For arrays must be zero"] + pub level: ::std::os::raw::c_uint, + #[doc = "< For layered arrays must be a valid layer index. Otherwise, must be zero"] + pub layer: ::std::os::raw::c_uint, + #[doc = "< X offset in elements"] + pub offsetX: ::std::os::raw::c_uint, + #[doc = "< Y offset in elements"] + pub offsetY: ::std::os::raw::c_uint, + #[doc = "< Z offset in elements"] + pub offsetZ: ::std::os::raw::c_uint, + #[doc = "< Width in elements"] + pub extentWidth: ::std::os::raw::c_uint, + #[doc = "< Height in elements"] + pub extentHeight: ::std::os::raw::c_uint, + #[doc = "< Depth in elements"] + pub extentDepth: ::std::os::raw::c_uint, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipArrayMapInfo__bindgen_ty_2__bindgen_ty_2 { + #[doc = "< For layered arrays must be a valid layer index. Otherwise, must be zero"] + pub layer: ::std::os::raw::c_uint, + #[doc = "< Offset within mip tail"] + pub offset: ::std::os::raw::c_ulonglong, + #[doc = "< Extent in bytes"] + pub size: ::std::os::raw::c_ulonglong, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union hipArrayMapInfo__bindgen_ty_3 { + pub memHandle: hipMemGenericAllocationHandle_t, +} +#[doc = " Memcpy node params"] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipMemcpyNodeParams { + #[doc = "< Must be zero."] + pub flags: ::std::os::raw::c_int, + #[doc = "< Must be zero."] + pub reserved: [::std::os::raw::c_int; 3usize], + #[doc = "< Params set for the memory copy."] + pub copyParams: hipMemcpy3DParms, +} +#[doc = " Child graph node params"] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipChildGraphNodeParams { + #[doc = "< Either the child graph to clone into the node, or\n< a handle to the graph possesed by the node used during query"] + pub graph: hipGraph_t, +} +#[doc = " Event record node params"] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipEventWaitNodeParams { + #[doc = "< Event to wait on"] + pub event: hipEvent_t, +} +#[doc = " Event record node params"] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipEventRecordNodeParams { + #[doc = "< The event to be recorded when node executes"] + pub event: hipEvent_t, +} +#[doc = " Memory free node params"] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipMemFreeNodeParams { + #[doc = "< the pointer to be freed"] + pub dptr: *mut ::std::os::raw::c_void, +} +#[doc = " Params for different graph nodes"] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct hipGraphNodeParams { + pub type_: hipGraphNodeType, + pub reserved0: [::std::os::raw::c_int; 3usize], + pub __bindgen_anon_1: hipGraphNodeParams__bindgen_ty_1, + pub reserved2: ::std::os::raw::c_longlong, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union hipGraphNodeParams__bindgen_ty_1 { + pub reserved1: [::std::os::raw::c_longlong; 29usize], + pub kernel: hipKernelNodeParams, + pub memcpy: hipMemcpyNodeParams, + pub memset: hipMemsetParams, + pub host: hipHostNodeParams, + pub graph: hipChildGraphNodeParams, + pub eventWait: hipEventWaitNodeParams, + pub eventRecord: hipEventRecordNodeParams, + pub extSemSignal: hipExternalSemaphoreSignalNodeParams, + pub extSemWait: hipExternalSemaphoreWaitNodeParams, + pub alloc: hipMemAllocNodeParams, + pub free: hipMemFreeNodeParams, +} +extern "C" { + #[must_use] + #[doc = " @}\n/\n/**\n @defgroup API HIP API\n @{\n\n Defines the HIP API. See the individual sections for more information.\n/\n/**\n @defgroup Driver Initialization and Version\n @{\n This section describes the initializtion and version functions of HIP runtime API.\n\n/\n/**\n @brief Explicitly initializes the HIP runtime.\n\n @param [in] flags Initialization flag, should be zero.\n\n Most HIP APIs implicitly initialize the HIP runtime.\n This API provides control over the timing of the initialization.\n\n @returns #hipSuccess, #hipErrorInvalidValue"] + pub fn hipInit(flags: ::std::os::raw::c_uint) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns the approximate HIP driver version.\n\n @param [out] driverVersion driver version\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning The HIP feature set does not correspond to an exact CUDA SDK driver revision.\n This function always set *driverVersion to 4 as an approximation though HIP supports\n some features which were introduced in later CUDA SDK revisions.\n HIP apps code should not rely on the driver revision number here and should\n use arch feature flags to test device capabilities or conditional compilation.\n\n @see hipRuntimeGetVersion"] + pub fn hipDriverGetVersion(driverVersion: *mut ::std::os::raw::c_int) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns the approximate HIP Runtime version.\n\n @param [out] runtimeVersion HIP runtime version\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning The version definition of HIP runtime is different from CUDA.\n On AMD platform, the function returns HIP runtime version,\n while on NVIDIA platform, it returns CUDA runtime version.\n And there is no mapping/correlation between HIP version and CUDA version.\n\n @see hipDriverGetVersion"] + pub fn hipRuntimeGetVersion(runtimeVersion: *mut ::std::os::raw::c_int) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns a handle to a compute device\n @param [out] device Handle of device\n @param [in] ordinal Device ordinal\n\n @returns #hipSuccess, #hipErrorInvalidDevice"] + pub fn hipDeviceGet(device: *mut hipDevice_t, ordinal: ::std::os::raw::c_int) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns the compute capability of the device\n @param [out] major Major compute capability version number\n @param [out] minor Minor compute capability version number\n @param [in] device Device ordinal\n\n @returns #hipSuccess, #hipErrorInvalidDevice"] + pub fn hipDeviceComputeCapability( + major: *mut ::std::os::raw::c_int, + minor: *mut ::std::os::raw::c_int, + device: hipDevice_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns an identifer string for the device.\n @param [out] name String of the device name\n @param [in] len Maximum length of string to store in device name\n @param [in] device Device ordinal\n\n @returns #hipSuccess, #hipErrorInvalidDevice"] + pub fn hipDeviceGetName( + name: *mut ::std::os::raw::c_char, + len: ::std::os::raw::c_int, + device: hipDevice_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns an UUID for the device.[BETA]\n @param [out] uuid UUID for the device\n @param [in] device device ordinal\n\n @warning This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue, #hipErrorNotInitialized,\n #hipErrorDeinitialized"] + pub fn hipDeviceGetUuid(uuid: *mut hipUUID, device: hipDevice_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns a value for attribute of link between two devices\n @param [out] value Pointer of the value for the attrubute\n @param [in] attr enum of hipDeviceP2PAttr to query\n @param [in] srcDevice The source device of the link\n @param [in] dstDevice The destination device of the link\n\n @returns #hipSuccess, #hipErrorInvalidDevice"] + pub fn hipDeviceGetP2PAttribute( + value: *mut ::std::os::raw::c_int, + attr: hipDeviceP2PAttr, + srcDevice: ::std::os::raw::c_int, + dstDevice: ::std::os::raw::c_int, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns a PCI Bus Id string for the device, overloaded to take int device ID.\n @param [out] pciBusId The string of PCI Bus Id format for the device\n @param [in] len Maximum length of string\n @param [in] device The device ordinal\n\n @returns #hipSuccess, #hipErrorInvalidDevice"] + pub fn hipDeviceGetPCIBusId( + pciBusId: *mut ::std::os::raw::c_char, + len: ::std::os::raw::c_int, + device: ::std::os::raw::c_int, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns a handle to a compute device.\n @param [out] device The handle of the device\n @param [in] pciBusId The string of PCI Bus Id for the device\n\n @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] + pub fn hipDeviceGetByPCIBusId( + device: *mut ::std::os::raw::c_int, + pciBusId: *const ::std::os::raw::c_char, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns the total amount of memory on the device.\n @param [out] bytes The size of memory in bytes, on the device\n @param [in] device The ordinal of the device\n\n @returns #hipSuccess, #hipErrorInvalidDevice"] + pub fn hipDeviceTotalMem(bytes: *mut usize, device: hipDevice_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @}\n/\n/**\n @defgroup Device Device Management\n @{\n This section describes the device management functions of HIP runtime API.\n/\n/**\n @brief Waits on all active streams on current device\n\n When this command is invoked, the host thread gets blocked until all the commands associated\n with streams associated with the device. HIP does not support multiple blocking modes (yet!).\n\n @returns #hipSuccess\n\n @see hipSetDevice, hipDeviceReset"] + pub fn hipDeviceSynchronize() -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief The state of current device is discarded and updated to a fresh state.\n\n Calling this function deletes all streams created, memory allocated, kernels running, events\n created. Make sure that no other thread is using the device or streams, memory, kernels, events\n associated with the current device.\n\n @returns #hipSuccess\n\n @see hipDeviceSynchronize"] + pub fn hipDeviceReset() -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Set default device to be used for subsequent hip API calls from this thread.\n\n @param[in] deviceId Valid device in range 0...hipGetDeviceCount().\n\n Sets @p device as the default device for the calling host thread. Valid device id's are 0...\n (hipGetDeviceCount()-1).\n\n Many HIP APIs implicitly use the \"default device\" :\n\n - Any device memory subsequently allocated from this host thread (using hipMalloc) will be\n allocated on device.\n - Any streams or events created from this host thread will be associated with device.\n - Any kernels launched from this host thread (using hipLaunchKernel) will be executed on device\n (unless a specific stream is specified, in which case the device associated with that stream will\n be used).\n\n This function may be called from any host thread. Multiple host threads may use the same device.\n This function does no synchronization with the previous or new device, and has very little\n runtime overhead. Applications can use hipSetDevice to quickly switch the default device before\n making a HIP runtime call which uses the default device.\n\n The default device is stored in thread-local-storage for each thread.\n Thread-pool implementations may inherit the default device of the previous thread. A good\n practice is to always call hipSetDevice at the start of HIP coding sequency to establish a known\n standard device.\n\n @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorNoDevice\n\n @see #hipGetDevice, #hipGetDeviceCount"] + pub fn hipSetDevice(deviceId: ::std::os::raw::c_int) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return the default device id for the calling host thread.\n\n @param [out] deviceId *device is written with the default device\n\n HIP maintains an default device for each thread using thread-local-storage.\n This device is used implicitly for HIP runtime APIs called by this thread.\n hipGetDevice returns in * @p device the default device for the calling host thread.\n\n @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue\n\n @see hipSetDevice, hipGetDevicesizeBytes"] + pub fn hipGetDevice(deviceId: *mut ::std::os::raw::c_int) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return number of compute-capable devices.\n\n @param [out] count Returns number of compute-capable devices.\n\n @returns #hipSuccess, #hipErrorNoDevice\n\n\n Returns in @p *count the number of devices that have ability to run compute commands. If there\n are no such devices, then @ref hipGetDeviceCount will return #hipErrorNoDevice. If 1 or more\n devices can be found, then hipGetDeviceCount returns #hipSuccess."] + pub fn hipGetDeviceCount(count: *mut ::std::os::raw::c_int) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Query for a specific device attribute.\n\n @param [out] pi pointer to value to return\n @param [in] attr attribute to query\n @param [in] deviceId which device to query for information\n\n @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] + pub fn hipDeviceGetAttribute( + pi: *mut ::std::os::raw::c_int, + attr: hipDeviceAttribute_t, + deviceId: ::std::os::raw::c_int, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns the default memory pool of the specified device\n\n @param [out] mem_pool Default memory pool to return\n @param [in] device Device index for query the default memory pool\n\n @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @see hipDeviceGetDefaultMemPool, hipMallocAsync, hipMemPoolTrimTo, hipMemPoolGetAttribute,\n hipDeviceSetMemPool, hipMemPoolSetAttribute, hipMemPoolSetAccess, hipMemPoolGetAccess\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipDeviceGetDefaultMemPool( + mem_pool: *mut hipMemPool_t, + device: ::std::os::raw::c_int, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Sets the current memory pool of a device\n\n The memory pool must be local to the specified device.\n @p hipMallocAsync allocates from the current mempool of the provided stream's device.\n By default, a device's current memory pool is its default memory pool.\n\n @note Use @p hipMallocFromPoolAsync for asynchronous memory allocations from a device\n different than the one the stream runs on.\n\n @param [in] device Device index for the update\n @param [in] mem_pool Memory pool for update as the current on the specified device\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidDevice, #hipErrorNotSupported\n\n @see hipDeviceGetDefaultMemPool, hipMallocAsync, hipMemPoolTrimTo, hipMemPoolGetAttribute,\n hipDeviceSetMemPool, hipMemPoolSetAttribute, hipMemPoolSetAccess, hipMemPoolGetAccess\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipDeviceSetMemPool(device: ::std::os::raw::c_int, mem_pool: hipMemPool_t) + -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Gets the current memory pool for the specified device\n\n Returns the last pool provided to @p hipDeviceSetMemPool for this device\n or the device's default memory pool if @p hipDeviceSetMemPool has never been called.\n By default the current mempool is the default mempool for a device,\n otherwise the returned pool must have been set with @p hipDeviceSetMemPool.\n\n @param [out] mem_pool Current memory pool on the specified device\n @param [in] device Device index to query the current memory pool\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @see hipDeviceGetDefaultMemPool, hipMallocAsync, hipMemPoolTrimTo, hipMemPoolGetAttribute,\n hipDeviceSetMemPool, hipMemPoolSetAttribute, hipMemPoolSetAccess, hipMemPoolGetAccess\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipDeviceGetMemPool( + mem_pool: *mut hipMemPool_t, + device: ::std::os::raw::c_int, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns device properties.\n\n @param [out] prop written with device properties\n @param [in] deviceId which device to query for information\n\n @return #hipSuccess, #hipErrorInvalidDevice\n @bug HCC always returns 0 for maxThreadsPerMultiProcessor\n @bug HCC always returns 0 for regsPerBlock\n @bug HCC always returns 0 for l2CacheSize\n\n Populates hipGetDeviceProperties with information for the specified device."] + pub fn hipGetDevicePropertiesR0600( + prop: *mut hipDeviceProp_tR0600, + deviceId: ::std::os::raw::c_int, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Set L1/Shared cache partition.\n\n @param [in] cacheConfig Cache configuration\n\n @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorNotSupported\n\n Note: AMD devices do not support reconfigurable cache. This API is not implemented\n on AMD platform. If the function is called, it will return hipErrorNotSupported.\n"] + pub fn hipDeviceSetCacheConfig(cacheConfig: hipFuncCache_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get Cache configuration for a specific Device\n\n @param [out] cacheConfig Pointer of cache configuration\n\n @returns #hipSuccess, #hipErrorNotInitialized\n Note: AMD devices do not support reconfigurable cache. This hint is ignored\n on these architectures.\n"] + pub fn hipDeviceGetCacheConfig(cacheConfig: *mut hipFuncCache_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Gets resource limits of current device\n\n The function queries the size of limit value, as required by the input enum value hipLimit_t,\n which can be either #hipLimitStackSize, or #hipLimitMallocHeapSize. Any other input as\n default, the function will return #hipErrorUnsupportedLimit.\n\n @param [out] pValue Returns the size of the limit in bytes\n @param [in] limit The limit to query\n\n @returns #hipSuccess, #hipErrorUnsupportedLimit, #hipErrorInvalidValue\n"] + pub fn hipDeviceGetLimit(pValue: *mut usize, limit: hipLimit_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Sets resource limits of current device.\n\n As the input enum limit,\n #hipLimitStackSize sets the limit value of the stack size on the current GPU device, per thread.\n The limit size can get via hipDeviceGetLimit. The size is in units of 256 dwords, up to the limit\n (128K - 16).\n\n #hipLimitMallocHeapSize sets the limit value of the heap used by the malloc()/free()\n calls. For limit size, use the #hipDeviceGetLimit API.\n\n Any other input as default, the funtion will return hipErrorUnsupportedLimit.\n\n @param [in] limit Enum of hipLimit_t to set\n @param [in] value The size of limit value in bytes\n\n @returns #hipSuccess, #hipErrorUnsupportedLimit, #hipErrorInvalidValue\n"] + pub fn hipDeviceSetLimit(limit: hipLimit_t, value: usize) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns bank width of shared memory for current device\n\n @param [out] pConfig The pointer of the bank width for shared memory\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized\n\n Note: AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is\n ignored on those architectures.\n"] + pub fn hipDeviceGetSharedMemConfig(pConfig: *mut hipSharedMemConfig) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Gets the flags set for current device\n\n @param [out] flags Pointer of the flags\n\n @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] + pub fn hipGetDeviceFlags(flags: *mut ::std::os::raw::c_uint) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief The bank width of shared memory on current device is set\n\n @param [in] config Configuration for the bank width of shared memory\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized\n\n Note: AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is\n ignored on those architectures.\n"] + pub fn hipDeviceSetSharedMemConfig(config: hipSharedMemConfig) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief The current device behavior is changed according the flags passed.\n\n @param [in] flags Flag to set on the current device\n\n The schedule flags impact how HIP waits for the completion of a command running on a device.\n hipDeviceScheduleSpin : HIP runtime will actively spin in the thread which submitted the\n work until the command completes. This offers the lowest latency, but will consume a CPU core\n and may increase power. hipDeviceScheduleYield : The HIP runtime will yield the CPU to\n system so that other tasks can use it. This may increase latency to detect the completion but\n will consume less power and is friendlier to other tasks in the system.\n hipDeviceScheduleBlockingSync : On ROCm platform, this is a synonym for hipDeviceScheduleYield.\n hipDeviceScheduleAuto : Use a hueristic to select between Spin and Yield modes. If the\n number of HIP contexts is greater than the number of logical processors in the system, use Spin\n scheduling. Else use Yield scheduling.\n\n\n hipDeviceMapHost : Allow mapping host memory. On ROCM, this is always allowed and\n the flag is ignored. hipDeviceLmemResizeToMax : @warning ROCm silently ignores this flag.\n\n @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorSetOnActiveProcess\n\n"] + pub fn hipSetDeviceFlags(flags: ::std::os::raw::c_uint) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Device which matches hipDeviceProp_t is returned\n\n @param [out] device Pointer of the device\n @param [in] prop Pointer of the properties\n\n @returns #hipSuccess, #hipErrorInvalidValue"] + pub fn hipChooseDeviceR0600( + device: *mut ::std::os::raw::c_int, + prop: *const hipDeviceProp_tR0600, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns the link type and hop count between two devices\n\n @param [in] device1 Ordinal for device1\n @param [in] device2 Ordinal for device2\n @param [out] linktype Returns the link type (See hsa_amd_link_info_type_t) between the two devices\n @param [out] hopcount Returns the hop count between the two devices\n\n Queries and returns the HSA link type and the hop count between the two specified devices.\n\n @returns #hipSuccess, #hipErrorInvalidValue"] + pub fn hipExtGetLinkTypeAndHopCount( + device1: ::std::os::raw::c_int, + device2: ::std::os::raw::c_int, + linktype: *mut u32, + hopcount: *mut u32, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Gets an interprocess memory handle for an existing device memory\n allocation\n\n Takes a pointer to the base of an existing device memory allocation created\n with hipMalloc and exports it for use in another process. This is a\n lightweight operation and may be called multiple times on an allocation\n without adverse effects.\n\n If a region of memory is freed with hipFree and a subsequent call\n to hipMalloc returns memory with the same device address,\n hipIpcGetMemHandle will return a unique handle for the\n new memory.\n\n @param handle - Pointer to user allocated hipIpcMemHandle to return\n the handle in.\n @param devPtr - Base pointer to previously allocated device memory\n\n @returns #hipSuccess, #hipErrorInvalidHandle, #hipErrorOutOfMemory, #hipErrorMapFailed\n\n @note This IPC memory related feature API on Windows may behave differently from Linux.\n"] + pub fn hipIpcGetMemHandle( + handle: *mut hipIpcMemHandle_t, + devPtr: *mut ::std::os::raw::c_void, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Opens an interprocess memory handle exported from another process\n and returns a device pointer usable in the local process.\n\n Maps memory exported from another process with hipIpcGetMemHandle into\n the current device address space. For contexts on different devices\n hipIpcOpenMemHandle can attempt to enable peer access between the\n devices as if the user called hipDeviceEnablePeerAccess. This behavior is\n controlled by the hipIpcMemLazyEnablePeerAccess flag.\n hipDeviceCanAccessPeer can determine if a mapping is possible.\n\n Contexts that may open hipIpcMemHandles are restricted in the following way.\n hipIpcMemHandles from each device in a given process may only be opened\n by one context per device per other process.\n\n Memory returned from hipIpcOpenMemHandle must be freed with\n hipIpcCloseMemHandle.\n\n Calling hipFree on an exported memory region before calling\n hipIpcCloseMemHandle in the importing context will result in undefined\n behavior.\n\n @param devPtr - Returned device pointer\n @param handle - hipIpcMemHandle to open\n @param flags - Flags for this operation. Must be specified as hipIpcMemLazyEnablePeerAccess\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidContext,\n #hipErrorInvalidDevicePointer\n\n @note During multiple processes, using the same memory handle opened by the current context,\n there is no guarantee that the same device poiter will be returned in @p *devPtr.\n This is diffrent from CUDA.\n @note This IPC memory related feature API on Windows may behave differently from Linux.\n"] + pub fn hipIpcOpenMemHandle( + devPtr: *mut *mut ::std::os::raw::c_void, + handle: hipIpcMemHandle_t, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Close memory mapped with hipIpcOpenMemHandle\n\n Unmaps memory returnd by hipIpcOpenMemHandle. The original allocation\n in the exporting process as well as imported mappings in other processes\n will be unaffected.\n\n Any resources used to enable peer access will be freed if this is the\n last mapping using them.\n\n @param devPtr - Device pointer returned by hipIpcOpenMemHandle\n\n @returns #hipSuccess, #hipErrorMapFailed, #hipErrorInvalidHandle\n\n @note This IPC memory related feature API on Windows may behave differently from Linux.\n"] + pub fn hipIpcCloseMemHandle(devPtr: *mut ::std::os::raw::c_void) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Gets an opaque interprocess handle for an event.\n\n This opaque handle may be copied into other processes and opened with hipIpcOpenEventHandle.\n Then hipEventRecord, hipEventSynchronize, hipStreamWaitEvent and hipEventQuery may be used in\n either process. Operations on the imported event after the exported event has been freed with hipEventDestroy\n will result in undefined behavior.\n\n @param[out] handle Pointer to hipIpcEventHandle to return the opaque event handle\n @param[in] event Event allocated with hipEventInterprocess and hipEventDisableTiming flags\n\n @returns #hipSuccess, #hipErrorInvalidConfiguration, #hipErrorInvalidValue\n\n @note This IPC event related feature API is currently applicable on Linux.\n"] + pub fn hipIpcGetEventHandle(handle: *mut hipIpcEventHandle_t, event: hipEvent_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Opens an interprocess event handles.\n\n Opens an interprocess event handle exported from another process with cudaIpcGetEventHandle. The returned\n hipEvent_t behaves like a locally created event with the hipEventDisableTiming flag specified. This event\n need be freed with hipEventDestroy. Operations on the imported event after the exported event has been freed\n with hipEventDestroy will result in undefined behavior. If the function is called within the same process where\n handle is returned by hipIpcGetEventHandle, it will return hipErrorInvalidContext.\n\n @param[out] event Pointer to hipEvent_t to return the event\n @param[in] handle The opaque interprocess handle to open\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidContext\n\n @note This IPC event related feature API is currently applicable on Linux.\n"] + pub fn hipIpcOpenEventHandle(event: *mut hipEvent_t, handle: hipIpcEventHandle_t) + -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @}\n/\n/**\n\n @defgroup Execution Execution Control\n @{\n This section describes the execution control functions of HIP runtime API.\n\n/\n/**\n @brief Set attribute for a specific function\n\n @param [in] func Pointer of the function\n @param [in] attr Attribute to set\n @param [in] value Value to set\n\n @returns #hipSuccess, #hipErrorInvalidDeviceFunction, #hipErrorInvalidValue\n\n Note: AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is\n ignored on those architectures.\n"] + pub fn hipFuncSetAttribute( + func: *const ::std::os::raw::c_void, + attr: hipFuncAttribute, + value: ::std::os::raw::c_int, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Set Cache configuration for a specific function\n\n @param [in] func Pointer of the function.\n @param [in] config Configuration to set.\n\n @returns #hipSuccess, #hipErrorNotInitialized\n Note: AMD devices and some Nvidia GPUS do not support reconfigurable cache. This hint is ignored\n on those architectures.\n"] + pub fn hipFuncSetCacheConfig( + func: *const ::std::os::raw::c_void, + config: hipFuncCache_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Set shared memory configuation for a specific function\n\n @param [in] func Pointer of the function\n @param [in] config Configuration\n\n @returns #hipSuccess, #hipErrorInvalidDeviceFunction, #hipErrorInvalidValue\n\n Note: AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is\n ignored on those architectures.\n"] + pub fn hipFuncSetSharedMemConfig( + func: *const ::std::os::raw::c_void, config: hipSharedMemConfig, ) -> hipError_t; } extern "C" { - #[doc = " @}"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = " @defgroup Error Error Handling"] - #[doc = " @{"] - #[doc = " This section describes the error handling functions of HIP runtime API."] - #[doc = " @brief Return last error returned by any HIP runtime API call and resets the stored error code to"] - #[doc = " #hipSuccess"] - #[doc = ""] - #[doc = " @returns return code from last HIP called from the active host thread"] - #[doc = ""] - #[doc = " Returns the last error that has been returned by any of the runtime calls in the same host"] - #[doc = " thread, and then resets the saved error to #hipSuccess."] - #[doc = ""] - #[doc = " @see hipGetErrorString, hipGetLastError, hipPeakAtLastError, hipError_t"] - pub fn hipGetLastError() -> hipError_t; + #[must_use] + #[doc = " @}\n/\n/**\n-------------------------------------------------------------------------------------------------\n-------------------------------------------------------------------------------------------------\n @defgroup Error Error Handling\n @{\n This section describes the error handling functions of HIP runtime API.\n/\n/**\n @brief Return last error returned by any HIP runtime API call and resets the stored error code to\n #hipSuccess\n\n @returns return code from last HIP called from the active host thread\n\n Returns the last error that has been returned by any of the runtime calls in the same host\n thread, and then resets the saved error to #hipSuccess.\n\n @see hipGetErrorString, hipGetLastError, hipPeakAtLastError, hipError_t"] + pub fn hipGetLastError() -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return last error returned by any HIP runtime API call and resets the stored error code to\n #hipSuccess\n\n @returns return code from last HIP called from the active host thread\n\n Returns the last error that has been returned by any of the runtime calls in the same host\n thread, and then resets the saved error to #hipSuccess.\n\n @see hipGetErrorString, hipGetLastError, hipPeakAtLastError, hipError_t"] + pub fn hipExtGetLastError() -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return last error returned by any HIP runtime API call.\n\n @return #hipSuccess\n\n Returns the last error that has been returned by any of the runtime calls in the same host\n thread. Unlike hipGetLastError, this function does not reset the saved error code.\n\n @see hipGetErrorString, hipGetLastError, hipPeakAtLastError, hipError_t"] + pub fn hipPeekAtLastError() -> hipError_t; +} +extern "C" { + #[doc = " @brief Return hip error as text string form.\n\n @param hip_error Error code to convert to name.\n @return const char pointer to the NULL-terminated error name\n\n @see hipGetErrorString, hipGetLastError, hipPeakAtLastError, hipError_t"] + pub fn hipGetErrorName(hip_error: hipError_t) -> *const ::std::os::raw::c_char; +} +extern "C" { + #[doc = " @brief Return handy text string message to explain the error which occurred\n\n @param hipError Error code to convert to string.\n @return const char pointer to the NULL-terminated error string\n\n @see hipGetErrorName, hipGetLastError, hipPeakAtLastError, hipError_t"] + pub fn hipGetErrorString(hipError: hipError_t) -> *const ::std::os::raw::c_char; +} +extern "C" { + #[must_use] + #[doc = " @brief Return hip error as text string form.\n\n @param [in] hipError Error code to convert to string.\n @param [out] errorString char pointer to the NULL-terminated error string\n @return #hipSuccess, #hipErrorInvalidValue\n\n @see hipGetErrorName, hipGetLastError, hipPeakAtLastError, hipError_t"] + pub fn hipDrvGetErrorName( + hipError: hipError_t, + errorString: *mut *const ::std::os::raw::c_char, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return handy text string message to explain the error which occurred\n\n @param [in] hipError Error code to convert to string.\n @param [out] errorString char pointer to the NULL-terminated error string\n @return #hipSuccess, #hipErrorInvalidValue\n\n @see hipGetErrorName, hipGetLastError, hipPeakAtLastError, hipError_t"] + pub fn hipDrvGetErrorString( + hipError: hipError_t, + errorString: *mut *const ::std::os::raw::c_char, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Create an asynchronous stream.\n\n @param[in, out] stream Valid pointer to hipStream_t. This function writes the memory with the\n newly created stream.\n @return #hipSuccess, #hipErrorInvalidValue\n\n Create a new asynchronous stream. @p stream returns an opaque handle that can be used to\n reference the newly created stream in subsequent hipStream* commands. The stream is allocated on\n the heap and will remain allocated even if the handle goes out-of-scope. To release the memory\n used by the stream, applicaiton must call hipStreamDestroy.\n\n @return #hipSuccess, #hipErrorInvalidValue\n\n @see hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy"] + pub fn hipStreamCreate(stream: *mut hipStream_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Create an asynchronous stream.\n\n @param[in, out] stream Pointer to new stream\n @param[in ] flags to control stream creation.\n @return #hipSuccess, #hipErrorInvalidValue\n\n Create a new asynchronous stream. @p stream returns an opaque handle that can be used to\n reference the newly created stream in subsequent hipStream* commands. The stream is allocated on\n the heap and will remain allocated even if the handle goes out-of-scope. To release the memory\n used by the stream, applicaiton must call hipStreamDestroy. Flags controls behavior of the\n stream. See #hipStreamDefault, #hipStreamNonBlocking.\n\n\n @see hipStreamCreate, hipStreamCreateWithPriority, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy"] + pub fn hipStreamCreateWithFlags( + stream: *mut hipStream_t, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Create an asynchronous stream with the specified priority.\n\n @param[in, out] stream Pointer to new stream\n @param[in ] flags to control stream creation.\n @param[in ] priority of the stream. Lower numbers represent higher priorities.\n @return #hipSuccess, #hipErrorInvalidValue\n\n Create a new asynchronous stream with the specified priority. @p stream returns an opaque handle\n that can be used to reference the newly created stream in subsequent hipStream* commands. The\n stream is allocated on the heap and will remain allocated even if the handle goes out-of-scope.\n To release the memory used by the stream, applicaiton must call hipStreamDestroy. Flags controls\n behavior of the stream. See #hipStreamDefault, #hipStreamNonBlocking.\n\n\n @see hipStreamCreate, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy"] + pub fn hipStreamCreateWithPriority( + stream: *mut hipStream_t, + flags: ::std::os::raw::c_uint, + priority: ::std::os::raw::c_int, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns numerical values that correspond to the least and greatest stream priority.\n\n @param[in, out] leastPriority pointer in which value corresponding to least priority is returned.\n @param[in, out] greatestPriority pointer in which value corresponding to greatest priority is returned.\n @returns #hipSuccess\n\n Returns in *leastPriority and *greatestPriority the numerical values that correspond to the least\n and greatest stream priority respectively. Stream priorities follow a convention where lower numbers\n imply greater priorities. The range of meaningful stream priorities is given by\n [*greatestPriority, *leastPriority]. If the user attempts to create a stream with a priority value\n that is outside the the meaningful range as specified by this API, the priority is automatically\n clamped to within the valid range."] + pub fn hipDeviceGetStreamPriorityRange( + leastPriority: *mut ::std::os::raw::c_int, + greatestPriority: *mut ::std::os::raw::c_int, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Destroys the specified stream.\n\n @param[in] stream stream identifier.\n @return #hipSuccess #hipErrorInvalidHandle\n\n Destroys the specified stream.\n\n If commands are still executing on the specified stream, some may complete execution before the\n queue is deleted.\n\n The queue may be destroyed while some commands are still inflight, or may wait for all commands\n queued to the stream before destroying it.\n\n @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamQuery,\n hipStreamWaitEvent, hipStreamSynchronize"] + pub fn hipStreamDestroy(stream: hipStream_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return #hipSuccess if all of the operations in the specified @p stream have completed, or\n #hipErrorNotReady if not.\n\n @param[in] stream stream to query\n\n @return #hipSuccess, #hipErrorNotReady, #hipErrorInvalidHandle\n\n This is thread-safe and returns a snapshot of the current state of the queue. However, if other\n host threads are sending work to the stream, the status may change immediately after the function\n is called. It is typically used for debug.\n\n @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamWaitEvent,\n hipStreamSynchronize, hipStreamDestroy"] + pub fn hipStreamQuery(stream: hipStream_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Wait for all commands in stream to complete.\n\n @param[in] stream stream identifier.\n\n @return #hipSuccess, #hipErrorInvalidHandle\n\n This command is host-synchronous : the host will block until the specified stream is empty.\n\n This command follows standard null-stream semantics. Specifically, specifying the null stream\n will cause the command to wait for other streams on the same device to complete all pending\n operations.\n\n This command honors the hipDeviceLaunchBlocking flag, which controls whether the wait is active\n or blocking.\n\n @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamWaitEvent,\n hipStreamDestroy\n"] + pub fn hipStreamSynchronize(stream: hipStream_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Make the specified compute stream wait for an event\n\n @param[in] stream stream to make wait.\n @param[in] event event to wait on\n @param[in] flags control operation [must be 0]\n\n @return #hipSuccess, #hipErrorInvalidHandle\n\n This function inserts a wait operation into the specified stream.\n All future work submitted to @p stream will wait until @p event reports completion before\n beginning execution.\n\n This function only waits for commands in the current stream to complete. Notably,, this function\n does not impliciy wait for commands in the default stream to complete, even if the specified\n stream is created with hipStreamNonBlocking = 0.\n\n @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamSynchronize, hipStreamDestroy"] + pub fn hipStreamWaitEvent( + stream: hipStream_t, + event: hipEvent_t, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return flags associated with this stream.\n\n @param[in] stream stream to be queried\n @param[in,out] flags Pointer to an unsigned integer in which the stream's flags are returned\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidHandle\n\n @returns #hipSuccess #hipErrorInvalidValue #hipErrorInvalidHandle\n\n Return flags associated with this stream in *@p flags.\n\n @see hipStreamCreateWithFlags"] + pub fn hipStreamGetFlags(stream: hipStream_t, flags: *mut ::std::os::raw::c_uint) + -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Query the priority of a stream.\n\n @param[in] stream stream to be queried\n @param[in,out] priority Pointer to an unsigned integer in which the stream's priority is returned\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidHandle\n\n @returns #hipSuccess #hipErrorInvalidValue #hipErrorInvalidHandle\n\n Query the priority of a stream. The priority is returned in in priority.\n\n @see hipStreamCreateWithFlags"] + pub fn hipStreamGetPriority( + stream: hipStream_t, + priority: *mut ::std::os::raw::c_int, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get the device assocaited with the stream\n\n @param[in] stream stream to be queried\n @param[out] device device associated with the stream\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorContextIsDestroyed, #hipErrorInvalidHandle,\n #hipErrorNotInitialized, #hipErrorDeinitialized, #hipErrorInvalidContext\n\n @see hipStreamCreate, hipStreamDestroy, hipDeviceGetStreamPriorityRange"] + pub fn hipStreamGetDevice(stream: hipStream_t, device: *mut hipDevice_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Create an asynchronous stream with the specified CU mask.\n\n @param[in, out] stream Pointer to new stream\n @param[in ] cuMaskSize Size of CU mask bit array passed in.\n @param[in ] cuMask Bit-vector representing the CU mask. Each active bit represents using one CU.\n The first 32 bits represent the first 32 CUs, and so on. If its size is greater than physical\n CU number (i.e., multiProcessorCount member of hipDeviceProp_t), the extra elements are ignored.\n It is user's responsibility to make sure the input is meaningful.\n @return #hipSuccess, #hipErrorInvalidHandle, #hipErrorInvalidValue\n\n Create a new asynchronous stream with the specified CU mask. @p stream returns an opaque handle\n that can be used to reference the newly created stream in subsequent hipStream* commands. The\n stream is allocated on the heap and will remain allocated even if the handle goes out-of-scope.\n To release the memory used by the stream, application must call hipStreamDestroy.\n\n\n @see hipStreamCreate, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy"] + pub fn hipExtStreamCreateWithCUMask( + stream: *mut hipStream_t, + cuMaskSize: u32, + cuMask: *const u32, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get CU mask associated with an asynchronous stream\n\n @param[in] stream stream to be queried\n @param[in] cuMaskSize number of the block of memories (uint32_t *) allocated by user\n @param[out] cuMask Pointer to a pre-allocated block of memories (uint32_t *) in which\n the stream's CU mask is returned. The CU mask is returned in a chunck of 32 bits where\n each active bit represents one active CU\n @return #hipSuccess, #hipErrorInvalidHandle, #hipErrorInvalidValue\n\n @see hipStreamCreate, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy"] + pub fn hipExtStreamGetCUMask( + stream: hipStream_t, + cuMaskSize: u32, + cuMask: *mut u32, + ) -> hipError_t; +} +#[doc = " Stream CallBack struct"] +pub type hipStreamCallback_t = ::std::option::Option< + unsafe extern "C" fn( + stream: hipStream_t, + status: hipError_t, + userData: *mut ::std::os::raw::c_void, + ), +>; +extern "C" { + #[must_use] + #[doc = " @brief Adds a callback to be called on the host after all currently enqueued\n items in the stream have completed. For each\n hipStreamAddCallback call, a callback will be executed exactly once.\n The callback will block later work in the stream until it is finished.\n @param[in] stream - Stream to add callback to\n @param[in] callback - The function to call once preceding stream operations are complete\n @param[in] userData - User specified data to be passed to the callback function\n @param[in] flags - Reserved for future use, must be 0\n @return #hipSuccess, #hipErrorInvalidHandle, #hipErrorNotSupported\n\n @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamQuery, hipStreamSynchronize,\n hipStreamWaitEvent, hipStreamDestroy, hipStreamCreateWithPriority\n"] + pub fn hipStreamAddCallback( + stream: hipStream_t, + callback: hipStreamCallback_t, + userData: *mut ::std::os::raw::c_void, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @}\n/\n/**\n-------------------------------------------------------------------------------------------------\n-------------------------------------------------------------------------------------------------\n @defgroup StreamM Stream Memory Operations\n @{\n This section describes Stream Memory Wait and Write functions of HIP runtime API.\n/\n/**\n @brief Enqueues a wait command to the stream.[BETA]\n\n @param [in] stream - Stream identifier\n @param [in] ptr - Pointer to memory object allocated using 'hipMallocSignalMemory' flag\n @param [in] value - Value to be used in compare operation\n @param [in] flags - Defines the compare operation, supported values are hipStreamWaitValueGte\n hipStreamWaitValueEq, hipStreamWaitValueAnd and hipStreamWaitValueNor\n @param [in] mask - Mask to be applied on value at memory before it is compared with value,\n default value is set to enable every bit\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n Enqueues a wait command to the stream, all operations enqueued on this stream after this, will\n not execute until the defined wait condition is true.\n\n hipStreamWaitValueGte: waits until *ptr&mask >= value\n hipStreamWaitValueEq : waits until *ptr&mask == value\n hipStreamWaitValueAnd: waits until ((*ptr&mask) & value) != 0\n hipStreamWaitValueNor: waits until ~((*ptr&mask) | (value&mask)) != 0\n\n @note when using 'hipStreamWaitValueNor', mask is applied on both 'value' and '*ptr'.\n\n @note Support for hipStreamWaitValue32 can be queried using 'hipDeviceGetAttribute()' and\n 'hipDeviceAttributeCanUseStreamWaitValue' flag.\n\n @warning This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @see hipExtMallocWithFlags, hipFree, hipStreamWaitValue64, hipStreamWriteValue64,\n hipStreamWriteValue32, hipDeviceGetAttribute"] + pub fn hipStreamWaitValue32( + stream: hipStream_t, + ptr: *mut ::std::os::raw::c_void, + value: u32, + flags: ::std::os::raw::c_uint, + mask: u32, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Enqueues a wait command to the stream.[BETA]\n\n @param [in] stream - Stream identifier\n @param [in] ptr - Pointer to memory object allocated using 'hipMallocSignalMemory' flag\n @param [in] value - Value to be used in compare operation\n @param [in] flags - Defines the compare operation, supported values are hipStreamWaitValueGte\n hipStreamWaitValueEq, hipStreamWaitValueAnd and hipStreamWaitValueNor.\n @param [in] mask - Mask to be applied on value at memory before it is compared with value\n default value is set to enable every bit\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n Enqueues a wait command to the stream, all operations enqueued on this stream after this, will\n not execute until the defined wait condition is true.\n\n hipStreamWaitValueGte: waits until *ptr&mask >= value\n hipStreamWaitValueEq : waits until *ptr&mask == value\n hipStreamWaitValueAnd: waits until ((*ptr&mask) & value) != 0\n hipStreamWaitValueNor: waits until ~((*ptr&mask) | (value&mask)) != 0\n\n @note when using 'hipStreamWaitValueNor', mask is applied on both 'value' and '*ptr'.\n\n @note Support for hipStreamWaitValue64 can be queried using 'hipDeviceGetAttribute()' and\n 'hipDeviceAttributeCanUseStreamWaitValue' flag.\n\n @warning This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @see hipExtMallocWithFlags, hipFree, hipStreamWaitValue32, hipStreamWriteValue64,\n hipStreamWriteValue32, hipDeviceGetAttribute"] + pub fn hipStreamWaitValue64( + stream: hipStream_t, + ptr: *mut ::std::os::raw::c_void, + value: u64, + flags: ::std::os::raw::c_uint, + mask: u64, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Enqueues a write command to the stream.[BETA]\n\n @param [in] stream - Stream identifier\n @param [in] ptr - Pointer to a GPU accessible memory object\n @param [in] value - Value to be written\n @param [in] flags - reserved, ignored for now, will be used in future releases\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n Enqueues a write command to the stream, write operation is performed after all earlier commands\n on this stream have completed the execution.\n\n @warning This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @see hipExtMallocWithFlags, hipFree, hipStreamWriteValue32, hipStreamWaitValue32,\n hipStreamWaitValue64"] + pub fn hipStreamWriteValue32( + stream: hipStream_t, + ptr: *mut ::std::os::raw::c_void, + value: u32, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Enqueues a write command to the stream.[BETA]\n\n @param [in] stream - Stream identifier\n @param [in] ptr - Pointer to a GPU accessible memory object\n @param [in] value - Value to be written\n @param [in] flags - reserved, ignored for now, will be used in future releases\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n Enqueues a write command to the stream, write operation is performed after all earlier commands\n on this stream have completed the execution.\n\n @warning This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @see hipExtMallocWithFlags, hipFree, hipStreamWriteValue32, hipStreamWaitValue32,\n hipStreamWaitValue64"] + pub fn hipStreamWriteValue64( + stream: hipStream_t, + ptr: *mut ::std::os::raw::c_void, + value: u64, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @}\n/\n/**\n-------------------------------------------------------------------------------------------------\n-------------------------------------------------------------------------------------------------\n @defgroup Event Event Management\n @{\n This section describes the event management functions of HIP runtime API.\n/\n/**\n @brief Create an event with the specified flags\n\n @param[in,out] event Returns the newly created event.\n @param[in] flags Flags to control event behavior. Valid values are #hipEventDefault,\n#hipEventBlockingSync, #hipEventDisableTiming, #hipEventInterprocess\n #hipEventDefault : Default flag. The event will use active synchronization and will support\ntiming. Blocking synchronization provides lowest possible latency at the expense of dedicating a\nCPU to poll on the event.\n #hipEventBlockingSync : The event will use blocking synchronization : if hipEventSynchronize is\ncalled on this event, the thread will block until the event completes. This can increase latency\nfor the synchroniation but can result in lower power and more resources for other CPU threads.\n #hipEventDisableTiming : Disable recording of timing information. Events created with this flag\nwould not record profiling data and provide best performance if used for synchronization.\n #hipEventInterprocess : The event can be used as an interprocess event. hipEventDisableTiming\nflag also must be set when hipEventInterprocess flag is set.\n #hipEventDisableSystemFence : Disable acquire and release system scope fence. This may\nimprove performance but device memory may not be visible to the host and other devices\nif this flag is set.\n\n @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue,\n#hipErrorLaunchFailure, #hipErrorOutOfMemory\n\n @see hipEventCreate, hipEventSynchronize, hipEventDestroy, hipEventElapsedTime"] + pub fn hipEventCreateWithFlags( + event: *mut hipEvent_t, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " Create an event\n\n @param[in,out] event Returns the newly created event.\n\n @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue,\n #hipErrorLaunchFailure, #hipErrorOutOfMemory\n\n @see hipEventCreateWithFlags, hipEventRecord, hipEventQuery, hipEventSynchronize,\n hipEventDestroy, hipEventElapsedTime"] + pub fn hipEventCreate(event: *mut hipEvent_t) -> hipError_t; +} +extern "C" { + #[must_use] + pub fn hipEventRecord(event: hipEvent_t, stream: hipStream_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Destroy the specified event.\n\n @param[in] event Event to destroy.\n @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue,\n #hipErrorLaunchFailure\n\n Releases memory associated with the event. If the event is recording but has not completed\n recording when hipEventDestroy() is called, the function will return immediately and the\n completion_future resources will be released later, when the hipDevice is synchronized.\n\n @see hipEventCreate, hipEventCreateWithFlags, hipEventQuery, hipEventSynchronize, hipEventRecord,\n hipEventElapsedTime\n\n @returns #hipSuccess"] + pub fn hipEventDestroy(event: hipEvent_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Wait for an event to complete.\n\n This function will block until the event is ready, waiting for all previous work in the stream\n specified when event was recorded with hipEventRecord().\n\n If hipEventRecord() has not been called on @p event, this function returns #hipSuccess when no\n event is captured.\n\n This function needs to support hipEventBlockingSync parameter.\n\n @param[in] event Event on which to wait.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized,\n #hipErrorInvalidHandle, #hipErrorLaunchFailure\n\n @see hipEventCreate, hipEventCreateWithFlags, hipEventQuery, hipEventDestroy, hipEventRecord,\n hipEventElapsedTime"] + pub fn hipEventSynchronize(event: hipEvent_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return the elapsed time between two events.\n\n @param[out] ms : Return time between start and stop in ms.\n @param[in] start : Start event.\n @param[in] stop : Stop event.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotReady, #hipErrorInvalidHandle,\n #hipErrorNotInitialized, #hipErrorLaunchFailure\n\n Computes the elapsed time between two events. Time is computed in ms, with\n a resolution of approximately 1 us.\n\n Events which are recorded in a NULL stream will block until all commands\n on all other streams complete execution, and then record the timestamp.\n\n Events which are recorded in a non-NULL stream will record their timestamp\n when they reach the head of the specified stream, after all previous\n commands in that stream have completed executing. Thus the time that\n the event recorded may be significantly after the host calls hipEventRecord().\n\n If hipEventRecord() has not been called on either event, then #hipErrorInvalidHandle is\n returned. If hipEventRecord() has been called on both events, but the timestamp has not yet been\n recorded on one or both events (that is, hipEventQuery() would return #hipErrorNotReady on at\n least one of the events), then #hipErrorNotReady is returned.\n\n @see hipEventCreate, hipEventCreateWithFlags, hipEventQuery, hipEventDestroy, hipEventRecord,\n hipEventSynchronize"] + pub fn hipEventElapsedTime(ms: *mut f32, start: hipEvent_t, stop: hipEvent_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Query event status\n\n @param[in] event Event to query.\n @returns #hipSuccess, #hipErrorNotReady, #hipErrorInvalidHandle, #hipErrorInvalidValue,\n #hipErrorNotInitialized, #hipErrorLaunchFailure\n\n Query the status of the specified event. This function will return #hipSuccess if all\n commands in the appropriate stream (specified to hipEventRecord()) have completed. If any execution\n has not completed, then #hipErrorNotReady is returned.\n\n @note: This API returns #hipSuccess, if hipEventRecord() is not called before this API.\n\n @see hipEventCreate, hipEventCreateWithFlags, hipEventRecord, hipEventDestroy,\n hipEventSynchronize, hipEventElapsedTime"] + pub fn hipEventQuery(event: hipEvent_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Sets information on the specified pointer.[BETA]\n\n @param [in] value Sets pointer attribute value\n @param [in] attribute Attribute to set\n @param [in] ptr Pointer to set attributes for\n\n @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue\n\n @warning This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipPointerSetAttribute( + value: *const ::std::os::raw::c_void, + attribute: hipPointer_attribute, + ptr: hipDeviceptr_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns attributes for the specified pointer\n\n @param [out] attributes attributes for the specified pointer\n @param [in] ptr pointer to get attributes for\n\n The output parameter 'attributes' has a member named 'type' that describes what memory the\n pointer is associated with, such as device memory, host memory, managed memory, and others.\n Otherwise, the API cannot handle the pointer and returns #hipErrorInvalidValue.\n\n @note The unrecognized memory type is unsupported to keep the HIP functionality backward\n compatibility due to #hipMemoryType enum values.\n\n @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue\n\n @note The current behavior of this HIP API corresponds to the CUDA API before version 11.0.\n\n @see hipPointerGetAttribute"] + pub fn hipPointerGetAttributes( + attributes: *mut hipPointerAttribute_t, + ptr: *const ::std::os::raw::c_void, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns information about the specified pointer.[BETA]\n\n @param [in, out] data Returned pointer attribute value\n @param [in] attribute Attribute to query for\n @param [in] ptr Pointer to get attributes for\n\n @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue\n\n @warning This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @see hipPointerGetAttributes"] + pub fn hipPointerGetAttribute( + data: *mut ::std::os::raw::c_void, + attribute: hipPointer_attribute, + ptr: hipDeviceptr_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns information about the specified pointer.[BETA]\n\n @param [in] numAttributes number of attributes to query for\n @param [in] attributes attributes to query for\n @param [in, out] data a two-dimensional containing pointers to memory locations\n where the result of each attribute query will be written to\n @param [in] ptr pointer to get attributes for\n\n @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue\n\n @warning This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @see hipPointerGetAttribute"] + pub fn hipDrvPointerGetAttributes( + numAttributes: ::std::os::raw::c_uint, + attributes: *mut hipPointer_attribute, + data: *mut *mut ::std::os::raw::c_void, + ptr: hipDeviceptr_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = "-------------------------------------------------------------------------------------------------\n-------------------------------------------------------------------------------------------------\n @defgroup External External Resource Interoperability\n @{\n @ingroup API\n\n This section describes the external resource interoperability functions of HIP runtime API.\n\n/\n/**\n @brief Imports an external semaphore.\n\n @param[out] extSem_out External semaphores to be waited on\n @param[in] semHandleDesc Semaphore import handle descriptor\n\n @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue\n\n @see"] + pub fn hipImportExternalSemaphore( + extSem_out: *mut hipExternalSemaphore_t, + semHandleDesc: *const hipExternalSemaphoreHandleDesc, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Signals a set of external semaphore objects.\n\n @param[in] extSemArray External semaphores to be waited on\n @param[in] paramsArray Array of semaphore parameters\n @param[in] numExtSems Number of semaphores to wait on\n @param[in] stream Stream to enqueue the wait operations in\n\n @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue\n\n @see"] + pub fn hipSignalExternalSemaphoresAsync( + extSemArray: *const hipExternalSemaphore_t, + paramsArray: *const hipExternalSemaphoreSignalParams, + numExtSems: ::std::os::raw::c_uint, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Waits on a set of external semaphore objects\n\n @param[in] extSemArray External semaphores to be waited on\n @param[in] paramsArray Array of semaphore parameters\n @param[in] numExtSems Number of semaphores to wait on\n @param[in] stream Stream to enqueue the wait operations in\n\n @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue\n\n @see"] + pub fn hipWaitExternalSemaphoresAsync( + extSemArray: *const hipExternalSemaphore_t, + paramsArray: *const hipExternalSemaphoreWaitParams, + numExtSems: ::std::os::raw::c_uint, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Destroys an external semaphore object and releases any references to the underlying resource. Any outstanding signals or waits must have completed before the semaphore is destroyed.\n\n @param[in] extSem handle to an external memory object\n\n @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue\n\n @see"] + pub fn hipDestroyExternalSemaphore(extSem: hipExternalSemaphore_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Imports an external memory object.\n\n @param[out] extMem_out Returned handle to an external memory object\n @param[in] memHandleDesc Memory import handle descriptor\n\n @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue\n\n @see"] + pub fn hipImportExternalMemory( + extMem_out: *mut hipExternalMemory_t, + memHandleDesc: *const hipExternalMemoryHandleDesc, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Maps a buffer onto an imported memory object.\n\n @param[out] devPtr Returned device pointer to buffer\n @param[in] extMem Handle to external memory object\n @param[in] bufferDesc Buffer descriptor\n\n @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue\n\n @see"] + pub fn hipExternalMemoryGetMappedBuffer( + devPtr: *mut *mut ::std::os::raw::c_void, + extMem: hipExternalMemory_t, + bufferDesc: *const hipExternalMemoryBufferDesc, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Destroys an external memory object.\n\n @param[in] extMem External memory object to be destroyed\n\n @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue\n\n @see"] + pub fn hipDestroyExternalMemory(extMem: hipExternalMemory_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Maps a mipmapped array onto an external memory object.\n\n @param[out] mipmap mipmapped array to return\n @param[in] extMem external memory object handle\n @param[in] mipmapDesc external mipmapped array descriptor\n\n Returned mipmapped array must be freed using hipFreeMipmappedArray.\n\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidResourceHandle\n\n @see hipImportExternalMemory, hipDestroyExternalMemory, hipExternalMemoryGetMappedBuffer, hipFreeMipmappedArray"] + pub fn hipExternalMemoryGetMappedMipmappedArray( + mipmap: *mut hipMipmappedArray_t, + extMem: hipExternalMemory_t, + mipmapDesc: *const hipExternalMemoryMipmappedArrayDesc, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @}\n/\n/**\n @brief Allocate memory on the default accelerator\n\n @param[out] ptr Pointer to the allocated memory\n @param[in] size Requested memory size\n\n If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.\n\n @return #hipSuccess, #hipErrorOutOfMemory, #hipErrorInvalidValue (bad context, null *ptr)\n\n @see hipMallocPitch, hipFree, hipMallocArray, hipFreeArray, hipMalloc3D, hipMalloc3DArray,\n hipHostFree, hipHostMalloc"] + pub fn hipMalloc(ptr: *mut *mut ::std::os::raw::c_void, size: usize) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Allocate memory on the default accelerator\n\n @param[out] ptr Pointer to the allocated memory\n @param[in] sizeBytes Requested memory size\n @param[in] flags Type of memory allocation\n\n If requested memory size is 0, no memory is allocated, *ptr returns nullptr, and #hipSuccess\n is returned.\n\n The memory allocation flag should be either #hipDeviceMallocDefault,\n #hipDeviceMallocFinegrained, #hipDeviceMallocUncached, or #hipMallocSignalMemory.\n If the flag is any other value, the API returns #hipErrorInvalidValue.\n\n @return #hipSuccess, #hipErrorOutOfMemory, #hipErrorInvalidValue (bad context, null *ptr)\n\n @see hipMallocPitch, hipFree, hipMallocArray, hipFreeArray, hipMalloc3D, hipMalloc3DArray,\n hipHostFree, hipHostMalloc"] + pub fn hipExtMallocWithFlags( + ptr: *mut *mut ::std::os::raw::c_void, + sizeBytes: usize, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Allocate pinned host memory [Deprecated]\n\n @param[out] ptr Pointer to the allocated host pinned memory\n @param[in] size Requested memory size\n\n If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.\n\n @return #hipSuccess, #hipErrorOutOfMemory\n\n @warning This API is deprecated, use hipHostMalloc() instead"] + pub fn hipMallocHost(ptr: *mut *mut ::std::os::raw::c_void, size: usize) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Allocate pinned host memory [Deprecated]\n\n @param[out] ptr Pointer to the allocated host pinned memory\n @param[in] size Requested memory size\n\n If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.\n\n @return #hipSuccess, #hipErrorOutOfMemory\n\n @warning This API is deprecated, use hipHostMalloc() instead"] + pub fn hipMemAllocHost(ptr: *mut *mut ::std::os::raw::c_void, size: usize) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Allocates device accessible page locked (pinned) host memory\n\n This API allocates pinned host memory which is mapped into the address space of all GPUs\n in the system, the memory can be accessed directly by the GPU device, and can be read or\n written with much higher bandwidth than pageable memory obtained with functions such as\n malloc().\n\n Using the pinned host memory, applications can implement faster data transfers for HostToDevice\n and DeviceToHost. The runtime tracks the hipHostMalloc allocations and can avoid some of the\n setup required for regular unpinned memory.\n\n When the memory accesses are infrequent, zero-copy memory can be a good choice, for coherent\n allocation. GPU can directly access the host memory over the CPU/GPU interconnect, without need\n to copy the data.\n\n Currently the allocation granularity is 4KB for the API.\n\n Developers need to choose proper allocation flag with consideration of synchronization.\n\n @param[out] ptr Pointer to the allocated host pinned memory\n @param[in] size Requested memory size in bytes\n If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.\n @param[in] flags Type of host memory allocation\n\n If no input for flags, it will be the default pinned memory allocation on the host.\n\n @return #hipSuccess, #hipErrorOutOfMemory\n\n @see hipSetDeviceFlags, hipHostFree"] + pub fn hipHostMalloc( + ptr: *mut *mut ::std::os::raw::c_void, + size: usize, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = "-------------------------------------------------------------------------------------------------\n-------------------------------------------------------------------------------------------------\n @defgroup MemoryM Managed Memory\n\n @ingroup Memory\n @{\n This section describes the managed memory management functions of HIP runtime API.\n\n @note The managed memory management APIs are implemented on Linux, under developement\n on Windows.\n\n/\n/**\n @brief Allocates memory that will be automatically managed by HIP.\n\n This API is used for managed memory, allows data be shared and accessible to both CPU and\n GPU using a single pointer.\n\n The API returns the allocation pointer, managed by HMM, can be used further to execute kernels\n on device and fetch data between the host and device as needed.\n\n @note It is recommend to do the capability check before call this API.\n\n @param [out] dev_ptr - pointer to allocated device memory\n @param [in] size - requested allocation size in bytes, it should be granularity of 4KB\n @param [in] flags - must be either hipMemAttachGlobal or hipMemAttachHost\n (defaults to hipMemAttachGlobal)\n\n @returns #hipSuccess, #hipErrorMemoryAllocation, #hipErrorNotSupported, #hipErrorInvalidValue\n"] + pub fn hipMallocManaged( + dev_ptr: *mut *mut ::std::os::raw::c_void, + size: usize, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Prefetches memory to the specified destination device using HIP.\n\n @param [in] dev_ptr pointer to be prefetched\n @param [in] count size in bytes for prefetching\n @param [in] device destination device to prefetch to\n @param [in] stream stream to enqueue prefetch operation\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemPrefetchAsync( + dev_ptr: *const ::std::os::raw::c_void, + count: usize, + device: ::std::os::raw::c_int, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Advise about the usage of a given memory range to HIP.\n\n @param [in] dev_ptr pointer to memory to set the advice for\n @param [in] count size in bytes of the memory range, it should be CPU page size alligned.\n @param [in] advice advice to be applied for the specified memory range\n @param [in] device device to apply the advice for\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n This HIP API advises about the usage to be applied on unified memory allocation in the\n range starting from the pointer address devPtr, with the size of count bytes.\n The memory range must refer to managed memory allocated via the API hipMallocManaged, and the\n range will be handled with proper round down and round up respectively in the driver to\n be aligned to CPU page size, the same way as corresponding CUDA API behaves in CUDA version 8.0\n and afterwards.\n\n @note This API is implemented on Linux and is under development on Windows."] + pub fn hipMemAdvise( + dev_ptr: *const ::std::os::raw::c_void, + count: usize, + advice: hipMemoryAdvise, + device: ::std::os::raw::c_int, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Query an attribute of a given memory range in HIP.\n\n @param [in,out] data a pointer to a memory location where the result of each\n attribute query will be written to\n @param [in] data_size the size of data\n @param [in] attribute the attribute to query\n @param [in] dev_ptr start of the range to query\n @param [in] count size of the range to query\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemRangeGetAttribute( + data: *mut ::std::os::raw::c_void, + data_size: usize, + attribute: hipMemRangeAttribute, + dev_ptr: *const ::std::os::raw::c_void, + count: usize, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Query attributes of a given memory range in HIP.\n\n @param [in,out] data a two-dimensional array containing pointers to memory locations\n where the result of each attribute query will be written to\n @param [in] data_sizes an array, containing the sizes of each result\n @param [in] attributes the attribute to query\n @param [in] num_attributes an array of attributes to query (numAttributes and the number\n of attributes in this array should match)\n @param [in] dev_ptr start of the range to query\n @param [in] count size of the range to query\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemRangeGetAttributes( + data: *mut *mut ::std::os::raw::c_void, + data_sizes: *mut usize, + attributes: *mut hipMemRangeAttribute, + num_attributes: usize, + dev_ptr: *const ::std::os::raw::c_void, + count: usize, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Attach memory to a stream asynchronously in HIP.\n\n @param [in] stream - stream in which to enqueue the attach operation\n @param [in] dev_ptr - pointer to memory (must be a pointer to managed memory or\n to a valid host-accessible region of system-allocated memory)\n @param [in] length - length of memory (defaults to zero)\n @param [in] flags - must be one of hipMemAttachGlobal, hipMemAttachHost or\n hipMemAttachSingle (defaults to hipMemAttachSingle)\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipStreamAttachMemAsync( + stream: hipStream_t, + dev_ptr: *mut ::std::os::raw::c_void, + length: usize, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Allocates memory with stream ordered semantics\n\n Inserts a memory allocation operation into @p stream.\n A pointer to the allocated memory is returned immediately in *dptr.\n The allocation must not be accessed until the the allocation operation completes.\n The allocation comes from the memory pool associated with the stream's device.\n\n @note The default memory pool of a device contains device memory from that device.\n @note Basic stream ordering allows future work submitted into the same stream to use the\n allocation. Stream query, stream synchronize, and HIP events can be used to guarantee that\n the allocation operation completes before work submitted in a separate stream runs.\n @note During stream capture, this function results in the creation of an allocation node.\n In this case, the allocation is owned by the graph instead of the memory pool. The memory\n pool's properties are used to set the node's creation parameters.\n\n @param [out] dev_ptr Returned device pointer of memory allocation\n @param [in] size Number of bytes to allocate\n @param [in] stream The stream establishing the stream ordering contract and\n the memory pool to allocate from\n\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported, #hipErrorOutOfMemory\n\n @see hipMallocFromPoolAsync, hipFreeAsync, hipMemPoolTrimTo, hipMemPoolGetAttribute,\n hipDeviceSetMemPool, hipMemPoolSetAttribute, hipMemPoolSetAccess, hipMemPoolGetAccess\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMallocAsync( + dev_ptr: *mut *mut ::std::os::raw::c_void, + size: usize, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Frees memory with stream ordered semantics\n\n Inserts a free operation into @p stream.\n The allocation must not be used after stream execution reaches the free.\n After this API returns, accessing the memory from any subsequent work launched on the GPU\n or querying its pointer attributes results in undefined behavior.\n\n @note During stream capture, this function results in the creation of a free node and\n must therefore be passed the address of a graph allocation.\n\n @param [in] dev_ptr Pointer to device memory to free\n @param [in] stream The stream, where the destruciton will occur according to the execution order\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @see hipMallocFromPoolAsync, hipMallocAsync, hipMemPoolTrimTo, hipMemPoolGetAttribute,\n hipDeviceSetMemPool, hipMemPoolSetAttribute, hipMemPoolSetAccess, hipMemPoolGetAccess\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipFreeAsync(dev_ptr: *mut ::std::os::raw::c_void, stream: hipStream_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Releases freed memory back to the OS\n\n Releases memory back to the OS until the pool contains fewer than @p min_bytes_to_keep\n reserved bytes, or there is no more memory that the allocator can safely release.\n The allocator cannot release OS allocations that back outstanding asynchronous allocations.\n The OS allocations may happen at different granularity from the user allocations.\n\n @note: Allocations that have not been freed count as outstanding.\n @note: Allocations that have been asynchronously freed but whose completion has\n not been observed on the host (eg. by a synchronize) can count as outstanding.\n\n @param[in] mem_pool The memory pool to trim allocations\n @param[in] min_bytes_to_hold If the pool has less than min_bytes_to_hold reserved,\n then the TrimTo operation is a no-op. Otherwise the memory pool will contain\n at least min_bytes_to_hold bytes reserved after the operation.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @see hipMallocFromPoolAsync, hipMallocAsync, hipFreeAsync, hipMemPoolGetAttribute,\n hipDeviceSetMemPool, hipMemPoolSetAttribute, hipMemPoolSetAccess, hipMemPoolGetAccess\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemPoolTrimTo(mem_pool: hipMemPool_t, min_bytes_to_hold: usize) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Sets attributes of a memory pool\n\n Supported attributes are:\n - @p hipMemPoolAttrReleaseThreshold: (value type = cuuint64_t)\n Amount of reserved memory in bytes to hold onto before trying\n to release memory back to the OS. When more than the release\n threshold bytes of memory are held by the memory pool, the\n allocator will try to release memory back to the OS on the\n next call to stream, event or context synchronize. (default 0)\n - @p hipMemPoolReuseFollowEventDependencies: (value type = int)\n Allow @p hipMallocAsync to use memory asynchronously freed\n in another stream as long as a stream ordering dependency\n of the allocating stream on the free action exists.\n HIP events and null stream interactions can create the required\n stream ordered dependencies. (default enabled)\n - @p hipMemPoolReuseAllowOpportunistic: (value type = int)\n Allow reuse of already completed frees when there is no dependency\n between the free and allocation. (default enabled)\n - @p hipMemPoolReuseAllowInternalDependencies: (value type = int)\n Allow @p hipMallocAsync to insert new stream dependencies\n in order to establish the stream ordering required to reuse\n a piece of memory released by @p hipFreeAsync (default enabled).\n\n @param [in] mem_pool The memory pool to modify\n @param [in] attr The attribute to modify\n @param [in] value Pointer to the value to assign\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @see hipMallocFromPoolAsync, hipMallocAsync, hipFreeAsync, hipMemPoolGetAttribute,\n hipMemPoolTrimTo, hipDeviceSetMemPool, hipMemPoolSetAccess, hipMemPoolGetAccess\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemPoolSetAttribute( + mem_pool: hipMemPool_t, + attr: hipMemPoolAttr, + value: *mut ::std::os::raw::c_void, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Gets attributes of a memory pool\n\n Supported attributes are:\n - @p hipMemPoolAttrReleaseThreshold: (value type = cuuint64_t)\n Amount of reserved memory in bytes to hold onto before trying\n to release memory back to the OS. When more than the release\n threshold bytes of memory are held by the memory pool, the\n allocator will try to release memory back to the OS on the\n next call to stream, event or context synchronize. (default 0)\n - @p hipMemPoolReuseFollowEventDependencies: (value type = int)\n Allow @p hipMallocAsync to use memory asynchronously freed\n in another stream as long as a stream ordering dependency\n of the allocating stream on the free action exists.\n HIP events and null stream interactions can create the required\n stream ordered dependencies. (default enabled)\n - @p hipMemPoolReuseAllowOpportunistic: (value type = int)\n Allow reuse of already completed frees when there is no dependency\n between the free and allocation. (default enabled)\n - @p hipMemPoolReuseAllowInternalDependencies: (value type = int)\n Allow @p hipMallocAsync to insert new stream dependencies\n in order to establish the stream ordering required to reuse\n a piece of memory released by @p hipFreeAsync (default enabled).\n\n @param [in] mem_pool The memory pool to get attributes of\n @param [in] attr The attribute to get\n @param [in] value Retrieved value\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @see hipMallocFromPoolAsync, hipMallocAsync, hipFreeAsync,\n hipMemPoolTrimTo, hipDeviceSetMemPool, hipMemPoolSetAttribute, hipMemPoolSetAccess, hipMemPoolGetAccess\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemPoolGetAttribute( + mem_pool: hipMemPool_t, + attr: hipMemPoolAttr, + value: *mut ::std::os::raw::c_void, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Controls visibility of the specified pool between devices\n\n @param [in] mem_pool Memory pool for acccess change\n @param [in] desc_list Array of access descriptors. Each descriptor instructs the access to enable for a single gpu\n @param [in] count Number of descriptors in the map array.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @see hipMallocFromPoolAsync, hipMallocAsync, hipFreeAsync, hipMemPoolGetAttribute,\n hipMemPoolTrimTo, hipDeviceSetMemPool, hipMemPoolSetAttribute, hipMemPoolGetAccess\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemPoolSetAccess( + mem_pool: hipMemPool_t, + desc_list: *const hipMemAccessDesc, + count: usize, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns the accessibility of a pool from a device\n\n Returns the accessibility of the pool's memory from the specified location.\n\n @param [out] flags Accessibility of the memory pool from the specified location/device\n @param [in] mem_pool Memory pool being queried\n @param [in] location Location/device for memory pool access\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @see hipMallocFromPoolAsync, hipMallocAsync, hipFreeAsync, hipMemPoolGetAttribute,\n hipMemPoolTrimTo, hipDeviceSetMemPool, hipMemPoolSetAttribute, hipMemPoolSetAccess\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemPoolGetAccess( + flags: *mut hipMemAccessFlags, + mem_pool: hipMemPool_t, + location: *mut hipMemLocation, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Creates a memory pool\n\n Creates a HIP memory pool and returns the handle in @p mem_pool. The @p pool_props determines\n the properties of the pool such as the backing device and IPC capabilities.\n\n By default, the memory pool will be accessible from the device it is allocated on.\n\n @param [out] mem_pool Contains createed memory pool\n @param [in] pool_props Memory pool properties\n\n @note Specifying hipMemHandleTypeNone creates a memory pool that will not support IPC.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @see hipMallocFromPoolAsync, hipMallocAsync, hipFreeAsync, hipMemPoolGetAttribute, hipMemPoolDestroy,\n hipMemPoolTrimTo, hipDeviceSetMemPool, hipMemPoolSetAttribute, hipMemPoolSetAccess, hipMemPoolGetAccess\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemPoolCreate( + mem_pool: *mut hipMemPool_t, + pool_props: *const hipMemPoolProps, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Destroys the specified memory pool\n\n If any pointers obtained from this pool haven't been freed or\n the pool has free operations that haven't completed\n when @p hipMemPoolDestroy is invoked, the function will return immediately and the\n resources associated with the pool will be released automatically\n once there are no more outstanding allocations.\n\n Destroying the current mempool of a device sets the default mempool of\n that device as the current mempool for that device.\n\n @param [in] mem_pool Memory pool for destruction\n\n @note A device's default memory pool cannot be destroyed.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @see hipMallocFromPoolAsync, hipMallocAsync, hipFreeAsync, hipMemPoolGetAttribute, hipMemPoolCreate\n hipMemPoolTrimTo, hipDeviceSetMemPool, hipMemPoolSetAttribute, hipMemPoolSetAccess, hipMemPoolGetAccess\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemPoolDestroy(mem_pool: hipMemPool_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Allocates memory from a specified pool with stream ordered semantics.\n\n Inserts an allocation operation into @p stream.\n A pointer to the allocated memory is returned immediately in @p dev_ptr.\n The allocation must not be accessed until the the allocation operation completes.\n The allocation comes from the specified memory pool.\n\n @note The specified memory pool may be from a device different than that of the specified @p stream.\n\n Basic stream ordering allows future work submitted into the same stream to use the allocation.\n Stream query, stream synchronize, and HIP events can be used to guarantee that the allocation\n operation completes before work submitted in a separate stream runs.\n\n @note During stream capture, this function results in the creation of an allocation node. In this case,\n the allocation is owned by the graph instead of the memory pool. The memory pool's properties\n are used to set the node's creation parameters.\n\n @param [out] dev_ptr Returned device pointer\n @param [in] size Number of bytes to allocate\n @param [in] mem_pool The pool to allocate from\n @param [in] stream The stream establishing the stream ordering semantic\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported, #hipErrorOutOfMemory\n\n @see hipMallocAsync, hipFreeAsync, hipMemPoolGetAttribute, hipMemPoolCreate\n hipMemPoolTrimTo, hipDeviceSetMemPool, hipMemPoolSetAttribute, hipMemPoolSetAccess, hipMemPoolGetAccess,\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMallocFromPoolAsync( + dev_ptr: *mut *mut ::std::os::raw::c_void, + size: usize, + mem_pool: hipMemPool_t, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Exports a memory pool to the requested handle type.\n\n Given an IPC capable mempool, create an OS handle to share the pool with another process.\n A recipient process can convert the shareable handle into a mempool with @p hipMemPoolImportFromShareableHandle.\n Individual pointers can then be shared with the @p hipMemPoolExportPointer and @p hipMemPoolImportPointer APIs.\n The implementation of what the shareable handle is and how it can be transferred is defined by the requested\n handle type.\n\n @note: To create an IPC capable mempool, create a mempool with a @p hipMemAllocationHandleType other\n than @p hipMemHandleTypeNone.\n\n @param [out] shared_handle Pointer to the location in which to store the requested handle\n @param [in] mem_pool Pool to export\n @param [in] handle_type The type of handle to create\n @param [in] flags Must be 0\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorOutOfMemory\n\n @see hipMemPoolImportFromShareableHandle\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemPoolExportToShareableHandle( + shared_handle: *mut ::std::os::raw::c_void, + mem_pool: hipMemPool_t, + handle_type: hipMemAllocationHandleType, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Imports a memory pool from a shared handle.\n\n Specific allocations can be imported from the imported pool with @p hipMemPoolImportPointer.\n\n @note Imported memory pools do not support creating new allocations.\n As such imported memory pools may not be used in @p hipDeviceSetMemPool\n or @p hipMallocFromPoolAsync calls.\n\n @param [out] mem_pool Returned memory pool\n @param [in] shared_handle OS handle of the pool to open\n @param [in] handle_type The type of handle being imported\n @param [in] flags Must be 0\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorOutOfMemory\n\n @see hipMemPoolExportToShareableHandle\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemPoolImportFromShareableHandle( + mem_pool: *mut hipMemPool_t, + shared_handle: *mut ::std::os::raw::c_void, + handle_type: hipMemAllocationHandleType, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Export data to share a memory pool allocation between processes.\n\n Constructs @p export_data for sharing a specific allocation from an already shared memory pool.\n The recipient process can import the allocation with the @p hipMemPoolImportPointer api.\n The data is not a handle and may be shared through any IPC mechanism.\n\n @param[out] export_data Returned export data\n @param[in] dev_ptr Pointer to memory being exported\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorOutOfMemory\n\n @see hipMemPoolImportPointer\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemPoolExportPointer( + export_data: *mut hipMemPoolPtrExportData, + dev_ptr: *mut ::std::os::raw::c_void, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Import a memory pool allocation from another process.\n\n Returns in @p dev_ptr a pointer to the imported memory.\n The imported memory must not be accessed before the allocation operation completes\n in the exporting process. The imported memory must be freed from all importing processes before\n being freed in the exporting process. The pointer may be freed with @p hipFree\n or @p hipFreeAsync. If @p hipFreeAsync is used, the free must be completed\n on the importing process before the free operation on the exporting process.\n\n @note The @p hipFreeAsync api may be used in the exporting process before\n the @p hipFreeAsync operation completes in its stream as long as the\n @p hipFreeAsync in the exporting process specifies a stream with\n a stream dependency on the importing process's @p hipFreeAsync.\n\n @param [out] dev_ptr Pointer to imported memory\n @param [in] mem_pool Memory pool from which to import a pointer\n @param [in] export_data Data specifying the memory to import\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized, #hipErrorOutOfMemory\n\n @see hipMemPoolExportPointer\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemPoolImportPointer( + dev_ptr: *mut *mut ::std::os::raw::c_void, + mem_pool: hipMemPool_t, + export_data: *mut hipMemPoolPtrExportData, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Allocate device accessible page locked host memory [Deprecated]\n\n @param[out] ptr Pointer to the allocated host pinned memory\n @param[in] size Requested memory size in bytes\n @param[in] flags Type of host memory allocation\n\n If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.\n\n @return #hipSuccess, #hipErrorOutOfMemory\n\n @warning This API is deprecated, use hipHostMalloc() instead"] + pub fn hipHostAlloc( + ptr: *mut *mut ::std::os::raw::c_void, + size: usize, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get Device pointer from Host Pointer allocated through hipHostMalloc\n\n @param[out] devPtr Device Pointer mapped to passed host pointer\n @param[in] hstPtr Host Pointer allocated through hipHostMalloc\n @param[in] flags Flags to be passed for extension\n\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorOutOfMemory\n\n @see hipSetDeviceFlags, hipHostMalloc"] + pub fn hipHostGetDevicePointer( + devPtr: *mut *mut ::std::os::raw::c_void, + hstPtr: *mut ::std::os::raw::c_void, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Return flags associated with host pointer\n\n @param[out] flagsPtr Memory location to store flags\n @param[in] hostPtr Host Pointer allocated through hipHostMalloc\n @return #hipSuccess, #hipErrorInvalidValue\n\n @see hipHostMalloc"] + pub fn hipHostGetFlags( + flagsPtr: *mut ::std::os::raw::c_uint, + hostPtr: *mut ::std::os::raw::c_void, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Register host memory so it can be accessed from the current device.\n\n @param[out] hostPtr Pointer to host memory to be registered.\n @param[in] sizeBytes Size of the host memory\n @param[in] flags See below.\n\n Flags:\n - #hipHostRegisterDefault Memory is Mapped and Portable\n - #hipHostRegisterPortable Memory is considered registered by all contexts. HIP only supports\n one context so this is always assumed true.\n - #hipHostRegisterMapped Map the allocation into the address space for the current device.\n The device pointer can be obtained with #hipHostGetDevicePointer.\n\n\n After registering the memory, use #hipHostGetDevicePointer to obtain the mapped device pointer.\n On many systems, the mapped device pointer will have a different value than the mapped host\n pointer. Applications must use the device pointer in device code, and the host pointer in device\n code.\n\n On some systems, registered memory is pinned. On some systems, registered memory may not be\n actually be pinned but uses OS or hardware facilities to all GPU access to the host memory.\n\n Developers are strongly encouraged to register memory blocks which are aligned to the host\n cache-line size. (typically 64-bytes but can be obtains from the CPUID instruction).\n\n If registering non-aligned pointers, the application must take care when register pointers from\n the same cache line on different devices. HIP's coarse-grained synchronization model does not\n guarantee correct results if different devices write to different parts of the same cache block -\n typically one of the writes will \"win\" and overwrite data from the other registered memory\n region.\n\n @return #hipSuccess, #hipErrorOutOfMemory\n\n @see hipHostUnregister, hipHostGetFlags, hipHostGetDevicePointer"] + pub fn hipHostRegister( + hostPtr: *mut ::std::os::raw::c_void, + sizeBytes: usize, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Un-register host pointer\n\n @param[in] hostPtr Host pointer previously registered with #hipHostRegister\n @return Error code\n\n @see hipHostRegister"] + pub fn hipHostUnregister(hostPtr: *mut ::std::os::raw::c_void) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " Allocates at least width (in bytes) * height bytes of linear memory\n Padding may occur to ensure alighnment requirements are met for the given row\n The change in width size due to padding will be returned in *pitch.\n Currently the alignment is set to 128 bytes\n\n @param[out] ptr Pointer to the allocated device memory\n @param[out] pitch Pitch for allocation (in bytes)\n @param[in] width Requested pitched allocation width (in bytes)\n @param[in] height Requested pitched allocation height\n\n If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.\n\n @return Error code\n\n @see hipMalloc, hipFree, hipMallocArray, hipFreeArray, hipHostFree, hipMalloc3D,\n hipMalloc3DArray, hipHostMalloc"] + pub fn hipMallocPitch( + ptr: *mut *mut ::std::os::raw::c_void, + pitch: *mut usize, + width: usize, + height: usize, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " Allocates at least width (in bytes) * height bytes of linear memory\n Padding may occur to ensure alighnment requirements are met for the given row\n The change in width size due to padding will be returned in *pitch.\n Currently the alignment is set to 128 bytes\n\n @param[out] dptr Pointer to the allocated device memory\n @param[out] pitch Pitch for allocation (in bytes)\n @param[in] widthInBytes Requested pitched allocation width (in bytes)\n @param[in] height Requested pitched allocation height\n @param[in] elementSizeBytes The size of element bytes, should be 4, 8 or 16\n\n If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.\n The intended usage of pitch is as a separate parameter of the allocation, used to compute addresses within the 2D array.\n Given the row and column of an array element of type T, the address is computed as:\n T* pElement = (T*)((char*)BaseAddress + Row * Pitch) + Column;\n\n @return Error code\n\n @see hipMalloc, hipFree, hipMallocArray, hipFreeArray, hipHostFree, hipMalloc3D,\n hipMalloc3DArray, hipHostMalloc"] + pub fn hipMemAllocPitch( + dptr: *mut hipDeviceptr_t, + pitch: *mut usize, + widthInBytes: usize, + height: usize, + elementSizeBytes: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Free memory allocated by the hcc hip memory allocation API.\n This API performs an implicit hipDeviceSynchronize() call.\n If pointer is NULL, the hip runtime is initialized and hipSuccess is returned.\n\n @param[in] ptr Pointer to memory to be freed\n @return #hipSuccess\n @return #hipErrorInvalidDevicePointer (if pointer is invalid, including host pointers allocated\n with hipHostMalloc)\n\n @see hipMalloc, hipMallocPitch, hipMallocArray, hipFreeArray, hipHostFree, hipMalloc3D,\n hipMalloc3DArray, hipHostMalloc"] + pub fn hipFree(ptr: *mut ::std::os::raw::c_void) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Free memory allocated by the hcc hip host memory allocation API [Deprecated]\n\n @param[in] ptr Pointer to memory to be freed\n @return #hipSuccess,\n #hipErrorInvalidValue (if pointer is invalid, including device pointers allocated\n with hipMalloc)\n\n @warning This API is deprecated, use hipHostFree() instead"] + pub fn hipFreeHost(ptr: *mut ::std::os::raw::c_void) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Free memory allocated by the hcc hip host memory allocation API\n This API performs an implicit hipDeviceSynchronize() call.\n If pointer is NULL, the hip runtime is initialized and hipSuccess is returned.\n\n @param[in] ptr Pointer to memory to be freed\n @return #hipSuccess,\n #hipErrorInvalidValue (if pointer is invalid, including device pointers allocated with\n hipMalloc)\n\n @see hipMalloc, hipMallocPitch, hipFree, hipMallocArray, hipFreeArray, hipMalloc3D,\n hipMalloc3DArray, hipHostMalloc"] + pub fn hipHostFree(ptr: *mut ::std::os::raw::c_void) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copy data from src to dst.\n\n It supports memory from host to device,\n device to host, device to device and host to host\n The src and dst must not overlap.\n\n For hipMemcpy, the copy is always performed by the current device (set by hipSetDevice).\n For multi-gpu or peer-to-peer configurations, it is recommended to set the current device to the\n device where the src data is physically located. For optimal peer-to-peer copies, the copy device\n must be able to access the src and dst pointers (by calling hipDeviceEnablePeerAccess with copy\n agent as the current device and src/dest as the peerDevice argument. if this is not done, the\n hipMemcpy will still work, but will perform the copy using a staging buffer on the host.\n Calling hipMemcpy with dst and src pointers that do not match the hipMemcpyKind results in\n undefined behavior.\n\n @param[out] dst Data being copy to\n @param[in] src Data being copy from\n @param[in] sizeBytes Data size in bytes\n @param[in] kind Kind of transfer\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorUnknown\n\n @see hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost,\n hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA,\n hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD,\n hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync,\n hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo,\n hipMemHostAlloc, hipMemHostGetDevicePointer"] + pub fn hipMemcpy( + dst: *mut ::std::os::raw::c_void, + src: *const ::std::os::raw::c_void, + sizeBytes: usize, + kind: hipMemcpyKind, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Memory copy on the stream.\n It allows single or multiple devices to do memory copy on single or multiple streams.\n\n @param[out] dst Data being copy to\n @param[in] src Data being copy from\n @param[in] sizeBytes Data size in bytes\n @param[in] kind Kind of transfer\n @param[in] stream Valid stream\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorUnknown, #hipErrorContextIsDestroyed\n\n @see hipMemcpy, hipStreamCreate, hipStreamSynchronize, hipStreamDestroy, hipSetDevice, hipLaunchKernelGGL\n"] + pub fn hipMemcpyWithStream( + dst: *mut ::std::os::raw::c_void, + src: *const ::std::os::raw::c_void, + sizeBytes: usize, + kind: hipMemcpyKind, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copy data from Host to Device\n\n @param[out] dst Data being copy to\n @param[in] src Data being copy from\n @param[in] sizeBytes Data size in bytes\n\n @return #hipSuccess, #hipErrorDeinitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,\n #hipErrorInvalidValue\n\n @see hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost,\n hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA,\n hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD,\n hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync,\n hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo,\n hipMemHostAlloc, hipMemHostGetDevicePointer"] + pub fn hipMemcpyHtoD( + dst: hipDeviceptr_t, + src: *mut ::std::os::raw::c_void, + sizeBytes: usize, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copy data from Device to Host\n\n @param[out] dst Data being copy to\n @param[in] src Data being copy from\n @param[in] sizeBytes Data size in bytes\n\n @return #hipSuccess, #hipErrorDeinitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,\n #hipErrorInvalidValue\n\n @see hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost,\n hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA,\n hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD,\n hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync,\n hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo,\n hipMemHostAlloc, hipMemHostGetDevicePointer"] + pub fn hipMemcpyDtoH( + dst: *mut ::std::os::raw::c_void, + src: hipDeviceptr_t, + sizeBytes: usize, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copy data from Device to Device\n\n @param[out] dst Data being copy to\n @param[in] src Data being copy from\n @param[in] sizeBytes Data size in bytes\n\n @return #hipSuccess, #hipErrorDeinitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,\n #hipErrorInvalidValue\n\n @see hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost,\n hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA,\n hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD,\n hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync,\n hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo,\n hipMemHostAlloc, hipMemHostGetDevicePointer"] + pub fn hipMemcpyDtoD(dst: hipDeviceptr_t, src: hipDeviceptr_t, sizeBytes: usize) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copy data from Host to Device asynchronously\n\n @param[out] dst Data being copy to\n @param[in] src Data being copy from\n @param[in] sizeBytes Data size in bytes\n @param[in] stream Stream identifier\n\n @return #hipSuccess, #hipErrorDeinitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,\n #hipErrorInvalidValue\n\n @see hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost,\n hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA,\n hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD,\n hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync,\n hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo,\n hipMemHostAlloc, hipMemHostGetDevicePointer"] + pub fn hipMemcpyHtoDAsync( + dst: hipDeviceptr_t, + src: *mut ::std::os::raw::c_void, + sizeBytes: usize, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copy data from Device to Host asynchronously\n\n @param[out] dst Data being copy to\n @param[in] src Data being copy from\n @param[in] sizeBytes Data size in bytes\n @param[in] stream Stream identifier\n\n @return #hipSuccess, #hipErrorDeinitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,\n #hipErrorInvalidValue\n\n @see hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost,\n hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA,\n hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD,\n hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync,\n hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo,\n hipMemHostAlloc, hipMemHostGetDevicePointer"] + pub fn hipMemcpyDtoHAsync( + dst: *mut ::std::os::raw::c_void, + src: hipDeviceptr_t, + sizeBytes: usize, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copy data from Device to Device asynchronously\n\n @param[out] dst Data being copy to\n @param[in] src Data being copy from\n @param[in] sizeBytes Data size in bytes\n @param[in] stream Stream identifier\n\n @return #hipSuccess, #hipErrorDeinitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,\n #hipErrorInvalidValue\n\n @see hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost,\n hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA,\n hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD,\n hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync,\n hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo,\n hipMemHostAlloc, hipMemHostGetDevicePointer"] + pub fn hipMemcpyDtoDAsync( + dst: hipDeviceptr_t, + src: hipDeviceptr_t, + sizeBytes: usize, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Returns a global pointer from a module.\n Returns in *dptr and *bytes the pointer and size of the global of name name located in module hmod.\n If no variable of that name exists, it returns hipErrorNotFound. Both parameters dptr and bytes are optional.\n If one of them is NULL, it is ignored and hipSuccess is returned.\n\n @param[out] dptr Returns global device pointer\n @param[out] bytes Returns global size in bytes\n @param[in] hmod Module to retrieve global from\n @param[in] name Name of global to retrieve\n\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotFound, #hipErrorInvalidContext\n"] + pub fn hipModuleGetGlobal( + dptr: *mut hipDeviceptr_t, + bytes: *mut usize, + hmod: hipModule_t, + name: *const ::std::os::raw::c_char, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Gets device pointer associated with symbol on the device.\n\n @param[out] devPtr pointer to the device associated the symbole\n @param[in] symbol pointer to the symbole of the device\n\n @return #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipGetSymbolAddress( + devPtr: *mut *mut ::std::os::raw::c_void, + symbol: *const ::std::os::raw::c_void, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Gets the size of the given symbol on the device.\n\n @param[in] symbol pointer to the device symbole\n @param[out] size pointer to the size\n\n @return #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipGetSymbolSize(size: *mut usize, symbol: *const ::std::os::raw::c_void) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data to the given symbol on the device.\n Symbol HIP APIs allow a kernel to define a device-side data symbol which can be accessed on\n the host side. The symbol can be in __constant or device space.\n Note that the symbol name needs to be encased in the HIP_SYMBOL macro.\n This also applies to hipMemcpyFromSymbol, hipGetSymbolAddress, and hipGetSymbolSize.\n For detail usage, see the example at\n https://github.com/ROCm/HIP/blob/develop/docs/user_guide/hip_porting_guide.md\n\n @param[out] symbol pointer to the device symbole\n @param[in] src pointer to the source address\n @param[in] sizeBytes size in bytes to copy\n @param[in] offset offset in bytes from start of symbole\n @param[in] kind type of memory transfer\n\n @return #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipMemcpyToSymbol( + symbol: *const ::std::os::raw::c_void, + src: *const ::std::os::raw::c_void, + sizeBytes: usize, + offset: usize, + kind: hipMemcpyKind, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data to the given symbol on the device asynchronously.\n\n @param[out] symbol pointer to the device symbole\n @param[in] src pointer to the source address\n @param[in] sizeBytes size in bytes to copy\n @param[in] offset offset in bytes from start of symbole\n @param[in] kind type of memory transfer\n @param[in] stream stream identifier\n\n @return #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipMemcpyToSymbolAsync( + symbol: *const ::std::os::raw::c_void, + src: *const ::std::os::raw::c_void, + sizeBytes: usize, + offset: usize, + kind: hipMemcpyKind, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data from the given symbol on the device.\n\n @param[out] dst Returns pointer to destinition memory address\n @param[in] symbol Pointer to the symbole address on the device\n @param[in] sizeBytes Size in bytes to copy\n @param[in] offset Offset in bytes from the start of symbole\n @param[in] kind Type of memory transfer\n\n @return #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipMemcpyFromSymbol( + dst: *mut ::std::os::raw::c_void, + symbol: *const ::std::os::raw::c_void, + sizeBytes: usize, + offset: usize, + kind: hipMemcpyKind, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data from the given symbol on the device asynchronously.\n\n @param[out] dst Returns pointer to destinition memory address\n @param[in] symbol pointer to the symbole address on the device\n @param[in] sizeBytes size in bytes to copy\n @param[in] offset offset in bytes from the start of symbole\n @param[in] kind type of memory transfer\n @param[in] stream stream identifier\n\n @return #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipMemcpyFromSymbolAsync( + dst: *mut ::std::os::raw::c_void, + symbol: *const ::std::os::raw::c_void, + sizeBytes: usize, + offset: usize, + kind: hipMemcpyKind, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copy data from src to dst asynchronously.\n\n @warning If host or dest are not pinned, the memory copy will be performed synchronously. For\n best performance, use hipHostMalloc to allocate host memory that is transferred asynchronously.\n\n @warning on HCC hipMemcpyAsync does not support overlapped H2D and D2H copies.\n For hipMemcpy, the copy is always performed by the device associated with the specified stream.\n\n For multi-gpu or peer-to-peer configurations, it is recommended to use a stream which is a\n attached to the device where the src data is physically located. For optimal peer-to-peer copies,\n the copy device must be able to access the src and dst pointers (by calling\n hipDeviceEnablePeerAccess with copy agent as the current device and src/dest as the peerDevice\n argument. if this is not done, the hipMemcpy will still work, but will perform the copy using a\n staging buffer on the host.\n\n @param[out] dst Data being copy to\n @param[in] src Data being copy from\n @param[in] sizeBytes Data size in bytes\n @param[in] kind Type of memory transfer\n @param[in] stream Stream identifier\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorUnknown\n\n @see hipMemcpy, hipMemcpy2D, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray,\n hipMemcpy2DFromArray, hipMemcpyArrayToArray, hipMemcpy2DArrayToArray, hipMemcpyToSymbol,\n hipMemcpyFromSymbol, hipMemcpy2DAsync, hipMemcpyToArrayAsync, hipMemcpy2DToArrayAsync,\n hipMemcpyFromArrayAsync, hipMemcpy2DFromArrayAsync, hipMemcpyToSymbolAsync,\n hipMemcpyFromSymbolAsync"] + pub fn hipMemcpyAsync( + dst: *mut ::std::os::raw::c_void, + src: *const ::std::os::raw::c_void, + sizeBytes: usize, + kind: hipMemcpyKind, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant\n byte value value.\n\n @param[out] dst Data being filled\n @param[in] value Value to be set\n @param[in] sizeBytes Data size in bytes\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] + pub fn hipMemset( + dst: *mut ::std::os::raw::c_void, + value: ::std::os::raw::c_int, + sizeBytes: usize, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Return last error returned by any HIP runtime API call."] - #[doc = ""] - #[doc = " @return #hipSuccess"] - #[doc = ""] - #[doc = " Returns the last error that has been returned by any of the runtime calls in the same host"] - #[doc = " thread. Unlike hipGetLastError, this function does not reset the saved error code."] - #[doc = ""] - #[doc = " @see hipGetErrorString, hipGetLastError, hipPeakAtLastError, hipError_t"] - pub fn hipPeekAtLastError() -> hipError_t; + #[must_use] + #[doc = " @brief Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant\n byte value value.\n\n @param[out] dest Data ptr to be filled\n @param[in] value Value to be set\n @param[in] count Number of values to be set\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] + pub fn hipMemsetD8( + dest: hipDeviceptr_t, + value: ::std::os::raw::c_uchar, + count: usize, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Return name of the specified error code in text form."] - #[doc = ""] - #[doc = " @param hip_error Error code to convert to name."] - #[doc = " @return const char pointer to the NULL-terminated error name"] - #[doc = ""] - #[doc = " @see hipGetErrorString, hipGetLastError, hipPeakAtLastError, hipError_t"] - pub fn hipGetErrorName(hip_error: hipError_t) -> *const ::std::os::raw::c_char; + #[must_use] + #[doc = " @brief Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant\n byte value value.\n\n hipMemsetD8Async() is asynchronous with respect to the host, so the call may return before the\n memset is complete. The operation can optionally be associated to a stream by passing a non-zero\n stream argument. If stream is non-zero, the operation may overlap with operations in other\n streams.\n\n @param[out] dest Data ptr to be filled\n @param[in] value Constant value to be set\n @param[in] count Number of values to be set\n @param[in] stream Stream identifier\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] + pub fn hipMemsetD8Async( + dest: hipDeviceptr_t, + value: ::std::os::raw::c_uchar, + count: usize, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant\n short value value.\n\n @param[out] dest Data ptr to be filled\n @param[in] value Constant value to be set\n @param[in] count Number of values to be set\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] + pub fn hipMemsetD16( + dest: hipDeviceptr_t, + value: ::std::os::raw::c_ushort, + count: usize, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant\n short value value.\n\n hipMemsetD16Async() is asynchronous with respect to the host, so the call may return before the\n memset is complete. The operation can optionally be associated to a stream by passing a non-zero\n stream argument. If stream is non-zero, the operation may overlap with operations in other\n streams.\n\n @param[out] dest Data ptr to be filled\n @param[in] value Constant value to be set\n @param[in] count Number of values to be set\n @param[in] stream Stream identifier\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] + pub fn hipMemsetD16Async( + dest: hipDeviceptr_t, + value: ::std::os::raw::c_ushort, + count: usize, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Fills the memory area pointed to by dest with the constant integer\n value for specified number of times.\n\n @param[out] dest Data being filled\n @param[in] value Constant value to be set\n @param[in] count Number of values to be set\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] + pub fn hipMemsetD32( + dest: hipDeviceptr_t, + value: ::std::os::raw::c_int, + count: usize, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Fills the first sizeBytes bytes of the memory area pointed to by dev with the constant\n byte value value.\n\n hipMemsetAsync() is asynchronous with respect to the host, so the call may return before the\n memset is complete. The operation can optionally be associated to a stream by passing a non-zero\n stream argument. If stream is non-zero, the operation may overlap with operations in other\n streams.\n\n @param[out] dst Pointer to device memory\n @param[in] value Value to set for each byte of specified memory\n @param[in] sizeBytes Size in bytes to set\n @param[in] stream Stream identifier\n @return #hipSuccess, #hipErrorInvalidValue"] + pub fn hipMemsetAsync( + dst: *mut ::std::os::raw::c_void, + value: ::std::os::raw::c_int, + sizeBytes: usize, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Fills the memory area pointed to by dev with the constant integer\n value for specified number of times.\n\n hipMemsetD32Async() is asynchronous with respect to the host, so the call may return before the\n memset is complete. The operation can optionally be associated to a stream by passing a non-zero\n stream argument. If stream is non-zero, the operation may overlap with operations in other\n streams.\n\n @param[out] dst Pointer to device memory\n @param[in] value Value to set for each byte of specified memory\n @param[in] count Number of values to be set\n @param[in] stream Stream identifier\n @return #hipSuccess, #hipErrorInvalidValue"] + pub fn hipMemsetD32Async( + dst: hipDeviceptr_t, + value: ::std::os::raw::c_int, + count: usize, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Fills the memory area pointed to by dst with the constant value.\n\n @param[out] dst Pointer to device memory\n @param[in] pitch Data size in bytes\n @param[in] value Constant value to be set\n @param[in] width\n @param[in] height\n @return #hipSuccess, #hipErrorInvalidValue"] + pub fn hipMemset2D( + dst: *mut ::std::os::raw::c_void, + pitch: usize, + value: ::std::os::raw::c_int, + width: usize, + height: usize, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Fills asynchronously the memory area pointed to by dst with the constant value.\n\n @param[in] dst Pointer to 2D device memory\n @param[in] pitch Pitch size in bytes\n @param[in] value Value to be set for each byte of specified memory\n @param[in] width Width of matrix set columns in bytes\n @param[in] height Height of matrix set rows in bytes\n @param[in] stream Stream identifier\n @return #hipSuccess, #hipErrorInvalidValue"] + pub fn hipMemset2DAsync( + dst: *mut ::std::os::raw::c_void, + pitch: usize, + value: ::std::os::raw::c_int, + width: usize, + height: usize, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Fills synchronously the memory area pointed to by pitchedDevPtr with the constant value.\n\n @param[in] pitchedDevPtr Pointer to pitched device memory\n @param[in] value Value to set for each byte of specified memory\n @param[in] extent Size parameters for width field in bytes in device memory\n @return #hipSuccess, #hipErrorInvalidValue"] + pub fn hipMemset3D( + pitchedDevPtr: hipPitchedPtr, + value: ::std::os::raw::c_int, + extent: hipExtent, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Fills asynchronously the memory area pointed to by pitchedDevPtr with the constant value.\n\n @param[in] pitchedDevPtr Pointer to pitched device memory\n @param[in] value Value to set for each byte of specified memory\n @param[in] extent Size parameters for width field in bytes in device memory\n @param[in] stream Stream identifier\n @return #hipSuccess, #hipErrorInvalidValue"] + pub fn hipMemset3DAsync( + pitchedDevPtr: hipPitchedPtr, + value: ::std::os::raw::c_int, + extent: hipExtent, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Query memory info.\n\n On ROCM, this function gets the actual free memory left on the current device, so supports\n the cases while running multi-workload (such as multiple processes, multiple threads, and\n multiple GPUs).\n\n @warning On Windows, the free memory only accounts for memory allocated by this process and may\n be optimistic.\n\n @param[out] free Returns free memory on the current device in bytes\n @param[out] total Returns total allocatable memory on the current device in bytes\n\n @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue\n"] + pub fn hipMemGetInfo(free: *mut usize, total: *mut usize) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Get allocated memory size via memory pointer.\n\n This function gets the allocated shared virtual memory size from memory pointer.\n\n @param[in] ptr Pointer to allocated memory\n @param[out] size Returns the allocated memory size in bytes\n\n @return #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipMemPtrGetInfo(ptr: *mut ::std::os::raw::c_void, size: *mut usize) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Allocate an array on the device.\n\n @param[out] array Pointer to allocated array in device memory\n @param[in] desc Requested channel format\n @param[in] width Requested array allocation width\n @param[in] height Requested array allocation height\n @param[in] flags Requested properties of allocated array\n @return #hipSuccess, #hipErrorOutOfMemory\n\n @see hipMalloc, hipMallocPitch, hipFree, hipFreeArray, hipHostMalloc, hipHostFree"] + pub fn hipMallocArray( + array: *mut hipArray_t, + desc: *const hipChannelFormatDesc, + width: usize, + height: usize, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Create an array memory pointer on the device.\n\n @param[out] pHandle Pointer to the array memory\n @param[in] pAllocateArray Requested array desciptor\n\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @see hipMallocArray, hipArrayDestroy, hipFreeArray"] + pub fn hipArrayCreate( + pHandle: *mut hipArray_t, + pAllocateArray: *const HIP_ARRAY_DESCRIPTOR, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Destroy an array memory pointer on the device.\n\n @param[in] array Pointer to the array memory\n\n @return #hipSuccess, #hipErrorInvalidValue\n\n @see hipArrayCreate, hipArrayDestroy, hipFreeArray"] + pub fn hipArrayDestroy(array: hipArray_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Create a 3D array memory pointer on the device.\n\n @param[out] array Pointer to the 3D array memory\n @param[in] pAllocateArray Requested array desciptor\n\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @see hipMallocArray, hipArrayDestroy, hipFreeArray"] + pub fn hipArray3DCreate( + array: *mut hipArray_t, + pAllocateArray: *const HIP_ARRAY3D_DESCRIPTOR, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Create a 3D memory pointer on the device.\n\n @param[out] pitchedDevPtr Pointer to the 3D memory\n @param[in] extent Requested extent\n\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @see hipMallocPitch, hipMemGetInfo, hipFree"] + pub fn hipMalloc3D(pitchedDevPtr: *mut hipPitchedPtr, extent: hipExtent) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Frees an array on the device.\n\n @param[in] array Pointer to array to free\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized\n\n @see hipMalloc, hipMallocPitch, hipFree, hipMallocArray, hipHostMalloc, hipHostFree"] + pub fn hipFreeArray(array: hipArray_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Allocate an array on the device.\n\n @param[out] array Pointer to allocated array in device memory\n @param[in] desc Requested channel format\n @param[in] extent Requested array allocation width, height and depth\n @param[in] flags Requested properties of allocated array\n @return #hipSuccess, #hipErrorOutOfMemory\n\n @see hipMalloc, hipMallocPitch, hipFree, hipFreeArray, hipHostMalloc, hipHostFree"] + pub fn hipMalloc3DArray( + array: *mut hipArray_t, + desc: *const hipChannelFormatDesc, + extent: hipExtent, + flags: ::std::os::raw::c_uint, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Gets info about the specified array\n\n @param[out] desc - Returned array type\n @param[out] extent - Returned array shape. 2D arrays will have depth of zero\n @param[out] flags - Returned array flags\n @param[in] array - The HIP array to get info for\n\n @return #hipSuccess, #hipErrorInvalidValue #hipErrorInvalidHandle\n\n @see hipArrayGetDescriptor, hipArray3DGetDescriptor"] + pub fn hipArrayGetInfo( + desc: *mut hipChannelFormatDesc, + extent: *mut hipExtent, + flags: *mut ::std::os::raw::c_uint, + array: hipArray_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Gets a 1D or 2D array descriptor\n\n @param[out] pArrayDescriptor - Returned array descriptor\n @param[in] array - Array to get descriptor of\n\n @return #hipSuccess, #hipErrorDeinitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,\n #hipErrorInvalidValue #hipErrorInvalidHandle\n\n @see hipArray3DCreate, hipArray3DGetDescriptor, hipArrayCreate, hipArrayDestroy, hipMemAlloc,\n hipMemAllocHost, hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned,\n hipMemcpy3D, hipMemcpy3DAsync, hipMemcpyAtoA, hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync,\n hipMemcpyDtoA, hipMemcpyDtoD, hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync,\n hipMemcpyHtoA, hipMemcpyHtoAAsync, hipMemcpyHtoD, hipMemcpyHtoDAsync, hipMemFree,\n hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo, hipMemHostAlloc,\n hipMemHostGetDevicePointer, hipMemsetD8, hipMemsetD16, hipMemsetD32, hipArrayGetInfo"] + pub fn hipArrayGetDescriptor( + pArrayDescriptor: *mut HIP_ARRAY_DESCRIPTOR, + array: hipArray_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Gets a 3D array descriptor\n\n @param[out] pArrayDescriptor - Returned 3D array descriptor\n @param[in] array - 3D array to get descriptor of\n\n @return #hipSuccess, #hipErrorDeinitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,\n #hipErrorInvalidValue #hipErrorInvalidHandle, #hipErrorContextIsDestroyed\n\n @see hipArray3DCreate, hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc,\n hipMemAllocHost, hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned,\n hipMemcpy3D, hipMemcpy3DAsync, hipMemcpyAtoA, hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync,\n hipMemcpyDtoA, hipMemcpyDtoD, hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync,\n hipMemcpyHtoA, hipMemcpyHtoAAsync, hipMemcpyHtoD, hipMemcpyHtoDAsync, hipMemFree,\n hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo, hipMemHostAlloc,\n hipMemHostGetDevicePointer, hipMemsetD8, hipMemsetD16, hipMemsetD32, hipArrayGetInfo"] + pub fn hipArray3DGetDescriptor( + pArrayDescriptor: *mut HIP_ARRAY3D_DESCRIPTOR, + array: hipArray_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data between host and device.\n\n @param[in] dst Destination memory address\n @param[in] dpitch Pitch of destination memory\n @param[in] src Source memory address\n @param[in] spitch Pitch of source memory\n @param[in] width Width of matrix transfer (columns in bytes)\n @param[in] height Height of matrix transfer (rows)\n @param[in] kind Type of transfer\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray, hipMemcpyToSymbol,\n hipMemcpyAsync"] + pub fn hipMemcpy2D( + dst: *mut ::std::os::raw::c_void, + dpitch: usize, + src: *const ::std::os::raw::c_void, + spitch: usize, + width: usize, + height: usize, + kind: hipMemcpyKind, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies memory for 2D arrays.\n @param[in] pCopy Parameters for the memory copy\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpy2D, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray,\n hipMemcpyToSymbol, hipMemcpyAsync"] + pub fn hipMemcpyParam2D(pCopy: *const hip_Memcpy2D) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies memory for 2D arrays.\n @param[in] pCopy Parameters for the memory copy\n @param[in] stream Stream to use\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpy2D, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray,\n hipMemcpyToSymbol, hipMemcpyAsync"] + pub fn hipMemcpyParam2DAsync(pCopy: *const hip_Memcpy2D, stream: hipStream_t) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data between host and device.\n\n @param[in] dst Destination memory address\n @param[in] dpitch Pitch of destination memory\n @param[in] src Source memory address\n @param[in] spitch Pitch of source memory\n @param[in] width Width of matrix transfer (columns in bytes)\n @param[in] height Height of matrix transfer (rows)\n @param[in] kind Type of transfer\n @param[in] stream Stream to use\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray, hipMemcpyToSymbol,\n hipMemcpyAsync"] + pub fn hipMemcpy2DAsync( + dst: *mut ::std::os::raw::c_void, + dpitch: usize, + src: *const ::std::os::raw::c_void, + spitch: usize, + width: usize, + height: usize, + kind: hipMemcpyKind, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data between host and device.\n\n @param[in] dst Destination memory address\n @param[in] wOffset Destination starting X offset\n @param[in] hOffset Destination starting Y offset\n @param[in] src Source memory address\n @param[in] spitch Pitch of source memory\n @param[in] width Width of matrix transfer (columns in bytes)\n @param[in] height Height of matrix transfer (rows)\n @param[in] kind Type of transfer\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpyToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,\n hipMemcpyAsync"] + pub fn hipMemcpy2DToArray( + dst: hipArray_t, + wOffset: usize, + hOffset: usize, + src: *const ::std::os::raw::c_void, + spitch: usize, + width: usize, + height: usize, + kind: hipMemcpyKind, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data between host and device.\n\n @param[in] dst Destination memory address\n @param[in] wOffset Destination starting X offset\n @param[in] hOffset Destination starting Y offset\n @param[in] src Source memory address\n @param[in] spitch Pitch of source memory\n @param[in] width Width of matrix transfer (columns in bytes)\n @param[in] height Height of matrix transfer (rows)\n @param[in] kind Type of transfer\n @param[in] stream Accelerator view which the copy is being enqueued\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpyToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,\n hipMemcpyAsync"] + pub fn hipMemcpy2DToArrayAsync( + dst: hipArray_t, + wOffset: usize, + hOffset: usize, + src: *const ::std::os::raw::c_void, + spitch: usize, + width: usize, + height: usize, + kind: hipMemcpyKind, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data between host and device.\n\n @param[in] dst Destination memory address\n @param[in] wOffset Destination starting X offset\n @param[in] hOffset Destination starting Y offset\n @param[in] src Source memory address\n @param[in] count size in bytes to copy\n @param[in] kind Type of transfer\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,\n hipMemcpyAsync\n @warning This API is deprecated."] + pub fn hipMemcpyToArray( + dst: hipArray_t, + wOffset: usize, + hOffset: usize, + src: *const ::std::os::raw::c_void, + count: usize, + kind: hipMemcpyKind, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data between host and device.\n\n @param[in] dst Destination memory address\n @param[in] srcArray Source memory address\n @param[in] wOffset Source starting X offset\n @param[in] hOffset Source starting Y offset\n @param[in] count Size in bytes to copy\n @param[in] kind Type of transfer\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,\n hipMemcpyAsync\n @warning This API is deprecated."] + pub fn hipMemcpyFromArray( + dst: *mut ::std::os::raw::c_void, + srcArray: hipArray_const_t, + wOffset: usize, + hOffset: usize, + count: usize, + kind: hipMemcpyKind, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data between host and device.\n\n @param[in] dst Destination memory address\n @param[in] dpitch Pitch of destination memory\n @param[in] src Source memory address\n @param[in] wOffset Source starting X offset\n @param[in] hOffset Source starting Y offset\n @param[in] width Width of matrix transfer (columns in bytes)\n @param[in] height Height of matrix transfer (rows)\n @param[in] kind Type of transfer\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,\n hipMemcpyAsync"] + pub fn hipMemcpy2DFromArray( + dst: *mut ::std::os::raw::c_void, + dpitch: usize, + src: hipArray_const_t, + wOffset: usize, + hOffset: usize, + width: usize, + height: usize, + kind: hipMemcpyKind, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data between host and device asynchronously.\n\n @param[in] dst Destination memory address\n @param[in] dpitch Pitch of destination memory\n @param[in] src Source memory address\n @param[in] wOffset Source starting X offset\n @param[in] hOffset Source starting Y offset\n @param[in] width Width of matrix transfer (columns in bytes)\n @param[in] height Height of matrix transfer (rows)\n @param[in] kind Type of transfer\n @param[in] stream Accelerator view which the copy is being enqueued\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,\n hipMemcpyAsync"] + pub fn hipMemcpy2DFromArrayAsync( + dst: *mut ::std::os::raw::c_void, + dpitch: usize, + src: hipArray_const_t, + wOffset: usize, + hOffset: usize, + width: usize, + height: usize, + kind: hipMemcpyKind, + stream: hipStream_t, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data between host and device.\n\n @param[in] dst Destination memory address\n @param[in] srcArray Source array\n @param[in] srcOffset Offset in bytes of source array\n @param[in] count Size of memory copy in bytes\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,\n hipMemcpyAsync"] + pub fn hipMemcpyAtoH( + dst: *mut ::std::os::raw::c_void, + srcArray: hipArray_t, + srcOffset: usize, + count: usize, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data between host and device.\n\n @param[in] dstArray Destination memory address\n @param[in] dstOffset Offset in bytes of destination array\n @param[in] srcHost Source host pointer\n @param[in] count Size of memory copy in bytes\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,\n hipMemcpyAsync"] + pub fn hipMemcpyHtoA( + dstArray: hipArray_t, + dstOffset: usize, + srcHost: *const ::std::os::raw::c_void, + count: usize, + ) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data between host and device.\n\n @param[in] p 3D memory copy parameters\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,\n hipMemcpyAsync"] + pub fn hipMemcpy3D(p: *const hipMemcpy3DParms) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Copies data between host and device asynchronously.\n\n @param[in] p 3D memory copy parameters\n @param[in] stream Stream to use\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,\n hipMemcpyAsync"] + pub fn hipMemcpy3DAsync(p: *const hipMemcpy3DParms, stream: hipStream_t) -> hipError_t; } extern "C" { - #[doc = " @brief Return handy text string message to explain the error which occurred"] - #[doc = ""] - #[doc = " @param hipError Error code to convert to string."] - #[doc = " @return const char pointer to the NULL-terminated error string"] - #[doc = ""] - #[doc = " @warning : on HCC, this function returns the name of the error (same as hipGetErrorName)"] - #[doc = ""] - #[doc = " @see hipGetErrorName, hipGetLastError, hipPeakAtLastError, hipError_t"] - pub fn hipGetErrorString(hipError: hipError_t) -> *const ::std::os::raw::c_char; + #[must_use] + #[doc = " @brief Copies data between host and device.\n\n @param[in] pCopy 3D memory copy parameters\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,\n hipMemcpyAsync"] + pub fn hipDrvMemcpy3D(pCopy: *const HIP_MEMCPY3D) -> hipError_t; } extern "C" { - #[doc = " @brief Create an asynchronous stream."] - #[doc = ""] - #[doc = " @param[in, out] stream Valid pointer to hipStream_t. This function writes the memory with the"] - #[doc = " newly created stream."] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " Create a new asynchronous stream. @p stream returns an opaque handle that can be used to"] - #[doc = " reference the newly created stream in subsequent hipStream* commands. The stream is allocated on"] - #[doc = " the heap and will remain allocated even if the handle goes out-of-scope. To release the memory"] - #[doc = " used by the stream, applicaiton must call hipStreamDestroy."] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy"] - pub fn hipStreamCreate(stream: *mut hipStream_t) -> hipError_t; + #[must_use] + #[doc = " @brief Copies data between host and device asynchronously.\n\n @param[in] pCopy 3D memory copy parameters\n @param[in] stream Stream to use\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,\n #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection\n\n @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,\n hipMemcpyAsync"] + pub fn hipDrvMemcpy3DAsync(pCopy: *const HIP_MEMCPY3D, stream: hipStream_t) -> hipError_t; } extern "C" { - #[doc = " @brief Create an asynchronous stream."] - #[doc = ""] - #[doc = " @param[in, out] stream Pointer to new stream"] - #[doc = " @param[in ] flags to control stream creation."] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " Create a new asynchronous stream. @p stream returns an opaque handle that can be used to"] - #[doc = " reference the newly created stream in subsequent hipStream* commands. The stream is allocated on"] - #[doc = " the heap and will remain allocated even if the handle goes out-of-scope. To release the memory"] - #[doc = " used by the stream, applicaiton must call hipStreamDestroy. Flags controls behavior of the"] - #[doc = " stream. See #hipStreamDefault, #hipStreamNonBlocking."] - #[doc = ""] - #[doc = ""] - #[doc = " @see hipStreamCreate, hipStreamCreateWithPriority, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy"] - pub fn hipStreamCreateWithFlags( - stream: *mut hipStream_t, - flags: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @}\n/\n/**\n-------------------------------------------------------------------------------------------------\n-------------------------------------------------------------------------------------------------\n @defgroup PeerToPeer PeerToPeer Device Memory Access\n @{\n @warning PeerToPeer support is experimental.\n This section describes the PeerToPeer device memory access functions of HIP runtime API.\n/\n/**\n @brief Determine if a device can access a peer's memory.\n\n @param [out] canAccessPeer Returns the peer access capability (0 or 1)\n @param [in] deviceId - device from where memory may be accessed.\n @param [in] peerDeviceId - device where memory is physically located\n\n Returns \"1\" in @p canAccessPeer if the specified @p device is capable\n of directly accessing memory physically located on peerDevice , or \"0\" if not.\n\n Returns \"0\" in @p canAccessPeer if deviceId == peerDeviceId, and both are valid devices : a\n device is not a peer of itself.\n\n @returns #hipSuccess,\n @returns #hipErrorInvalidDevice if deviceId or peerDeviceId are not valid devices"] + pub fn hipDeviceCanAccessPeer( + canAccessPeer: *mut ::std::os::raw::c_int, + deviceId: ::std::os::raw::c_int, + peerDeviceId: ::std::os::raw::c_int, ) -> hipError_t; } extern "C" { - #[doc = " @brief Create an asynchronous stream with the specified priority."] - #[doc = ""] - #[doc = " @param[in, out] stream Pointer to new stream"] - #[doc = " @param[in ] flags to control stream creation."] - #[doc = " @param[in ] priority of the stream. Lower numbers represent higher priorities."] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " Create a new asynchronous stream with the specified priority. @p stream returns an opaque handle"] - #[doc = " that can be used to reference the newly created stream in subsequent hipStream* commands. The"] - #[doc = " stream is allocated on the heap and will remain allocated even if the handle goes out-of-scope."] - #[doc = " To release the memory used by the stream, applicaiton must call hipStreamDestroy. Flags controls"] - #[doc = " behavior of the stream. See #hipStreamDefault, #hipStreamNonBlocking."] - #[doc = ""] - #[doc = ""] - #[doc = " @see hipStreamCreate, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy"] - pub fn hipStreamCreateWithPriority( - stream: *mut hipStream_t, + #[must_use] + #[doc = " @brief Enable direct access from current device's virtual address space to memory allocations\n physically located on a peer device.\n\n Memory which already allocated on peer device will be mapped into the address space of the\n current device. In addition, all future memory allocations on peerDeviceId will be mapped into\n the address space of the current device when the memory is allocated. The peer memory remains\n accessible from the current device until a call to hipDeviceDisablePeerAccess or hipDeviceReset.\n\n\n @param [in] peerDeviceId Peer device to enable direct access to from the current device\n @param [in] flags Reserved for future use, must be zero\n\n Returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue,\n @returns #hipErrorPeerAccessAlreadyEnabled if peer access is already enabled for this device."] + pub fn hipDeviceEnablePeerAccess( + peerDeviceId: ::std::os::raw::c_int, flags: ::std::os::raw::c_uint, - priority: ::std::os::raw::c_int, ) -> hipError_t; } extern "C" { - #[doc = " @brief Returns numerical values that correspond to the least and greatest stream priority."] - #[doc = ""] - #[doc = " @param[in, out] leastPriority pointer in which value corresponding to least priority is returned."] - #[doc = " @param[in, out] greatestPriority pointer in which value corresponding to greatest priority is returned."] - #[doc = ""] - #[doc = " Returns in *leastPriority and *greatestPriority the numerical values that correspond to the least"] - #[doc = " and greatest stream priority respectively. Stream priorities follow a convention where lower numbers"] - #[doc = " imply greater priorities. The range of meaningful stream priorities is given by"] - #[doc = " [*greatestPriority, *leastPriority]. If the user attempts to create a stream with a priority value"] - #[doc = " that is outside the the meaningful range as specified by this API, the priority is automatically"] - #[doc = " clamped to within the valid range."] - pub fn hipDeviceGetStreamPriorityRange( - leastPriority: *mut ::std::os::raw::c_int, - greatestPriority: *mut ::std::os::raw::c_int, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Disable direct access from current device's virtual address space to memory allocations\n physically located on a peer device.\n\n Returns hipErrorPeerAccessNotEnabled if direct access to memory on peerDevice has not yet been\n enabled from the current device.\n\n @param [in] peerDeviceId Peer device to disable direct access to\n\n @returns #hipSuccess, #hipErrorPeerAccessNotEnabled"] + pub fn hipDeviceDisablePeerAccess(peerDeviceId: ::std::os::raw::c_int) -> hipError_t; } extern "C" { - #[doc = " @brief Destroys the specified stream."] - #[doc = ""] - #[doc = " @param[in, out] stream Valid pointer to hipStream_t. This function writes the memory with the"] - #[doc = " newly created stream."] - #[doc = " @return #hipSuccess #hipErrorInvalidHandle"] - #[doc = ""] - #[doc = " Destroys the specified stream."] - #[doc = ""] - #[doc = " If commands are still executing on the specified stream, some may complete execution before the"] - #[doc = " queue is deleted."] - #[doc = ""] - #[doc = " The queue may be destroyed while some commands are still inflight, or may wait for all commands"] - #[doc = " queued to the stream before destroying it."] - #[doc = ""] - #[doc = " @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamQuery, hipStreamWaitEvent,"] - #[doc = " hipStreamSynchronize"] - pub fn hipStreamDestroy(stream: hipStream_t) -> hipError_t; + #[must_use] + #[doc = " @brief Get information on memory allocations.\n\n @param [out] pbase - BAse pointer address\n @param [out] psize - Size of allocation\n @param [in] dptr- Device Pointer\n\n @returns #hipSuccess, #hipErrorInvalidDevicePointer\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] + pub fn hipMemGetAddressRange( + pbase: *mut hipDeviceptr_t, + psize: *mut usize, + dptr: hipDeviceptr_t, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Return #hipSuccess if all of the operations in the specified @p stream have completed, or"] - #[doc = " #hipErrorNotReady if not."] - #[doc = ""] - #[doc = " @param[in] stream stream to query"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorNotReady, #hipErrorInvalidHandle"] - #[doc = ""] - #[doc = " This is thread-safe and returns a snapshot of the current state of the queue. However, if other"] - #[doc = " host threads are sending work to the stream, the status may change immediately after the function"] - #[doc = " is called. It is typically used for debug."] - #[doc = ""] - #[doc = " @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamWaitEvent, hipStreamSynchronize,"] - #[doc = " hipStreamDestroy"] - pub fn hipStreamQuery(stream: hipStream_t) -> hipError_t; + #[must_use] + #[doc = " @brief Copies memory from one device to memory on another device.\n\n @param [out] dst - Destination device pointer.\n @param [in] dstDeviceId - Destination device\n @param [in] src - Source device pointer\n @param [in] srcDeviceId - Source device\n @param [in] sizeBytes - Size of memory copy in bytes\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidDevice"] + pub fn hipMemcpyPeer( + dst: *mut ::std::os::raw::c_void, + dstDeviceId: ::std::os::raw::c_int, + src: *const ::std::os::raw::c_void, + srcDeviceId: ::std::os::raw::c_int, + sizeBytes: usize, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Wait for all commands in stream to complete."] - #[doc = ""] - #[doc = " @param[in] stream stream identifier."] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidHandle"] - #[doc = ""] - #[doc = " This command is host-synchronous : the host will block until the specified stream is empty."] - #[doc = ""] - #[doc = " This command follows standard null-stream semantics. Specifically, specifying the null stream"] - #[doc = " will cause the command to wait for other streams on the same device to complete all pending"] - #[doc = " operations."] - #[doc = ""] - #[doc = " This command honors the hipDeviceLaunchBlocking flag, which controls whether the wait is active"] - #[doc = " or blocking."] - #[doc = ""] - #[doc = " @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamWaitEvent, hipStreamDestroy"] - #[doc = ""] - pub fn hipStreamSynchronize(stream: hipStream_t) -> hipError_t; + #[must_use] + #[doc = " @brief Copies memory from one device to memory on another device.\n\n @param [out] dst - Destination device pointer.\n @param [in] dstDeviceId - Destination device\n @param [in] src - Source device pointer\n @param [in] srcDevice - Source device\n @param [in] sizeBytes - Size of memory copy in bytes\n @param [in] stream - Stream identifier\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidDevice"] + pub fn hipMemcpyPeerAsync( + dst: *mut ::std::os::raw::c_void, + dstDeviceId: ::std::os::raw::c_int, + src: *const ::std::os::raw::c_void, + srcDevice: ::std::os::raw::c_int, + sizeBytes: usize, + stream: hipStream_t, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Make the specified compute stream wait for an event"] - #[doc = ""] - #[doc = " @param[in] stream stream to make wait."] - #[doc = " @param[in] event event to wait on"] - #[doc = " @param[in] flags control operation [must be 0]"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidHandle"] - #[doc = ""] - #[doc = " This function inserts a wait operation into the specified stream."] - #[doc = " All future work submitted to @p stream will wait until @p event reports completion before"] - #[doc = " beginning execution."] - #[doc = ""] - #[doc = " This function only waits for commands in the current stream to complete. Notably,, this function"] - #[doc = " does not impliciy wait for commands in the default stream to complete, even if the specified"] - #[doc = " stream is created with hipStreamNonBlocking = 0."] - #[doc = ""] - #[doc = " @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamCreateWithPriority, hipStreamSynchronize, hipStreamDestroy"] - pub fn hipStreamWaitEvent( - stream: hipStream_t, - event: hipEvent_t, + #[must_use] + #[doc = " @brief Create a context and set it as current/default context\n\n @param [out] ctx Context to create\n @param [in] flags Context creation flags\n @param [in] device device handle\n\n @return #hipSuccess\n\n @see hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent, hipCtxPushCurrent,\n hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform.\n"] + pub fn hipCtxCreate( + ctx: *mut hipCtx_t, flags: ::std::os::raw::c_uint, + device: hipDevice_t, ) -> hipError_t; } extern "C" { - pub fn hipStreamGetCtx(stream: hipStream_t, pctx: *mut hipCtx_t) -> hipError_t; + #[must_use] + #[doc = " @brief Destroy a HIP context.\n\n @param [in] ctx Context to destroy\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @see hipCtxCreate, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,hipCtxSetCurrent,\n hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize , hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxDestroy(ctx: hipCtx_t) -> hipError_t; } extern "C" { - #[doc = " @brief Return flags associated with this stream."] - #[doc = ""] - #[doc = " @param[in] stream stream to be queried"] - #[doc = " @param[in,out] flags Pointer to an unsigned integer in which the stream's flags are returned"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidHandle"] - #[doc = ""] - #[doc = " @returns #hipSuccess #hipErrorInvalidValue #hipErrorInvalidHandle"] - #[doc = ""] - #[doc = " Return flags associated with this stream in *@p flags."] - #[doc = ""] - #[doc = " @see hipStreamCreateWithFlags"] - pub fn hipStreamGetFlags(stream: hipStream_t, flags: *mut ::std::os::raw::c_uint) - -> hipError_t; + #[must_use] + #[doc = " @brief Pop the current/default context and return the popped context.\n\n @param [out] ctx The current context to pop\n\n @returns #hipSuccess, #hipErrorInvalidContext\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxSetCurrent, hipCtxGetCurrent,\n hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxPopCurrent(ctx: *mut hipCtx_t) -> hipError_t; } extern "C" { - #[doc = " @brief Query the priority of a stream."] - #[doc = ""] - #[doc = " @param[in] stream stream to be queried"] - #[doc = " @param[in,out] priority Pointer to an unsigned integer in which the stream's priority is returned"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidHandle"] - #[doc = ""] - #[doc = " @returns #hipSuccess #hipErrorInvalidValue #hipErrorInvalidHandle"] - #[doc = ""] - #[doc = " Query the priority of a stream. The priority is returned in in priority."] - #[doc = ""] - #[doc = " @see hipStreamCreateWithFlags"] - pub fn hipStreamGetPriority( - stream: hipStream_t, - priority: *mut ::std::os::raw::c_int, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Push the context to be set as current/ default context\n\n @param [in] ctx The current context to push\n\n @returns #hipSuccess, #hipErrorInvalidContext\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize , hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxPushCurrent(ctx: hipCtx_t) -> hipError_t; } extern "C" { - #[doc = " @brief Create an asynchronous stream with the specified CU mask."] - #[doc = ""] - #[doc = " @param[in, out] stream Pointer to new stream"] - #[doc = " @param[in ] cuMaskSize Size of CU mask bit array passed in."] - #[doc = " @param[in ] cuMask Bit-vector representing the CU mask. Each active bit represents using one CU."] - #[doc = " The first 32 bits represent the first 32 CUs, and so on. If its size is greater than physical"] - #[doc = " CU number (i.e., multiProcessorCount member of hipDeviceProp_t), the extra elements are ignored."] - #[doc = " It is user's responsibility to make sure the input is meaningful."] - #[doc = " @return #hipSuccess, #hipErrorInvalidHandle, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " Create a new asynchronous stream with the specified CU mask. @p stream returns an opaque handle"] - #[doc = " that can be used to reference the newly created stream in subsequent hipStream* commands. The"] - #[doc = " stream is allocated on the heap and will remain allocated even if the handle goes out-of-scope."] - #[doc = " To release the memory used by the stream, application must call hipStreamDestroy."] - #[doc = ""] - #[doc = ""] - #[doc = " @see hipStreamCreate, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy"] - pub fn hipExtStreamCreateWithCUMask( - stream: *mut hipStream_t, - cuMaskSize: u32, - cuMask: *const u32, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Set the passed context as current/default\n\n @param [in] ctx The context to set as current\n\n @returns #hipSuccess, #hipErrorInvalidContext\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize , hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxSetCurrent(ctx: hipCtx_t) -> hipError_t; } extern "C" { - #[doc = " @brief Get CU mask associated with an asynchronous stream"] - #[doc = ""] - #[doc = " @param[in] stream stream to be queried"] - #[doc = " @param[in] cuMaskSize number of the block of memories (uint32_t *) allocated by user"] - #[doc = " @param[out] cuMask Pointer to a pre-allocated block of memories (uint32_t *) in which"] - #[doc = " the stream's CU mask is returned. The CU mask is returned in a chunck of 32 bits where"] - #[doc = " each active bit represents one active CU"] - #[doc = " @return #hipSuccess, #hipErrorInvalidHandle, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see hipStreamCreate, hipStreamSynchronize, hipStreamWaitEvent, hipStreamDestroy"] - pub fn hipExtStreamGetCUMask( - stream: hipStream_t, - cuMaskSize: u32, - cuMask: *mut u32, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Get the handle of the current/ default context\n\n @param [out] ctx The context to get as current\n\n @returns #hipSuccess, #hipErrorInvalidContext\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetDevice, hipCtxGetFlags, hipCtxPopCurrent,\n hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxGetCurrent(ctx: *mut hipCtx_t) -> hipError_t; } -#[doc = " Stream CallBack struct"] -pub type hipStreamCallback_t = ::std::option::Option< - unsafe extern "C" fn( - stream: hipStream_t, - status: hipError_t, - userData: *mut ::std::os::raw::c_void, - ), ->; extern "C" { - #[doc = " @brief Adds a callback to be called on the host after all currently enqueued"] - #[doc = " items in the stream have completed. For each"] - #[doc = " hipStreamAddCallback call, a callback will be executed exactly once."] - #[doc = " The callback will block later work in the stream until it is finished."] - #[doc = " @param[in] stream - Stream to add callback to"] - #[doc = " @param[in] callback - The function to call once preceding stream operations are complete"] - #[doc = " @param[in] userData - User specified data to be passed to the callback function"] - #[doc = " @param[in] flags - Reserved for future use, must be 0"] - #[doc = " @return #hipSuccess, #hipErrorInvalidHandle, #hipErrorNotSupported"] - #[doc = ""] - #[doc = " @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamQuery, hipStreamSynchronize,"] - #[doc = " hipStreamWaitEvent, hipStreamDestroy, hipStreamCreateWithPriority"] - #[doc = ""] - pub fn hipStreamAddCallback( - stream: hipStream_t, - callback: hipStreamCallback_t, - userData: *mut ::std::os::raw::c_void, - flags: ::std::os::raw::c_uint, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Get the handle of the device associated with current/default context\n\n @param [out] device The device from the current context\n\n @returns #hipSuccess, #hipErrorInvalidContext\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxGetDevice(device: *mut hipDevice_t) -> hipError_t; } extern "C" { - #[doc = " @}"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = " @defgroup Stream Memory Operations"] - #[doc = " @{"] - #[doc = " This section describes Stream Memory Wait and Write functions of HIP runtime API."] - #[doc = " @brief Enqueues a wait command to the stream.[BETA]"] - #[doc = ""] - #[doc = " @param [in] stream - Stream identifier"] - #[doc = " @param [in] ptr - Pointer to memory object allocated using 'hipMallocSignalMemory' flag"] - #[doc = " @param [in] value - Value to be used in compare operation"] - #[doc = " @param [in] flags - Defines the compare operation, supported values are hipStreamWaitValueGte"] - #[doc = " hipStreamWaitValueEq, hipStreamWaitValueAnd and hipStreamWaitValueNor"] - #[doc = " @param [in] mask - Mask to be applied on value at memory before it is compared with value,"] - #[doc = " default value is set to enable every bit"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " Enqueues a wait command to the stream, all operations enqueued on this stream after this, will"] - #[doc = " not execute until the defined wait condition is true."] - #[doc = ""] - #[doc = " hipStreamWaitValueGte: waits until *ptr&mask >= value"] - #[doc = " hipStreamWaitValueEq : waits until *ptr&mask == value"] - #[doc = " hipStreamWaitValueAnd: waits until ((*ptr&mask) & value) != 0"] - #[doc = " hipStreamWaitValueNor: waits until ~((*ptr&mask) | (value&mask)) != 0"] - #[doc = ""] - #[doc = " @note when using 'hipStreamWaitValueNor', mask is applied on both 'value' and '*ptr'."] - #[doc = ""] - #[doc = " @note Support for hipStreamWaitValue32 can be queried using 'hipDeviceGetAttribute()' and"] - #[doc = " 'hipDeviceAttributeCanUseStreamWaitValue' flag."] - #[doc = ""] - #[doc = " @beta This API is marked as beta, meaning, while this is feature complete,"] - #[doc = " it is still open to changes and may have outstanding issues."] - #[doc = ""] - #[doc = " @see hipExtMallocWithFlags, hipFree, hipStreamWaitValue64, hipStreamWriteValue64,"] - #[doc = " hipStreamWriteValue32, hipDeviceGetAttribute"] - pub fn hipStreamWaitValue32( - stream: hipStream_t, - ptr: *mut ::std::os::raw::c_void, - value: u32, - flags: ::std::os::raw::c_uint, - mask: u32, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Returns the approximate HIP api version.\n\n @param [in] ctx Context to check\n @param [out] apiVersion API version to get\n\n @return #hipSuccess\n\n @warning The HIP feature set does not correspond to an exact CUDA SDK api revision.\n This function always set *apiVersion to 4 as an approximation though HIP supports\n some features which were introduced in later CUDA SDK revisions.\n HIP apps code should not rely on the api revision number here and should\n use arch feature flags to test device capabilities or conditional compilation.\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetDevice, hipCtxGetFlags, hipCtxPopCurrent,\n hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxGetApiVersion(ctx: hipCtx_t, apiVersion: *mut ::std::os::raw::c_int) + -> hipError_t; } extern "C" { - #[doc = " @brief Enqueues a wait command to the stream.[BETA]"] - #[doc = ""] - #[doc = " @param [in] stream - Stream identifier"] - #[doc = " @param [in] ptr - Pointer to memory object allocated using 'hipMallocSignalMemory' flag"] - #[doc = " @param [in] value - Value to be used in compare operation"] - #[doc = " @param [in] flags - Defines the compare operation, supported values are hipStreamWaitValueGte"] - #[doc = " hipStreamWaitValueEq, hipStreamWaitValueAnd and hipStreamWaitValueNor."] - #[doc = " @param [in] mask - Mask to be applied on value at memory before it is compared with value"] - #[doc = " default value is set to enable every bit"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " Enqueues a wait command to the stream, all operations enqueued on this stream after this, will"] - #[doc = " not execute until the defined wait condition is true."] - #[doc = ""] - #[doc = " hipStreamWaitValueGte: waits until *ptr&mask >= value"] - #[doc = " hipStreamWaitValueEq : waits until *ptr&mask == value"] - #[doc = " hipStreamWaitValueAnd: waits until ((*ptr&mask) & value) != 0"] - #[doc = " hipStreamWaitValueNor: waits until ~((*ptr&mask) | (value&mask)) != 0"] - #[doc = ""] - #[doc = " @note when using 'hipStreamWaitValueNor', mask is applied on both 'value' and '*ptr'."] - #[doc = ""] - #[doc = " @note Support for hipStreamWaitValue64 can be queried using 'hipDeviceGetAttribute()' and"] - #[doc = " 'hipDeviceAttributeCanUseStreamWaitValue' flag."] - #[doc = ""] - #[doc = " @beta This API is marked as beta, meaning, while this is feature complete,"] - #[doc = " it is still open to changes and may have outstanding issues."] - #[doc = ""] - #[doc = " @see hipExtMallocWithFlags, hipFree, hipStreamWaitValue32, hipStreamWriteValue64,"] - #[doc = " hipStreamWriteValue32, hipDeviceGetAttribute"] - pub fn hipStreamWaitValue64( - stream: hipStream_t, - ptr: *mut ::std::os::raw::c_void, - value: u64, - flags: ::std::os::raw::c_uint, - mask: u64, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Get Cache configuration for a specific function\n\n @param [out] cacheConfig Cache configuration\n\n @return #hipSuccess\n\n @warning AMD devices and some Nvidia GPUS do not support reconfigurable cache. This hint is\n ignored on those architectures.\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxGetCacheConfig(cacheConfig: *mut hipFuncCache_t) -> hipError_t; } extern "C" { - #[doc = " @brief Enqueues a write command to the stream.[BETA]"] - #[doc = ""] - #[doc = " @param [in] stream - Stream identifier"] - #[doc = " @param [in] ptr - Pointer to a GPU accessible memory object"] - #[doc = " @param [in] value - Value to be written"] - #[doc = " @param [in] flags - reserved, ignored for now, will be used in future releases"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " Enqueues a write command to the stream, write operation is performed after all earlier commands"] - #[doc = " on this stream have completed the execution."] - #[doc = ""] - #[doc = " @beta This API is marked as beta, meaning, while this is feature complete,"] - #[doc = " it is still open to changes and may have outstanding issues."] - #[doc = ""] - #[doc = " @see hipExtMallocWithFlags, hipFree, hipStreamWriteValue32, hipStreamWaitValue32,"] - #[doc = " hipStreamWaitValue64"] - pub fn hipStreamWriteValue32( - stream: hipStream_t, - ptr: *mut ::std::os::raw::c_void, - value: u32, - flags: ::std::os::raw::c_uint, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Set L1/Shared cache partition.\n\n @param [in] cacheConfig Cache configuration to set\n\n @return #hipSuccess\n\n @warning AMD devices and some Nvidia GPUS do not support reconfigurable cache. This hint is\n ignored on those architectures.\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxSetCacheConfig(cacheConfig: hipFuncCache_t) -> hipError_t; } extern "C" { - #[doc = " @brief Enqueues a write command to the stream.[BETA]"] - #[doc = ""] - #[doc = " @param [in] stream - Stream identifier"] - #[doc = " @param [in] ptr - Pointer to a GPU accessible memory object"] - #[doc = " @param [in] value - Value to be written"] - #[doc = " @param [in] flags - reserved, ignored for now, will be used in future releases"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " Enqueues a write command to the stream, write operation is performed after all earlier commands"] - #[doc = " on this stream have completed the execution."] - #[doc = ""] - #[doc = " @beta This API is marked as beta, meaning, while this is feature complete,"] - #[doc = " it is still open to changes and may have outstanding issues."] - #[doc = ""] - #[doc = " @see hipExtMallocWithFlags, hipFree, hipStreamWriteValue32, hipStreamWaitValue32,"] - #[doc = " hipStreamWaitValue64"] - pub fn hipStreamWriteValue64( - stream: hipStream_t, - ptr: *mut ::std::os::raw::c_void, - value: u64, - flags: ::std::os::raw::c_uint, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Set Shared memory bank configuration.\n\n @param [in] config Shared memory configuration to set\n\n @return #hipSuccess\n\n @warning AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is\n ignored on those architectures.\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxSetSharedMemConfig(config: hipSharedMemConfig) -> hipError_t; } extern "C" { - #[doc = " @}"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = " @defgroup Event Event Management"] - #[doc = " @{"] - #[doc = " This section describes the event management functions of HIP runtime API."] - #[doc = " @brief Create an event with the specified flags"] - #[doc = ""] - #[doc = " @param[in,out] event Returns the newly created event."] - #[doc = " @param[in] flags Flags to control event behavior. Valid values are #hipEventDefault,"] - #[doc = "#hipEventBlockingSync, #hipEventDisableTiming, #hipEventInterprocess"] - #[doc = " #hipEventDefault : Default flag. The event will use active synchronization and will support"] - #[doc = "timing. Blocking synchronization provides lowest possible latency at the expense of dedicating a"] - #[doc = "CPU to poll on the event."] - #[doc = " #hipEventBlockingSync : The event will use blocking synchronization : if hipEventSynchronize is"] - #[doc = "called on this event, the thread will block until the event completes. This can increase latency"] - #[doc = "for the synchroniation but can result in lower power and more resources for other CPU threads."] - #[doc = " #hipEventDisableTiming : Disable recording of timing information. Events created with this flag"] - #[doc = "would not record profiling data and provide best performance if used for synchronization."] - #[doc = " @warning On AMD platform, hipEventInterprocess support is under development. Use of this flag"] - #[doc = "will return an error."] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue,"] - #[doc = "#hipErrorLaunchFailure, #hipErrorOutOfMemory"] - #[doc = ""] - #[doc = " @see hipEventCreate, hipEventSynchronize, hipEventDestroy, hipEventElapsedTime"] - pub fn hipEventCreateWithFlags( - event: *mut hipEvent_t, - flags: ::std::os::raw::c_uint, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Get Shared memory bank configuration.\n\n @param [out] pConfig Pointer of shared memory configuration\n\n @return #hipSuccess\n\n @warning AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is\n ignored on those architectures.\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxGetSharedMemConfig(pConfig: *mut hipSharedMemConfig) -> hipError_t; } extern "C" { - #[doc = " Create an event"] - #[doc = ""] - #[doc = " @param[in,out] event Returns the newly created event."] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue,"] - #[doc = " #hipErrorLaunchFailure, #hipErrorOutOfMemory"] - #[doc = ""] - #[doc = " @see hipEventCreateWithFlags, hipEventRecord, hipEventQuery, hipEventSynchronize,"] - #[doc = " hipEventDestroy, hipEventElapsedTime"] - pub fn hipEventCreate(event: *mut hipEvent_t) -> hipError_t; + #[must_use] + #[doc = " @brief Blocks until the default context has completed all preceding requested tasks.\n\n @return #hipSuccess\n\n @warning This function waits for all streams on the default context to complete execution, and\n then returns.\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxSynchronize() -> hipError_t; } extern "C" { - pub fn hipEventRecord(event: hipEvent_t, stream: hipStream_t) -> hipError_t; + #[must_use] + #[doc = " @brief Return flags used for creating default context.\n\n @param [out] flags Pointer of flags\n\n @returns #hipSuccess\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxPopCurrent, hipCtxGetCurrent, hipCtxGetCurrent,\n hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxGetFlags(flags: *mut ::std::os::raw::c_uint) -> hipError_t; } extern "C" { - #[doc = " @brief Destroy the specified event."] - #[doc = ""] - #[doc = " @param[in] event Event to destroy."] - #[doc = " @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue,"] - #[doc = " #hipErrorLaunchFailure"] - #[doc = ""] - #[doc = " Releases memory associated with the event. If the event is recording but has not completed"] - #[doc = " recording when hipEventDestroy() is called, the function will return immediately and the"] - #[doc = " completion_future resources will be released later, when the hipDevice is synchronized."] - #[doc = ""] - #[doc = " @see hipEventCreate, hipEventCreateWithFlags, hipEventQuery, hipEventSynchronize, hipEventRecord,"] - #[doc = " hipEventElapsedTime"] - #[doc = ""] - #[doc = " @returns #hipSuccess"] - pub fn hipEventDestroy(event: hipEvent_t) -> hipError_t; + #[must_use] + #[doc = " @brief Enables direct access to memory allocations in a peer context.\n\n Memory which already allocated on peer device will be mapped into the address space of the\n current device. In addition, all future memory allocations on peerDeviceId will be mapped into\n the address space of the current device when the memory is allocated. The peer memory remains\n accessible from the current device until a call to hipDeviceDisablePeerAccess or hipDeviceReset.\n\n\n @param [in] peerCtx Peer context\n @param [in] flags flags, need to set as 0\n\n @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue,\n #hipErrorPeerAccessAlreadyEnabled\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n @warning PeerToPeer support is experimental.\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxEnablePeerAccess(peerCtx: hipCtx_t, flags: ::std::os::raw::c_uint) -> hipError_t; } extern "C" { - #[doc = " @brief Wait for an event to complete."] - #[doc = ""] - #[doc = " This function will block until the event is ready, waiting for all previous work in the stream"] - #[doc = " specified when event was recorded with hipEventRecord()."] - #[doc = ""] - #[doc = " If hipEventRecord() has not been called on @p event, this function returns immediately."] - #[doc = ""] - #[doc = " TODO-hip- This function needs to support hipEventBlockingSync parameter."] - #[doc = ""] - #[doc = " @param[in] event Event on which to wait."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized,"] - #[doc = " #hipErrorInvalidHandle, #hipErrorLaunchFailure"] - #[doc = ""] - #[doc = " @see hipEventCreate, hipEventCreateWithFlags, hipEventQuery, hipEventDestroy, hipEventRecord,"] - #[doc = " hipEventElapsedTime"] - pub fn hipEventSynchronize(event: hipEvent_t) -> hipError_t; + #[must_use] + #[doc = " @brief Disable direct access from current context's virtual address space to memory allocations\n physically located on a peer context.Disables direct access to memory allocations in a peer\n context and unregisters any registered allocations.\n\n Returns #hipErrorPeerAccessNotEnabled if direct access to memory on peerDevice has not yet been\n enabled from the current device.\n\n @param [in] peerCtx Peer context to be disabled\n\n @returns #hipSuccess, #hipErrorPeerAccessNotEnabled\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n @warning PeerToPeer support is experimental.\n\n @warning This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the\n NVIDIA platform."] + pub fn hipCtxDisablePeerAccess(peerCtx: hipCtx_t) -> hipError_t; } extern "C" { - #[doc = " @brief Return the elapsed time between two events."] - #[doc = ""] - #[doc = " @param[out] ms : Return time between start and stop in ms."] - #[doc = " @param[in] start : Start event."] - #[doc = " @param[in] stop : Stop event."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotReady, #hipErrorInvalidHandle,"] - #[doc = " #hipErrorNotInitialized, #hipErrorLaunchFailure"] - #[doc = ""] - #[doc = " Computes the elapsed time between two events. Time is computed in ms, with"] - #[doc = " a resolution of approximately 1 us."] - #[doc = ""] - #[doc = " Events which are recorded in a NULL stream will block until all commands"] - #[doc = " on all other streams complete execution, and then record the timestamp."] - #[doc = ""] - #[doc = " Events which are recorded in a non-NULL stream will record their timestamp"] - #[doc = " when they reach the head of the specified stream, after all previous"] - #[doc = " commands in that stream have completed executing. Thus the time that"] - #[doc = " the event recorded may be significantly after the host calls hipEventRecord()."] - #[doc = ""] - #[doc = " If hipEventRecord() has not been called on either event, then #hipErrorInvalidHandle is"] - #[doc = " returned. If hipEventRecord() has been called on both events, but the timestamp has not yet been"] - #[doc = " recorded on one or both events (that is, hipEventQuery() would return #hipErrorNotReady on at"] - #[doc = " least one of the events), then #hipErrorNotReady is returned."] - #[doc = ""] - #[doc = " Note, for HIP Events used in kernel dispatch using hipExtLaunchKernelGGL/hipExtLaunchKernel,"] - #[doc = " events passed in hipExtLaunchKernelGGL/hipExtLaunchKernel are not explicitly recorded and should"] - #[doc = " only be used to get elapsed time for that specific launch. In case events are used across"] - #[doc = " multiple dispatches, for example, start and stop events from different hipExtLaunchKernelGGL/"] - #[doc = " hipExtLaunchKernel calls, they will be treated as invalid unrecorded events, HIP will throw"] - #[doc = " error \"hipErrorInvalidHandle\" from hipEventElapsedTime."] - #[doc = ""] - #[doc = " @see hipEventCreate, hipEventCreateWithFlags, hipEventQuery, hipEventDestroy, hipEventRecord,"] - #[doc = " hipEventSynchronize"] - pub fn hipEventElapsedTime(ms: *mut f32, start: hipEvent_t, stop: hipEvent_t) -> hipError_t; + #[must_use] + #[doc = " @brief Get the state of the primary context.\n\n @param [in] dev Device to get primary context flags for\n @param [out] flags Pointer to store flags\n @param [out] active Pointer to store context state; 0 = inactive, 1 = active\n\n @returns #hipSuccess\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent driver API on the\n NVIDIA platform."] + pub fn hipDevicePrimaryCtxGetState( + dev: hipDevice_t, + flags: *mut ::std::os::raw::c_uint, + active: *mut ::std::os::raw::c_int, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Query event status"] - #[doc = ""] - #[doc = " @param[in] event Event to query."] - #[doc = " @returns #hipSuccess, #hipErrorNotReady, #hipErrorInvalidHandle, #hipErrorInvalidValue,"] - #[doc = " #hipErrorNotInitialized, #hipErrorLaunchFailure"] - #[doc = ""] - #[doc = " Query the status of the specified event. This function will return #hipErrorNotReady if all"] - #[doc = " commands in the appropriate stream (specified to hipEventRecord()) have completed. If that work"] - #[doc = " has not completed, or if hipEventRecord() was not called on the event, then #hipSuccess is"] - #[doc = " returned."] - #[doc = ""] - #[doc = " @see hipEventCreate, hipEventCreateWithFlags, hipEventRecord, hipEventDestroy,"] - #[doc = " hipEventSynchronize, hipEventElapsedTime"] - pub fn hipEventQuery(event: hipEvent_t) -> hipError_t; + #[must_use] + #[doc = " @brief Release the primary context on the GPU.\n\n @param [in] dev Device which primary context is released\n\n @returns #hipSuccess\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n @warning This function return #hipSuccess though doesn't release the primaryCtx by design on\n HIP/HCC path.\n\n @warning This API is deprecated on the AMD platform, only for equivalent driver API on the NVIDIA\n platform."] + pub fn hipDevicePrimaryCtxRelease(dev: hipDevice_t) -> hipError_t; } extern "C" { - #[doc = " @}"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = " @defgroup Memory Memory Management"] - #[doc = " @{"] - #[doc = " This section describes the memory management functions of HIP runtime API."] - #[doc = " The following CUDA APIs are not currently supported:"] - #[doc = " - cudaMalloc3D"] - #[doc = " - cudaMalloc3DArray"] - #[doc = " - TODO - more 2D, 3D, array APIs here."] - #[doc = ""] - #[doc = ""] - #[doc = " @brief Return attributes for the specified pointer"] - #[doc = ""] - #[doc = " @param[out] attributes for the specified pointer"] - #[doc = " @param[in] pointer to get attributes for"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see hipGetDeviceCount, hipGetDevice, hipSetDevice, hipChooseDevice"] - pub fn hipPointerGetAttributes( - attributes: *mut hipPointerAttribute_t, - ptr: *const ::std::os::raw::c_void, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Retain the primary context on the GPU.\n\n @param [out] pctx Returned context handle of the new context\n @param [in] dev Device which primary context is released\n\n @returns #hipSuccess\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent driver API on the NVIDIA\n platform."] + pub fn hipDevicePrimaryCtxRetain(pctx: *mut hipCtx_t, dev: hipDevice_t) -> hipError_t; } extern "C" { - #[doc = " @brief Imports an external semaphore."] - #[doc = ""] - #[doc = " @param[out] extSem_out External semaphores to be waited on"] - #[doc = " @param[in] semHandleDesc Semaphore import handle descriptor"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see"] - pub fn hipImportExternalSemaphore( - extSem_out: *mut hipExternalSemaphore_t, - semHandleDesc: *const hipExternalSemaphoreHandleDesc, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Resets the primary context on the GPU.\n\n @param [in] dev Device which primary context is reset\n\n @returns #hipSuccess\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent driver API on the NVIDIA\n platform."] + pub fn hipDevicePrimaryCtxReset(dev: hipDevice_t) -> hipError_t; } extern "C" { - #[doc = " @brief Signals a set of external semaphore objects."] - #[doc = ""] - #[doc = " @param[in] extSem_out External semaphores to be waited on"] - #[doc = " @param[in] paramsArray Array of semaphore parameters"] - #[doc = " @param[in] numExtSems Number of semaphores to wait on"] - #[doc = " @param[in] stream Stream to enqueue the wait operations in"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see"] - pub fn hipSignalExternalSemaphoresAsync( - extSemArray: *const hipExternalSemaphore_t, - paramsArray: *const hipExternalSemaphoreSignalParams, - numExtSems: ::std::os::raw::c_uint, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Set flags for the primary context.\n\n @param [in] dev Device for which the primary context flags are set\n @param [in] flags New flags for the device\n\n @returns #hipSuccess, #hipErrorContextAlreadyInUse\n\n @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,\n hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice\n\n @warning This API is deprecated on the AMD platform, only for equivalent driver API on the NVIDIA\n platform."] + pub fn hipDevicePrimaryCtxSetFlags( + dev: hipDevice_t, + flags: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Waits on a set of external semaphore objects"] - #[doc = ""] - #[doc = " @param[in] extSem_out External semaphores to be waited on"] - #[doc = " @param[in] paramsArray Array of semaphore parameters"] - #[doc = " @param[in] numExtSems Number of semaphores to wait on"] - #[doc = " @param[in] stream Stream to enqueue the wait operations in"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see"] - pub fn hipWaitExternalSemaphoresAsync( - extSemArray: *const hipExternalSemaphore_t, - paramsArray: *const hipExternalSemaphoreWaitParams, - numExtSems: ::std::os::raw::c_uint, - stream: hipStream_t, + #[must_use] + #[doc = " @}\n/\n/**\n-------------------------------------------------------------------------------------------------\n-------------------------------------------------------------------------------------------------\n\n @defgroup Module Module Management\n @{\n @ingroup API\n This section describes the module management functions of HIP runtime API.\n\n/\n/**\n @brief Loads code object from file into a module the currrent context.\n\n @param [in] fname Filename of code object to load\n\n @param [out] module Module\n\n @warning File/memory resources allocated in this function are released only in hipModuleUnload.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidContext, #hipErrorFileNotFound,\n #hipErrorOutOfMemory, #hipErrorSharedObjectInitFailed, #hipErrorNotInitialized\n"] + pub fn hipModuleLoad( + module: *mut hipModule_t, + fname: *const ::std::os::raw::c_char, ) -> hipError_t; } extern "C" { - #[doc = " @brief Destroys an external semaphore object and releases any references to the underlying resource. Any outstanding signals or waits must have completed before the semaphore is destroyed."] - #[doc = ""] - #[doc = " @param[in] extSem handle to an external memory object"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see"] - pub fn hipDestroyExternalSemaphore(extSem: hipExternalSemaphore_t) -> hipError_t; + #[must_use] + #[doc = " @brief Frees the module\n\n @param [in] module Module to free\n\n @returns #hipSuccess, #hipErrorInvalidResourceHandle\n\n The module is freed, and the code objects associated with it are destroyed."] + pub fn hipModuleUnload(module: hipModule_t) -> hipError_t; } extern "C" { - #[doc = " @brief Imports an external memory object."] - #[doc = ""] - #[doc = " @param[out] extMem_out Returned handle to an external memory object"] - #[doc = " @param[in] memHandleDesc Memory import handle descriptor"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see"] - pub fn hipImportExternalMemory( - extMem_out: *mut hipExternalMemory_t, - memHandleDesc: *const hipExternalMemoryHandleDesc, + #[must_use] + #[doc = " @brief Function with kname will be extracted if present in module\n\n @param [in] module Module to get function from\n @param [in] kname Pointer to the name of function\n @param [out] function Pointer to function handle\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidContext, #hipErrorNotInitialized,\n #hipErrorNotFound,"] + pub fn hipModuleGetFunction( + function: *mut hipFunction_t, + module: hipModule_t, + kname: *const ::std::os::raw::c_char, ) -> hipError_t; } extern "C" { - #[doc = " @brief Maps a buffer onto an imported memory object."] - #[doc = ""] - #[doc = " @param[out] devPtr Returned device pointer to buffer"] - #[doc = " @param[in] extMem Handle to external memory object"] - #[doc = " @param[in] bufferDesc Buffer descriptor"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see"] - pub fn hipExternalMemoryGetMappedBuffer( - devPtr: *mut *mut ::std::os::raw::c_void, - extMem: hipExternalMemory_t, - bufferDesc: *const hipExternalMemoryBufferDesc, + #[must_use] + #[doc = " @brief Find out attributes for a given function.\n\n @param [out] attr Attributes of funtion\n @param [in] func Pointer to the function handle\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidDeviceFunction"] + pub fn hipFuncGetAttributes( + attr: *mut hipFuncAttributes, + func: *const ::std::os::raw::c_void, ) -> hipError_t; } extern "C" { - #[doc = " @brief Destroys an external memory object."] - #[doc = ""] - #[doc = " @param[in] extMem External memory object to be destroyed"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see"] - pub fn hipDestroyExternalMemory(extMem: hipExternalMemory_t) -> hipError_t; + #[must_use] + #[doc = " @brief Find out a specific attribute for a given function.\n\n @param [out] value Pointer to the value\n @param [in] attrib Attributes of the given funtion\n @param [in] hfunc Function to get attributes from\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidDeviceFunction"] + pub fn hipFuncGetAttribute( + value: *mut ::std::os::raw::c_int, + attrib: hipFunction_attribute, + hfunc: hipFunction_t, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Allocate memory on the default accelerator"] - #[doc = ""] - #[doc = " @param[out] ptr Pointer to the allocated memory"] - #[doc = " @param[in] size Requested memory size"] - #[doc = ""] - #[doc = " If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned."] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorOutOfMemory, #hipErrorInvalidValue (bad context, null *ptr)"] - #[doc = ""] - #[doc = " @see hipMallocPitch, hipFree, hipMallocArray, hipFreeArray, hipMalloc3D, hipMalloc3DArray,"] - #[doc = " hipHostFree, hipHostMalloc"] - pub fn hipMalloc(ptr: *mut *mut ::std::os::raw::c_void, size: usize) -> hipError_t; + #[must_use] + #[doc = " @brief returns the handle of the texture reference with the name from the module.\n\n @param [in] hmod Module\n @param [in] name Pointer of name of texture reference\n @param [out] texRef Pointer of texture reference\n\n @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorNotFound, #hipErrorInvalidValue"] + pub fn hipModuleGetTexRef( + texRef: *mut *mut textureReference, + hmod: hipModule_t, + name: *const ::std::os::raw::c_char, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Allocate memory on the default accelerator"] - #[doc = ""] - #[doc = " @param[out] ptr Pointer to the allocated memory"] - #[doc = " @param[in] size Requested memory size"] - #[doc = " @param[in] flags Type of memory allocation"] - #[doc = ""] - #[doc = " If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned."] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorOutOfMemory, #hipErrorInvalidValue (bad context, null *ptr)"] - #[doc = ""] - #[doc = " @see hipMallocPitch, hipFree, hipMallocArray, hipFreeArray, hipMalloc3D, hipMalloc3DArray,"] - #[doc = " hipHostFree, hipHostMalloc"] - pub fn hipExtMallocWithFlags( - ptr: *mut *mut ::std::os::raw::c_void, - sizeBytes: usize, - flags: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief builds module from code object which resides in host memory. Image is pointer to that\n location.\n\n @param [in] image The pointer to the location of data\n @param [out] module Retuned module\n\n @returns hipSuccess, hipErrorNotInitialized, hipErrorOutOfMemory, hipErrorNotInitialized"] + pub fn hipModuleLoadData( + module: *mut hipModule_t, + image: *const ::std::os::raw::c_void, ) -> hipError_t; } extern "C" { - #[doc = " @brief Allocate pinned host memory [Deprecated]"] - #[doc = ""] - #[doc = " @param[out] ptr Pointer to the allocated host pinned memory"] - #[doc = " @param[in] size Requested memory size"] - #[doc = ""] - #[doc = " If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned."] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorOutOfMemory"] - #[doc = ""] - #[doc = " @deprecated use hipHostMalloc() instead"] - pub fn hipMallocHost(ptr: *mut *mut ::std::os::raw::c_void, size: usize) -> hipError_t; + #[must_use] + #[doc = " @brief builds module from code object which resides in host memory. Image is pointer to that\n location. Options are not used. hipModuleLoadData is called.\n\n @param [in] image The pointer to the location of data\n @param [out] module Retuned module\n @param [in] numOptions Number of options\n @param [in] options Options for JIT\n @param [in] optionValues Option values for JIT\n\n @returns hipSuccess, hipErrorNotInitialized, hipErrorOutOfMemory, hipErrorNotInitialized"] + pub fn hipModuleLoadDataEx( + module: *mut hipModule_t, + image: *const ::std::os::raw::c_void, + numOptions: ::std::os::raw::c_uint, + options: *mut hipJitOption, + optionValues: *mut *mut ::std::os::raw::c_void, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Allocate pinned host memory [Deprecated]"] - #[doc = ""] - #[doc = " @param[out] ptr Pointer to the allocated host pinned memory"] - #[doc = " @param[in] size Requested memory size"] - #[doc = ""] - #[doc = " If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned."] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorOutOfMemory"] - #[doc = ""] - #[doc = " @deprecated use hipHostMalloc() instead"] - pub fn hipMemAllocHost(ptr: *mut *mut ::std::os::raw::c_void, size: usize) -> hipError_t; + #[must_use] + #[doc = " @brief launches kernel f with launch parameters and shared memory on stream with arguments passed\n to kernelparams or extra\n\n @param [in] f Kernel to launch.\n @param [in] gridDimX X grid dimension specified as multiple of blockDimX.\n @param [in] gridDimY Y grid dimension specified as multiple of blockDimY.\n @param [in] gridDimZ Z grid dimension specified as multiple of blockDimZ.\n @param [in] blockDimX X block dimensions specified in work-items\n @param [in] blockDimY Y grid dimension specified in work-items\n @param [in] blockDimZ Z grid dimension specified in work-items\n @param [in] sharedMemBytes Amount of dynamic shared memory to allocate for this kernel. The\n HIP-Clang compiler provides support for extern shared declarations.\n @param [in] stream Stream where the kernel should be dispatched. May be 0, in which case th\n default stream is used with associated synchronization rules.\n @param [in] kernelParams Kernel parameters to launch\n @param [in] extra Pointer to kernel arguments. These are passed directly to the kernel and\n must be in the memory layout and alignment expected by the kernel.\n All passed arguments must be naturally aligned according to their type. The memory address of each\n argument should be a multiple of its size in bytes. Please refer to hip_porting_driver_api.md\n for sample usage.\n\n Please note, HIP does not support kernel launch with total work items defined in dimension with\n size gridDim x blockDim >= 2^32. So gridDim.x * blockDim.x, gridDim.y * blockDim.y\n and gridDim.z * blockDim.z are always less than 2^32.\n\n @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue"] + pub fn hipModuleLaunchKernel( + f: hipFunction_t, + gridDimX: ::std::os::raw::c_uint, + gridDimY: ::std::os::raw::c_uint, + gridDimZ: ::std::os::raw::c_uint, + blockDimX: ::std::os::raw::c_uint, + blockDimY: ::std::os::raw::c_uint, + blockDimZ: ::std::os::raw::c_uint, + sharedMemBytes: ::std::os::raw::c_uint, + stream: hipStream_t, + kernelParams: *mut *mut ::std::os::raw::c_void, + extra: *mut *mut ::std::os::raw::c_void, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Allocate device accessible page locked host memory"] - #[doc = ""] - #[doc = " @param[out] ptr Pointer to the allocated host pinned memory"] - #[doc = " @param[in] size Requested memory size"] - #[doc = " @param[in] flags Type of host memory allocation"] - #[doc = ""] - #[doc = " If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned."] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorOutOfMemory"] - #[doc = ""] - #[doc = " @see hipSetDeviceFlags, hipHostFree"] - pub fn hipHostMalloc( - ptr: *mut *mut ::std::os::raw::c_void, - size: usize, - flags: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief launches kernel f with launch parameters and shared memory on stream with arguments passed\n to kernelParams, where thread blocks can cooperate and synchronize as they execute\n\n @param [in] f Kernel to launch.\n @param [in] gridDimX X grid dimension specified as multiple of blockDimX.\n @param [in] gridDimY Y grid dimension specified as multiple of blockDimY.\n @param [in] gridDimZ Z grid dimension specified as multiple of blockDimZ.\n @param [in] blockDimX X block dimension specified in work-items.\n @param [in] blockDimY Y block dimension specified in work-items.\n @param [in] blockDimZ Z block dimension specified in work-items.\n @param [in] sharedMemBytes Amount of dynamic shared memory to allocate for this kernel. The\n HIP-Clang compiler provides support for extern shared declarations.\n @param [in] stream Stream where the kernel should be dispatched. May be 0,\n in which case the default stream is used with associated synchronization rules.\n @param [in] kernelParams A list of kernel arguments.\n\n Please note, HIP does not support kernel launch with total work items defined in dimension with\n size gridDim x blockDim >= 2^32.\n\n @returns #hipSuccess, #hipErrorDeinitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,\n #hipErrorInvalidHandle, #hipErrorInvalidImage, #hipErrorInvalidValue,\n #hipErrorInvalidConfiguration, #hipErrorLaunchFailure, #hipErrorLaunchOutOfResources,\n #hipErrorLaunchTimeOut, #hipErrorCooperativeLaunchTooLarge, #hipErrorSharedObjectInitFailed"] + pub fn hipModuleLaunchCooperativeKernel( + f: hipFunction_t, + gridDimX: ::std::os::raw::c_uint, + gridDimY: ::std::os::raw::c_uint, + gridDimZ: ::std::os::raw::c_uint, + blockDimX: ::std::os::raw::c_uint, + blockDimY: ::std::os::raw::c_uint, + blockDimZ: ::std::os::raw::c_uint, + sharedMemBytes: ::std::os::raw::c_uint, + stream: hipStream_t, + kernelParams: *mut *mut ::std::os::raw::c_void, ) -> hipError_t; } extern "C" { - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = " @addtogroup Memory Managed Memory"] - #[doc = " @{"] - #[doc = " @ingroup Memory"] - #[doc = " This section describes the managed memory management functions of HIP runtime API."] - #[doc = ""] - #[doc = " @brief Allocates memory that will be automatically managed by HIP."] - #[doc = ""] - #[doc = " @param [out] dev_ptr - pointer to allocated device memory"] - #[doc = " @param [in] size - requested allocation size in bytes"] - #[doc = " @param [in] flags - must be either hipMemAttachGlobal or hipMemAttachHost"] - #[doc = " (defaults to hipMemAttachGlobal)"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorMemoryAllocation, #hipErrorNotSupported, #hipErrorInvalidValue"] - pub fn hipMallocManaged( - dev_ptr: *mut *mut ::std::os::raw::c_void, - size: usize, + #[must_use] + #[doc = " @brief Launches kernels on multiple devices where thread blocks can cooperate and\n synchronize as they execute.\n\n @param [in] launchParamsList List of launch parameters, one per device.\n @param [in] numDevices Size of the launchParamsList array.\n @param [in] flags Flags to control launch behavior.\n\n @returns #hipSuccess, #hipErrorDeinitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,\n #hipErrorInvalidHandle, #hipErrorInvalidImage, #hipErrorInvalidValue,\n #hipErrorInvalidConfiguration, #hipErrorInvalidResourceHandle, #hipErrorLaunchFailure,\n #hipErrorLaunchOutOfResources, #hipErrorLaunchTimeOut, #hipErrorCooperativeLaunchTooLarge,\n #hipErrorSharedObjectInitFailed"] + pub fn hipModuleLaunchCooperativeKernelMultiDevice( + launchParamsList: *mut hipFunctionLaunchParams, + numDevices: ::std::os::raw::c_uint, flags: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Prefetches memory to the specified destination device using HIP."] - #[doc = ""] - #[doc = " @param [in] dev_ptr pointer to be prefetched"] - #[doc = " @param [in] count size in bytes for prefetching"] - #[doc = " @param [in] device destination device to prefetch to"] - #[doc = " @param [in] stream stream to enqueue prefetch operation"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - pub fn hipMemPrefetchAsync( - dev_ptr: *const ::std::os::raw::c_void, - count: usize, - device: ::std::os::raw::c_int, + #[must_use] + #[doc = " @brief launches kernel f with launch parameters and shared memory on stream with arguments passed\n to kernelparams or extra, where thread blocks can cooperate and synchronize as they execute\n\n @param [in] f Kernel to launch.\n @param [in] gridDim Grid dimensions specified as multiple of blockDim.\n @param [in] blockDimX Block dimensions specified in work-items\n @param [in] kernelParams A list of kernel arguments\n @param [in] sharedMemBytes Amount of dynamic shared memory to allocate for this kernel. The\n HIP-Clang compiler provides support for extern shared declarations.\n @param [in] stream Stream where the kernel should be dispatched. May be 0, in which case th\n default stream is used with associated synchronization rules.\n\n Please note, HIP does not support kernel launch with total work items defined in dimension with\n size gridDim x blockDim >= 2^32.\n\n @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue, #hipErrorCooperativeLaunchTooLarge"] + pub fn hipLaunchCooperativeKernel( + f: *const ::std::os::raw::c_void, + gridDim: dim3, + blockDimX: dim3, + kernelParams: *mut *mut ::std::os::raw::c_void, + sharedMemBytes: ::std::os::raw::c_uint, stream: hipStream_t, ) -> hipError_t; } extern "C" { - #[doc = " @brief Advise about the usage of a given memory range to HIP."] - #[doc = ""] - #[doc = " @param [in] dev_ptr pointer to memory to set the advice for"] - #[doc = " @param [in] count size in bytes of the memory range"] - #[doc = " @param [in] advice advice to be applied for the specified memory range"] - #[doc = " @param [in] device device to apply the advice for"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - pub fn hipMemAdvise( - dev_ptr: *const ::std::os::raw::c_void, - count: usize, - advice: hipMemoryAdvise, - device: ::std::os::raw::c_int, + #[must_use] + #[doc = " @brief Launches kernels on multiple devices where thread blocks can cooperate and\n synchronize as they execute.\n\n @param [in] launchParamsList List of launch parameters, one per device.\n @param [in] numDevices Size of the launchParamsList array.\n @param [in] flags Flags to control launch behavior.\n\n @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue,\n #hipErrorCooperativeLaunchTooLarge"] + pub fn hipLaunchCooperativeKernelMultiDevice( + launchParamsList: *mut hipLaunchParams, + numDevices: ::std::os::raw::c_int, + flags: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Query an attribute of a given memory range in HIP."] - #[doc = ""] - #[doc = " @param [in,out] data a pointer to a memory location where the result of each"] - #[doc = " attribute query will be written to"] - #[doc = " @param [in] data_size the size of data"] - #[doc = " @param [in] attribute the attribute to query"] - #[doc = " @param [in] dev_ptr start of the range to query"] - #[doc = " @param [in] count size of the range to query"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - pub fn hipMemRangeGetAttribute( - data: *mut ::std::os::raw::c_void, - data_size: usize, - attribute: hipMemRangeAttribute, - dev_ptr: *const ::std::os::raw::c_void, - count: usize, + #[must_use] + #[doc = " @brief Launches kernels on multiple devices and guarantees all specified kernels are dispatched\n on respective streams before enqueuing any other work on the specified streams from any other threads\n\n\n @param [in] launchParamsList List of launch parameters, one per device.\n @param [in] numDevices Size of the launchParamsList array.\n @param [in] flags Flags to control launch behavior.\n\n @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue"] + pub fn hipExtLaunchMultiKernelMultiDevice( + launchParamsList: *mut hipLaunchParams, + numDevices: ::std::os::raw::c_int, + flags: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Query attributes of a given memory range in HIP."] - #[doc = ""] - #[doc = " @param [in,out] data a two-dimensional array containing pointers to memory locations"] - #[doc = " where the result of each attribute query will be written to"] - #[doc = " @param [in] data_sizes an array, containing the sizes of each result"] - #[doc = " @param [in] attributes the attribute to query"] - #[doc = " @param [in] num_attributes an array of attributes to query (numAttributes and the number"] - #[doc = " of attributes in this array should match)"] - #[doc = " @param [in] dev_ptr start of the range to query"] - #[doc = " @param [in] count size of the range to query"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - pub fn hipMemRangeGetAttributes( - data: *mut *mut ::std::os::raw::c_void, - data_sizes: *mut usize, - attributes: *mut hipMemRangeAttribute, - num_attributes: usize, - dev_ptr: *const ::std::os::raw::c_void, - count: usize, + #[must_use] + #[doc = "-------------------------------------------------------------------------------------------------\n-------------------------------------------------------------------------------------------------\n @defgroup Occupancy Occupancy\n @{\n This section describes the occupancy functions of HIP runtime API.\n\n/\n/**\n @brief determine the grid and block sizes to achieves maximum occupancy for a kernel\n\n @param [out] gridSize minimum grid size for maximum potential occupancy\n @param [out] blockSize block size for maximum potential occupancy\n @param [in] f kernel function for which occupancy is calulated\n @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block\n @param [in] blockSizeLimit the maximum block size for the kernel, use 0 for no limit\n\n Please note, HIP does not support kernel launch with total work items defined in dimension with\n size gridDim x blockDim >= 2^32.\n\n @returns #hipSuccess, #hipErrorInvalidValue"] + pub fn hipModuleOccupancyMaxPotentialBlockSize( + gridSize: *mut ::std::os::raw::c_int, + blockSize: *mut ::std::os::raw::c_int, + f: hipFunction_t, + dynSharedMemPerBlk: usize, + blockSizeLimit: ::std::os::raw::c_int, ) -> hipError_t; } extern "C" { - #[doc = " @brief Attach memory to a stream asynchronously in HIP."] - #[doc = ""] - #[doc = " @param [in] stream - stream in which to enqueue the attach operation"] - #[doc = " @param [in] dev_ptr - pointer to memory (must be a pointer to managed memory or"] - #[doc = " to a valid host-accessible region of system-allocated memory)"] - #[doc = " @param [in] length - length of memory (defaults to zero)"] - #[doc = " @param [in] flags - must be one of hipMemAttachGlobal, hipMemAttachHost or"] - #[doc = " hipMemAttachSingle (defaults to hipMemAttachSingle)"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - pub fn hipStreamAttachMemAsync( - stream: hipStream_t, - dev_ptr: *mut ::std::os::raw::c_void, - length: usize, + #[must_use] + #[doc = " @brief determine the grid and block sizes to achieves maximum occupancy for a kernel\n\n @param [out] gridSize minimum grid size for maximum potential occupancy\n @param [out] blockSize block size for maximum potential occupancy\n @param [in] f kernel function for which occupancy is calulated\n @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block\n @param [in] blockSizeLimit the maximum block size for the kernel, use 0 for no limit\n @param [in] flags Extra flags for occupancy calculation (only default supported)\n\n Please note, HIP does not support kernel launch with total work items defined in dimension with\n size gridDim x blockDim >= 2^32.\n\n @returns #hipSuccess, #hipErrorInvalidValue"] + pub fn hipModuleOccupancyMaxPotentialBlockSizeWithFlags( + gridSize: *mut ::std::os::raw::c_int, + blockSize: *mut ::std::os::raw::c_int, + f: hipFunction_t, + dynSharedMemPerBlk: usize, + blockSizeLimit: ::std::os::raw::c_int, flags: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @}"] - #[doc = " @brief Allocate device accessible page locked host memory [Deprecated]"] - #[doc = ""] - #[doc = " @param[out] ptr Pointer to the allocated host pinned memory"] - #[doc = " @param[in] size Requested memory size"] - #[doc = " @param[in] flags Type of host memory allocation"] - #[doc = ""] - #[doc = " If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned."] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorOutOfMemory"] - #[doc = ""] - #[doc = " @deprecated use hipHostMalloc() instead"] - pub fn hipHostAlloc( - ptr: *mut *mut ::std::os::raw::c_void, - size: usize, - flags: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief Returns occupancy for a device function.\n\n @param [out] numBlocks Returned occupancy\n @param [in] f Kernel function (hipFunction) for which occupancy is calulated\n @param [in] blockSize Block size the kernel is intended to be launched with\n @param [in] dynSharedMemPerBlk Dynamic shared memory usage (in bytes) intended for each block\n @returns #hipSuccess, #hipErrorInvalidValue"] + pub fn hipModuleOccupancyMaxActiveBlocksPerMultiprocessor( + numBlocks: *mut ::std::os::raw::c_int, + f: hipFunction_t, + blockSize: ::std::os::raw::c_int, + dynSharedMemPerBlk: usize, ) -> hipError_t; } extern "C" { - #[doc = " @brief Get Device pointer from Host Pointer allocated through hipHostMalloc"] - #[doc = ""] - #[doc = " @param[out] dstPtr Device Pointer mapped to passed host pointer"] - #[doc = " @param[in] hstPtr Host Pointer allocated through hipHostMalloc"] - #[doc = " @param[in] flags Flags to be passed for extension"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorOutOfMemory"] - #[doc = ""] - #[doc = " @see hipSetDeviceFlags, hipHostMalloc"] - pub fn hipHostGetDevicePointer( - devPtr: *mut *mut ::std::os::raw::c_void, - hstPtr: *mut ::std::os::raw::c_void, + #[must_use] + #[doc = " @brief Returns occupancy for a device function.\n\n @param [out] numBlocks Returned occupancy\n @param [in] f Kernel function(hipFunction_t) for which occupancy is calulated\n @param [in] blockSize Block size the kernel is intended to be launched with\n @param [in] dynSharedMemPerBlk Dynamic shared memory usage (in bytes) intended for each block\n @param [in] flags Extra flags for occupancy calculation (only default supported)\n @returns #hipSuccess, #hipErrorInvalidValue"] + pub fn hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags( + numBlocks: *mut ::std::os::raw::c_int, + f: hipFunction_t, + blockSize: ::std::os::raw::c_int, + dynSharedMemPerBlk: usize, flags: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Return flags associated with host pointer"] - #[doc = ""] - #[doc = " @param[out] flagsPtr Memory location to store flags"] - #[doc = " @param[in] hostPtr Host Pointer allocated through hipHostMalloc"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see hipHostMalloc"] - pub fn hipHostGetFlags( - flagsPtr: *mut ::std::os::raw::c_uint, - hostPtr: *mut ::std::os::raw::c_void, + #[must_use] + #[doc = " @brief Returns occupancy for a device function.\n\n @param [out] numBlocks Returned occupancy\n @param [in] f Kernel function for which occupancy is calulated\n @param [in] blockSize Block size the kernel is intended to be launched with\n @param [in] dynSharedMemPerBlk Dynamic shared memory usage (in bytes) intended for each block\n @returns #hipSuccess, #hipErrorInvalidDeviceFunction, #hipErrorInvalidValue"] + pub fn hipOccupancyMaxActiveBlocksPerMultiprocessor( + numBlocks: *mut ::std::os::raw::c_int, + f: *const ::std::os::raw::c_void, + blockSize: ::std::os::raw::c_int, + dynSharedMemPerBlk: usize, ) -> hipError_t; } extern "C" { - #[doc = " @brief Register host memory so it can be accessed from the current device."] - #[doc = ""] - #[doc = " @param[out] hostPtr Pointer to host memory to be registered."] - #[doc = " @param[in] sizeBytes size of the host memory"] - #[doc = " @param[in] flags. See below."] - #[doc = ""] - #[doc = " Flags:"] - #[doc = " - #hipHostRegisterDefault Memory is Mapped and Portable"] - #[doc = " - #hipHostRegisterPortable Memory is considered registered by all contexts. HIP only supports"] - #[doc = " one context so this is always assumed true."] - #[doc = " - #hipHostRegisterMapped Map the allocation into the address space for the current device."] - #[doc = " The device pointer can be obtained with #hipHostGetDevicePointer."] - #[doc = ""] - #[doc = ""] - #[doc = " After registering the memory, use #hipHostGetDevicePointer to obtain the mapped device pointer."] - #[doc = " On many systems, the mapped device pointer will have a different value than the mapped host"] - #[doc = " pointer. Applications must use the device pointer in device code, and the host pointer in device"] - #[doc = " code."] - #[doc = ""] - #[doc = " On some systems, registered memory is pinned. On some systems, registered memory may not be"] - #[doc = " actually be pinned but uses OS or hardware facilities to all GPU access to the host memory."] - #[doc = ""] - #[doc = " Developers are strongly encouraged to register memory blocks which are aligned to the host"] - #[doc = " cache-line size. (typically 64-bytes but can be obtains from the CPUID instruction)."] - #[doc = ""] - #[doc = " If registering non-aligned pointers, the application must take care when register pointers from"] - #[doc = " the same cache line on different devices. HIP's coarse-grained synchronization model does not"] - #[doc = " guarantee correct results if different devices write to different parts of the same cache block -"] - #[doc = " typically one of the writes will \"win\" and overwrite data from the other registered memory"] - #[doc = " region."] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorOutOfMemory"] - #[doc = ""] - #[doc = " @see hipHostUnregister, hipHostGetFlags, hipHostGetDevicePointer"] - pub fn hipHostRegister( - hostPtr: *mut ::std::os::raw::c_void, - sizeBytes: usize, + #[must_use] + #[doc = " @brief Returns occupancy for a device function.\n\n @param [out] numBlocks Returned occupancy\n @param [in] f Kernel function for which occupancy is calulated\n @param [in] blockSize Block size the kernel is intended to be launched with\n @param [in] dynSharedMemPerBlk Dynamic shared memory usage (in bytes) intended for each block\n @param [in] flags Extra flags for occupancy calculation (currently ignored)\n @returns #hipSuccess, #hipErrorInvalidDeviceFunction, #hipErrorInvalidValue"] + pub fn hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags( + numBlocks: *mut ::std::os::raw::c_int, + f: *const ::std::os::raw::c_void, + blockSize: ::std::os::raw::c_int, + dynSharedMemPerBlk: usize, flags: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Un-register host pointer"] - #[doc = ""] - #[doc = " @param[in] hostPtr Host pointer previously registered with #hipHostRegister"] - #[doc = " @return Error code"] - #[doc = ""] - #[doc = " @see hipHostRegister"] - pub fn hipHostUnregister(hostPtr: *mut ::std::os::raw::c_void) -> hipError_t; + #[must_use] + #[doc = " @brief determine the grid and block sizes to achieves maximum occupancy for a kernel\n\n @param [out] gridSize minimum grid size for maximum potential occupancy\n @param [out] blockSize block size for maximum potential occupancy\n @param [in] f kernel function for which occupancy is calulated\n @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block\n @param [in] blockSizeLimit the maximum block size for the kernel, use 0 for no limit\n\n Please note, HIP does not support kernel launch with total work items defined in dimension with\n size gridDim x blockDim >= 2^32.\n\n @returns #hipSuccess, #hipErrorInvalidValue"] + pub fn hipOccupancyMaxPotentialBlockSize( + gridSize: *mut ::std::os::raw::c_int, + blockSize: *mut ::std::os::raw::c_int, + f: *const ::std::os::raw::c_void, + dynSharedMemPerBlk: usize, + blockSizeLimit: ::std::os::raw::c_int, + ) -> hipError_t; } extern "C" { - #[doc = " Allocates at least width (in bytes) * height bytes of linear memory"] - #[doc = " Padding may occur to ensure alighnment requirements are met for the given row"] - #[doc = " The change in width size due to padding will be returned in *pitch."] - #[doc = " Currently the alignment is set to 128 bytes"] - #[doc = ""] - #[doc = " @param[out] ptr Pointer to the allocated device memory"] - #[doc = " @param[out] pitch Pitch for allocation (in bytes)"] - #[doc = " @param[in] width Requested pitched allocation width (in bytes)"] - #[doc = " @param[in] height Requested pitched allocation height"] - #[doc = ""] - #[doc = " If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned."] - #[doc = ""] - #[doc = " @return Error code"] - #[doc = ""] - #[doc = " @see hipMalloc, hipFree, hipMallocArray, hipFreeArray, hipHostFree, hipMalloc3D,"] - #[doc = " hipMalloc3DArray, hipHostMalloc"] - pub fn hipMallocPitch( - ptr: *mut *mut ::std::os::raw::c_void, - pitch: *mut usize, - width: usize, - height: usize, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Start recording of profiling information\n When using this API, start the profiler with profiling disabled. (--startdisabled)\n @returns #hipErrorNotSupported\n @warning : hipProfilerStart API is deprecated, use roctracer/rocTX instead."] + pub fn hipProfilerStart() -> hipError_t; } extern "C" { - #[doc = " Allocates at least width (in bytes) * height bytes of linear memory"] - #[doc = " Padding may occur to ensure alighnment requirements are met for the given row"] - #[doc = " The change in width size due to padding will be returned in *pitch."] - #[doc = " Currently the alignment is set to 128 bytes"] - #[doc = ""] - #[doc = " @param[out] dptr Pointer to the allocated device memory"] - #[doc = " @param[out] pitch Pitch for allocation (in bytes)"] - #[doc = " @param[in] width Requested pitched allocation width (in bytes)"] - #[doc = " @param[in] height Requested pitched allocation height"] - #[doc = ""] - #[doc = " If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned."] - #[doc = " The intended usage of pitch is as a separate parameter of the allocation, used to compute addresses within the 2D array."] - #[doc = " Given the row and column of an array element of type T, the address is computed as:"] - #[doc = " T* pElement = (T*)((char*)BaseAddress + Row * Pitch) + Column;"] - #[doc = ""] - #[doc = " @return Error code"] - #[doc = ""] - #[doc = " @see hipMalloc, hipFree, hipMallocArray, hipFreeArray, hipHostFree, hipMalloc3D,"] - #[doc = " hipMalloc3DArray, hipHostMalloc"] - pub fn hipMemAllocPitch( - dptr: *mut hipDeviceptr_t, - pitch: *mut usize, - widthInBytes: usize, - height: usize, - elementSizeBytes: ::std::os::raw::c_uint, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Stop recording of profiling information.\n When using this API, start the profiler with profiling disabled. (--startdisabled)\n @returns #hipErrorNotSupported\n @warning hipProfilerStart API is deprecated, use roctracer/rocTX instead."] + pub fn hipProfilerStop() -> hipError_t; } extern "C" { - #[doc = " @brief Free memory allocated by the hcc hip memory allocation API."] - #[doc = " This API performs an implicit hipDeviceSynchronize() call."] - #[doc = " If pointer is NULL, the hip runtime is initialized and hipSuccess is returned."] - #[doc = ""] - #[doc = " @param[in] ptr Pointer to memory to be freed"] - #[doc = " @return #hipSuccess"] - #[doc = " @return #hipErrorInvalidDevicePointer (if pointer is invalid, including host pointers allocated"] - #[doc = " with hipHostMalloc)"] - #[doc = ""] - #[doc = " @see hipMalloc, hipMallocPitch, hipMallocArray, hipFreeArray, hipHostFree, hipMalloc3D,"] - #[doc = " hipMalloc3DArray, hipHostMalloc"] - pub fn hipFree(ptr: *mut ::std::os::raw::c_void) -> hipError_t; + #[must_use] + #[doc = " @}\n/\n/**\n-------------------------------------------------------------------------------------------------\n-------------------------------------------------------------------------------------------------\n @defgroup Clang Launch API to support the triple-chevron syntax\n @{\n This section describes the API to support the triple-chevron syntax.\n/\n/**\n @brief Configure a kernel launch.\n\n @param [in] gridDim grid dimension specified as multiple of blockDim.\n @param [in] blockDim block dimensions specified in work-items\n @param [in] sharedMem Amount of dynamic shared memory to allocate for this kernel. The\n HIP-Clang compiler provides support for extern shared declarations.\n @param [in] stream Stream where the kernel should be dispatched. May be 0, in which case the\n default stream is used with associated synchronization rules.\n\n Please note, HIP does not support kernel launch with total work items defined in dimension with\n size gridDim x blockDim >= 2^32.\n\n @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue\n"] + pub fn hipConfigureCall( + gridDim: dim3, + blockDim: dim3, + sharedMem: usize, + stream: hipStream_t, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Free memory allocated by the hcc hip host memory allocation API. [Deprecated]"] - #[doc = ""] - #[doc = " @param[in] ptr Pointer to memory to be freed"] - #[doc = " @return #hipSuccess,"] - #[doc = " #hipErrorInvalidValue (if pointer is invalid, including device pointers allocated with"] - #[doc = "hipMalloc)"] - #[doc = " @deprecated use hipHostFree() instead"] - pub fn hipFreeHost(ptr: *mut ::std::os::raw::c_void) -> hipError_t; + #[must_use] + #[doc = " @brief Set a kernel argument.\n\n @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue\n\n @param [in] arg Pointer the argument in host memory.\n @param [in] size Size of the argument.\n @param [in] offset Offset of the argument on the argument stack.\n"] + pub fn hipSetupArgument( + arg: *const ::std::os::raw::c_void, + size: usize, + offset: usize, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Free memory allocated by the hcc hip host memory allocation API"] - #[doc = " This API performs an implicit hipDeviceSynchronize() call."] - #[doc = " If pointer is NULL, the hip runtime is initialized and hipSuccess is returned."] - #[doc = ""] - #[doc = " @param[in] ptr Pointer to memory to be freed"] - #[doc = " @return #hipSuccess,"] - #[doc = " #hipErrorInvalidValue (if pointer is invalid, including device pointers allocated with"] - #[doc = " hipMalloc)"] - #[doc = ""] - #[doc = " @see hipMalloc, hipMallocPitch, hipFree, hipMallocArray, hipFreeArray, hipMalloc3D,"] - #[doc = " hipMalloc3DArray, hipHostMalloc"] - pub fn hipHostFree(ptr: *mut ::std::os::raw::c_void) -> hipError_t; + #[must_use] + #[doc = " @brief Launch a kernel.\n\n @param [in] func Kernel to launch.\n\n @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue\n"] + pub fn hipLaunchByPtr(func: *const ::std::os::raw::c_void) -> hipError_t; } extern "C" { - #[doc = " @brief Copy data from src to dst."] - #[doc = ""] - #[doc = " It supports memory from host to device,"] - #[doc = " device to host, device to device and host to host"] - #[doc = " The src and dst must not overlap."] - #[doc = ""] - #[doc = " For hipMemcpy, the copy is always performed by the current device (set by hipSetDevice)."] - #[doc = " For multi-gpu or peer-to-peer configurations, it is recommended to set the current device to the"] - #[doc = " device where the src data is physically located. For optimal peer-to-peer copies, the copy device"] - #[doc = " must be able to access the src and dst pointers (by calling hipDeviceEnablePeerAccess with copy"] - #[doc = " agent as the current device and src/dest as the peerDevice argument. if this is not done, the"] - #[doc = " hipMemcpy will still work, but will perform the copy using a staging buffer on the host."] - #[doc = " Calling hipMemcpy with dst and src pointers that do not match the hipMemcpyKind results in"] - #[doc = " undefined behavior."] - #[doc = ""] - #[doc = " @param[out] dst Data being copy to"] - #[doc = " @param[in] src Data being copy from"] - #[doc = " @param[in] sizeBytes Data size in bytes"] - #[doc = " @param[in] copyType Memory copy type"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree, #hipErrorUnknowni"] - #[doc = ""] - #[doc = " @see hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost,"] - #[doc = " hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA,"] - #[doc = " hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD,"] - #[doc = " hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync,"] - #[doc = " hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo,"] - #[doc = " hipMemHostAlloc, hipMemHostGetDevicePointer"] - pub fn hipMemcpy( - dst: *mut ::std::os::raw::c_void, - src: *const ::std::os::raw::c_void, - sizeBytes: usize, - kind: hipMemcpyKind, + #[must_use] + #[doc = " @brief C compliant kernel launch API\n\n @param [in] function_address - kernel stub function pointer.\n @param [in] numBlocks - number of blocks\n @param [in] dimBlocks - dimension of a block\n @param [in] args - kernel arguments\n @param [in] sharedMemBytes - Amount of dynamic shared memory to allocate for this kernel. The\n HIP-Clang compiler provides support for extern shared declarations.\n @param [in] stream - Stream where the kernel should be dispatched. May be 0, in which case th\n default stream is used with associated synchronization rules.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipLaunchKernel( + function_address: *const ::std::os::raw::c_void, + numBlocks: dim3, + dimBlocks: dim3, + args: *mut *mut ::std::os::raw::c_void, + sharedMemBytes: usize, + stream: hipStream_t, ) -> hipError_t; } extern "C" { - pub fn hipMemcpyWithStream( - dst: *mut ::std::os::raw::c_void, - src: *const ::std::os::raw::c_void, - sizeBytes: usize, - kind: hipMemcpyKind, + #[must_use] + #[doc = " @brief Enqueues a host function call in a stream.\n\n @param [in] stream - stream to enqueue work to.\n @param [in] fn - function to call once operations enqueued preceeding are complete.\n @param [in] userData - User-specified data to be passed to the function.\n @returns #hipSuccess, #hipErrorInvalidResourceHandle, #hipErrorInvalidValue,\n #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipLaunchHostFunc( stream: hipStream_t, + fn_: hipHostFn_t, + userData: *mut ::std::os::raw::c_void, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copy data from Host to Device"] - #[doc = ""] - #[doc = " @param[out] dst Data being copy to"] - #[doc = " @param[in] src Data being copy from"] - #[doc = " @param[in] sizeBytes Data size in bytes"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorDeInitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,"] - #[doc = " #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost,"] - #[doc = " hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA,"] - #[doc = " hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD,"] - #[doc = " hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync,"] - #[doc = " hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo,"] - #[doc = " hipMemHostAlloc, hipMemHostGetDevicePointer"] - pub fn hipMemcpyHtoD( - dst: hipDeviceptr_t, - src: *mut ::std::os::raw::c_void, - sizeBytes: usize, + #[must_use] + #[doc = " Copies memory for 2D arrays.\n\n @param pCopy - Parameters for the memory copy\n\n @returns #hipSuccess, #hipErrorInvalidValue"] + pub fn hipDrvMemcpy2DUnaligned(pCopy: *const hip_Memcpy2D) -> hipError_t; +} +extern "C" { + #[must_use] + #[doc = " @brief Launches kernel from the pointer address, with arguments and shared memory on stream.\n\n @param [in] function_address pointer to the Kernel to launch.\n @param [in] numBlocks number of blocks.\n @param [in] dimBlocks dimension of a block.\n @param [in] args pointer to kernel arguments.\n @param [in] sharedMemBytes Amount of dynamic shared memory to allocate for this kernel.\n HIP-Clang compiler provides support for extern shared declarations.\n @param [in] stream Stream where the kernel should be dispatched.\n May be 0, in which case the default stream is used with associated synchronization rules.\n @param [in] startEvent If non-null, specified event will be updated to track the start time of\n the kernel launch. The event must be created before calling this API.\n @param [in] stopEvent If non-null, specified event will be updated to track the stop time of\n the kernel launch. The event must be created before calling this API.\n @param [in] flags The value of hipExtAnyOrderLaunch, signifies if kernel can be\n launched in any order.\n @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue.\n"] + pub fn hipExtLaunchKernel( + function_address: *const ::std::os::raw::c_void, + numBlocks: dim3, + dimBlocks: dim3, + args: *mut *mut ::std::os::raw::c_void, + sharedMemBytes: usize, + stream: hipStream_t, + startEvent: hipEvent_t, + stopEvent: hipEvent_t, + flags: ::std::os::raw::c_int, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copy data from Device to Host"] - #[doc = ""] - #[doc = " @param[out] dst Data being copy to"] - #[doc = " @param[in] src Data being copy from"] - #[doc = " @param[in] sizeBytes Data size in bytes"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorDeInitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,"] - #[doc = " #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost,"] - #[doc = " hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA,"] - #[doc = " hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD,"] - #[doc = " hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync,"] - #[doc = " hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo,"] - #[doc = " hipMemHostAlloc, hipMemHostGetDevicePointer"] - pub fn hipMemcpyDtoH( - dst: *mut ::std::os::raw::c_void, - src: hipDeviceptr_t, - sizeBytes: usize, + #[must_use] + #[doc = " @brief Creates a texture object.\n\n @param [out] pTexObject pointer to the texture object to create\n @param [in] pResDesc pointer to resource descriptor\n @param [in] pTexDesc pointer to texture descriptor\n @param [in] pResViewDesc pointer to resource view descriptor\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported, #hipErrorOutOfMemory\n\n @note 3D liner filter isn't supported on GFX90A boards, on which the API @p hipCreateTextureObject will\n return hipErrorNotSupported.\n"] + pub fn hipCreateTextureObject( + pTexObject: *mut hipTextureObject_t, + pResDesc: *const hipResourceDesc, + pTexDesc: *const hipTextureDesc, + pResViewDesc: *const hipResourceViewDesc, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copy data from Device to Device"] - #[doc = ""] - #[doc = " @param[out] dst Data being copy to"] - #[doc = " @param[in] src Data being copy from"] - #[doc = " @param[in] sizeBytes Data size in bytes"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorDeInitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,"] - #[doc = " #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost,"] - #[doc = " hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA,"] - #[doc = " hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD,"] - #[doc = " hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync,"] - #[doc = " hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo,"] - #[doc = " hipMemHostAlloc, hipMemHostGetDevicePointer"] - pub fn hipMemcpyDtoD(dst: hipDeviceptr_t, src: hipDeviceptr_t, sizeBytes: usize) -> hipError_t; + #[must_use] + #[doc = " @brief Destroys a texture object.\n\n @param [in] textureObject texture object to destroy\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipDestroyTextureObject(textureObject: hipTextureObject_t) -> hipError_t; } extern "C" { - #[doc = " @brief Copy data from Host to Device asynchronously"] - #[doc = ""] - #[doc = " @param[out] dst Data being copy to"] - #[doc = " @param[in] src Data being copy from"] - #[doc = " @param[in] sizeBytes Data size in bytes"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorDeInitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,"] - #[doc = " #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost,"] - #[doc = " hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA,"] - #[doc = " hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD,"] - #[doc = " hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync,"] - #[doc = " hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo,"] - #[doc = " hipMemHostAlloc, hipMemHostGetDevicePointer"] - pub fn hipMemcpyHtoDAsync( - dst: hipDeviceptr_t, - src: *mut ::std::os::raw::c_void, - sizeBytes: usize, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Gets the channel descriptor in an array.\n\n @param [in] desc pointer to channel format descriptor\n @param [out] array memory array on the device\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipGetChannelDesc( + desc: *mut hipChannelFormatDesc, + array: hipArray_const_t, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copy data from Device to Host asynchronously"] - #[doc = ""] - #[doc = " @param[out] dst Data being copy to"] - #[doc = " @param[in] src Data being copy from"] - #[doc = " @param[in] sizeBytes Data size in bytes"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorDeInitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,"] - #[doc = " #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost,"] - #[doc = " hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA,"] - #[doc = " hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD,"] - #[doc = " hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync,"] - #[doc = " hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo,"] - #[doc = " hipMemHostAlloc, hipMemHostGetDevicePointer"] - pub fn hipMemcpyDtoHAsync( - dst: *mut ::std::os::raw::c_void, - src: hipDeviceptr_t, - sizeBytes: usize, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Gets resource descriptor for the texture object.\n\n @param [out] pResDesc pointer to resource descriptor\n @param [in] textureObject texture object\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipGetTextureObjectResourceDesc( + pResDesc: *mut hipResourceDesc, + textureObject: hipTextureObject_t, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copy data from Device to Device asynchronously"] - #[doc = ""] - #[doc = " @param[out] dst Data being copy to"] - #[doc = " @param[in] src Data being copy from"] - #[doc = " @param[in] sizeBytes Data size in bytes"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorDeInitialized, #hipErrorNotInitialized, #hipErrorInvalidContext,"] - #[doc = " #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see hipArrayCreate, hipArrayDestroy, hipArrayGetDescriptor, hipMemAlloc, hipMemAllocHost,"] - #[doc = " hipMemAllocPitch, hipMemcpy2D, hipMemcpy2DAsync, hipMemcpy2DUnaligned, hipMemcpyAtoA,"] - #[doc = " hipMemcpyAtoD, hipMemcpyAtoH, hipMemcpyAtoHAsync, hipMemcpyDtoA, hipMemcpyDtoD,"] - #[doc = " hipMemcpyDtoDAsync, hipMemcpyDtoH, hipMemcpyDtoHAsync, hipMemcpyHtoA, hipMemcpyHtoAAsync,"] - #[doc = " hipMemcpyHtoDAsync, hipMemFree, hipMemFreeHost, hipMemGetAddressRange, hipMemGetInfo,"] - #[doc = " hipMemHostAlloc, hipMemHostGetDevicePointer"] - pub fn hipMemcpyDtoDAsync( - dst: hipDeviceptr_t, - src: hipDeviceptr_t, - sizeBytes: usize, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Gets resource view descriptor for the texture object.\n\n @param [out] pResViewDesc pointer to resource view descriptor\n @param [in] textureObject texture object\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipGetTextureObjectResourceViewDesc( + pResViewDesc: *mut hipResourceViewDesc, + textureObject: hipTextureObject_t, ) -> hipError_t; } extern "C" { - #[doc = " @brief Returns a global pointer from a module."] - #[doc = " Returns in *dptr and *bytes the pointer and size of the global of name name located in module hmod."] - #[doc = " If no variable of that name exists, it returns hipErrorNotFound. Both parameters dptr and bytes are optional."] - #[doc = " If one of them is NULL, it is ignored and hipSuccess is returned."] - #[doc = ""] - #[doc = " @param[out] dptr Returned global device pointer"] - #[doc = " @param[out] bytes Returned global size in bytes"] - #[doc = " @param[in] hmod Module to retrieve global from"] - #[doc = " @param[in] name Name of global to retrieve"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotFound, #hipErrorInvalidContext"] - #[doc = ""] - pub fn hipModuleGetGlobal( - dptr: *mut hipDeviceptr_t, - bytes: *mut usize, - hmod: hipModule_t, - name: *const ::std::os::raw::c_char, + #[must_use] + #[doc = " @brief Gets texture descriptor for the texture object.\n\n @param [out] pTexDesc pointer to texture descriptor\n @param [in] textureObject texture object\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipGetTextureObjectTextureDesc( + pTexDesc: *mut hipTextureDesc, + textureObject: hipTextureObject_t, ) -> hipError_t; } extern "C" { - pub fn hipGetSymbolAddress( - devPtr: *mut *mut ::std::os::raw::c_void, - symbol: *const ::std::os::raw::c_void, + #[must_use] + #[doc = " @brief Creates a texture object.\n\n @param [out] pTexObject pointer to texture object to create\n @param [in] pResDesc pointer to resource descriptor\n @param [in] pTexDesc pointer to texture descriptor\n @param [in] pResViewDesc pointer to resource view descriptor\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipTexObjectCreate( + pTexObject: *mut hipTextureObject_t, + pResDesc: *const HIP_RESOURCE_DESC, + pTexDesc: *const HIP_TEXTURE_DESC, + pResViewDesc: *const HIP_RESOURCE_VIEW_DESC, ) -> hipError_t; } extern "C" { - pub fn hipGetSymbolSize(size: *mut usize, symbol: *const ::std::os::raw::c_void) -> hipError_t; + #[must_use] + #[doc = " @brief Destroys a texture object.\n\n @param [in] texObject texture object to destroy\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipTexObjectDestroy(texObject: hipTextureObject_t) -> hipError_t; } extern "C" { - pub fn hipMemcpyToSymbol( - symbol: *const ::std::os::raw::c_void, - src: *const ::std::os::raw::c_void, - sizeBytes: usize, - offset: usize, - kind: hipMemcpyKind, + #[must_use] + #[doc = " @brief Gets resource descriptor of a texture object.\n\n @param [out] pResDesc pointer to resource descriptor\n @param [in] texObject texture object\n\n @returns #hipSuccess, #hipErrorNotSupported, #hipErrorInvalidValue\n"] + pub fn hipTexObjectGetResourceDesc( + pResDesc: *mut HIP_RESOURCE_DESC, + texObject: hipTextureObject_t, ) -> hipError_t; } extern "C" { - pub fn hipMemcpyToSymbolAsync( - symbol: *const ::std::os::raw::c_void, - src: *const ::std::os::raw::c_void, - sizeBytes: usize, - offset: usize, - kind: hipMemcpyKind, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Gets resource view descriptor of a texture object.\n\n @param [out] pResViewDesc pointer to resource view descriptor\n @param [in] texObject texture object\n\n @returns #hipSuccess, #hipErrorNotSupported, #hipErrorInvalidValue\n"] + pub fn hipTexObjectGetResourceViewDesc( + pResViewDesc: *mut HIP_RESOURCE_VIEW_DESC, + texObject: hipTextureObject_t, ) -> hipError_t; } extern "C" { - pub fn hipMemcpyFromSymbol( - dst: *mut ::std::os::raw::c_void, - symbol: *const ::std::os::raw::c_void, - sizeBytes: usize, - offset: usize, - kind: hipMemcpyKind, + #[must_use] + #[doc = " @brief Gets texture descriptor of a texture object.\n\n @param [out] pTexDesc pointer to texture descriptor\n @param [in] texObject texture object\n\n @returns #hipSuccess, #hipErrorNotSupported, #hipErrorInvalidValue\n"] + pub fn hipTexObjectGetTextureDesc( + pTexDesc: *mut HIP_TEXTURE_DESC, + texObject: hipTextureObject_t, ) -> hipError_t; } extern "C" { - pub fn hipMemcpyFromSymbolAsync( - dst: *mut ::std::os::raw::c_void, - symbol: *const ::std::os::raw::c_void, - sizeBytes: usize, - offset: usize, - kind: hipMemcpyKind, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Allocate a mipmapped array on the device.\n\n @param[out] mipmappedArray - Pointer to allocated mipmapped array in device memory\n @param[in] desc - Requested channel format\n @param[in] extent - Requested allocation size (width field in elements)\n @param[in] numLevels - Number of mipmap levels to allocate\n @param[in] flags - Flags for extensions\n\n @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryAllocation\n\n @note This API is implemented on Windows, under development on Linux.\n"] + pub fn hipMallocMipmappedArray( + mipmappedArray: *mut hipMipmappedArray_t, + desc: *const hipChannelFormatDesc, + extent: hipExtent, + numLevels: ::std::os::raw::c_uint, + flags: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copy data from src to dst asynchronously."] - #[doc = ""] - #[doc = " @warning If host or dest are not pinned, the memory copy will be performed synchronously. For"] - #[doc = " best performance, use hipHostMalloc to allocate host memory that is transferred asynchronously."] - #[doc = ""] - #[doc = " @warning on HCC hipMemcpyAsync does not support overlapped H2D and D2H copies."] - #[doc = " For hipMemcpy, the copy is always performed by the device associated with the specified stream."] - #[doc = ""] - #[doc = " For multi-gpu or peer-to-peer configurations, it is recommended to use a stream which is a"] - #[doc = " attached to the device where the src data is physically located. For optimal peer-to-peer copies,"] - #[doc = " the copy device must be able to access the src and dst pointers (by calling"] - #[doc = " hipDeviceEnablePeerAccess with copy agent as the current device and src/dest as the peerDevice"] - #[doc = " argument. if this is not done, the hipMemcpy will still work, but will perform the copy using a"] - #[doc = " staging buffer on the host."] - #[doc = ""] - #[doc = " @param[out] dst Data being copy to"] - #[doc = " @param[in] src Data being copy from"] - #[doc = " @param[in] sizeBytes Data size in bytes"] - #[doc = " @param[in] accelerator_view Accelerator view which the copy is being enqueued"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree, #hipErrorUnknown"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpy2D, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray,"] - #[doc = " hipMemcpy2DFromArray, hipMemcpyArrayToArray, hipMemcpy2DArrayToArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyFromSymbol, hipMemcpy2DAsync, hipMemcpyToArrayAsync, hipMemcpy2DToArrayAsync,"] - #[doc = " hipMemcpyFromArrayAsync, hipMemcpy2DFromArrayAsync, hipMemcpyToSymbolAsync,"] - #[doc = " hipMemcpyFromSymbolAsync"] - pub fn hipMemcpyAsync( - dst: *mut ::std::os::raw::c_void, - src: *const ::std::os::raw::c_void, - sizeBytes: usize, - kind: hipMemcpyKind, - stream: hipStream_t, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Frees a mipmapped array on the device.\n\n @param[in] mipmappedArray - Pointer to mipmapped array to free\n\n @return #hipSuccess, #hipErrorInvalidValue\n\n @note This API is implemented on Windows, under development on Linux.\n"] + pub fn hipFreeMipmappedArray(mipmappedArray: hipMipmappedArray_t) -> hipError_t; } extern "C" { - #[doc = " @brief Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant"] - #[doc = " byte value value."] - #[doc = ""] - #[doc = " @param[out] dst Data being filled"] - #[doc = " @param[in] constant value to be set"] - #[doc = " @param[in] sizeBytes Data size in bytes"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] - pub fn hipMemset( - dst: *mut ::std::os::raw::c_void, - value: ::std::os::raw::c_int, - sizeBytes: usize, + #[must_use] + #[doc = " @brief Gets a mipmap level of a HIP mipmapped array.\n\n @param[out] levelArray - Returned mipmap level HIP array\n @param[in] mipmappedArray - HIP mipmapped array\n @param[in] level - Mipmap level\n\n @return #hipSuccess, #hipErrorInvalidValue\n\n @note This API is implemented on Windows, under development on Linux.\n"] + pub fn hipGetMipmappedArrayLevel( + levelArray: *mut hipArray_t, + mipmappedArray: hipMipmappedArray_const_t, + level: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant"] - #[doc = " byte value value."] - #[doc = ""] - #[doc = " @param[out] dst Data ptr to be filled"] - #[doc = " @param[in] constant value to be set"] - #[doc = " @param[in] number of values to be set"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] - pub fn hipMemsetD8( - dest: hipDeviceptr_t, - value: ::std::os::raw::c_uchar, - count: usize, + #[must_use] + #[doc = " @brief Create a mipmapped array.\n\n @param [out] pHandle pointer to mipmapped array\n @param [in] pMipmappedArrayDesc mipmapped array descriptor\n @param [in] numMipmapLevels mipmap level\n\n @returns #hipSuccess, #hipErrorNotSupported, #hipErrorInvalidValue\n\n @note This API is implemented on Windows, under development on Linux."] + pub fn hipMipmappedArrayCreate( + pHandle: *mut hipMipmappedArray_t, + pMipmappedArrayDesc: *mut HIP_ARRAY3D_DESCRIPTOR, + numMipmapLevels: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant"] - #[doc = " byte value value."] - #[doc = ""] - #[doc = " hipMemsetD8Async() is asynchronous with respect to the host, so the call may return before the"] - #[doc = " memset is complete. The operation can optionally be associated to a stream by passing a non-zero"] - #[doc = " stream argument. If stream is non-zero, the operation may overlap with operations in other"] - #[doc = " streams."] - #[doc = ""] - #[doc = " @param[out] dst Data ptr to be filled"] - #[doc = " @param[in] constant value to be set"] - #[doc = " @param[in] number of values to be set"] - #[doc = " @param[in] stream - Stream identifier"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] - pub fn hipMemsetD8Async( - dest: hipDeviceptr_t, - value: ::std::os::raw::c_uchar, - count: usize, - stream: hipStream_t, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Destroy a mipmapped array.\n\n @param [out] hMipmappedArray pointer to mipmapped array to destroy\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @note This API is implemented on Windows, under development on Linux.\n"] + pub fn hipMipmappedArrayDestroy(hMipmappedArray: hipMipmappedArray_t) -> hipError_t; } extern "C" { - #[doc = " @brief Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant"] - #[doc = " short value value."] - #[doc = ""] - #[doc = " @param[out] dst Data ptr to be filled"] - #[doc = " @param[in] constant value to be set"] - #[doc = " @param[in] number of values to be set"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] - pub fn hipMemsetD16( - dest: hipDeviceptr_t, - value: ::std::os::raw::c_ushort, - count: usize, + #[must_use] + #[doc = " @brief Get a mipmapped array on a mipmapped level.\n\n @param [in] pLevelArray Pointer of array\n @param [out] hMipMappedArray Pointer of mipmapped array on the requested mipmap level\n @param [out] level Mipmap level\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @note This API is implemented on Windows, under development on Linux.\n"] + pub fn hipMipmappedArrayGetLevel( + pLevelArray: *mut hipArray_t, + hMipMappedArray: hipMipmappedArray_t, + level: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant"] - #[doc = " short value value."] - #[doc = ""] - #[doc = " hipMemsetD16Async() is asynchronous with respect to the host, so the call may return before the"] - #[doc = " memset is complete. The operation can optionally be associated to a stream by passing a non-zero"] - #[doc = " stream argument. If stream is non-zero, the operation may overlap with operations in other"] - #[doc = " streams."] - #[doc = ""] - #[doc = " @param[out] dst Data ptr to be filled"] - #[doc = " @param[in] constant value to be set"] - #[doc = " @param[in] number of values to be set"] - #[doc = " @param[in] stream - Stream identifier"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] - pub fn hipMemsetD16Async( - dest: hipDeviceptr_t, - value: ::std::os::raw::c_ushort, - count: usize, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Binds a mipmapped array to a texture.\n\n @param [in] tex pointer to the texture reference to bind\n @param [in] mipmappedArray memory mipmapped array on the device\n @param [in] desc opointer to the channel format\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipBindTextureToMipmappedArray( + tex: *const textureReference, + mipmappedArray: hipMipmappedArray_const_t, + desc: *const hipChannelFormatDesc, ) -> hipError_t; } extern "C" { - #[doc = " @brief Fills the memory area pointed to by dest with the constant integer"] - #[doc = " value for specified number of times."] - #[doc = ""] - #[doc = " @param[out] dst Data being filled"] - #[doc = " @param[in] constant value to be set"] - #[doc = " @param[in] number of values to be set"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] - pub fn hipMemsetD32( - dest: hipDeviceptr_t, - value: ::std::os::raw::c_int, - count: usize, + #[must_use] + #[doc = " @brief Gets the texture reference related with the symbol.\n\n @param [out] texref texture reference\n @param [in] symbol pointer to the symbol related with the texture for the reference\n\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning This API is deprecated.\n"] + pub fn hipGetTextureReference( + texref: *mut *const textureReference, + symbol: *const ::std::os::raw::c_void, ) -> hipError_t; } extern "C" { - #[doc = " @brief Fills the first sizeBytes bytes of the memory area pointed to by dev with the constant"] - #[doc = " byte value value."] - #[doc = ""] - #[doc = " hipMemsetAsync() is asynchronous with respect to the host, so the call may return before the"] - #[doc = " memset is complete. The operation can optionally be associated to a stream by passing a non-zero"] - #[doc = " stream argument. If stream is non-zero, the operation may overlap with operations in other"] - #[doc = " streams."] - #[doc = ""] - #[doc = " @param[out] dst Pointer to device memory"] - #[doc = " @param[in] value - Value to set for each byte of specified memory"] - #[doc = " @param[in] sizeBytes - Size in bytes to set"] - #[doc = " @param[in] stream - Stream identifier"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree"] - pub fn hipMemsetAsync( - dst: *mut ::std::os::raw::c_void, - value: ::std::os::raw::c_int, - sizeBytes: usize, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Gets the border color used by a texture reference.\n\n @param [out] pBorderColor Returned Type and Value of RGBA color.\n @param [in] texRef Texture reference.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning This API is deprecated.\n"] + pub fn hipTexRefGetBorderColor( + pBorderColor: *mut f32, + texRef: *const textureReference, ) -> hipError_t; } extern "C" { - #[doc = " @brief Fills the memory area pointed to by dev with the constant integer"] - #[doc = " value for specified number of times."] - #[doc = ""] - #[doc = " hipMemsetD32Async() is asynchronous with respect to the host, so the call may return before the"] - #[doc = " memset is complete. The operation can optionally be associated to a stream by passing a non-zero"] - #[doc = " stream argument. If stream is non-zero, the operation may overlap with operations in other"] - #[doc = " streams."] - #[doc = ""] - #[doc = " @param[out] dst Pointer to device memory"] - #[doc = " @param[in] value - Value to set for each byte of specified memory"] - #[doc = " @param[in] count - number of values to be set"] - #[doc = " @param[in] stream - Stream identifier"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree"] - pub fn hipMemsetD32Async( - dst: hipDeviceptr_t, - value: ::std::os::raw::c_int, - count: usize, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Gets the array bound to a texture reference.\n\n\n @param [in] pArray Returned array.\n @param [in] texRef texture reference.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning This API is deprecated.\n"] + pub fn hipTexRefGetArray( + pArray: *mut hipArray_t, + texRef: *const textureReference, ) -> hipError_t; } extern "C" { - #[doc = " @brief Fills the memory area pointed to by dst with the constant value."] - #[doc = ""] - #[doc = " @param[out] dst Pointer to device memory"] - #[doc = " @param[in] pitch - data size in bytes"] - #[doc = " @param[in] value - constant value to be set"] - #[doc = " @param[in] width"] - #[doc = " @param[in] height"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree"] - pub fn hipMemset2D( - dst: *mut ::std::os::raw::c_void, - pitch: usize, - value: ::std::os::raw::c_int, - width: usize, - height: usize, + #[must_use] + #[doc = " @brief Sets address mode for a texture reference.\n\n @param [in] texRef texture reference.\n @param [in] dim Dimension of the texture.\n @param [in] am Value of the texture address mode.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning This API is deprecated.\n"] + pub fn hipTexRefSetAddressMode( + texRef: *mut textureReference, + dim: ::std::os::raw::c_int, + am: hipTextureAddressMode, ) -> hipError_t; } extern "C" { - #[doc = " @brief Fills asynchronously the memory area pointed to by dst with the constant value."] - #[doc = ""] - #[doc = " @param[in] dst Pointer to device memory"] - #[doc = " @param[in] pitch - data size in bytes"] - #[doc = " @param[in] value - constant value to be set"] - #[doc = " @param[in] width"] - #[doc = " @param[in] height"] - #[doc = " @param[in] stream"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree"] - pub fn hipMemset2DAsync( - dst: *mut ::std::os::raw::c_void, - pitch: usize, - value: ::std::os::raw::c_int, - width: usize, - height: usize, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Binds an array as a texture reference.\n\n @param [in] tex Pointer texture reference.\n @param [in] array Array to bind.\n @param [in] flags Flags should be set as HIP_TRSA_OVERRIDE_FORMAT, as a valid value.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefSetArray( + tex: *mut textureReference, + array: hipArray_const_t, + flags: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Fills synchronously the memory area pointed to by pitchedDevPtr with the constant value."] - #[doc = ""] - #[doc = " @param[in] pitchedDevPtr"] - #[doc = " @param[in] value - constant value to be set"] - #[doc = " @param[in] extent"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree"] - pub fn hipMemset3D( - pitchedDevPtr: hipPitchedPtr, - value: ::std::os::raw::c_int, - extent: hipExtent, + #[must_use] + #[doc = " @brief Set filter mode for a texture reference.\n\n @param [in] texRef Pointer texture reference.\n @param [in] fm Value of texture filter mode.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefSetFilterMode( + texRef: *mut textureReference, + fm: hipTextureFilterMode, ) -> hipError_t; } extern "C" { - #[doc = " @brief Fills asynchronously the memory area pointed to by pitchedDevPtr with the constant value."] - #[doc = ""] - #[doc = " @param[in] pitchedDevPtr"] - #[doc = " @param[in] value - constant value to be set"] - #[doc = " @param[in] extent"] - #[doc = " @param[in] stream"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree"] - pub fn hipMemset3DAsync( - pitchedDevPtr: hipPitchedPtr, - value: ::std::os::raw::c_int, - extent: hipExtent, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Set flags for a texture reference.\n\n @param [in] texRef Pointer texture reference.\n @param [in] Flags Value of flags.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefSetFlags( + texRef: *mut textureReference, + Flags: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Query memory info."] - #[doc = " Return snapshot of free memory, and total allocatable memory on the device."] - #[doc = ""] - #[doc = " Returns in *free a snapshot of the current free memory."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue"] - #[doc = " @warning On HCC, the free memory only accounts for memory allocated by this process and may be"] - #[doc = "optimistic."] - pub fn hipMemGetInfo(free: *mut usize, total: *mut usize) -> hipError_t; + #[must_use] + #[doc = " @brief Set format for a texture reference.\n\n @param [in] texRef Pointer texture reference.\n @param [in] fmt Value of format.\n @param [in] NumPackedComponents Number of components per array.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefSetFormat( + texRef: *mut textureReference, + fmt: hipArray_Format, + NumPackedComponents: ::std::os::raw::c_int, + ) -> hipError_t; } extern "C" { - pub fn hipMemPtrGetInfo(ptr: *mut ::std::os::raw::c_void, size: *mut usize) -> hipError_t; + #[must_use] + #[doc = " @brief Binds a memory area to a texture.\n\n @param [in] offset Offset in bytes.\n @param [in] tex Texture to bind.\n @param [in] devPtr Pointer of memory on the device.\n @param [in] desc Pointer of channel format descriptor.\n @param [in] size Size of memory in bites.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipBindTexture( + offset: *mut usize, + tex: *const textureReference, + devPtr: *const ::std::os::raw::c_void, + desc: *const hipChannelFormatDesc, + size: usize, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Allocate an array on the device."] - #[doc = ""] - #[doc = " @param[out] array Pointer to allocated array in device memory"] - #[doc = " @param[in] desc Requested channel format"] - #[doc = " @param[in] width Requested array allocation width"] - #[doc = " @param[in] height Requested array allocation height"] - #[doc = " @param[in] flags Requested properties of allocated array"] - #[doc = " @return #hipSuccess, #hipErrorOutOfMemory"] - #[doc = ""] - #[doc = " @see hipMalloc, hipMallocPitch, hipFree, hipFreeArray, hipHostMalloc, hipHostFree"] - pub fn hipMallocArray( - array: *mut *mut hipArray, + #[must_use] + #[doc = " @brief Binds a 2D memory area to a texture.\n\n @param [in] offset Offset in bytes.\n @param [in] tex Texture to bind.\n @param [in] devPtr Pointer of 2D memory area on the device.\n @param [in] desc Pointer of channel format descriptor.\n @param [in] width Width in texel units.\n @param [in] height Height in texel units.\n @param [in] pitch Pitch in bytes.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipBindTexture2D( + offset: *mut usize, + tex: *const textureReference, + devPtr: *const ::std::os::raw::c_void, desc: *const hipChannelFormatDesc, width: usize, height: usize, - flags: ::std::os::raw::c_uint, + pitch: usize, ) -> hipError_t; } extern "C" { - pub fn hipArrayCreate( - pHandle: *mut *mut hipArray, - pAllocateArray: *const HIP_ARRAY_DESCRIPTOR, + #[must_use] + #[doc = " @brief Binds a memory area to a texture.\n\n @param [in] tex Pointer of texture reference.\n @param [in] array Array to bind.\n @param [in] desc Pointer of channel format descriptor.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipBindTextureToArray( + tex: *const textureReference, + array: hipArray_const_t, + desc: *const hipChannelFormatDesc, ) -> hipError_t; } extern "C" { - pub fn hipArrayDestroy(array: *mut hipArray) -> hipError_t; -} -extern "C" { - pub fn hipArray3DCreate( - array: *mut *mut hipArray, - pAllocateArray: *const HIP_ARRAY3D_DESCRIPTOR, + #[must_use] + #[doc = " @brief Get the offset of the alignment in a texture.\n\n @param [in] offset Offset in bytes.\n @param [in] texref Pointer of texture reference.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipGetTextureAlignmentOffset( + offset: *mut usize, + texref: *const textureReference, ) -> hipError_t; } extern "C" { - pub fn hipMalloc3D(pitchedDevPtr: *mut hipPitchedPtr, extent: hipExtent) -> hipError_t; + #[must_use] + #[doc = " @brief Unbinds a texture.\n\n @param [in] tex Texture to unbind.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipUnbindTexture(tex: *const textureReference) -> hipError_t; } extern "C" { - #[doc = " @brief Frees an array on the device."] - #[doc = ""] - #[doc = " @param[in] array Pointer to array to free"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized"] - #[doc = ""] - #[doc = " @see hipMalloc, hipMallocPitch, hipFree, hipMallocArray, hipHostMalloc, hipHostFree"] - pub fn hipFreeArray(array: *mut hipArray) -> hipError_t; + #[must_use] + #[doc = " @brief Gets the the address for a texture reference.\n\n @param [out] dev_ptr Pointer of device address.\n @param [in] texRef Pointer of texture reference.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefGetAddress( + dev_ptr: *mut hipDeviceptr_t, + texRef: *const textureReference, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Frees a mipmapped array on the device"] - #[doc = ""] - #[doc = " @param[in] mipmappedArray - Pointer to mipmapped array to free"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue"] - pub fn hipFreeMipmappedArray(mipmappedArray: hipMipmappedArray_t) -> hipError_t; + #[must_use] + #[doc = " @brief Gets the address mode for a texture reference.\n\n @param [out] pam Pointer of address mode.\n @param [in] texRef Pointer of texture reference.\n @param [in] dim Dimension.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefGetAddressMode( + pam: *mut hipTextureAddressMode, + texRef: *const textureReference, + dim: ::std::os::raw::c_int, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Allocate an array on the device."] - #[doc = ""] - #[doc = " @param[out] array Pointer to allocated array in device memory"] - #[doc = " @param[in] desc Requested channel format"] - #[doc = " @param[in] extent Requested array allocation width, height and depth"] - #[doc = " @param[in] flags Requested properties of allocated array"] - #[doc = " @return #hipSuccess, #hipErrorOutOfMemory"] - #[doc = ""] - #[doc = " @see hipMalloc, hipMallocPitch, hipFree, hipFreeArray, hipHostMalloc, hipHostFree"] - pub fn hipMalloc3DArray( - array: *mut *mut hipArray, - desc: *const hipChannelFormatDesc, - extent: hipExtent, - flags: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief Gets filter mode for a texture reference.\n\n @param [out] pfm Pointer of filter mode.\n @param [in] texRef Pointer of texture reference.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefGetFilterMode( + pfm: *mut hipTextureFilterMode, + texRef: *const textureReference, ) -> hipError_t; } extern "C" { - #[doc = " @brief Allocate a mipmapped array on the device"] - #[doc = ""] - #[doc = " @param[out] mipmappedArray - Pointer to allocated mipmapped array in device memory"] - #[doc = " @param[in] desc - Requested channel format"] - #[doc = " @param[in] extent - Requested allocation size (width field in elements)"] - #[doc = " @param[in] numLevels - Number of mipmap levels to allocate"] - #[doc = " @param[in] flags - Flags for extensions"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryAllocation"] - pub fn hipMallocMipmappedArray( - mipmappedArray: *mut hipMipmappedArray_t, - desc: *const hipChannelFormatDesc, - extent: hipExtent, - numLevels: ::std::os::raw::c_uint, - flags: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief Gets flags for a texture reference.\n\n @param [out] pFlags Pointer of flags.\n @param [in] texRef Pointer of texture reference.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefGetFlags( + pFlags: *mut ::std::os::raw::c_uint, + texRef: *const textureReference, ) -> hipError_t; } extern "C" { - #[doc = " @brief Gets a mipmap level of a HIP mipmapped array"] - #[doc = ""] - #[doc = " @param[out] levelArray - Returned mipmap level HIP array"] - #[doc = " @param[in] mipmappedArray - HIP mipmapped array"] - #[doc = " @param[in] level - Mipmap level"] - #[doc = ""] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue"] - pub fn hipGetMipmappedArrayLevel( - levelArray: *mut hipArray_t, - mipmappedArray: hipMipmappedArray_const_t, - level: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief Gets texture format for a texture reference.\n\n @param [out] pFormat Pointer of the format.\n @param [out] pNumChannels Pointer of number of channels.\n @param [in] texRef Pointer of texture reference.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefGetFormat( + pFormat: *mut hipArray_Format, + pNumChannels: *mut ::std::os::raw::c_int, + texRef: *const textureReference, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies data between host and device."] - #[doc = ""] - #[doc = " @param[in] dst Destination memory address"] - #[doc = " @param[in] dpitch Pitch of destination memory"] - #[doc = " @param[in] src Source memory address"] - #[doc = " @param[in] spitch Pitch of source memory"] - #[doc = " @param[in] width Width of matrix transfer (columns in bytes)"] - #[doc = " @param[in] height Height of matrix transfer (rows)"] - #[doc = " @param[in] kind Type of transfer"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyAsync"] - pub fn hipMemcpy2D( - dst: *mut ::std::os::raw::c_void, - dpitch: usize, - src: *const ::std::os::raw::c_void, - spitch: usize, - width: usize, - height: usize, - kind: hipMemcpyKind, + #[must_use] + #[doc = " @brief Gets the maximum anisotropy for a texture reference.\n\n @param [out] pmaxAnsio Pointer of the maximum anisotropy.\n @param [in] texRef Pointer of texture reference.\n\n @returns #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefGetMaxAnisotropy( + pmaxAnsio: *mut ::std::os::raw::c_int, + texRef: *const textureReference, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies memory for 2D arrays."] - #[doc = " @param[in] pCopy Parameters for the memory copy"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpy2D, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray,"] - #[doc = " hipMemcpyToSymbol, hipMemcpyAsync"] - pub fn hipMemcpyParam2D(pCopy: *const hip_Memcpy2D) -> hipError_t; + #[must_use] + #[doc = " @brief Gets the mipmap filter mode for a texture reference.\n\n @param [out] pfm Pointer of the mipmap filter mode.\n @param [in] texRef Pointer of texture reference.\n\n @returns #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefGetMipmapFilterMode( + pfm: *mut hipTextureFilterMode, + texRef: *const textureReference, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies memory for 2D arrays."] - #[doc = " @param[in] pCopy Parameters for the memory copy"] - #[doc = " @param[in] stream Stream to use"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpy2D, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray,"] - #[doc = " hipMemcpyToSymbol, hipMemcpyAsync"] - pub fn hipMemcpyParam2DAsync(pCopy: *const hip_Memcpy2D, stream: hipStream_t) -> hipError_t; + #[must_use] + #[doc = " @brief Gets the mipmap level bias for a texture reference.\n\n @param [out] pbias Pointer of the mipmap level bias.\n @param [in] texRef Pointer of texture reference.\n\n @returns #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefGetMipmapLevelBias( + pbias: *mut f32, + texRef: *const textureReference, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies data between host and device."] - #[doc = ""] - #[doc = " @param[in] dst Destination memory address"] - #[doc = " @param[in] dpitch Pitch of destination memory"] - #[doc = " @param[in] src Source memory address"] - #[doc = " @param[in] spitch Pitch of source memory"] - #[doc = " @param[in] width Width of matrix transfer (columns in bytes)"] - #[doc = " @param[in] height Height of matrix transfer (rows)"] - #[doc = " @param[in] kind Type of transfer"] - #[doc = " @param[in] stream Stream to use"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyAsync"] - pub fn hipMemcpy2DAsync( - dst: *mut ::std::os::raw::c_void, - dpitch: usize, - src: *const ::std::os::raw::c_void, - spitch: usize, - width: usize, - height: usize, - kind: hipMemcpyKind, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Gets the minimum and maximum mipmap level clamps for a texture reference.\n\n @param [out] pminMipmapLevelClamp Pointer of the minimum mipmap level clamp.\n @param [out] pmaxMipmapLevelClamp Pointer of the maximum mipmap level clamp.\n @param [in] texRef Pointer of texture reference.\n\n @returns #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefGetMipmapLevelClamp( + pminMipmapLevelClamp: *mut f32, + pmaxMipmapLevelClamp: *mut f32, + texRef: *const textureReference, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies data between host and device."] - #[doc = ""] - #[doc = " @param[in] dst Destination memory address"] - #[doc = " @param[in] wOffset Destination starting X offset"] - #[doc = " @param[in] hOffset Destination starting Y offset"] - #[doc = " @param[in] src Source memory address"] - #[doc = " @param[in] spitch Pitch of source memory"] - #[doc = " @param[in] width Width of matrix transfer (columns in bytes)"] - #[doc = " @param[in] height Height of matrix transfer (rows)"] - #[doc = " @param[in] kind Type of transfer"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpyToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyAsync"] - pub fn hipMemcpy2DToArray( - dst: *mut hipArray, - wOffset: usize, - hOffset: usize, - src: *const ::std::os::raw::c_void, - spitch: usize, - width: usize, - height: usize, - kind: hipMemcpyKind, + #[must_use] + #[doc = " @brief Gets the mipmapped array bound to a texture reference.\n\n @param [out] pArray Pointer of the mipmapped array.\n @param [in] texRef Pointer of texture reference.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefGetMipMappedArray( + pArray: *mut hipMipmappedArray_t, + texRef: *const textureReference, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies data between host and device."] - #[doc = ""] - #[doc = " @param[in] dst Destination memory address"] - #[doc = " @param[in] wOffset Destination starting X offset"] - #[doc = " @param[in] hOffset Destination starting Y offset"] - #[doc = " @param[in] src Source memory address"] - #[doc = " @param[in] spitch Pitch of source memory"] - #[doc = " @param[in] width Width of matrix transfer (columns in bytes)"] - #[doc = " @param[in] height Height of matrix transfer (rows)"] - #[doc = " @param[in] kind Type of transfer"] - #[doc = " @param[in] stream Accelerator view which the copy is being enqueued"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpyToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyAsync"] - pub fn hipMemcpy2DToArrayAsync( - dst: *mut hipArray, - wOffset: usize, - hOffset: usize, - src: *const ::std::os::raw::c_void, - spitch: usize, - width: usize, - height: usize, - kind: hipMemcpyKind, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Sets an bound address for a texture reference.\n\n @param [out] ByteOffset Pointer of the offset in bytes.\n @param [in] texRef Pointer of texture reference.\n @param [in] dptr Pointer of device address to bind.\n @param [in] bytes Size in bytes.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefSetAddress( + ByteOffset: *mut usize, + texRef: *mut textureReference, + dptr: hipDeviceptr_t, + bytes: usize, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies data between host and device."] - #[doc = ""] - #[doc = " @param[in] dst Destination memory address"] - #[doc = " @param[in] wOffset Destination starting X offset"] - #[doc = " @param[in] hOffset Destination starting Y offset"] - #[doc = " @param[in] src Source memory address"] - #[doc = " @param[in] count size in bytes to copy"] - #[doc = " @param[in] kind Type of transfer"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyAsync"] - pub fn hipMemcpyToArray( - dst: *mut hipArray, - wOffset: usize, - hOffset: usize, - src: *const ::std::os::raw::c_void, - count: usize, - kind: hipMemcpyKind, + #[must_use] + #[doc = " @brief Set a bind an address as a 2D texture reference.\n\n @param [in] texRef Pointer of texture reference.\n @param [in] desc Pointer of array descriptor.\n @param [in] dptr Pointer of device address to bind.\n @param [in] Pitch Pitch in bytes.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefSetAddress2D( + texRef: *mut textureReference, + desc: *const HIP_ARRAY_DESCRIPTOR, + dptr: hipDeviceptr_t, + Pitch: usize, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies data between host and device."] - #[doc = ""] - #[doc = " @param[in] dst Destination memory address"] - #[doc = " @param[in] srcArray Source memory address"] - #[doc = " @param[in] woffset Source starting X offset"] - #[doc = " @param[in] hOffset Source starting Y offset"] - #[doc = " @param[in] count Size in bytes to copy"] - #[doc = " @param[in] kind Type of transfer"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyAsync"] - pub fn hipMemcpyFromArray( - dst: *mut ::std::os::raw::c_void, - srcArray: hipArray_const_t, - wOffset: usize, - hOffset: usize, - count: usize, - kind: hipMemcpyKind, + #[must_use] + #[doc = " @brief Sets the maximum anisotropy for a texture reference.\n\n @param [in] texRef Pointer of texture reference.\n @param [out] maxAniso Value of the maximum anisotropy.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefSetMaxAnisotropy( + texRef: *mut textureReference, + maxAniso: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies data between host and device."] - #[doc = ""] - #[doc = " @param[in] dst Destination memory address"] - #[doc = " @param[in] dpitch Pitch of destination memory"] - #[doc = " @param[in] src Source memory address"] - #[doc = " @param[in] wOffset Source starting X offset"] - #[doc = " @param[in] hOffset Source starting Y offset"] - #[doc = " @param[in] width Width of matrix transfer (columns in bytes)"] - #[doc = " @param[in] height Height of matrix transfer (rows)"] - #[doc = " @param[in] kind Type of transfer"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyAsync"] - pub fn hipMemcpy2DFromArray( - dst: *mut ::std::os::raw::c_void, - dpitch: usize, - src: hipArray_const_t, - wOffset: usize, - hOffset: usize, - width: usize, - height: usize, - kind: hipMemcpyKind, + #[must_use] + #[doc = " @brief Sets border color for a texture reference.\n\n @param [in] texRef Pointer of texture reference.\n @param [in] pBorderColor Pointer of border color.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefSetBorderColor( + texRef: *mut textureReference, + pBorderColor: *mut f32, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies data between host and device asynchronously."] - #[doc = ""] - #[doc = " @param[in] dst Destination memory address"] - #[doc = " @param[in] dpitch Pitch of destination memory"] - #[doc = " @param[in] src Source memory address"] - #[doc = " @param[in] wOffset Source starting X offset"] - #[doc = " @param[in] hOffset Source starting Y offset"] - #[doc = " @param[in] width Width of matrix transfer (columns in bytes)"] - #[doc = " @param[in] height Height of matrix transfer (rows)"] - #[doc = " @param[in] kind Type of transfer"] - #[doc = " @param[in] stream Accelerator view which the copy is being enqueued"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyAsync"] - pub fn hipMemcpy2DFromArrayAsync( - dst: *mut ::std::os::raw::c_void, - dpitch: usize, - src: hipArray_const_t, - wOffset: usize, - hOffset: usize, - width: usize, - height: usize, - kind: hipMemcpyKind, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Sets mipmap filter mode for a texture reference.\n\n @param [in] texRef Pointer of texture reference.\n @param [in] fm Value of filter mode.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefSetMipmapFilterMode( + texRef: *mut textureReference, + fm: hipTextureFilterMode, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies data between host and device."] - #[doc = ""] - #[doc = " @param[in] dst Destination memory address"] - #[doc = " @param[in] srcArray Source array"] - #[doc = " @param[in] srcoffset Offset in bytes of source array"] - #[doc = " @param[in] count Size of memory copy in bytes"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyAsync"] - pub fn hipMemcpyAtoH( - dst: *mut ::std::os::raw::c_void, - srcArray: *mut hipArray, - srcOffset: usize, - count: usize, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Sets mipmap level bias for a texture reference.\n\n @param [in] texRef Pointer of texture reference.\n @param [in] bias Value of mipmap bias.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefSetMipmapLevelBias(texRef: *mut textureReference, bias: f32) -> hipError_t; } extern "C" { - #[doc = " @brief Copies data between host and device."] - #[doc = ""] - #[doc = " @param[in] dstArray Destination memory address"] - #[doc = " @param[in] dstOffset Offset in bytes of destination array"] - #[doc = " @param[in] srcHost Source host pointer"] - #[doc = " @param[in] count Size of memory copy in bytes"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyAsync"] - pub fn hipMemcpyHtoA( - dstArray: *mut hipArray, - dstOffset: usize, - srcHost: *const ::std::os::raw::c_void, - count: usize, + #[must_use] + #[doc = " @brief Sets mipmap level clamp for a texture reference.\n\n @param [in] texRef Pointer of texture reference.\n @param [in] minMipMapLevelClamp Value of minimum mipmap level clamp.\n @param [in] maxMipMapLevelClamp Value of maximum mipmap level clamp.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefSetMipmapLevelClamp( + texRef: *mut textureReference, + minMipMapLevelClamp: f32, + maxMipMapLevelClamp: f32, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies data between host and device."] - #[doc = ""] - #[doc = " @param[in] p 3D memory copy parameters"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyAsync"] - pub fn hipMemcpy3D(p: *const hipMemcpy3DParms) -> hipError_t; + #[must_use] + #[doc = " @brief Binds mipmapped array to a texture reference.\n\n @param [in] texRef Pointer of texture reference to bind.\n @param [in] mipmappedArray Pointer of mipmapped array to bind.\n @param [in] Flags Flags should be set as HIP_TRSA_OVERRIDE_FORMAT, as a valid value.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning This API is deprecated.\n"] + pub fn hipTexRefSetMipmappedArray( + texRef: *mut textureReference, + mipmappedArray: *mut hipMipmappedArray, + Flags: ::std::os::raw::c_uint, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies data between host and device asynchronously."] - #[doc = ""] - #[doc = " @param[in] p 3D memory copy parameters"] - #[doc = " @param[in] stream Stream to use"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyAsync"] - pub fn hipMemcpy3DAsync(p: *const hipMemcpy3DParms, stream: hipStream_t) -> hipError_t; + #[doc = " @defgroup Callback Callback Activity APIs\n @{\n This section describes the callback/Activity of HIP runtime API.\n/\n/**\n @brief Returns HIP API name by ID.\n\n @param [in] id ID of HIP API\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipApiName(id: u32) -> *const ::std::os::raw::c_char; } extern "C" { - #[doc = " @brief Copies data between host and device."] - #[doc = ""] - #[doc = " @param[in] pCopy 3D memory copy parameters"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyAsync"] - pub fn hipDrvMemcpy3D(pCopy: *const HIP_MEMCPY3D) -> hipError_t; + #[doc = " @brief Returns kernel name reference by function name.\n\n @param [in] f Name of function\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipKernelNameRef(f: hipFunction_t) -> *const ::std::os::raw::c_char; } extern "C" { - #[doc = " @brief Copies data between host and device asynchronously."] - #[doc = ""] - #[doc = " @param[in] pCopy 3D memory copy parameters"] - #[doc = " @param[in] stream Stream to use"] - #[doc = " @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidPitchValue,"] - #[doc = " #hipErrorInvalidDevicePointer, #hipErrorInvalidMemcpyDirection"] - #[doc = ""] - #[doc = " @see hipMemcpy, hipMemcpy2DToArray, hipMemcpy2D, hipMemcpyFromArray, hipMemcpyToSymbol,"] - #[doc = " hipMemcpyAsync"] - pub fn hipDrvMemcpy3DAsync(pCopy: *const HIP_MEMCPY3D, stream: hipStream_t) -> hipError_t; + #[doc = " @brief Retrives kernel for a given host pointer, unless stated otherwise.\n\n @param [in] hostFunction Pointer of host function.\n @param [in] stream Stream the kernel is executed on.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipKernelNameRefByPtr( + hostFunction: *const ::std::os::raw::c_void, + stream: hipStream_t, + ) -> *const ::std::os::raw::c_char; } extern "C" { - #[doc = " @}"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = " @defgroup PeerToPeer PeerToPeer Device Memory Access"] - #[doc = " @{"] - #[doc = " @warning PeerToPeer support is experimental."] - #[doc = " This section describes the PeerToPeer device memory access functions of HIP runtime API."] - #[doc = " @brief Determine if a device can access a peer's memory."] - #[doc = ""] - #[doc = " @param [out] canAccessPeer Returns the peer access capability (0 or 1)"] - #[doc = " @param [in] device - device from where memory may be accessed."] - #[doc = " @param [in] peerDevice - device where memory is physically located"] - #[doc = ""] - #[doc = " Returns \"1\" in @p canAccessPeer if the specified @p device is capable"] - #[doc = " of directly accessing memory physically located on peerDevice , or \"0\" if not."] - #[doc = ""] - #[doc = " Returns \"0\" in @p canAccessPeer if deviceId == peerDeviceId, and both are valid devices : a"] - #[doc = " device is not a peer of itself."] - #[doc = ""] - #[doc = " @returns #hipSuccess,"] - #[doc = " @returns #hipErrorInvalidDevice if deviceId or peerDeviceId are not valid devices"] - pub fn hipDeviceCanAccessPeer( - canAccessPeer: *mut ::std::os::raw::c_int, - deviceId: ::std::os::raw::c_int, - peerDeviceId: ::std::os::raw::c_int, - ) -> hipError_t; + #[doc = " @brief Returns device ID on the stream.\n\n @param [in] stream Stream of device executed on.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipGetStreamDeviceId(stream: hipStream_t) -> ::std::os::raw::c_int; } extern "C" { - #[doc = " @brief Enable direct access from current device's virtual address space to memory allocations"] - #[doc = " physically located on a peer device."] - #[doc = ""] - #[doc = " Memory which already allocated on peer device will be mapped into the address space of the"] - #[doc = " current device. In addition, all future memory allocations on peerDeviceId will be mapped into"] - #[doc = " the address space of the current device when the memory is allocated. The peer memory remains"] - #[doc = " accessible from the current device until a call to hipDeviceDisablePeerAccess or hipDeviceReset."] - #[doc = ""] - #[doc = ""] - #[doc = " @param [in] peerDeviceId"] - #[doc = " @param [in] flags"] - #[doc = ""] - #[doc = " Returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue,"] - #[doc = " @returns #hipErrorPeerAccessAlreadyEnabled if peer access is already enabled for this device."] - pub fn hipDeviceEnablePeerAccess( - peerDeviceId: ::std::os::raw::c_int, - flags: ::std::os::raw::c_uint, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Begins graph capture on a stream.\n\n @param [in] stream - Stream to initiate capture.\n @param [in] mode - Controls the interaction of this capture sequence with other API calls that\n are not safe.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipStreamBeginCapture(stream: hipStream_t, mode: hipStreamCaptureMode) -> hipError_t; } extern "C" { - #[doc = " @brief Disable direct access from current device's virtual address space to memory allocations"] - #[doc = " physically located on a peer device."] - #[doc = ""] - #[doc = " Returns hipErrorPeerAccessNotEnabled if direct access to memory on peerDevice has not yet been"] - #[doc = " enabled from the current device."] - #[doc = ""] - #[doc = " @param [in] peerDeviceId"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorPeerAccessNotEnabled"] - pub fn hipDeviceDisablePeerAccess(peerDeviceId: ::std::os::raw::c_int) -> hipError_t; + #[must_use] + #[doc = " @brief Ends capture on a stream, returning the captured graph.\n\n @param [in] stream - Stream to end capture.\n @param [out] pGraph - returns the graph captured.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipStreamEndCapture(stream: hipStream_t, pGraph: *mut hipGraph_t) -> hipError_t; } extern "C" { - #[doc = " @brief Get information on memory allocations."] - #[doc = ""] - #[doc = " @param [out] pbase - BAse pointer address"] - #[doc = " @param [out] psize - Size of allocation"] - #[doc = " @param [in] dptr- Device Pointer"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidDevicePointer"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - pub fn hipMemGetAddressRange( - pbase: *mut hipDeviceptr_t, - psize: *mut usize, - dptr: hipDeviceptr_t, + #[must_use] + #[doc = " @brief Get capture status of a stream.\n\n @param [in] stream - Stream under capture.\n @param [out] pCaptureStatus - returns current status of the capture.\n @param [out] pId - unique ID of the capture.\n\n @returns #hipSuccess, #hipErrorStreamCaptureImplicit\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipStreamGetCaptureInfo( + stream: hipStream_t, + pCaptureStatus: *mut hipStreamCaptureStatus, + pId: *mut ::std::os::raw::c_ulonglong, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies memory from one device to memory on another device."] - #[doc = ""] - #[doc = " @param [out] dst - Destination device pointer."] - #[doc = " @param [in] dstDeviceId - Destination device"] - #[doc = " @param [in] src - Source device pointer"] - #[doc = " @param [in] srcDeviceId - Source device"] - #[doc = " @param [in] sizeBytes - Size of memory copy in bytes"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidDevice"] - pub fn hipMemcpyPeer( - dst: *mut ::std::os::raw::c_void, - dstDeviceId: ::std::os::raw::c_int, - src: *const ::std::os::raw::c_void, - srcDeviceId: ::std::os::raw::c_int, - sizeBytes: usize, + #[must_use] + #[doc = " @brief Get stream's capture state\n\n @param [in] stream - Stream under capture.\n @param [out] captureStatus_out - returns current status of the capture.\n @param [out] id_out - unique ID of the capture.\n @param [in] graph_out - returns the graph being captured into.\n @param [out] dependencies_out - returns pointer to an array of nodes.\n @param [out] numDependencies_out - returns size of the array returned in dependencies_out.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorStreamCaptureImplicit\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipStreamGetCaptureInfo_v2( + stream: hipStream_t, + captureStatus_out: *mut hipStreamCaptureStatus, + id_out: *mut ::std::os::raw::c_ulonglong, + graph_out: *mut hipGraph_t, + dependencies_out: *mut *const hipGraphNode_t, + numDependencies_out: *mut usize, ) -> hipError_t; } extern "C" { - #[doc = " @brief Copies memory from one device to memory on another device."] - #[doc = ""] - #[doc = " @param [out] dst - Destination device pointer."] - #[doc = " @param [in] dstDevice - Destination device"] - #[doc = " @param [in] src - Source device pointer"] - #[doc = " @param [in] srcDevice - Source device"] - #[doc = " @param [in] sizeBytes - Size of memory copy in bytes"] - #[doc = " @param [in] stream - Stream identifier"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidDevice"] - pub fn hipMemcpyPeerAsync( - dst: *mut ::std::os::raw::c_void, - dstDeviceId: ::std::os::raw::c_int, - src: *const ::std::os::raw::c_void, - srcDevice: ::std::os::raw::c_int, - sizeBytes: usize, + #[must_use] + #[doc = " @brief Get stream's capture state\n\n @param [in] stream - Stream under capture.\n @param [out] pCaptureStatus - returns current status of the capture.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorStreamCaptureImplicit\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipStreamIsCapturing( stream: hipStream_t, + pCaptureStatus: *mut hipStreamCaptureStatus, ) -> hipError_t; } extern "C" { - #[doc = " @}"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = " @defgroup Context Context Management"] - #[doc = " @{"] - #[doc = " This section describes the context management functions of HIP runtime API."] - #[doc = ""] - #[doc = " @addtogroup ContextD Context Management [Deprecated]"] - #[doc = " @{"] - #[doc = " @ingroup Context"] - #[doc = " This section describes the deprecated context management functions of HIP runtime API."] - #[doc = " @brief Create a context and set it as current/ default context"] - #[doc = ""] - #[doc = " @param [out] ctx"] - #[doc = " @param [in] flags"] - #[doc = " @param [in] associated device handle"] - #[doc = ""] - #[doc = " @return #hipSuccess"] - #[doc = ""] - #[doc = " @see hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent, hipCtxPushCurrent,"] - #[doc = " hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - pub fn hipCtxCreate( - ctx: *mut hipCtx_t, + #[must_use] + #[doc = " @brief Update the set of dependencies in a capturing stream\n\n @param [in] stream Stream under capture.\n @param [in] dependencies pointer to an array of nodes to Add/Replace.\n @param [in] numDependencies size of the array in dependencies.\n @param [in] flags Flag how to update dependency set. Should be one of value in enum\n #hipStreamUpdateCaptureDependenciesFlags\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorIllegalState\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipStreamUpdateCaptureDependencies( + stream: hipStream_t, + dependencies: *mut hipGraphNode_t, + numDependencies: usize, flags: ::std::os::raw::c_uint, - device: hipDevice_t, ) -> hipError_t; } extern "C" { - #[doc = " @brief Destroy a HIP context."] - #[doc = ""] - #[doc = " @param [in] ctx Context to destroy"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,hipCtxSetCurrent,"] - #[doc = " hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize , hipCtxGetDevice"] - pub fn hipCtxDestroy(ctx: hipCtx_t) -> hipError_t; -} -extern "C" { - #[doc = " @brief Pop the current/default context and return the popped context."] - #[doc = ""] - #[doc = " @param [out] ctx"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidContext"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxSetCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - pub fn hipCtxPopCurrent(ctx: *mut hipCtx_t) -> hipError_t; -} -extern "C" { - #[doc = " @brief Push the context to be set as current/ default context"] - #[doc = ""] - #[doc = " @param [in] ctx"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidContext"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize , hipCtxGetDevice"] - pub fn hipCtxPushCurrent(ctx: hipCtx_t) -> hipError_t; + #[must_use] + #[doc = " @brief Swaps the stream capture mode of a thread.\n\n @param [in] mode - Pointer to mode value to swap with the current mode\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipThreadExchangeStreamCaptureMode(mode: *mut hipStreamCaptureMode) -> hipError_t; } extern "C" { - #[doc = " @brief Set the passed context as current/default"] - #[doc = ""] - #[doc = " @param [in] ctx"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidContext"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize , hipCtxGetDevice"] - pub fn hipCtxSetCurrent(ctx: hipCtx_t) -> hipError_t; + #[must_use] + #[doc = " @brief Creates a graph\n\n @param [out] pGraph - pointer to graph to create.\n @param [in] flags - flags for graph creation, must be 0.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryAllocation\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipGraphCreate(pGraph: *mut hipGraph_t, flags: ::std::os::raw::c_uint) -> hipError_t; } extern "C" { - #[doc = " @brief Get the handle of the current/ default context"] - #[doc = ""] - #[doc = " @param [out] ctx"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidContext"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetDevice, hipCtxGetFlags, hipCtxPopCurrent,"] - #[doc = " hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - pub fn hipCtxGetCurrent(ctx: *mut hipCtx_t) -> hipError_t; + #[must_use] + #[doc = " @brief Destroys a graph\n\n @param [in] graph - instance of graph to destroy.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipGraphDestroy(graph: hipGraph_t) -> hipError_t; } extern "C" { - #[doc = " @brief Get the handle of the device associated with current/default context"] - #[doc = ""] - #[doc = " @param [out] device"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidContext"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize"] - pub fn hipCtxGetDevice(device: *mut hipDevice_t) -> hipError_t; + #[must_use] + #[doc = " @brief Adds dependency edges to a graph.\n\n @param [in] graph - instance of the graph to add dependencies.\n @param [in] from - pointer to the graph nodes with dependenties to add from.\n @param [in] to - pointer to the graph nodes to add dependenties to.\n @param [in] numDependencies - the number of dependencies to add.\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipGraphAddDependencies( + graph: hipGraph_t, + from: *const hipGraphNode_t, + to: *const hipGraphNode_t, + numDependencies: usize, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Returns the approximate HIP api version."] - #[doc = ""] - #[doc = " @param [in] ctx Context to check"] - #[doc = " @param [out] apiVersion"] - #[doc = ""] - #[doc = " @return #hipSuccess"] - #[doc = ""] - #[doc = " @warning The HIP feature set does not correspond to an exact CUDA SDK api revision."] - #[doc = " This function always set *apiVersion to 4 as an approximation though HIP supports"] - #[doc = " some features which were introduced in later CUDA SDK revisions."] - #[doc = " HIP apps code should not rely on the api revision number here and should"] - #[doc = " use arch feature flags to test device capabilities or conditional compilation."] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetDevice, hipCtxGetFlags, hipCtxPopCurrent,"] - #[doc = " hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - pub fn hipCtxGetApiVersion(ctx: hipCtx_t, apiVersion: *mut ::std::os::raw::c_int) - -> hipError_t; + #[must_use] + #[doc = " @brief Removes dependency edges from a graph.\n\n @param [in] graph - instance of the graph to remove dependencies.\n @param [in] from - Array of nodes that provide the dependencies.\n @param [in] to - Array of dependent nodes.\n @param [in] numDependencies - the number of dependencies to remove.\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipGraphRemoveDependencies( + graph: hipGraph_t, + from: *const hipGraphNode_t, + to: *const hipGraphNode_t, + numDependencies: usize, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Set Cache configuration for a specific function"] - #[doc = ""] - #[doc = " @param [out] cacheConfiguration"] - #[doc = ""] - #[doc = " @return #hipSuccess"] - #[doc = ""] - #[doc = " @warning AMD devices and some Nvidia GPUS do not support reconfigurable cache. This hint is"] - #[doc = " ignored on those architectures."] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - pub fn hipCtxGetCacheConfig(cacheConfig: *mut hipFuncCache_t) -> hipError_t; + #[must_use] + #[doc = " @brief Returns a graph's dependency edges.\n\n @param [in] graph - instance of the graph to get the edges from.\n @param [out] from - pointer to the graph nodes to return edge endpoints.\n @param [out] to - pointer to the graph nodes to return edge endpoints.\n @param [out] numEdges - returns number of edges.\n @returns #hipSuccess, #hipErrorInvalidValue\n\n from and to may both be NULL, in which case this function only returns the number of edges in\n numEdges. Otherwise, numEdges entries will be filled in. If numEdges is higher than the actual\n number of edges, the remaining entries in from and to will be set to NULL, and the number of\n edges actually returned will be written to numEdges\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipGraphGetEdges( + graph: hipGraph_t, + from: *mut hipGraphNode_t, + to: *mut hipGraphNode_t, + numEdges: *mut usize, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Set L1/Shared cache partition."] - #[doc = ""] - #[doc = " @param [in] cacheConfiguration"] - #[doc = ""] - #[doc = " @return #hipSuccess"] - #[doc = ""] - #[doc = " @warning AMD devices and some Nvidia GPUS do not support reconfigurable cache. This hint is"] - #[doc = " ignored on those architectures."] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - pub fn hipCtxSetCacheConfig(cacheConfig: hipFuncCache_t) -> hipError_t; + #[must_use] + #[doc = " @brief Returns graph nodes.\n\n @param [in] graph - instance of graph to get the nodes.\n @param [out] nodes - pointer to return the graph nodes.\n @param [out] numNodes - returns number of graph nodes.\n @returns #hipSuccess, #hipErrorInvalidValue\n\n nodes may be NULL, in which case this function will return the number of nodes in numNodes.\n Otherwise, numNodes entries will be filled in. If numNodes is higher than the actual number of\n nodes, the remaining entries in nodes will be set to NULL, and the number of nodes actually\n obtained will be returned in numNodes.\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipGraphGetNodes( + graph: hipGraph_t, + nodes: *mut hipGraphNode_t, + numNodes: *mut usize, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Set Shared memory bank configuration."] - #[doc = ""] - #[doc = " @param [in] sharedMemoryConfiguration"] - #[doc = ""] - #[doc = " @return #hipSuccess"] - #[doc = ""] - #[doc = " @warning AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is"] - #[doc = " ignored on those architectures."] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - pub fn hipCtxSetSharedMemConfig(config: hipSharedMemConfig) -> hipError_t; + #[must_use] + #[doc = " @brief Returns graph's root nodes.\n\n @param [in] graph - instance of the graph to get the nodes.\n @param [out] pRootNodes - pointer to return the graph's root nodes.\n @param [out] pNumRootNodes - returns the number of graph's root nodes.\n @returns #hipSuccess, #hipErrorInvalidValue\n\n pRootNodes may be NULL, in which case this function will return the number of root nodes in\n pNumRootNodes. Otherwise, pNumRootNodes entries will be filled in. If pNumRootNodes is higher\n than the actual number of root nodes, the remaining entries in pRootNodes will be set to NULL,\n and the number of nodes actually obtained will be returned in pNumRootNodes.\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipGraphGetRootNodes( + graph: hipGraph_t, + pRootNodes: *mut hipGraphNode_t, + pNumRootNodes: *mut usize, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Get Shared memory bank configuration."] - #[doc = ""] - #[doc = " @param [out] sharedMemoryConfiguration"] - #[doc = ""] - #[doc = " @return #hipSuccess"] - #[doc = ""] - #[doc = " @warning AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is"] - #[doc = " ignored on those architectures."] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - pub fn hipCtxGetSharedMemConfig(pConfig: *mut hipSharedMemConfig) -> hipError_t; + #[must_use] + #[doc = " @brief Returns a node's dependencies.\n\n @param [in] node - graph node to get the dependencies from.\n @param [out] pDependencies - pointer to to return the dependencies.\n @param [out] pNumDependencies - returns the number of graph node dependencies.\n @returns #hipSuccess, #hipErrorInvalidValue\n\n pDependencies may be NULL, in which case this function will return the number of dependencies in\n pNumDependencies. Otherwise, pNumDependencies entries will be filled in. If pNumDependencies is\n higher than the actual number of dependencies, the remaining entries in pDependencies will be set\n to NULL, and the number of nodes actually obtained will be returned in pNumDependencies.\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipGraphNodeGetDependencies( + node: hipGraphNode_t, + pDependencies: *mut hipGraphNode_t, + pNumDependencies: *mut usize, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Blocks until the default context has completed all preceding requested tasks."] - #[doc = ""] - #[doc = " @return #hipSuccess"] - #[doc = ""] - #[doc = " @warning This function waits for all streams on the default context to complete execution, and"] - #[doc = " then returns."] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxGetDevice"] - pub fn hipCtxSynchronize() -> hipError_t; + #[must_use] + #[doc = " @brief Returns a node's dependent nodes.\n\n @param [in] node - graph node to get the Dependent nodes from.\n @param [out] pDependentNodes - pointer to return the graph dependent nodes.\n @param [out] pNumDependentNodes - returns the number of graph node dependent nodes.\n @returns #hipSuccess, #hipErrorInvalidValue\n\n DependentNodes may be NULL, in which case this function will return the number of dependent nodes\n in pNumDependentNodes. Otherwise, pNumDependentNodes entries will be filled in. If\n pNumDependentNodes is higher than the actual number of dependent nodes, the remaining entries in\n pDependentNodes will be set to NULL, and the number of nodes actually obtained will be returned\n in pNumDependentNodes.\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipGraphNodeGetDependentNodes( + node: hipGraphNode_t, + pDependentNodes: *mut hipGraphNode_t, + pNumDependentNodes: *mut usize, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Return flags used for creating default context."] - #[doc = ""] - #[doc = " @param [out] flags"] - #[doc = ""] - #[doc = " @returns #hipSuccess"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxPopCurrent, hipCtxGetCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - pub fn hipCtxGetFlags(flags: *mut ::std::os::raw::c_uint) -> hipError_t; + #[must_use] + #[doc = " @brief Returns a node's type.\n\n @param [in] node - instance of the graph to add dependencies.\n @param [out] pType - pointer to the return the type\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipGraphNodeGetType(node: hipGraphNode_t, pType: *mut hipGraphNodeType) -> hipError_t; } extern "C" { - #[doc = " @brief Enables direct access to memory allocations in a peer context."] - #[doc = ""] - #[doc = " Memory which already allocated on peer device will be mapped into the address space of the"] - #[doc = " current device. In addition, all future memory allocations on peerDeviceId will be mapped into"] - #[doc = " the address space of the current device when the memory is allocated. The peer memory remains"] - #[doc = " accessible from the current device until a call to hipDeviceDisablePeerAccess or hipDeviceReset."] - #[doc = ""] - #[doc = ""] - #[doc = " @param [in] peerCtx"] - #[doc = " @param [in] flags"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue,"] - #[doc = " #hipErrorPeerAccessAlreadyEnabled"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - #[doc = " @warning PeerToPeer support is experimental."] - pub fn hipCtxEnablePeerAccess(peerCtx: hipCtx_t, flags: ::std::os::raw::c_uint) -> hipError_t; + #[must_use] + #[doc = " @brief Remove a node from the graph.\n\n @param [in] node - graph node to remove\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipGraphDestroyNode(node: hipGraphNode_t) -> hipError_t; } extern "C" { - #[doc = " @brief Disable direct access from current context's virtual address space to memory allocations"] - #[doc = " physically located on a peer context.Disables direct access to memory allocations in a peer"] - #[doc = " context and unregisters any registered allocations."] - #[doc = ""] - #[doc = " Returns hipErrorPeerAccessNotEnabled if direct access to memory on peerDevice has not yet been"] - #[doc = " enabled from the current device."] - #[doc = ""] - #[doc = " @param [in] peerCtx"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorPeerAccessNotEnabled"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - #[doc = " @warning PeerToPeer support is experimental."] - pub fn hipCtxDisablePeerAccess(peerCtx: hipCtx_t) -> hipError_t; + #[must_use] + #[doc = " @brief Clones a graph.\n\n @param [out] pGraphClone - Returns newly created cloned graph.\n @param [in] originalGraph - original graph to clone from.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryAllocation\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipGraphClone(pGraphClone: *mut hipGraph_t, originalGraph: hipGraph_t) -> hipError_t; } extern "C" { - #[doc = " @}"] - #[doc = " @brief Get the state of the primary context."] - #[doc = ""] - #[doc = " @param [in] Device to get primary context flags for"] - #[doc = " @param [out] Pointer to store flags"] - #[doc = " @param [out] Pointer to store context state; 0 = inactive, 1 = active"] - #[doc = ""] - #[doc = " @returns #hipSuccess"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - pub fn hipDevicePrimaryCtxGetState( - dev: hipDevice_t, - flags: *mut ::std::os::raw::c_uint, - active: *mut ::std::os::raw::c_int, + #[must_use] + #[doc = " @brief Finds a cloned version of a node.\n\n @param [out] pNode - Returns the cloned node.\n @param [in] originalNode - original node handle.\n @param [in] clonedGraph - Cloned graph to query.\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipGraphNodeFindInClone( + pNode: *mut hipGraphNode_t, + originalNode: hipGraphNode_t, + clonedGraph: hipGraph_t, ) -> hipError_t; } extern "C" { - #[doc = " @brief Release the primary context on the GPU."] - #[doc = ""] - #[doc = " @param [in] Device which primary context is released"] - #[doc = ""] - #[doc = " @returns #hipSuccess"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - #[doc = " @warning This function return #hipSuccess though doesn't release the primaryCtx by design on"] - #[doc = " HIP/HCC path."] - pub fn hipDevicePrimaryCtxRelease(dev: hipDevice_t) -> hipError_t; -} -extern "C" { - #[doc = " @brief Retain the primary context on the GPU."] - #[doc = ""] - #[doc = " @param [out] Returned context handle of the new context"] - #[doc = " @param [in] Device which primary context is released"] - #[doc = ""] - #[doc = " @returns #hipSuccess"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - pub fn hipDevicePrimaryCtxRetain(pctx: *mut hipCtx_t, dev: hipDevice_t) -> hipError_t; + #[must_use] + #[doc = " @brief Creates an executable graph from a graph\n\n @param [out] pGraphExec - pointer to instantiated executable graph that is created.\n @param [in] graph - instance of graph to instantiate.\n @param [out] pErrorNode - pointer to error node in case error occured in graph instantiation,\n it could modify the correponding node.\n @param [out] pLogBuffer - pointer to log buffer.\n @param [out] bufferSize - the size of log buffer.\n\n @returns #hipSuccess, #hipErrorOutOfMemory\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n"] + pub fn hipGraphInstantiate( + pGraphExec: *mut hipGraphExec_t, + graph: hipGraph_t, + pErrorNode: *mut hipGraphNode_t, + pLogBuffer: *mut ::std::os::raw::c_char, + bufferSize: usize, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Resets the primary context on the GPU."] - #[doc = ""] - #[doc = " @param [in] Device which primary context is reset"] - #[doc = ""] - #[doc = " @returns #hipSuccess"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - pub fn hipDevicePrimaryCtxReset(dev: hipDevice_t) -> hipError_t; + #[must_use] + #[doc = " @brief Creates an executable graph from a graph.\n\n @param [out] pGraphExec - pointer to instantiated executable graph that is created.\n @param [in] graph - instance of graph to instantiate.\n @param [in] flags - Flags to control instantiation.\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.It does not support\n any of flag and is behaving as hipGraphInstantiate."] + pub fn hipGraphInstantiateWithFlags( + pGraphExec: *mut hipGraphExec_t, + graph: hipGraph_t, + flags: ::std::os::raw::c_ulonglong, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Set flags for the primary context."] - #[doc = ""] - #[doc = " @param [in] Device for which the primary context flags are set"] - #[doc = " @param [in] New flags for the device"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorContextAlreadyInUse"] - #[doc = ""] - #[doc = " @see hipCtxCreate, hipCtxDestroy, hipCtxGetFlags, hipCtxPopCurrent, hipCtxGetCurrent,"] - #[doc = " hipCtxSetCurrent, hipCtxPushCurrent, hipCtxSetCacheConfig, hipCtxSynchronize, hipCtxGetDevice"] - pub fn hipDevicePrimaryCtxSetFlags( - dev: hipDevice_t, - flags: ::std::os::raw::c_uint, - ) -> hipError_t; + #[must_use] + #[doc = " @brief launches an executable graph in a stream\n\n @param [in] graphExec - instance of executable graph to launch.\n @param [in] stream - instance of stream in which to launch executable graph.\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphLaunch(graphExec: hipGraphExec_t, stream: hipStream_t) -> hipError_t; } extern "C" { - #[doc = " @}"] - #[doc = ""] - #[doc = " @defgroup Module Module Management"] - #[doc = " @{"] - #[doc = " This section describes the module management functions of HIP runtime API."] - #[doc = ""] - #[doc = " @brief Loads code object from file into a hipModule_t"] - #[doc = ""] - #[doc = " @param [in] fname"] - #[doc = " @param [out] module"] - #[doc = ""] - #[doc = " @returns hipSuccess, hipErrorInvalidValue, hipErrorInvalidContext, hipErrorFileNotFound,"] - #[doc = " hipErrorOutOfMemory, hipErrorSharedObjectInitFailed, hipErrorNotInitialized"] - #[doc = ""] - #[doc = ""] - pub fn hipModuleLoad( - module: *mut hipModule_t, - fname: *const ::std::os::raw::c_char, - ) -> hipError_t; + #[must_use] + #[doc = " @brief uploads an executable graph in a stream\n\n @param [in] graphExec - instance of executable graph to launch.\n @param [in] stream - instance of stream in which to launch executable graph.\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphUpload(graphExec: hipGraphExec_t, stream: hipStream_t) -> hipError_t; } extern "C" { - #[doc = " @brief Frees the module"] - #[doc = ""] - #[doc = " @param [in] module"] - #[doc = ""] - #[doc = " @returns hipSuccess, hipInvalidValue"] - #[doc = " module is freed and the code objects associated with it are destroyed"] - #[doc = ""] - pub fn hipModuleUnload(module: hipModule_t) -> hipError_t; + #[must_use] + #[doc = " @brief Destroys an executable graph\n\n @param [in] graphExec - instance of executable graph to destry.\n\n @returns #hipSuccess.\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExecDestroy(graphExec: hipGraphExec_t) -> hipError_t; } extern "C" { - #[doc = " @brief Function with kname will be extracted if present in module"] - #[doc = ""] - #[doc = " @param [in] module"] - #[doc = " @param [in] kname"] - #[doc = " @param [out] function"] - #[doc = ""] - #[doc = " @returns hipSuccess, hipErrorInvalidValue, hipErrorInvalidContext, hipErrorNotInitialized,"] - #[doc = " hipErrorNotFound,"] - pub fn hipModuleGetFunction( - function: *mut hipFunction_t, - module: hipModule_t, - kname: *const ::std::os::raw::c_char, + #[must_use] + #[doc = " @brief Check whether an executable graph can be updated with a graph and perform the update if *\n possible.\n\n @param [in] hGraphExec - instance of executable graph to update.\n @param [in] hGraph - graph that contains the updated parameters.\n @param [in] hErrorNode_out - node which caused the permissibility check to forbid the update.\n @param [in] updateResult_out - Whether the graph update was permitted.\n @returns #hipSuccess, #hipErrorGraphExecUpdateFailure\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExecUpdate( + hGraphExec: hipGraphExec_t, + hGraph: hipGraph_t, + hErrorNode_out: *mut hipGraphNode_t, + updateResult_out: *mut hipGraphExecUpdateResult, ) -> hipError_t; } extern "C" { - #[doc = " @brief Find out attributes for a given function."] - #[doc = ""] - #[doc = " @param [out] attr"] - #[doc = " @param [in] func"] - #[doc = ""] - #[doc = " @returns hipSuccess, hipErrorInvalidValue, hipErrorInvalidDeviceFunction"] - pub fn hipFuncGetAttributes( - attr: *mut hipFuncAttributes, - func: *const ::std::os::raw::c_void, + #[must_use] + #[doc = " @brief Creates a kernel execution node and adds it to a graph.\n\n @param [out] pGraphNode - pointer to graph node to create.\n @param [in] graph - instance of graph to add the created node.\n @param [in] pDependencies - pointer to the dependencies on the kernel execution node.\n @param [in] numDependencies - the number of the dependencies.\n @param [in] pNodeParams - pointer to the parameters to the kernel execution node on the GPU.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidDeviceFunction\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddKernelNode( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, + pNodeParams: *const hipKernelNodeParams, ) -> hipError_t; } extern "C" { - #[doc = " @brief Find out a specific attribute for a given function."] - #[doc = ""] - #[doc = " @param [out] value"] - #[doc = " @param [in] attrib"] - #[doc = " @param [in] hfunc"] - #[doc = ""] - #[doc = " @returns hipSuccess, hipErrorInvalidValue, hipErrorInvalidDeviceFunction"] - pub fn hipFuncGetAttribute( - value: *mut ::std::os::raw::c_int, - attrib: hipFunction_attribute, - hfunc: hipFunction_t, + #[must_use] + #[doc = " @brief Gets kernel node's parameters.\n\n @param [in] node - instance of the node to get parameters from.\n @param [out] pNodeParams - pointer to the parameters\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphKernelNodeGetParams( + node: hipGraphNode_t, + pNodeParams: *mut hipKernelNodeParams, ) -> hipError_t; } extern "C" { - #[doc = " @brief returns the handle of the texture reference with the name from the module."] - #[doc = ""] - #[doc = " @param [in] hmod"] - #[doc = " @param [in] name"] - #[doc = " @param [out] texRef"] - #[doc = ""] - #[doc = " @returns hipSuccess, hipErrorNotInitialized, hipErrorNotFound, hipErrorInvalidValue"] - pub fn hipModuleGetTexRef( - texRef: *mut *mut textureReference, - hmod: hipModule_t, - name: *const ::std::os::raw::c_char, + #[must_use] + #[doc = " @brief Sets a kernel node's parameters.\n\n @param [in] node - instance of the node to set parameters to.\n @param [in] pNodeParams - const pointer to the parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphKernelNodeSetParams( + node: hipGraphNode_t, + pNodeParams: *const hipKernelNodeParams, ) -> hipError_t; } extern "C" { - #[doc = " @brief builds module from code object which resides in host memory. Image is pointer to that"] - #[doc = " location."] - #[doc = ""] - #[doc = " @param [in] image"] - #[doc = " @param [out] module"] - #[doc = ""] - #[doc = " @returns hipSuccess, hipErrorNotInitialized, hipErrorOutOfMemory, hipErrorNotInitialized"] - pub fn hipModuleLoadData( - module: *mut hipModule_t, - image: *const ::std::os::raw::c_void, + #[must_use] + #[doc = " @brief Sets the parameters for a kernel node in the given graphExec.\n\n @param [in] hGraphExec - instance of the executable graph with the node.\n @param [in] node - instance of the node to set parameters to.\n @param [in] pNodeParams - const pointer to the kernel node parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExecKernelNodeSetParams( + hGraphExec: hipGraphExec_t, + node: hipGraphNode_t, + pNodeParams: *const hipKernelNodeParams, ) -> hipError_t; } extern "C" { - #[doc = " @brief builds module from code object which resides in host memory. Image is pointer to that"] - #[doc = " location. Options are not used. hipModuleLoadData is called."] - #[doc = ""] - #[doc = " @param [in] image"] - #[doc = " @param [out] module"] - #[doc = " @param [in] number of options"] - #[doc = " @param [in] options for JIT"] - #[doc = " @param [in] option values for JIT"] - #[doc = ""] - #[doc = " @returns hipSuccess, hipErrorNotInitialized, hipErrorOutOfMemory, hipErrorNotInitialized"] - pub fn hipModuleLoadDataEx( - module: *mut hipModule_t, - image: *const ::std::os::raw::c_void, - numOptions: ::std::os::raw::c_uint, - options: *mut hipJitOption, - optionValues: *mut *mut ::std::os::raw::c_void, + #[must_use] + #[doc = " @brief Creates a memcpy node and adds it to a graph.\n\n @param [out] phGraphNode - pointer to graph node to create.\n @param [in] hGraph - instance of graph to add the created node.\n @param [in] dependencies - const pointer to the dependencies on the memcpy execution node.\n @param [in] numDependencies - the number of the dependencies.\n @param [in] copyParams - const pointer to the parameters for the memory copy.\n @param [in] ctx - cotext related to current device.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipDrvGraphAddMemcpyNode( + phGraphNode: *mut hipGraphNode_t, + hGraph: hipGraph_t, + dependencies: *const hipGraphNode_t, + numDependencies: usize, + copyParams: *const HIP_MEMCPY3D, + ctx: hipCtx_t, ) -> hipError_t; } extern "C" { - #[doc = " @brief launches kernel f with launch parameters and shared memory on stream with arguments passed"] - #[doc = " to kernelparams or extra"] - #[doc = ""] - #[doc = " @param [in] f Kernel to launch."] - #[doc = " @param [in] gridDimX X grid dimension specified as multiple of blockDimX."] - #[doc = " @param [in] gridDimY Y grid dimension specified as multiple of blockDimY."] - #[doc = " @param [in] gridDimZ Z grid dimension specified as multiple of blockDimZ."] - #[doc = " @param [in] blockDimX X block dimensions specified in work-items"] - #[doc = " @param [in] blockDimY Y grid dimension specified in work-items"] - #[doc = " @param [in] blockDimZ Z grid dimension specified in work-items"] - #[doc = " @param [in] sharedMemBytes Amount of dynamic shared memory to allocate for this kernel. The"] - #[doc = " HIP-Clang compiler provides support for extern shared declarations."] - #[doc = " @param [in] stream Stream where the kernel should be dispatched. May be 0, in which case th"] - #[doc = " default stream is used with associated synchronization rules."] - #[doc = " @param [in] kernelParams"] - #[doc = " @param [in] extra Pointer to kernel arguments. These are passed directly to the kernel and"] - #[doc = " must be in the memory layout and alignment expected by the kernel."] - #[doc = ""] - #[doc = " @returns hipSuccess, hipInvalidDevice, hipErrorNotInitialized, hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @warning kernellParams argument is not yet implemented in HIP. Please use extra instead. Please"] - #[doc = " refer to hip_porting_driver_api.md for sample usage."] - pub fn hipModuleLaunchKernel( - f: hipFunction_t, - gridDimX: ::std::os::raw::c_uint, - gridDimY: ::std::os::raw::c_uint, - gridDimZ: ::std::os::raw::c_uint, - blockDimX: ::std::os::raw::c_uint, - blockDimY: ::std::os::raw::c_uint, - blockDimZ: ::std::os::raw::c_uint, - sharedMemBytes: ::std::os::raw::c_uint, - stream: hipStream_t, - kernelParams: *mut *mut ::std::os::raw::c_void, - extra: *mut *mut ::std::os::raw::c_void, + #[must_use] + #[doc = " @brief Creates a memcpy node and adds it to a graph.\n\n @param [out] pGraphNode - pointer to graph node to create.\n @param [in] graph - instance of graph to add the created node.\n @param [in] pDependencies - const pointer to the dependencies on the memcpy execution node.\n @param [in] numDependencies - the number of the dependencies.\n @param [in] pCopyParams - const pointer to the parameters for the memory copy.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddMemcpyNode( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, + pCopyParams: *const hipMemcpy3DParms, ) -> hipError_t; } extern "C" { - #[doc = " @brief launches kernel f with launch parameters and shared memory on stream with arguments passed"] - #[doc = " to kernelparams or extra, where thread blocks can cooperate and synchronize as they execute"] - #[doc = ""] - #[doc = " @param [in] f Kernel to launch."] - #[doc = " @param [in] gridDim Grid dimensions specified as multiple of blockDim."] - #[doc = " @param [in] blockDim Block dimensions specified in work-items"] - #[doc = " @param [in] kernelParams A list of kernel arguments"] - #[doc = " @param [in] sharedMemBytes Amount of dynamic shared memory to allocate for this kernel. The"] - #[doc = " HIP-Clang compiler provides support for extern shared declarations."] - #[doc = " @param [in] stream Stream where the kernel should be dispatched. May be 0, in which case th"] - #[doc = " default stream is used with associated synchronization rules."] - #[doc = ""] - #[doc = " @returns hipSuccess, hipInvalidDevice, hipErrorNotInitialized, hipErrorInvalidValue, hipErrorCooperativeLaunchTooLarge"] - pub fn hipLaunchCooperativeKernel( - f: *const ::std::os::raw::c_void, - gridDim: dim3, - blockDimX: dim3, - kernelParams: *mut *mut ::std::os::raw::c_void, - sharedMemBytes: ::std::os::raw::c_uint, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Gets a memcpy node's parameters.\n\n @param [in] node - instance of the node to get parameters from.\n @param [out] pNodeParams - pointer to the parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphMemcpyNodeGetParams( + node: hipGraphNode_t, + pNodeParams: *mut hipMemcpy3DParms, ) -> hipError_t; } extern "C" { - #[doc = " @brief Launches kernels on multiple devices where thread blocks can cooperate and"] - #[doc = " synchronize as they execute."] - #[doc = ""] - #[doc = " @param [in] launchParamsList List of launch parameters, one per device."] - #[doc = " @param [in] numDevices Size of the launchParamsList array."] - #[doc = " @param [in] flags Flags to control launch behavior."] - #[doc = ""] - #[doc = " @returns hipSuccess, hipInvalidDevice, hipErrorNotInitialized, hipErrorInvalidValue, hipErrorCooperativeLaunchTooLarge"] - pub fn hipLaunchCooperativeKernelMultiDevice( - launchParamsList: *mut hipLaunchParams, - numDevices: ::std::os::raw::c_int, - flags: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief Sets a memcpy node's parameters.\n\n @param [in] node - instance of the node to set parameters to.\n @param [in] pNodeParams - const pointer to the parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphMemcpyNodeSetParams( + node: hipGraphNode_t, + pNodeParams: *const hipMemcpy3DParms, ) -> hipError_t; } extern "C" { - #[doc = " @brief Launches kernels on multiple devices and guarantees all specified kernels are dispatched"] - #[doc = " on respective streams before enqueuing any other work on the specified streams from any other threads"] - #[doc = ""] - #[doc = ""] - #[doc = " @param [in] hipLaunchParams List of launch parameters, one per device."] - #[doc = " @param [in] numDevices Size of the launchParamsList array."] - #[doc = " @param [in] flags Flags to control launch behavior."] - #[doc = ""] - #[doc = " @returns hipSuccess, hipInvalidDevice, hipErrorNotInitialized, hipErrorInvalidValue"] - pub fn hipExtLaunchMultiKernelMultiDevice( - launchParamsList: *mut hipLaunchParams, - numDevices: ::std::os::raw::c_int, - flags: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief Sets a node attribute.\n\n @param [in] hNode - instance of the node to set parameters to.\n @param [in] attr - the attribute node is set to.\n @param [in] value - const pointer to the parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphKernelNodeSetAttribute( + hNode: hipGraphNode_t, + attr: hipKernelNodeAttrID, + value: *const hipKernelNodeAttrValue, ) -> hipError_t; } extern "C" { - #[doc = " @}"] - #[doc = ""] - #[doc = " @defgroup Occupancy Occupancy"] - #[doc = " @{"] - #[doc = " This section describes the occupancy functions of HIP runtime API."] - #[doc = ""] - #[doc = " @brief determine the grid and block sizes to achieves maximum occupancy for a kernel"] - #[doc = ""] - #[doc = " @param [out] gridSize minimum grid size for maximum potential occupancy"] - #[doc = " @param [out] blockSize block size for maximum potential occupancy"] - #[doc = " @param [in] f kernel function for which occupancy is calulated"] - #[doc = " @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block"] - #[doc = " @param [in] blockSizeLimit the maximum block size for the kernel, use 0 for no limit"] - #[doc = ""] - #[doc = " @returns hipSuccess, hipInvalidDevice, hipErrorInvalidValue"] - pub fn hipModuleOccupancyMaxPotentialBlockSize( - gridSize: *mut ::std::os::raw::c_int, - blockSize: *mut ::std::os::raw::c_int, - f: hipFunction_t, - dynSharedMemPerBlk: usize, - blockSizeLimit: ::std::os::raw::c_int, + #[must_use] + #[doc = " @brief Gets a node attribute.\n\n @param [in] hNode - instance of the node to set parameters to.\n @param [in] attr - the attribute node is set to.\n @param [in] value - const pointer to the parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphKernelNodeGetAttribute( + hNode: hipGraphNode_t, + attr: hipKernelNodeAttrID, + value: *mut hipKernelNodeAttrValue, ) -> hipError_t; } extern "C" { - #[doc = " @brief determine the grid and block sizes to achieves maximum occupancy for a kernel"] - #[doc = ""] - #[doc = " @param [out] gridSize minimum grid size for maximum potential occupancy"] - #[doc = " @param [out] blockSize block size for maximum potential occupancy"] - #[doc = " @param [in] f kernel function for which occupancy is calulated"] - #[doc = " @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block"] - #[doc = " @param [in] blockSizeLimit the maximum block size for the kernel, use 0 for no limit"] - #[doc = " @param [in] flags Extra flags for occupancy calculation (only default supported)"] - #[doc = ""] - #[doc = " @returns hipSuccess, hipInvalidDevice, hipErrorInvalidValue"] - pub fn hipModuleOccupancyMaxPotentialBlockSizeWithFlags( - gridSize: *mut ::std::os::raw::c_int, - blockSize: *mut ::std::os::raw::c_int, - f: hipFunction_t, - dynSharedMemPerBlk: usize, - blockSizeLimit: ::std::os::raw::c_int, - flags: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief Sets the parameters for a memcpy node in the given graphExec.\n\n @param [in] hGraphExec - instance of the executable graph with the node.\n @param [in] node - instance of the node to set parameters to.\n @param [in] pNodeParams - const pointer to the kernel node parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExecMemcpyNodeSetParams( + hGraphExec: hipGraphExec_t, + node: hipGraphNode_t, + pNodeParams: *mut hipMemcpy3DParms, ) -> hipError_t; } extern "C" { - #[doc = " @brief Returns occupancy for a device function."] - #[doc = ""] - #[doc = " @param [out] numBlocks Returned occupancy"] - #[doc = " @param [in] func Kernel function (hipFunction) for which occupancy is calulated"] - #[doc = " @param [in] blockSize Block size the kernel is intended to be launched with"] - #[doc = " @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block"] - pub fn hipModuleOccupancyMaxActiveBlocksPerMultiprocessor( - numBlocks: *mut ::std::os::raw::c_int, - f: hipFunction_t, - blockSize: ::std::os::raw::c_int, - dynSharedMemPerBlk: usize, + #[must_use] + #[doc = " @brief Creates a 1D memcpy node and adds it to a graph.\n\n @param [out] pGraphNode - pointer to graph node to create.\n @param [in] graph - instance of graph to add the created node.\n @param [in] pDependencies - const pointer to the dependencies on the memcpy execution node.\n @param [in] numDependencies - the number of the dependencies.\n @param [in] dst - pointer to memory address to the destination.\n @param [in] src - pointer to memory address to the source.\n @param [in] count - the size of the memory to copy.\n @param [in] kind - the type of memory copy.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddMemcpyNode1D( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, + dst: *mut ::std::os::raw::c_void, + src: *const ::std::os::raw::c_void, + count: usize, + kind: hipMemcpyKind, ) -> hipError_t; } extern "C" { - #[doc = " @brief Returns occupancy for a device function."] - #[doc = ""] - #[doc = " @param [out] numBlocks Returned occupancy"] - #[doc = " @param [in] f Kernel function(hipFunction_t) for which occupancy is calulated"] - #[doc = " @param [in] blockSize Block size the kernel is intended to be launched with"] - #[doc = " @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block"] - #[doc = " @param [in] flags Extra flags for occupancy calculation (only default supported)"] - pub fn hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags( - numBlocks: *mut ::std::os::raw::c_int, - f: hipFunction_t, - blockSize: ::std::os::raw::c_int, - dynSharedMemPerBlk: usize, - flags: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief Sets a memcpy node's parameters to perform a 1-dimensional copy.\n\n @param [in] node - instance of the node to set parameters to.\n @param [in] dst - pointer to memory address to the destination.\n @param [in] src - pointer to memory address to the source.\n @param [in] count - the size of the memory to copy.\n @param [in] kind - the type of memory copy.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphMemcpyNodeSetParams1D( + node: hipGraphNode_t, + dst: *mut ::std::os::raw::c_void, + src: *const ::std::os::raw::c_void, + count: usize, + kind: hipMemcpyKind, ) -> hipError_t; } extern "C" { - #[doc = " @brief Returns occupancy for a device function."] - #[doc = ""] - #[doc = " @param [out] numBlocks Returned occupancy"] - #[doc = " @param [in] func Kernel function for which occupancy is calulated"] - #[doc = " @param [in] blockSize Block size the kernel is intended to be launched with"] - #[doc = " @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block"] - pub fn hipOccupancyMaxActiveBlocksPerMultiprocessor( - numBlocks: *mut ::std::os::raw::c_int, - f: *const ::std::os::raw::c_void, - blockSize: ::std::os::raw::c_int, - dynSharedMemPerBlk: usize, + #[must_use] + #[doc = " @brief Sets the parameters for a memcpy node in the given graphExec to perform a 1-dimensional\n copy.\n\n @param [in] hGraphExec - instance of the executable graph with the node.\n @param [in] node - instance of the node to set parameters to.\n @param [in] dst - pointer to memory address to the destination.\n @param [in] src - pointer to memory address to the source.\n @param [in] count - the size of the memory to copy.\n @param [in] kind - the type of memory copy.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExecMemcpyNodeSetParams1D( + hGraphExec: hipGraphExec_t, + node: hipGraphNode_t, + dst: *mut ::std::os::raw::c_void, + src: *const ::std::os::raw::c_void, + count: usize, + kind: hipMemcpyKind, ) -> hipError_t; } extern "C" { - #[doc = " @brief Returns occupancy for a device function."] - #[doc = ""] - #[doc = " @param [out] numBlocks Returned occupancy"] - #[doc = " @param [in] f Kernel function for which occupancy is calulated"] - #[doc = " @param [in] blockSize Block size the kernel is intended to be launched with"] - #[doc = " @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block"] - #[doc = " @param [in] flags Extra flags for occupancy calculation (currently ignored)"] - pub fn hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags( - numBlocks: *mut ::std::os::raw::c_int, - f: *const ::std::os::raw::c_void, - blockSize: ::std::os::raw::c_int, - dynSharedMemPerBlk: usize, - flags: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief Creates a memcpy node to copy from a symbol on the device and adds it to a graph.\n\n @param [out] pGraphNode - pointer to graph node to create.\n @param [in] graph - instance of graph to add the created node.\n @param [in] pDependencies - const pointer to the dependencies on the memcpy execution node.\n @param [in] numDependencies - the number of the dependencies.\n @param [in] dst - pointer to memory address to the destination.\n @param [in] symbol - Device symbol address.\n @param [in] count - the size of the memory to copy.\n @param [in] offset - Offset from start of symbol in bytes.\n @param [in] kind - the type of memory copy.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddMemcpyNodeFromSymbol( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, + dst: *mut ::std::os::raw::c_void, + symbol: *const ::std::os::raw::c_void, + count: usize, + offset: usize, + kind: hipMemcpyKind, ) -> hipError_t; } extern "C" { - #[doc = " @brief determine the grid and block sizes to achieves maximum occupancy for a kernel"] - #[doc = ""] - #[doc = " @param [out] gridSize minimum grid size for maximum potential occupancy"] - #[doc = " @param [out] blockSize block size for maximum potential occupancy"] - #[doc = " @param [in] f kernel function for which occupancy is calulated"] - #[doc = " @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block"] - #[doc = " @param [in] blockSizeLimit the maximum block size for the kernel, use 0 for no limit"] - #[doc = ""] - #[doc = " @returns hipSuccess, hipInvalidDevice, hipErrorInvalidValue"] - pub fn hipOccupancyMaxPotentialBlockSize( - gridSize: *mut ::std::os::raw::c_int, - blockSize: *mut ::std::os::raw::c_int, - f: *const ::std::os::raw::c_void, - dynSharedMemPerBlk: usize, - blockSizeLimit: ::std::os::raw::c_int, + #[must_use] + #[doc = " @brief Sets a memcpy node's parameters to copy from a symbol on the device.\n\n @param [in] node - instance of the node to set parameters to.\n @param [in] dst - pointer to memory address to the destination.\n @param [in] symbol - Device symbol address.\n @param [in] count - the size of the memory to copy.\n @param [in] offset - Offset from start of symbol in bytes.\n @param [in] kind - the type of memory copy.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphMemcpyNodeSetParamsFromSymbol( + node: hipGraphNode_t, + dst: *mut ::std::os::raw::c_void, + symbol: *const ::std::os::raw::c_void, + count: usize, + offset: usize, + kind: hipMemcpyKind, ) -> hipError_t; } extern "C" { - #[doc = " @brief Start recording of profiling information"] - #[doc = " When using this API, start the profiler with profiling disabled. (--startdisabled)"] - #[doc = " @warning : hipProfilerStart API is under development."] - pub fn hipProfilerStart() -> hipError_t; + #[must_use] + #[doc = " @brief Sets the parameters for a memcpy node in the given graphExec to copy from a symbol on the\n * device.\n\n @param [in] hGraphExec - instance of the executable graph with the node.\n @param [in] node - instance of the node to set parameters to.\n @param [in] dst - pointer to memory address to the destination.\n @param [in] symbol - Device symbol address.\n @param [in] count - the size of the memory to copy.\n @param [in] offset - Offset from start of symbol in bytes.\n @param [in] kind - the type of memory copy.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExecMemcpyNodeSetParamsFromSymbol( + hGraphExec: hipGraphExec_t, + node: hipGraphNode_t, + dst: *mut ::std::os::raw::c_void, + symbol: *const ::std::os::raw::c_void, + count: usize, + offset: usize, + kind: hipMemcpyKind, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Stop recording of profiling information."] - #[doc = " When using this API, start the profiler with profiling disabled. (--startdisabled)"] - #[doc = " @warning : hipProfilerStop API is under development."] - pub fn hipProfilerStop() -> hipError_t; + #[must_use] + #[doc = " @brief Creates a memcpy node to copy to a symbol on the device and adds it to a graph.\n\n @param [out] pGraphNode - pointer to graph node to create.\n @param [in] graph - instance of graph to add the created node.\n @param [in] pDependencies - const pointer to the dependencies on the memcpy execution node.\n @param [in] numDependencies - the number of the dependencies.\n @param [in] symbol - Device symbol address.\n @param [in] src - pointer to memory address of the src.\n @param [in] count - the size of the memory to copy.\n @param [in] offset - Offset from start of symbol in bytes.\n @param [in] kind - the type of memory copy.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddMemcpyNodeToSymbol( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, + symbol: *const ::std::os::raw::c_void, + src: *const ::std::os::raw::c_void, + count: usize, + offset: usize, + kind: hipMemcpyKind, + ) -> hipError_t; } extern "C" { - #[doc = " @}"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = " @defgroup Clang Launch API to support the triple-chevron syntax"] - #[doc = " @{"] - #[doc = " This section describes the API to support the triple-chevron syntax."] - #[doc = " @brief Configure a kernel launch."] - #[doc = ""] - #[doc = " @param [in] gridDim grid dimension specified as multiple of blockDim."] - #[doc = " @param [in] blockDim block dimensions specified in work-items"] - #[doc = " @param [in] sharedMem Amount of dynamic shared memory to allocate for this kernel. The"] - #[doc = " HIP-Clang compiler provides support for extern shared declarations."] - #[doc = " @param [in] stream Stream where the kernel should be dispatched. May be 0, in which case the"] - #[doc = " default stream is used with associated synchronization rules."] - #[doc = ""] - #[doc = " @returns hipSuccess, hipInvalidDevice, hipErrorNotInitialized, hipErrorInvalidValue"] - #[doc = ""] - pub fn hipConfigureCall( - gridDim: dim3, - blockDim: dim3, - sharedMem: usize, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Sets a memcpy node's parameters to copy to a symbol on the device.\n\n @param [in] node - instance of the node to set parameters to.\n @param [in] symbol - Device symbol address.\n @param [in] src - pointer to memory address of the src.\n @param [in] count - the size of the memory to copy.\n @param [in] offset - Offset from start of symbol in bytes.\n @param [in] kind - the type of memory copy.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphMemcpyNodeSetParamsToSymbol( + node: hipGraphNode_t, + symbol: *const ::std::os::raw::c_void, + src: *const ::std::os::raw::c_void, + count: usize, + offset: usize, + kind: hipMemcpyKind, ) -> hipError_t; } extern "C" { - #[doc = " @brief Set a kernel argument."] - #[doc = ""] - #[doc = " @returns hipSuccess, hipInvalidDevice, hipErrorNotInitialized, hipErrorInvalidValue"] - #[doc = ""] - #[doc = " @param [in] arg Pointer the argument in host memory."] - #[doc = " @param [in] size Size of the argument."] - #[doc = " @param [in] offset Offset of the argument on the argument stack."] - #[doc = ""] - pub fn hipSetupArgument( - arg: *const ::std::os::raw::c_void, - size: usize, + #[must_use] + #[doc = " @brief Sets the parameters for a memcpy node in the given graphExec to copy to a symbol on the\n device.\n @param [in] hGraphExec - instance of the executable graph with the node.\n @param [in] node - instance of the node to set parameters to.\n @param [in] symbol - Device symbol address.\n @param [in] src - pointer to memory address of the src.\n @param [in] count - the size of the memory to copy.\n @param [in] offset - Offset from start of symbol in bytes.\n @param [in] kind - the type of memory copy.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExecMemcpyNodeSetParamsToSymbol( + hGraphExec: hipGraphExec_t, + node: hipGraphNode_t, + symbol: *const ::std::os::raw::c_void, + src: *const ::std::os::raw::c_void, + count: usize, offset: usize, + kind: hipMemcpyKind, ) -> hipError_t; } extern "C" { - #[doc = " @brief Launch a kernel."] - #[doc = ""] - #[doc = " @param [in] func Kernel to launch."] - #[doc = ""] - #[doc = " @returns hipSuccess, hipInvalidDevice, hipErrorNotInitialized, hipErrorInvalidValue"] - #[doc = ""] - pub fn hipLaunchByPtr(func: *const ::std::os::raw::c_void) -> hipError_t; + #[must_use] + #[doc = " @brief Creates a memset node and adds it to a graph.\n\n @param [out] pGraphNode - pointer to the graph node to create.\n @param [in] graph - instance of the graph to add the created node.\n @param [in] pDependencies - const pointer to the dependencies on the memset execution node.\n @param [in] numDependencies - the number of the dependencies.\n @param [in] pMemsetParams - const pointer to the parameters for the memory set.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddMemsetNode( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, + pMemsetParams: *const hipMemsetParams, + ) -> hipError_t; } extern "C" { - #[doc = " @brief C compliant kernel launch API"] - #[doc = ""] - #[doc = " @param [in] function_address - kernel stub function pointer."] - #[doc = " @param [in] numBlocks - number of blocks"] - #[doc = " @param [in] dimBlocks - dimension of a block"] - #[doc = " @param [in] args - kernel arguments"] - #[doc = " @param [in] sharedMemBytes - Amount of dynamic shared memory to allocate for this kernel. The"] - #[doc = " HIP-Clang compiler provides support for extern shared declarations."] - #[doc = " @param [in] stream - Stream where the kernel should be dispatched. May be 0, in which case th"] - #[doc = " default stream is used with associated synchronization rules."] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue, hipInvalidDevice"] - #[doc = ""] - pub fn hipLaunchKernel( - function_address: *const ::std::os::raw::c_void, - numBlocks: dim3, - dimBlocks: dim3, - args: *mut *mut ::std::os::raw::c_void, - sharedMemBytes: usize, - stream: hipStream_t, + #[must_use] + #[doc = " @brief Gets a memset node's parameters.\n\n @param [in] node - instane of the node to get parameters from.\n @param [out] pNodeParams - pointer to the parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphMemsetNodeGetParams( + node: hipGraphNode_t, + pNodeParams: *mut hipMemsetParams, ) -> hipError_t; } extern "C" { - #[doc = " Copies memory for 2D arrays."] - #[doc = ""] - #[doc = " @param pCopy - Parameters for the memory copy"] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - pub fn hipDrvMemcpy2DUnaligned(pCopy: *const hip_Memcpy2D) -> hipError_t; + #[must_use] + #[doc = " @brief Sets a memset node's parameters.\n\n @param [in] node - instance of the node to set parameters to.\n @param [in] pNodeParams - pointer to the parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphMemsetNodeSetParams( + node: hipGraphNode_t, + pNodeParams: *const hipMemsetParams, + ) -> hipError_t; } extern "C" { - pub fn hipExtLaunchKernel( - function_address: *const ::std::os::raw::c_void, - numBlocks: dim3, - dimBlocks: dim3, - args: *mut *mut ::std::os::raw::c_void, - sharedMemBytes: usize, - stream: hipStream_t, - startEvent: hipEvent_t, - stopEvent: hipEvent_t, - flags: ::std::os::raw::c_int, + #[must_use] + #[doc = " @brief Sets the parameters for a memset node in the given graphExec.\n\n @param [in] hGraphExec - instance of the executable graph with the node.\n @param [in] node - instance of the node to set parameters to.\n @param [in] pNodeParams - pointer to the parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExecMemsetNodeSetParams( + hGraphExec: hipGraphExec_t, + node: hipGraphNode_t, + pNodeParams: *const hipMemsetParams, ) -> hipError_t; } extern "C" { - #[doc = " @}"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = " @defgroup Texture Texture Management"] - #[doc = " @{"] - #[doc = " This section describes the texture management functions of HIP runtime API."] - #[doc = ""] - #[doc = " @addtogroup TexturD Texture Management [Deprecated]"] - #[doc = " @{"] - #[doc = " @ingroup Texture"] - #[doc = " This section describes the deprecated texture management functions of HIP runtime API."] - pub fn hipBindTexture( - offset: *mut usize, - tex: *const textureReference, - devPtr: *const ::std::os::raw::c_void, - desc: *const hipChannelFormatDesc, - size: usize, + #[must_use] + #[doc = " @brief Creates a host execution node and adds it to a graph.\n\n @param [out] pGraphNode - pointer to the graph node to create.\n @param [in] graph - instance of the graph to add the created node.\n @param [in] pDependencies - const pointer to the dependencies on the memset execution node.\n @param [in] numDependencies - the number of the dependencies.\n @param [in] pNodeParams -pointer to the parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddHostNode( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, + pNodeParams: *const hipHostNodeParams, ) -> hipError_t; } extern "C" { - pub fn hipBindTexture2D( - offset: *mut usize, - tex: *const textureReference, - devPtr: *const ::std::os::raw::c_void, - desc: *const hipChannelFormatDesc, - width: usize, - height: usize, - pitch: usize, + #[must_use] + #[doc = " @brief Returns a host node's parameters.\n\n @param [in] node - instane of the node to get parameters from.\n @param [out] pNodeParams - pointer to the parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphHostNodeGetParams( + node: hipGraphNode_t, + pNodeParams: *mut hipHostNodeParams, ) -> hipError_t; } extern "C" { - pub fn hipBindTextureToArray( - tex: *const textureReference, - array: hipArray_const_t, - desc: *const hipChannelFormatDesc, + #[must_use] + #[doc = " @brief Sets a host node's parameters.\n\n @param [in] node - instance of the node to set parameters to.\n @param [in] pNodeParams - pointer to the parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphHostNodeSetParams( + node: hipGraphNode_t, + pNodeParams: *const hipHostNodeParams, ) -> hipError_t; } extern "C" { - pub fn hipGetTextureAlignmentOffset( - offset: *mut usize, - texref: *const textureReference, + #[must_use] + #[doc = " @brief Sets the parameters for a host node in the given graphExec.\n\n @param [in] hGraphExec - instance of the executable graph with the node.\n @param [in] node - instance of the node to set parameters to.\n @param [in] pNodeParams - pointer to the parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExecHostNodeSetParams( + hGraphExec: hipGraphExec_t, + node: hipGraphNode_t, + pNodeParams: *const hipHostNodeParams, ) -> hipError_t; } extern "C" { - pub fn hipUnbindTexture(tex: *const textureReference) -> hipError_t; + #[must_use] + #[doc = " @brief Creates a child graph node and adds it to a graph.\n\n @param [out] pGraphNode - pointer to the graph node to create.\n @param [in] graph - instance of the graph to add the created node.\n @param [in] pDependencies - const pointer to the dependencies on the memset execution node.\n @param [in] numDependencies - the number of the dependencies.\n @param [in] childGraph - the graph to clone into this node\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddChildGraphNode( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, + childGraph: hipGraph_t, + ) -> hipError_t; } extern "C" { - #[doc = " @}"] - pub fn hipBindTextureToMipmappedArray( - tex: *const textureReference, - mipmappedArray: hipMipmappedArray_const_t, - desc: *const hipChannelFormatDesc, + #[must_use] + #[doc = " @brief Gets a handle to the embedded graph of a child graph node.\n\n @param [in] node - instane of the node to get child graph.\n @param [out] pGraph - pointer to get the graph.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphChildGraphNodeGetGraph( + node: hipGraphNode_t, + pGraph: *mut hipGraph_t, ) -> hipError_t; } extern "C" { - pub fn hipGetTextureReference( - texref: *mut *const textureReference, - symbol: *const ::std::os::raw::c_void, + #[must_use] + #[doc = " @brief Updates node parameters in the child graph node in the given graphExec.\n\n @param [in] hGraphExec - instance of the executable graph with the node.\n @param [in] node - node from the graph which was used to instantiate graphExec.\n @param [in] childGraph - child graph with updated parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExecChildGraphNodeSetParams( + hGraphExec: hipGraphExec_t, + node: hipGraphNode_t, + childGraph: hipGraph_t, ) -> hipError_t; } extern "C" { - pub fn hipCreateTextureObject( - pTexObject: *mut hipTextureObject_t, - pResDesc: *const hipResourceDesc, - pTexDesc: *const hipTextureDesc, - pResViewDesc: *const hipResourceViewDesc, + #[must_use] + #[doc = " @brief Creates an empty node and adds it to a graph.\n\n @param [out] pGraphNode - pointer to the graph node to create and add to the graph.\n @param [in] graph - instane of the graph the node is add to.\n @param [in] pDependencies - const pointer to the node dependenties.\n @param [in] numDependencies - the number of dependencies.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddEmptyNode( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, ) -> hipError_t; } extern "C" { - pub fn hipDestroyTextureObject(textureObject: hipTextureObject_t) -> hipError_t; + #[must_use] + #[doc = " @brief Creates an event record node and adds it to a graph.\n\n @param [out] pGraphNode - pointer to the graph node to create and add to the graph.\n @param [in] graph - instane of the graph the node to be added.\n @param [in] pDependencies - const pointer to the node dependenties.\n @param [in] numDependencies - the number of dependencies.\n @param [in] event - Event for the node.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddEventRecordNode( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, + event: hipEvent_t, + ) -> hipError_t; } extern "C" { - pub fn hipGetChannelDesc( - desc: *mut hipChannelFormatDesc, - array: hipArray_const_t, + #[must_use] + #[doc = " @brief Returns the event associated with an event record node.\n\n @param [in] node - instane of the node to get event from.\n @param [out] event_out - Pointer to return the event.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphEventRecordNodeGetEvent( + node: hipGraphNode_t, + event_out: *mut hipEvent_t, ) -> hipError_t; } extern "C" { - pub fn hipGetTextureObjectResourceDesc( - pResDesc: *mut hipResourceDesc, - textureObject: hipTextureObject_t, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Sets an event record node's event.\n\n @param [in] node - instane of the node to set event to.\n @param [in] event - pointer to the event.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphEventRecordNodeSetEvent(node: hipGraphNode_t, event: hipEvent_t) -> hipError_t; } extern "C" { - pub fn hipGetTextureObjectResourceViewDesc( - pResViewDesc: *mut hipResourceViewDesc, - textureObject: hipTextureObject_t, + #[must_use] + #[doc = " @brief Sets the event for an event record node in the given graphExec.\n\n @param [in] hGraphExec - instance of the executable graph with the node.\n @param [in] hNode - node from the graph which was used to instantiate graphExec.\n @param [in] event - pointer to the event.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExecEventRecordNodeSetEvent( + hGraphExec: hipGraphExec_t, + hNode: hipGraphNode_t, + event: hipEvent_t, ) -> hipError_t; } extern "C" { - pub fn hipGetTextureObjectTextureDesc( - pTexDesc: *mut hipTextureDesc, - textureObject: hipTextureObject_t, + #[must_use] + #[doc = " @brief Creates an event wait node and adds it to a graph.\n\n @param [out] pGraphNode - pointer to the graph node to create and add to the graph.\n @param [in] graph - instane of the graph the node to be added.\n @param [in] pDependencies - const pointer to the node dependenties.\n @param [in] numDependencies - the number of dependencies.\n @param [in] event - Event for the node.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddEventWaitNode( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, + event: hipEvent_t, ) -> hipError_t; } extern "C" { - pub fn hipTexRefGetAddress( - dev_ptr: *mut hipDeviceptr_t, - texRef: *const textureReference, + #[must_use] + #[doc = " @brief Returns the event associated with an event wait node.\n\n @param [in] node - instane of the node to get event from.\n @param [out] event_out - Pointer to return the event.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphEventWaitNodeGetEvent( + node: hipGraphNode_t, + event_out: *mut hipEvent_t, ) -> hipError_t; } extern "C" { - pub fn hipTexRefGetAddressMode( - pam: *mut hipTextureAddressMode, - texRef: *const textureReference, - dim: ::std::os::raw::c_int, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Sets an event wait node's event.\n\n @param [in] node - instane of the node to set event to.\n @param [in] event - pointer to the event.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphEventWaitNodeSetEvent(node: hipGraphNode_t, event: hipEvent_t) -> hipError_t; } extern "C" { - pub fn hipTexRefGetFilterMode( - pfm: *mut hipTextureFilterMode, - texRef: *const textureReference, + #[must_use] + #[doc = " @brief Sets the event for an event record node in the given graphExec.\n\n @param [in] hGraphExec - instance of the executable graph with the node.\n @param [in] hNode - node from the graph which was used to instantiate graphExec.\n @param [in] event - pointer to the event.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExecEventWaitNodeSetEvent( + hGraphExec: hipGraphExec_t, + hNode: hipGraphNode_t, + event: hipEvent_t, ) -> hipError_t; } extern "C" { - pub fn hipTexRefGetFlags( - pFlags: *mut ::std::os::raw::c_uint, - texRef: *const textureReference, + #[must_use] + #[doc = " @brief Creates a memory allocation node and adds it to a graph\n\n @param [out] pGraphNode - Pointer to the graph node to create and add to the graph\n @param [in] graph - Instane of the graph the node to be added\n @param [in] pDependencies - Const pointer to the node dependenties\n @param [in] numDependencies - The number of dependencies\n @param [in] pNodeParams - Node parameters for memory allocation\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddMemAllocNode( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, + pNodeParams: *mut hipMemAllocNodeParams, ) -> hipError_t; } extern "C" { - pub fn hipTexRefGetFormat( - pFormat: *mut hipArray_Format, - pNumChannels: *mut ::std::os::raw::c_int, - texRef: *const textureReference, + #[must_use] + #[doc = " @brief Returns parameters for memory allocation node\n\n @param [in] node - Memory allocation node for a query\n @param [out] pNodeParams - Parameters for the specified memory allocation node\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphMemAllocNodeGetParams( + node: hipGraphNode_t, + pNodeParams: *mut hipMemAllocNodeParams, ) -> hipError_t; } extern "C" { - pub fn hipTexRefGetMaxAnisotropy( - pmaxAnsio: *mut ::std::os::raw::c_int, - texRef: *const textureReference, + #[must_use] + #[doc = " @brief Creates a memory free node and adds it to a graph\n\n @param [out] pGraphNode - Pointer to the graph node to create and add to the graph\n @param [in] graph - Instane of the graph the node to be added\n @param [in] pDependencies - Const pointer to the node dependenties\n @param [in] numDependencies - The number of dependencies\n @param [in] dev_ptr - Pointer to the memory to be freed\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddMemFreeNode( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, + dev_ptr: *mut ::std::os::raw::c_void, ) -> hipError_t; } extern "C" { - pub fn hipTexRefGetMipmapFilterMode( - pfm: *mut hipTextureFilterMode, - texRef: *const textureReference, + #[must_use] + #[doc = " @brief Returns parameters for memory free node\n\n @param [in] node - Memory free node for a query\n @param [out] dev_ptr - Device pointer for the specified memory free node\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphMemFreeNodeGetParams( + node: hipGraphNode_t, + dev_ptr: *mut ::std::os::raw::c_void, ) -> hipError_t; } extern "C" { - pub fn hipTexRefGetMipmapLevelBias( - pbias: *mut f32, - texRef: *const textureReference, + #[must_use] + #[doc = " @brief Get the mem attribute for graphs.\n\n @param [in] device - device the attr is get for.\n @param [in] attr - attr to get.\n @param [out] value - value for specific attr.\n @returns #hipSuccess, #hipErrorInvalidDevice\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipDeviceGetGraphMemAttribute( + device: ::std::os::raw::c_int, + attr: hipGraphMemAttributeType, + value: *mut ::std::os::raw::c_void, ) -> hipError_t; } extern "C" { - pub fn hipTexRefGetMipmapLevelClamp( - pminMipmapLevelClamp: *mut f32, - pmaxMipmapLevelClamp: *mut f32, - texRef: *const textureReference, + #[must_use] + #[doc = " @brief Set the mem attribute for graphs.\n\n @param [in] device - device the attr is set for.\n @param [in] attr - attr to set.\n @param [in] value - value for specific attr.\n @returns #hipSuccess, #hipErrorInvalidDevice\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipDeviceSetGraphMemAttribute( + device: ::std::os::raw::c_int, + attr: hipGraphMemAttributeType, + value: *mut ::std::os::raw::c_void, ) -> hipError_t; } extern "C" { - pub fn hipTexRefGetMipMappedArray( - pArray: *mut hipMipmappedArray_t, - texRef: *const textureReference, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Free unused memory on specific device used for graph back to OS.\n\n @param [in] device - device the memory is used for graphs\n @returns #hipSuccess, #hipErrorInvalidDevice\n\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipDeviceGraphMemTrim(device: ::std::os::raw::c_int) -> hipError_t; } extern "C" { - pub fn hipTexRefSetAddress( - ByteOffset: *mut usize, - texRef: *mut textureReference, - dptr: hipDeviceptr_t, - bytes: usize, + #[must_use] + #[doc = " @brief Create an instance of userObject to manage lifetime of a resource.\n\n @param [out] object_out - pointer to instace of userobj.\n @param [in] ptr - pointer to pass to destroy function.\n @param [in] destroy - destroy callback to remove resource.\n @param [in] initialRefcount - reference to resource.\n @param [in] flags - flags passed to API.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipUserObjectCreate( + object_out: *mut hipUserObject_t, + ptr: *mut ::std::os::raw::c_void, + destroy: hipHostFn_t, + initialRefcount: ::std::os::raw::c_uint, + flags: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - pub fn hipTexRefSetAddress2D( - texRef: *mut textureReference, - desc: *const HIP_ARRAY_DESCRIPTOR, - dptr: hipDeviceptr_t, - Pitch: usize, + #[must_use] + #[doc = " @brief Release number of references to resource.\n\n @param [in] object - pointer to instace of userobj.\n @param [in] count - reference to resource to be retained.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipUserObjectRelease( + object: hipUserObject_t, + count: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - pub fn hipTexRefSetAddressMode( - texRef: *mut textureReference, - dim: ::std::os::raw::c_int, - am: hipTextureAddressMode, + #[must_use] + #[doc = " @brief Retain number of references to resource.\n\n @param [in] object - pointer to instace of userobj.\n @param [in] count - reference to resource to be retained.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipUserObjectRetain( + object: hipUserObject_t, + count: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - pub fn hipTexRefSetArray( - tex: *mut textureReference, - array: hipArray_const_t, + #[must_use] + #[doc = " @brief Retain user object for graphs.\n\n @param [in] graph - pointer to graph to retain the user object for.\n @param [in] object - pointer to instace of userobj.\n @param [in] count - reference to resource to be retained.\n @param [in] flags - flags passed to API.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphRetainUserObject( + graph: hipGraph_t, + object: hipUserObject_t, + count: ::std::os::raw::c_uint, flags: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - pub fn hipTexRefSetFilterMode( - texRef: *mut textureReference, - fm: hipTextureFilterMode, + #[must_use] + #[doc = " @brief Release user object from graphs.\n\n @param [in] graph - pointer to graph to retain the user object for.\n @param [in] object - pointer to instace of userobj.\n @param [in] count - reference to resource to be retained.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphReleaseUserObject( + graph: hipGraph_t, + object: hipUserObject_t, + count: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - pub fn hipTexRefSetFlags( - texRef: *mut textureReference, - Flags: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief Write a DOT file describing graph structure.\n\n @param [in] graph - graph object for which DOT file has to be generated.\n @param [in] path - path to write the DOT file.\n @param [in] flags - Flags from hipGraphDebugDotFlags to get additional node information.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorOperatingSystem\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphDebugDotPrint( + graph: hipGraph_t, + path: *const ::std::os::raw::c_char, + flags: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - pub fn hipTexRefSetFormat( - texRef: *mut textureReference, - fmt: hipArray_Format, - NumPackedComponents: ::std::os::raw::c_int, + #[must_use] + #[doc = " @brief Copies attributes from source node to destination node.\n\n Copies attributes from source node to destination node.\n Both node must have the same context.\n\n @param [out] hDst - Destination node.\n @param [in] hSrc - Source node.\n For list of attributes see ::hipKernelNodeAttrID.\n\n @returns #hipSuccess, #hipErrorInvalidContext\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphKernelNodeCopyAttributes( + hSrc: hipGraphNode_t, + hDst: hipGraphNode_t, ) -> hipError_t; } extern "C" { - pub fn hipTexRefSetMaxAnisotropy( - texRef: *mut textureReference, - maxAniso: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief Enables or disables the specified node in the given graphExec\n\n Sets hNode to be either enabled or disabled. Disabled nodes are functionally equivalent\n to empty nodes until they are reenabled. Existing node parameters are not affected by\n disabling/enabling the node.\n\n The node is identified by the corresponding hNode in the non-executable graph, from which the\n executable graph was instantiated.\n\n hNode must not have been removed from the original graph.\n\n @note Currently only kernel, memset and memcpy nodes are supported.\n\n @param [in] hGraphExec - The executable graph in which to set the specified node.\n @param [in] hNode - Node from the graph from which graphExec was instantiated.\n @param [in] isEnabled - Node is enabled if != 0, otherwise the node is disabled.\n\n @returns #hipSuccess, #hipErrorInvalidValue,\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphNodeSetEnabled( + hGraphExec: hipGraphExec_t, + hNode: hipGraphNode_t, + isEnabled: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - pub fn hipTexObjectCreate( - pTexObject: *mut hipTextureObject_t, - pResDesc: *const HIP_RESOURCE_DESC, - pTexDesc: *const HIP_TEXTURE_DESC, - pResViewDesc: *const HIP_RESOURCE_VIEW_DESC, + #[must_use] + #[doc = " @brief Query whether a node in the given graphExec is enabled\n\n Sets isEnabled to 1 if hNode is enabled, or 0 if it is disabled.\n\n The node is identified by the corresponding node in the non-executable graph, from which the\n executable graph was instantiated.\n\n hNode must not have been removed from the original graph.\n\n @note Currently only kernel, memset and memcpy nodes are supported.\n\n @param [in] hGraphExec - The executable graph in which to set the specified node.\n @param [in] hNode - Node from the graph from which graphExec was instantiated.\n @param [out] isEnabled - Location to return the enabled status of the node.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphNodeGetEnabled( + hGraphExec: hipGraphExec_t, + hNode: hipGraphNode_t, + isEnabled: *mut ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - pub fn hipTexObjectDestroy(texObject: hipTextureObject_t) -> hipError_t; + #[must_use] + #[doc = " @brief Creates a external semaphor wait node and adds it to a graph.\n\n @param [out] pGraphNode - pointer to the graph node to create.\n @param [in] graph - instance of the graph to add the created node.\n @param [in] pDependencies - const pointer to the dependencies on the memset execution node.\n @param [in] numDependencies - the number of the dependencies.\n @param [in] nodeParams -pointer to the parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddExternalSemaphoresWaitNode( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, + nodeParams: *const hipExternalSemaphoreWaitNodeParams, + ) -> hipError_t; } extern "C" { - pub fn hipTexObjectGetResourceDesc( - pResDesc: *mut HIP_RESOURCE_DESC, - texObject: hipTextureObject_t, + #[must_use] + #[doc = " @brief Creates a external semaphor signal node and adds it to a graph.\n\n @param [out] pGraphNode - pointer to the graph node to create.\n @param [in] graph - instance of the graph to add the created node.\n @param [in] pDependencies - const pointer to the dependencies on the memset execution node.\n @param [in] numDependencies - the number of the dependencies.\n @param [in] nodeParams -pointer to the parameters.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphAddExternalSemaphoresSignalNode( + pGraphNode: *mut hipGraphNode_t, + graph: hipGraph_t, + pDependencies: *const hipGraphNode_t, + numDependencies: usize, + nodeParams: *const hipExternalSemaphoreSignalNodeParams, ) -> hipError_t; } extern "C" { - pub fn hipTexObjectGetResourceViewDesc( - pResViewDesc: *mut HIP_RESOURCE_VIEW_DESC, - texObject: hipTextureObject_t, + #[must_use] + #[doc = " @brief Updates node parameters in the external semaphore signal node.\n\n @param [in] hNode - Node from the graph from which graphExec was instantiated.\n @param [in] nodeParams - Pointer to the params to be set.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExternalSemaphoresSignalNodeSetParams( + hNode: hipGraphNode_t, + nodeParams: *const hipExternalSemaphoreSignalNodeParams, ) -> hipError_t; } extern "C" { - pub fn hipTexObjectGetTextureDesc( - pTexDesc: *mut HIP_TEXTURE_DESC, - texObject: hipTextureObject_t, + #[must_use] + #[doc = " @brief Updates node parameters in the external semaphore wait node.\n\n @param [in] hNode - Node from the graph from which graphExec was instantiated.\n @param [in] nodeParams - Pointer to the params to be set.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExternalSemaphoresWaitNodeSetParams( + hNode: hipGraphNode_t, + nodeParams: *const hipExternalSemaphoreWaitNodeParams, ) -> hipError_t; } extern "C" { - #[doc = " @}"] - pub fn hipTexRefSetBorderColor( - texRef: *mut textureReference, - pBorderColor: *mut f32, + #[must_use] + #[doc = " @brief Returns external semaphore signal node params.\n\n @param [in] hNode - Node from the graph from which graphExec was instantiated.\n @param [out] params_out - Pointer to params.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExternalSemaphoresSignalNodeGetParams( + hNode: hipGraphNode_t, + params_out: *mut hipExternalSemaphoreSignalNodeParams, ) -> hipError_t; } extern "C" { - pub fn hipTexRefSetMipmapFilterMode( - texRef: *mut textureReference, - fm: hipTextureFilterMode, + #[must_use] + #[doc = " @brief Returns external semaphore wait node params.\n\n @param [in] hNode - Node from the graph from which graphExec was instantiated.\n @param [out] params_out - Pointer to params.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExternalSemaphoresWaitNodeGetParams( + hNode: hipGraphNode_t, + params_out: *mut hipExternalSemaphoreWaitNodeParams, ) -> hipError_t; } extern "C" { - pub fn hipTexRefSetMipmapLevelBias(texRef: *mut textureReference, bias: f32) -> hipError_t; + #[must_use] + #[doc = " @brief Updates node parameters in the external semaphore signal node in the given graphExec.\n\n @param [in] hGraphExec - The executable graph in which to set the specified node.\n @param [in] hNode - Node from the graph from which graphExec was instantiated.\n @param [in] nodeParams - Pointer to the params to be set.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExecExternalSemaphoresSignalNodeSetParams( + hGraphExec: hipGraphExec_t, + hNode: hipGraphNode_t, + nodeParams: *const hipExternalSemaphoreSignalNodeParams, + ) -> hipError_t; } extern "C" { - pub fn hipTexRefSetMipmapLevelClamp( - texRef: *mut textureReference, - minMipMapLevelClamp: f32, - maxMipMapLevelClamp: f32, + #[must_use] + #[doc = " @brief Updates node parameters in the external semaphore wait node in the given graphExec.\n\n @param [in] hGraphExec - The executable graph in which to set the specified node.\n @param [in] hNode - Node from the graph from which graphExec was instantiated.\n @param [in] nodeParams - Pointer to the params to be set.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipGraphExecExternalSemaphoresWaitNodeSetParams( + hGraphExec: hipGraphExec_t, + hNode: hipGraphNode_t, + nodeParams: *const hipExternalSemaphoreWaitNodeParams, ) -> hipError_t; } extern "C" { - pub fn hipTexRefSetMipmappedArray( - texRef: *mut textureReference, - mipmappedArray: *mut hipMipmappedArray, - Flags: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief Creates a memset node and adds it to a graph.\n\n @param [out] phGraphNode - pointer to graph node to create.\n @param [in] hGraph - instance of graph to add the created node to.\n @param [in] dependencies - const pointer to the dependencies on the memset execution node.\n @param [in] numDependencies - number of the dependencies.\n @param [in] memsetParams - const pointer to the parameters for the memory set.\n @param [in] ctx - cotext related to current device.\n @returns #hipSuccess, #hipErrorInvalidValue\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues."] + pub fn hipDrvGraphAddMemsetNode( + phGraphNode: *mut hipGraphNode_t, + hGraph: hipGraph_t, + dependencies: *const hipGraphNode_t, + numDependencies: usize, + memsetParams: *const HIP_MEMSET_NODE_PARAMS, + ctx: hipCtx_t, ) -> hipError_t; } extern "C" { - pub fn hipMipmappedArrayCreate( - pHandle: *mut hipMipmappedArray_t, - pMipmappedArrayDesc: *mut HIP_ARRAY3D_DESCRIPTOR, - numMipmapLevels: ::std::os::raw::c_uint, - ) -> hipError_t; + #[must_use] + #[doc = " @brief Frees an address range reservation made via hipMemAddressReserve\n\n @param [in] devPtr - starting address of the range.\n @param [in] size - size of the range.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemAddressFree(devPtr: *mut ::std::os::raw::c_void, size: usize) -> hipError_t; } extern "C" { - pub fn hipMipmappedArrayDestroy(hMipmappedArray: hipMipmappedArray_t) -> hipError_t; + #[must_use] + #[doc = " @brief Reserves an address range\n\n @param [out] ptr - starting address of the reserved range.\n @param [in] size - size of the reservation.\n @param [in] alignment - alignment of the address.\n @param [in] addr - requested starting address of the range.\n @param [in] flags - currently unused, must be zero.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemAddressReserve( + ptr: *mut *mut ::std::os::raw::c_void, + size: usize, + alignment: usize, + addr: *mut ::std::os::raw::c_void, + flags: ::std::os::raw::c_ulonglong, + ) -> hipError_t; } extern "C" { - pub fn hipMipmappedArrayGetLevel( - pLevelArray: *mut hipArray_t, - hMipMappedArray: hipMipmappedArray_t, - level: ::std::os::raw::c_uint, + #[must_use] + #[doc = " @brief Creates a memory allocation described by the properties and size\n\n @param [out] handle - value of the returned handle.\n @param [in] size - size of the allocation.\n @param [in] prop - properties of the allocation.\n @param [in] flags - currently unused, must be zero.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemCreate( + handle: *mut hipMemGenericAllocationHandle_t, + size: usize, + prop: *const hipMemAllocationProp, + flags: ::std::os::raw::c_ulonglong, ) -> hipError_t; } extern "C" { - #[doc = " Callback/Activity API"] - pub fn hipRegisterApiCallback( - id: u32, - fun: *mut ::std::os::raw::c_void, - arg: *mut ::std::os::raw::c_void, + #[must_use] + #[doc = " @brief Exports an allocation to a requested shareable handle type.\n\n @param [out] shareableHandle - value of the returned handle.\n @param [in] handle - handle to share.\n @param [in] handleType - type of the shareable handle.\n @param [in] flags - currently unused, must be zero.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemExportToShareableHandle( + shareableHandle: *mut ::std::os::raw::c_void, + handle: hipMemGenericAllocationHandle_t, + handleType: hipMemAllocationHandleType, + flags: ::std::os::raw::c_ulonglong, ) -> hipError_t; } extern "C" { - pub fn hipRemoveApiCallback(id: u32) -> hipError_t; + #[must_use] + #[doc = " @brief Get the access flags set for the given location and ptr.\n\n @param [out] flags - flags for this location.\n @param [in] location - target location.\n @param [in] ptr - address to check the access flags.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemGetAccess( + flags: *mut ::std::os::raw::c_ulonglong, + location: *const hipMemLocation, + ptr: *mut ::std::os::raw::c_void, + ) -> hipError_t; } extern "C" { - pub fn hipRegisterActivityCallback( - id: u32, - fun: *mut ::std::os::raw::c_void, - arg: *mut ::std::os::raw::c_void, + #[must_use] + #[doc = " @brief Calculates either the minimal or recommended granularity.\n\n @param [out] granularity - returned granularity.\n @param [in] prop - location properties.\n @param [in] option - determines which granularity to return.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows.\n"] + pub fn hipMemGetAllocationGranularity( + granularity: *mut usize, + prop: *const hipMemAllocationProp, + option: hipMemAllocationGranularity_flags, ) -> hipError_t; } extern "C" { - pub fn hipRemoveActivityCallback(id: u32) -> hipError_t; + #[must_use] + #[doc = " @brief Retrieve the property structure of the given handle.\n\n @param [out] prop - properties of the given handle.\n @param [in] handle - handle to perform the query on.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux under development on Windows."] + pub fn hipMemGetAllocationPropertiesFromHandle( + prop: *mut hipMemAllocationProp, + handle: hipMemGenericAllocationHandle_t, + ) -> hipError_t; } extern "C" { - pub fn hipApiName(id: u32) -> *const ::std::os::raw::c_char; + #[must_use] + #[doc = " @brief Imports an allocation from a requested shareable handle type.\n\n @param [out] handle - returned value.\n @param [in] osHandle - shareable handle representing the memory allocation.\n @param [in] shHandleType - handle type.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemImportFromShareableHandle( + handle: *mut hipMemGenericAllocationHandle_t, + osHandle: *mut ::std::os::raw::c_void, + shHandleType: hipMemAllocationHandleType, + ) -> hipError_t; } extern "C" { - pub fn hipKernelNameRef(f: hipFunction_t) -> *const ::std::os::raw::c_char; + #[must_use] + #[doc = " @brief Maps an allocation handle to a reserved virtual address range.\n\n @param [in] ptr - address where the memory will be mapped.\n @param [in] size - size of the mapping.\n @param [in] offset - offset into the memory, currently must be zero.\n @param [in] handle - memory allocation to be mapped.\n @param [in] flags - currently unused, must be zero.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemMap( + ptr: *mut ::std::os::raw::c_void, + size: usize, + offset: usize, + handle: hipMemGenericAllocationHandle_t, + flags: ::std::os::raw::c_ulonglong, + ) -> hipError_t; } extern "C" { - pub fn hipKernelNameRefByPtr( - hostFunction: *const ::std::os::raw::c_void, + #[must_use] + #[doc = " @brief Maps or unmaps subregions of sparse HIP arrays and sparse HIP mipmapped arrays.\n\n @param [in] mapInfoList - list of hipArrayMapInfo.\n @param [in] count - number of hipArrayMapInfo in mapInfoList.\n @param [in] stream - stream identifier for the stream to use for map or unmap operations.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemMapArrayAsync( + mapInfoList: *mut hipArrayMapInfo, + count: ::std::os::raw::c_uint, stream: hipStream_t, - ) -> *const ::std::os::raw::c_char; + ) -> hipError_t; } extern "C" { - pub fn hipGetStreamDeviceId(stream: hipStream_t) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ihipGraph { - _unused: [u8; 0], -} -#[doc = " An opaque value that represents a hip graph"] -pub type hipGraph_t = *mut ihipGraph; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct hipGraphNode { - _unused: [u8; 0], -} -#[doc = " An opaque value that represents a hip graph node"] -pub type hipGraphNode_t = *mut hipGraphNode; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct hipGraphExec { - _unused: [u8; 0], -} -#[doc = " An opaque value that represents a hip graph Exec"] -pub type hipGraphExec_t = *mut hipGraphExec; -impl hipGraphNodeType { - #[doc = "< GPU kernel node"] - pub const hipGraphNodeTypeKernel: hipGraphNodeType = hipGraphNodeType(1); -} -impl hipGraphNodeType { - #[doc = "< Memcpy 3D node"] - pub const hipGraphNodeTypeMemcpy: hipGraphNodeType = hipGraphNodeType(2); -} -impl hipGraphNodeType { - #[doc = "< Memset 1D node"] - pub const hipGraphNodeTypeMemset: hipGraphNodeType = hipGraphNodeType(3); -} -impl hipGraphNodeType { - #[doc = "< Host (executable) node"] - pub const hipGraphNodeTypeHost: hipGraphNodeType = hipGraphNodeType(4); -} -impl hipGraphNodeType { - #[doc = "< Node which executes an embedded graph"] - pub const hipGraphNodeTypeGraph: hipGraphNodeType = hipGraphNodeType(5); -} -impl hipGraphNodeType { - #[doc = "< Empty (no-op) node"] - pub const hipGraphNodeTypeEmpty: hipGraphNodeType = hipGraphNodeType(6); -} -impl hipGraphNodeType { - #[doc = "< External event wait node"] - pub const hipGraphNodeTypeWaitEvent: hipGraphNodeType = hipGraphNodeType(7); -} -impl hipGraphNodeType { - #[doc = "< External event record node"] - pub const hipGraphNodeTypeEventRecord: hipGraphNodeType = hipGraphNodeType(8); -} -impl hipGraphNodeType { - #[doc = "< Memcpy 1D node"] - pub const hipGraphNodeTypeMemcpy1D: hipGraphNodeType = hipGraphNodeType(9); -} -impl hipGraphNodeType { - #[doc = "< MemcpyFromSymbol node"] - pub const hipGraphNodeTypeMemcpyFromSymbol: hipGraphNodeType = hipGraphNodeType(10); -} -impl hipGraphNodeType { - #[doc = "< MemcpyToSymbol node"] - pub const hipGraphNodeTypeMemcpyToSymbol: hipGraphNodeType = hipGraphNodeType(11); -} -impl hipGraphNodeType { - pub const hipGraphNodeTypeCount: hipGraphNodeType = hipGraphNodeType(12); -} -#[repr(transparent)] -#[doc = " @brief hipGraphNodeType"] -#[doc = " @enum"] -#[doc = ""] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct hipGraphNodeType(pub ::std::os::raw::c_uint); -pub type hipHostFn_t = - ::std::option::Option; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct hipHostNodeParams { - pub fn_: hipHostFn_t, - pub userData: *mut ::std::os::raw::c_void, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct hipKernelNodeParams { - pub blockDim: dim3, - pub extra: *mut *mut ::std::os::raw::c_void, - pub func: *mut ::std::os::raw::c_void, - pub gridDim: dim3, - pub kernelParams: *mut *mut ::std::os::raw::c_void, - pub sharedMemBytes: ::std::os::raw::c_uint, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct hipMemsetParams { - pub dst: *mut ::std::os::raw::c_void, - pub elementSize: ::std::os::raw::c_uint, - pub height: usize, - pub pitch: usize, - pub value: ::std::os::raw::c_uint, - pub width: usize, + #[must_use] + #[doc = " @brief Release a memory handle representing a memory allocation which was previously allocated through hipMemCreate.\n\n @param [in] handle - handle of the memory allocation.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemRelease(handle: hipMemGenericAllocationHandle_t) -> hipError_t; } -impl hipGraphExecUpdateResult { - #[doc = "< The update succeeded"] - pub const hipGraphExecUpdateSuccess: hipGraphExecUpdateResult = hipGraphExecUpdateResult(0); +extern "C" { + #[must_use] + #[doc = " @brief Returns the allocation handle of the backing memory allocation given the address.\n\n @param [out] handle - handle representing addr.\n @param [in] addr - address to look up.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemRetainAllocationHandle( + handle: *mut hipMemGenericAllocationHandle_t, + addr: *mut ::std::os::raw::c_void, + ) -> hipError_t; } -impl hipGraphExecUpdateResult { - #[doc = "< The update failed for an unexpected reason which is described"] - #[doc = "< in the return value of the function"] - pub const hipGraphExecUpdateError: hipGraphExecUpdateResult = hipGraphExecUpdateResult(1); +extern "C" { + #[must_use] + #[doc = " @brief Set the access flags for each location specified in desc for the given virtual address range.\n\n @param [in] ptr - starting address of the virtual address range.\n @param [in] size - size of the range.\n @param [in] desc - array of hipMemAccessDesc.\n @param [in] count - number of hipMemAccessDesc in desc.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemSetAccess( + ptr: *mut ::std::os::raw::c_void, + size: usize, + desc: *const hipMemAccessDesc, + count: usize, + ) -> hipError_t; } -impl hipGraphExecUpdateResult { - #[doc = "< The update failed because the topology changed"] - pub const hipGraphExecUpdateErrorTopologyChanged: hipGraphExecUpdateResult = - hipGraphExecUpdateResult(2); +extern "C" { + #[must_use] + #[doc = " @brief Unmap memory allocation of a given address range.\n\n @param [in] ptr - starting address of the range to unmap.\n @param [in] size - size of the virtual address range.\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotSupported\n @warning : This API is marked as beta, meaning, while this is feature complete,\n it is still open to changes and may have outstanding issues.\n\n @note This API is implemented on Linux, under development on Windows."] + pub fn hipMemUnmap(ptr: *mut ::std::os::raw::c_void, size: usize) -> hipError_t; } -impl hipGraphExecUpdateResult { - #[doc = "< The update failed because a node type changed"] - pub const hipGraphExecUpdateErrorNodeTypeChanged: hipGraphExecUpdateResult = - hipGraphExecUpdateResult(3); +extern "C" { + #[must_use] + #[doc = " @brief Maps a graphics resource for access.\n\n @param [in] count - Number of resources to map.\n @param [in] resources - Pointer of resources to map.\n @param [in] stream - Stream for synchronization.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorUnknown, #hipErrorInvalidResourceHandle\n"] + pub fn hipGraphicsMapResources( + count: ::std::os::raw::c_int, + resources: *mut hipGraphicsResource_t, + stream: hipStream_t, + ) -> hipError_t; } -impl hipGraphExecUpdateResult { - pub const hipGraphExecUpdateErrorFunctionChanged: hipGraphExecUpdateResult = - hipGraphExecUpdateResult(4); +extern "C" { + #[must_use] + #[doc = " @brief Get an array through which to access a subresource of a mapped graphics resource.\n\n @param [out] array - Pointer of array through which a subresource of resource may be accessed.\n @param [in] resource - Mapped resource to access.\n @param [in] arrayIndex - Array index for the subresource to access.\n @param [in] mipLevel - Mipmap level for the subresource to access.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n\n @note In this API, the value of arrayIndex higher than zero is currently not supported.\n"] + pub fn hipGraphicsSubResourceGetMappedArray( + array: *mut hipArray_t, + resource: hipGraphicsResource_t, + arrayIndex: ::std::os::raw::c_uint, + mipLevel: ::std::os::raw::c_uint, + ) -> hipError_t; } -impl hipGraphExecUpdateResult { - pub const hipGraphExecUpdateErrorParametersChanged: hipGraphExecUpdateResult = - hipGraphExecUpdateResult(5); +extern "C" { + #[must_use] + #[doc = " @brief Gets device accessible address of a graphics resource.\n\n @param [out] devPtr - Pointer of device through which graphic resource may be accessed.\n @param [out] size - Size of the buffer accessible from devPtr.\n @param [in] resource - Mapped resource to access.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipGraphicsResourceGetMappedPointer( + devPtr: *mut *mut ::std::os::raw::c_void, + size: *mut usize, + resource: hipGraphicsResource_t, + ) -> hipError_t; } -impl hipGraphExecUpdateResult { - pub const hipGraphExecUpdateErrorNotSupported: hipGraphExecUpdateResult = - hipGraphExecUpdateResult(6); +extern "C" { + #[must_use] + #[doc = " @brief Unmaps graphics resources.\n\n @param [in] count - Number of resources to unmap.\n @param [in] resources - Pointer of resources to unmap.\n @param [in] stream - Stream for synchronization.\n\n @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorUnknown, #hipErrorContextIsDestroyed\n"] + pub fn hipGraphicsUnmapResources( + count: ::std::os::raw::c_int, + resources: *mut hipGraphicsResource_t, + stream: hipStream_t, + ) -> hipError_t; } -impl hipGraphExecUpdateResult { - pub const hipGraphExecUpdateErrorUnsupportedFunctionChange: hipGraphExecUpdateResult = - hipGraphExecUpdateResult(7); +extern "C" { + #[must_use] + #[doc = " @brief Unregisters a graphics resource.\n\n @param [in] resource - Graphics resources to unregister.\n\n @returns #hipSuccess\n"] + pub fn hipGraphicsUnregisterResource(resource: hipGraphicsResource_t) -> hipError_t; } -#[repr(transparent)] -#[doc = " @brief hipGraphExecUpdateResult"] -#[doc = " @enum"] -#[doc = ""] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct hipGraphExecUpdateResult(pub ::std::os::raw::c_uint); -impl hipStreamCaptureMode { - pub const hipStreamCaptureModeGlobal: hipStreamCaptureMode = hipStreamCaptureMode(0); +extern "C" { + #[must_use] + #[doc = " @brief Create a surface object.\n\n @param [out] pSurfObject Pointer of surface object to be created.\n @param [in] pResDesc Pointer of suface object descriptor.\n\n @returns #hipSuccess, #hipErrorInvalidValue\n"] + pub fn hipCreateSurfaceObject( + pSurfObject: *mut hipSurfaceObject_t, + pResDesc: *const hipResourceDesc, + ) -> hipError_t; } -impl hipStreamCaptureMode { - pub const hipStreamCaptureModeThreadLocal: hipStreamCaptureMode = hipStreamCaptureMode(1); +extern "C" { + #[must_use] + #[doc = " @brief Destroy a surface object.\n\n @param [in] surfaceObject Surface object to be destroyed.\n\n @returns #hipSuccess, #hipErrorInvalidValue"] + pub fn hipDestroySurfaceObject(surfaceObject: hipSurfaceObject_t) -> hipError_t; } -impl hipStreamCaptureMode { - pub const hipStreamCaptureModeRelaxed: hipStreamCaptureMode = hipStreamCaptureMode(2); +extern "C" { + #[must_use] + pub fn hipMemcpy_spt( + dst: *mut ::std::os::raw::c_void, + src: *const ::std::os::raw::c_void, + sizeBytes: usize, + kind: hipMemcpyKind, + ) -> hipError_t; } -#[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct hipStreamCaptureMode(pub ::std::os::raw::c_uint); -impl hipStreamCaptureStatus { - #[doc = "< Stream is not capturing"] - pub const hipStreamCaptureStatusNone: hipStreamCaptureStatus = hipStreamCaptureStatus(0); +extern "C" { + #[must_use] + pub fn hipMemcpyToSymbol_spt( + symbol: *const ::std::os::raw::c_void, + src: *const ::std::os::raw::c_void, + sizeBytes: usize, + offset: usize, + kind: hipMemcpyKind, + ) -> hipError_t; } -impl hipStreamCaptureStatus { - #[doc = "< Stream is actively capturing"] - pub const hipStreamCaptureStatusActive: hipStreamCaptureStatus = hipStreamCaptureStatus(1); +extern "C" { + #[must_use] + pub fn hipMemcpyFromSymbol_spt( + dst: *mut ::std::os::raw::c_void, + symbol: *const ::std::os::raw::c_void, + sizeBytes: usize, + offset: usize, + kind: hipMemcpyKind, + ) -> hipError_t; } -impl hipStreamCaptureStatus { - #[doc = "< Stream is part of a capture sequence that has been"] - #[doc = "< invalidated, but not terminated"] - pub const hipStreamCaptureStatusInvalidated: hipStreamCaptureStatus = hipStreamCaptureStatus(2); +extern "C" { + #[must_use] + pub fn hipMemcpy2D_spt( + dst: *mut ::std::os::raw::c_void, + dpitch: usize, + src: *const ::std::os::raw::c_void, + spitch: usize, + width: usize, + height: usize, + kind: hipMemcpyKind, + ) -> hipError_t; } -#[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct hipStreamCaptureStatus(pub ::std::os::raw::c_uint); extern "C" { - pub fn hipStreamBeginCapture(stream: hipStream_t, mode: hipStreamCaptureMode) -> hipError_t; + #[must_use] + pub fn hipMemcpy2DFromArray_spt( + dst: *mut ::std::os::raw::c_void, + dpitch: usize, + src: hipArray_const_t, + wOffset: usize, + hOffset: usize, + width: usize, + height: usize, + kind: hipMemcpyKind, + ) -> hipError_t; } extern "C" { - pub fn hipStreamEndCapture(stream: hipStream_t, pGraph: *mut hipGraph_t) -> hipError_t; + #[must_use] + pub fn hipMemcpy3D_spt(p: *const hipMemcpy3DParms) -> hipError_t; } extern "C" { - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = "-------------------------------------------------------------------------------------------------"] - #[doc = " @defgroup Graph Graph Management"] - #[doc = " @{"] - #[doc = " This section describes the graph management functions of HIP runtime API."] - #[doc = " @brief Creates a graph"] - #[doc = ""] - #[doc = " @param [out] pGraph - pointer to graph to create."] - #[doc = " @param [in] flags - flags for graph creation, must be 0."] - #[doc = ""] - #[doc = " @returns #hipSuccess."] - #[doc = ""] - pub fn hipGraphCreate(pGraph: *mut hipGraph_t, flags: ::std::os::raw::c_uint) -> hipError_t; + #[must_use] + pub fn hipMemset_spt( + dst: *mut ::std::os::raw::c_void, + value: ::std::os::raw::c_int, + sizeBytes: usize, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Destroys a graph"] - #[doc = ""] - #[doc = " @param [in] graph - instance of graph to destroy."] - #[doc = ""] - #[doc = " @returns #hipSuccess."] - #[doc = ""] - pub fn hipGraphDestroy(graph: hipGraph_t) -> hipError_t; + #[must_use] + pub fn hipMemsetAsync_spt( + dst: *mut ::std::os::raw::c_void, + value: ::std::os::raw::c_int, + sizeBytes: usize, + stream: hipStream_t, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Destroys an executable graph"] - #[doc = ""] - #[doc = " @param [in] pGraphExec - instance of executable graph to destry."] - #[doc = ""] - #[doc = " @returns #hipSuccess."] - #[doc = ""] - pub fn hipGraphExecDestroy(pGraphExec: hipGraphExec_t) -> hipError_t; -} -extern "C" { - #[doc = " @brief Creates an executable graph from a graph"] - #[doc = ""] - #[doc = " @param [out] pGraphExec - pointer to instantiated executable graph to create."] - #[doc = " @param [in] graph - instance of graph to instantiate."] - #[doc = " @param [out] pErrorNode - pointer to error node in case error occured in graph instantiation,"] - #[doc = " it could modify the correponding node."] - #[doc = " @param [out] pLogBuffer - pointer to log buffer."] - #[doc = " @param [in] bufferSize - the size of log buffer."] - #[doc = ""] - #[doc = " @returns #hipSuccess, #hipErrorOutOfMemory."] - #[doc = ""] - pub fn hipGraphInstantiate( - pGraphExec: *mut hipGraphExec_t, - graph: hipGraph_t, - pErrorNode: *mut hipGraphNode_t, - pLogBuffer: *mut ::std::os::raw::c_char, - bufferSize: usize, + #[must_use] + pub fn hipMemset2D_spt( + dst: *mut ::std::os::raw::c_void, + pitch: usize, + value: ::std::os::raw::c_int, + width: usize, + height: usize, ) -> hipError_t; } extern "C" { - #[doc = " @brief launches an executable graph in a stream"] - #[doc = ""] - #[doc = " @param [in] graphExec - instance of executable graph to launch."] - #[doc = " @param [in] stream - instance of stream in which to launch executable graph."] - #[doc = " @returns #hipSuccess, #hipErrorOutOfMemory, #hipErrorInvalidHandle, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphLaunch(graphExec: hipGraphExec_t, stream: hipStream_t) -> hipError_t; + #[must_use] + pub fn hipMemset2DAsync_spt( + dst: *mut ::std::os::raw::c_void, + pitch: usize, + value: ::std::os::raw::c_int, + width: usize, + height: usize, + stream: hipStream_t, + ) -> hipError_t; } extern "C" { - #[doc = " @brief Creates a kernel execution node and adds it to a graph."] - #[doc = ""] - #[doc = " @param [out] pGraphNode - pointer to graph node to create."] - #[doc = " @param [in,out] graph - instance of graph to add the created node."] - #[doc = " @param [in] pDependencies - pointer to the dependencies on the kernel execution node."] - #[doc = " @param [in] numDependencies - the number of the dependencies."] - #[doc = " @param [in] pNodeParams - pointer to the parameters to the kernel execution node on the GPU."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidDeviceFunction"] - #[doc = ""] - pub fn hipGraphAddKernelNode( - pGraphNode: *mut hipGraphNode_t, - graph: hipGraph_t, - pDependencies: *const hipGraphNode_t, - numDependencies: usize, - pNodeParams: *const hipKernelNodeParams, + #[must_use] + pub fn hipMemset3DAsync_spt( + pitchedDevPtr: hipPitchedPtr, + value: ::std::os::raw::c_int, + extent: hipExtent, + stream: hipStream_t, ) -> hipError_t; } extern "C" { - #[doc = " @brief Creates a memcpy node and adds it to a graph."] - #[doc = ""] - #[doc = " @param [out] pGraphNode - pointer to graph node to create."] - #[doc = " @param [in,out] graph - instance of graph to add the created node."] - #[doc = " @param [in] pDependencies - const pointer to the dependencies on the kernel execution node."] - #[doc = " @param [in] numDependencies - the number of the dependencies."] - #[doc = " @param [in] pCopyParams - const pointer to the parameters for the memory copy."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphAddMemcpyNode( - pGraphNode: *mut hipGraphNode_t, - graph: hipGraph_t, - pDependencies: *const hipGraphNode_t, - numDependencies: usize, - pCopyParams: *const hipMemcpy3DParms, + #[must_use] + pub fn hipMemset3D_spt( + pitchedDevPtr: hipPitchedPtr, + value: ::std::os::raw::c_int, + extent: hipExtent, ) -> hipError_t; } extern "C" { - #[doc = " @brief Creates a 1D memcpy node and adds it to a graph."] - #[doc = ""] - #[doc = " @param [out] pGraphNode - pointer to graph node to create."] - #[doc = " @param [in,out] graph - instance of the graph to add the created node."] - #[doc = " @param [in] pDependencies - const pointer to the dependencies on the kernel execution node."] - #[doc = " @param [in] numDependencies - the number of the dependencies."] - #[doc = " @param [in] dst - pointer to memory address to the destination."] - #[doc = " @param [in] src - pointer to memory address to the source."] - #[doc = " @param [in] count - the size of the memory to copy."] - #[doc = " @param [in] kind - the type of memory copy."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphAddMemcpyNode1D( - pGraphNode: *mut hipGraphNode_t, - graph: hipGraph_t, - pDependencies: *const hipGraphNode_t, - numDependencies: usize, + #[must_use] + pub fn hipMemcpyAsync_spt( dst: *mut ::std::os::raw::c_void, src: *const ::std::os::raw::c_void, - count: usize, + sizeBytes: usize, kind: hipMemcpyKind, + stream: hipStream_t, ) -> hipError_t; } extern "C" { - #[doc = " @brief Creates a memset node and adds it to a graph."] - #[doc = ""] - #[doc = " @param [out] pGraphNode - pointer to the graph node to create."] - #[doc = " @param [in,out] graph - instance of the graph to add the created node."] - #[doc = " @param [in] pDependencies - const pointer to the dependencies on the kernel execution node."] - #[doc = " @param [in] numDependencies - the number of the dependencies."] - #[doc = " @param [in] pMemsetParams - const pointer to the parameters for the memory set."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphAddMemsetNode( - pGraphNode: *mut hipGraphNode_t, - graph: hipGraph_t, - pDependencies: *const hipGraphNode_t, - numDependencies: usize, - pMemsetParams: *const hipMemsetParams, - ) -> hipError_t; + #[must_use] + pub fn hipMemcpy3DAsync_spt(p: *const hipMemcpy3DParms, stream: hipStream_t) -> hipError_t; } extern "C" { - #[doc = " @brief Returns graph nodes."] - #[doc = ""] - #[doc = " @param [in] graph - instance of graph to get the nodes."] - #[doc = " @param [out] nodes - pointer to the graph nodes."] - #[doc = " @param [out] numNodes - the number of graph nodes."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphGetNodes( - graph: hipGraph_t, - nodes: *mut hipGraphNode_t, - numNodes: *mut usize, + #[must_use] + pub fn hipMemcpy2DAsync_spt( + dst: *mut ::std::os::raw::c_void, + dpitch: usize, + src: *const ::std::os::raw::c_void, + spitch: usize, + width: usize, + height: usize, + kind: hipMemcpyKind, + stream: hipStream_t, ) -> hipError_t; } extern "C" { - #[doc = " @brief Returns graph's root nodes."] - #[doc = ""] - #[doc = " @param [in] graph - instance of the graph to get the nodes."] - #[doc = " @param [out] pRootNodes - pointer to the graph's root nodes."] - #[doc = " @param [out] pNumRootNodes - the number of graph's root nodes."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphGetRootNodes( - graph: hipGraph_t, - pRootNodes: *mut hipGraphNode_t, - pNumRootNodes: *mut usize, + #[must_use] + pub fn hipMemcpyFromSymbolAsync_spt( + dst: *mut ::std::os::raw::c_void, + symbol: *const ::std::os::raw::c_void, + sizeBytes: usize, + offset: usize, + kind: hipMemcpyKind, + stream: hipStream_t, ) -> hipError_t; } extern "C" { - #[doc = " @brief Gets kernel node's parameters."] - #[doc = ""] - #[doc = " @param [in] node - instance of the node to get parameters from."] - #[doc = " @param [out] pNodeParams - pointer to the parameters"] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphKernelNodeGetParams( - node: hipGraphNode_t, - pNodeParams: *mut hipKernelNodeParams, + #[must_use] + pub fn hipMemcpyToSymbolAsync_spt( + symbol: *const ::std::os::raw::c_void, + src: *const ::std::os::raw::c_void, + sizeBytes: usize, + offset: usize, + kind: hipMemcpyKind, + stream: hipStream_t, ) -> hipError_t; } extern "C" { - #[doc = " @brief Sets a kernel node's parameters."] - #[doc = ""] - #[doc = " @param [in] node - instance of the node to set parameters to."] - #[doc = " @param [in] pNodeParams - const pointer to the parameters."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphKernelNodeSetParams( - node: hipGraphNode_t, - pNodeParams: *const hipKernelNodeParams, + #[must_use] + pub fn hipMemcpyFromArray_spt( + dst: *mut ::std::os::raw::c_void, + src: hipArray_const_t, + wOffsetSrc: usize, + hOffset: usize, + count: usize, + kind: hipMemcpyKind, ) -> hipError_t; } extern "C" { - #[doc = " @brief Gets a memcpy node's parameters."] - #[doc = ""] - #[doc = " @param [in] node - instance of the node to get parameters from."] - #[doc = " @param [out] pNodeParams - pointer to the parameters."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphMemcpyNodeGetParams( - node: hipGraphNode_t, - pNodeParams: *mut hipMemcpy3DParms, + #[must_use] + pub fn hipMemcpy2DToArray_spt( + dst: hipArray_t, + wOffset: usize, + hOffset: usize, + src: *const ::std::os::raw::c_void, + spitch: usize, + width: usize, + height: usize, + kind: hipMemcpyKind, ) -> hipError_t; } extern "C" { - #[doc = " @brief Sets a memcpy node's parameters."] - #[doc = ""] - #[doc = " @param [in] node - instance of the node to set parameters to."] - #[doc = " @param [in] pNodeParams - const pointer to the parameters."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphMemcpyNodeSetParams( - node: hipGraphNode_t, - pNodeParams: *const hipMemcpy3DParms, + #[must_use] + pub fn hipMemcpy2DFromArrayAsync_spt( + dst: *mut ::std::os::raw::c_void, + dpitch: usize, + src: hipArray_const_t, + wOffsetSrc: usize, + hOffsetSrc: usize, + width: usize, + height: usize, + kind: hipMemcpyKind, + stream: hipStream_t, ) -> hipError_t; } extern "C" { - #[doc = " @brief Gets a memset node's parameters."] - #[doc = ""] - #[doc = " @param [in] node - instane of the node to get parameters from."] - #[doc = " @param [out] pNodeParams - pointer to the parameters."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphMemsetNodeGetParams( - node: hipGraphNode_t, - pNodeParams: *mut hipMemsetParams, + #[must_use] + pub fn hipMemcpy2DToArrayAsync_spt( + dst: hipArray_t, + wOffset: usize, + hOffset: usize, + src: *const ::std::os::raw::c_void, + spitch: usize, + width: usize, + height: usize, + kind: hipMemcpyKind, + stream: hipStream_t, ) -> hipError_t; } extern "C" { - #[doc = " @brief Sets a memset node's parameters."] - #[doc = ""] - #[doc = " @param [in] node - instance of the node to set parameters to."] - #[doc = " @param [out] pNodeParams - pointer to the parameters."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphMemsetNodeSetParams( - node: hipGraphNode_t, - pNodeParams: *const hipMemsetParams, + #[must_use] + pub fn hipStreamQuery_spt(stream: hipStream_t) -> hipError_t; +} +extern "C" { + #[must_use] + pub fn hipStreamSynchronize_spt(stream: hipStream_t) -> hipError_t; +} +extern "C" { + #[must_use] + pub fn hipStreamGetPriority_spt( + stream: hipStream_t, + priority: *mut ::std::os::raw::c_int, ) -> hipError_t; } extern "C" { - #[doc = " @brief Sets the parameters for a kernel node in the given graphExec."] - #[doc = ""] - #[doc = " @param [in] hGraphExec - instance of the executable graph with the node."] - #[doc = " @param [in] node - instance of the node to set parameters to."] - #[doc = " @param [in] pNodeParams - const pointer to the kernel node parameters."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphExecKernelNodeSetParams( - hGraphExec: hipGraphExec_t, - node: hipGraphNode_t, - pNodeParams: *const hipKernelNodeParams, + #[must_use] + pub fn hipStreamWaitEvent_spt( + stream: hipStream_t, + event: hipEvent_t, + flags: ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Adds dependency edges to a graph."] - #[doc = ""] - #[doc = " @param [in] graph - instance of the graph to add dependencies."] - #[doc = " @param [in] from - pointer to the graph nodes with dependenties to add from."] - #[doc = " @param [in] to - pointer to the graph nodes to add dependenties to."] - #[doc = " @param [in] numDependencies - the number of dependencies to add."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphAddDependencies( - graph: hipGraph_t, - from: *const hipGraphNode_t, - to: *const hipGraphNode_t, - numDependencies: usize, + #[must_use] + pub fn hipStreamGetFlags_spt( + stream: hipStream_t, + flags: *mut ::std::os::raw::c_uint, ) -> hipError_t; } extern "C" { - #[doc = " @brief Creates an empty node and adds it to a graph."] - #[doc = ""] - #[doc = " @param [out] pGraphNode - pointer to the graph node to create and add to the graph."] - #[doc = " @param [in,out] graph - instane of the graph the node is add to."] - #[doc = " @param [in] pDependencies - const pointer to the node dependenties."] - #[doc = " @param [in] numDependencies - the number of dependencies."] - #[doc = " @returns #hipSuccess, #hipErrorInvalidValue"] - #[doc = ""] - pub fn hipGraphAddEmptyNode( - pGraphNode: *mut hipGraphNode_t, - graph: hipGraph_t, - pDependencies: *const hipGraphNode_t, - numDependencies: usize, + #[must_use] + pub fn hipStreamAddCallback_spt( + stream: hipStream_t, + callback: hipStreamCallback_t, + userData: *mut ::std::os::raw::c_void, + flags: ::std::os::raw::c_uint, ) -> hipError_t; } -#[doc = "-------------------------------------------------------------------------------------------------"] -#[doc = "-------------------------------------------------------------------------------------------------"] -#[doc = " @defgroup GL Interop"] -#[doc = " @{"] -#[doc = " This section describes Stream Memory Wait and Write functions of HIP runtime API."] -pub type GLuint = ::std::os::raw::c_uint; extern "C" { - pub fn hipGLGetDevices( - pHipDeviceCount: *mut ::std::os::raw::c_uint, - pHipDevices: *mut ::std::os::raw::c_int, - hipDeviceCount: ::std::os::raw::c_uint, - deviceList: hipGLDeviceList, + #[must_use] + pub fn hipEventRecord_spt(event: hipEvent_t, stream: hipStream_t) -> hipError_t; +} +extern "C" { + #[must_use] + pub fn hipLaunchCooperativeKernel_spt( + f: *const ::std::os::raw::c_void, + gridDim: dim3, + blockDim: dim3, + kernelParams: *mut *mut ::std::os::raw::c_void, + sharedMemBytes: u32, + hStream: hipStream_t, ) -> hipError_t; } extern "C" { - pub fn hipGraphicsGLRegisterBuffer( - resource: *mut *mut hipGraphicsResource, - buffer: GLuint, - flags: ::std::os::raw::c_uint, + #[must_use] + pub fn hipLaunchKernel_spt( + function_address: *const ::std::os::raw::c_void, + numBlocks: dim3, + dimBlocks: dim3, + args: *mut *mut ::std::os::raw::c_void, + sharedMemBytes: usize, + stream: hipStream_t, ) -> hipError_t; } extern "C" { - pub fn hipGraphicsMapResources( - count: ::std::os::raw::c_int, - resources: *mut hipGraphicsResource_t, + #[must_use] + pub fn hipGraphLaunch_spt(graphExec: hipGraphExec_t, stream: hipStream_t) -> hipError_t; +} +extern "C" { + #[must_use] + pub fn hipStreamBeginCapture_spt(stream: hipStream_t, mode: hipStreamCaptureMode) + -> hipError_t; +} +extern "C" { + #[must_use] + pub fn hipStreamEndCapture_spt(stream: hipStream_t, pGraph: *mut hipGraph_t) -> hipError_t; +} +extern "C" { + #[must_use] + pub fn hipStreamIsCapturing_spt( stream: hipStream_t, + pCaptureStatus: *mut hipStreamCaptureStatus, ) -> hipError_t; } extern "C" { - pub fn hipGraphicsResourceGetMappedPointer( - devPtr: *mut *mut ::std::os::raw::c_void, - size: *mut usize, - resource: hipGraphicsResource_t, + #[must_use] + pub fn hipStreamGetCaptureInfo_spt( + stream: hipStream_t, + pCaptureStatus: *mut hipStreamCaptureStatus, + pId: *mut ::std::os::raw::c_ulonglong, ) -> hipError_t; } extern "C" { - pub fn hipGraphicsUnmapResources( - count: ::std::os::raw::c_int, - resources: *mut hipGraphicsResource_t, + #[must_use] + pub fn hipStreamGetCaptureInfo_v2_spt( stream: hipStream_t, + captureStatus_out: *mut hipStreamCaptureStatus, + id_out: *mut ::std::os::raw::c_ulonglong, + graph_out: *mut hipGraph_t, + dependencies_out: *mut *const hipGraphNode_t, + numDependencies_out: *mut usize, ) -> hipError_t; } extern "C" { - pub fn hipGraphicsUnregisterResource(resource: hipGraphicsResource_t) -> hipError_t; + #[must_use] + pub fn hipLaunchHostFunc_spt( + stream: hipStream_t, + fn_: hipHostFn_t, + userData: *mut ::std::os::raw::c_void, + ) -> hipError_t; } diff --git a/llvm_zluda/Cargo.toml b/llvm_zluda/Cargo.toml new file mode 100644 index 00000000..0e7f8a05 --- /dev/null +++ b/llvm_zluda/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "llvm_zluda" +version = "0.1.0" +edition = "2021" + +[lib] + +[dependencies] +bitflags = "2.4" + +[dependencies.llvm-sys] +version = "170" +features = [ "disable-alltargets-init", "no-llvm-linking" ] + +[build-dependencies] +cmake = "0.1" +cc = "1.0.69" + +[dependencies.inkwell] +version = "0.5" +default-features = false # default features contain all LLVM targets (x86, mips, riscv, etc.) +features = [ "llvm17-0-no-llvm-linking", "no-libffi-linking" ] diff --git a/llvm_zluda/build.rs b/llvm_zluda/build.rs new file mode 100644 index 00000000..9660b4d4 --- /dev/null +++ b/llvm_zluda/build.rs @@ -0,0 +1,129 @@ +use cmake::Config; +use std::io; +use std::path::PathBuf; +use std::process::Command; + +const COMPONENTS: &[&'static str] = &[ + "LLVMCore", + "LLVMBitWriter", + #[cfg(debug_assertions)] + "LLVMAnalysis", // for module verify + #[cfg(debug_assertions)] + "LLVMBitReader", +]; + +fn main() { + let mut cmake = Config::new(r"../ext/llvm-project/llvm"); + try_use_ninja(&mut cmake); + cmake + // For some reason Rust always links to release MSVCRT + .define("CMAKE_MSVC_RUNTIME_LIBRARY", "MultiThreadedDLL") + .define("LLVM_ENABLE_TERMINFO", "OFF") + .define("LLVM_ENABLE_LIBXML2", "OFF") + .define("LLVM_ENABLE_LIBEDIT", "OFF") + .define("LLVM_ENABLE_LIBPFM", "OFF") + .define("LLVM_ENABLE_ZLIB", "OFF") + .define("LLVM_ENABLE_ZSTD", "OFF") + .define("LLVM_INCLUDE_BENCHMARKS", "OFF") + .define("LLVM_INCLUDE_EXAMPLES", "OFF") + .define("LLVM_INCLUDE_TESTS", "OFF") + .define("LLVM_BUILD_TOOLS", "OFF") + .define("LLVM_TARGETS_TO_BUILD", "") + .define("LLVM_ENABLE_PROJECTS", ""); + cmake.build_target("llvm-config"); + let llvm_dir = cmake.build(); + for c in COMPONENTS { + cmake.build_target(c); + cmake.build(); + } + let cmake_profile = cmake.get_profile(); + let (cxxflags, ldflags, libdir, lib_names, system_libs) = + llvm_config(&llvm_dir, &["build", "bin", "llvm-config"]) + .or_else(|_| llvm_config(&llvm_dir, &["build", cmake_profile, "bin", "llvm-config"])) + .unwrap(); + println!("cargo:rustc-link-arg={ldflags}"); + println!("cargo:rustc-link-search=native={libdir}"); + for lib in system_libs.split_ascii_whitespace() { + println!("cargo:rustc-link-arg={lib}"); + } + link_llvm_components(lib_names); + compile_cxx_lib(cxxflags); +} + +fn try_use_ninja(cmake: &mut Config) { + let mut cmd = Command::new("ninja"); + cmd.arg("--version"); + if let Ok(status) = cmd.status() { + if status.success() { + cmake.generator("Ninja"); + } + } +} + +fn llvm_config( + llvm_build_dir: &PathBuf, + path_to_llvm_config: &[&str], +) -> io::Result<(String, String, String, String, String)> { + let mut llvm_build_path = llvm_build_dir.clone(); + llvm_build_path.extend(path_to_llvm_config); + let mut cmd = Command::new(llvm_build_path); + cmd.args([ + "--link-static", + "--cxxflags", + "--ldflags", + "--libdir", + "--libnames", + "--system-libs", + ]); + for c in COMPONENTS { + cmd.arg(c[4..].to_lowercase()); + } + let output = cmd.output()?; + if !output.status.success() { + return Err(io::Error::from(io::ErrorKind::Other)); + } + let output = unsafe { String::from_utf8_unchecked(output.stdout) }; + let mut lines = output.lines(); + let cxxflags = lines.next().unwrap(); + let ldflags = lines.next().unwrap(); + let libdir = lines.next().unwrap(); + let lib_names = lines.next().unwrap(); + let system_libs = lines.next().unwrap(); + Ok(( + cxxflags.to_string(), + ldflags.to_string(), + libdir.to_string(), + lib_names.to_string(), + system_libs.to_string(), + )) +} + +fn compile_cxx_lib(cxxflags: String) { + let mut cc = cc::Build::new(); + for flag in cxxflags.split_whitespace() { + cc.flag(flag); + } + cc.cpp(true).file("src/lib.cpp").compile("llvm_zluda_cpp"); + println!("cargo:rerun-if-changed=src/lib.cpp"); + println!("cargo:rerun-if-changed=src/lib.rs"); +} + +fn link_llvm_components(components: String) { + for component in components.split_whitespace() { + let component = if let Some(component) = component + .strip_prefix("lib") + .and_then(|component| component.strip_suffix(".a")) + { + // Unix (Linux/Mac) + // libLLVMfoo.a + component + } else if let Some(component) = component.strip_suffix(".lib") { + // Windows + // LLVMfoo.lib + component + } else { + panic!("'{}' does not look like a static library name", component) + }; + println!("cargo:rustc-link-lib={component}"); + } +} diff --git a/llvm_zluda/src/lib.cpp b/llvm_zluda/src/lib.cpp new file mode 100644 index 00000000..3da88fb4 --- /dev/null +++ b/llvm_zluda/src/lib.cpp @@ -0,0 +1,13 @@ +#include +#include "llvm/IR/IRBuilder.h" +#include "llvm/IR/Type.h" + +LLVM_C_EXTERN_C_BEGIN + +LLVMValueRef LLVMZludaBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, unsigned AddrSpace, + const char *Name) +{ + return llvm::wrap(llvm::unwrap(B)->CreateAlloca(llvm::unwrap(Ty), AddrSpace, nullptr, Name)); +} + +LLVM_C_EXTERN_C_END \ No newline at end of file diff --git a/llvm_zluda/src/lib.rs b/llvm_zluda/src/lib.rs new file mode 100644 index 00000000..c72e2618 --- /dev/null +++ b/llvm_zluda/src/lib.rs @@ -0,0 +1,15 @@ +pub mod inkwell { + pub use inkwell::*; +} +pub mod llvm { + use llvm_sys::prelude::*; + pub use llvm_sys::*; + extern "C" { + pub fn LLVMZludaBuildAlloca( + B: LLVMBuilderRef, + Ty: LLVMTypeRef, + AddrSpace: u32, + Name: *const i8, + ) -> LLVMValueRef; + } +} diff --git a/ptx/Cargo.toml b/ptx/Cargo.toml index d4852862..12f47ea3 100644 --- a/ptx/Cargo.toml +++ b/ptx/Cargo.toml @@ -8,6 +8,7 @@ edition = "2018" [dependencies] ptx_parser = { path = "../ptx_parser" } +llvm_zluda = { path = "../llvm_zluda" } regex = "1" rspirv = "0.7" spirv_headers = "1.5" @@ -27,7 +28,8 @@ features = ["lexer"] [dev-dependencies] hip_runtime-sys = { path = "../hip_runtime-sys" } -tempfile = "3" +amd_comgr-sys = { path = "../amd_comgr-sys" } spirv_tools-sys = { path = "../spirv_tools-sys" } +tempfile = "3" paste = "1.0" cuda-driver-sys = "0.3.0" diff --git a/ptx/src/pass/emit_llvm.rs b/ptx/src/pass/emit_llvm.rs new file mode 100644 index 00000000..acadc4ac --- /dev/null +++ b/ptx/src/pass/emit_llvm.rs @@ -0,0 +1,708 @@ +use std::convert::{TryFrom, TryInto}; +use std::ptr; + +use super::*; +use llvm_zluda::inkwell::builder::{Builder, BuilderError}; +use llvm_zluda::inkwell::context::{AsContextRef, Context}; +use llvm_zluda::inkwell::memory_buffer::MemoryBuffer; +use llvm_zluda::inkwell::types::{ + ArrayType, AsTypeRef, BasicMetadataTypeEnum, BasicType, BasicTypeEnum, FloatType, FunctionType, + IntType, PointerType, VectorType, VoidType, +}; +use llvm_zluda::inkwell::values::{ + AnyValue, AnyValueEnum, ArrayValue, BasicValueEnum, FloatMathValue, FloatValue, FunctionValue, + InstructionValue, IntMathValue, IntValue, PhiValue, PointerValue, StructValue, VectorValue, +}; +use llvm_zluda::inkwell::{self, module, AddressSpace}; +use llvm_zluda::llvm::core::{ + LLVMArrayType2, LLVMBFloatType, LLVMBFloatTypeInContext, LLVMVectorType, +}; +use llvm_zluda::llvm::prelude::*; +use llvm_zluda::llvm::{LLVMCallConv, LLVMZludaBuildAlloca}; + +const LLVM_UNNAMED: &str = "\0"; +// https://llvm.org/docs/AMDGPUUsage.html#address-spaces +const GENERIC_ADDRESS_SPACE: u16 = 0; +const GLOBAL_ADDRESS_SPACE: u16 = 1; +const SHARED_ADDRESS_SPACE: u16 = 3; +const CONSTANT_ADDRESS_SPACE: u16 = 4; +const PRIVATE_ADDRESS_SPACE: u16 = 5; + +pub(super) fn run<'input>( + id_defs: &GlobalStringIdResolver<'input>, + call_map: MethodsCallMap<'input>, + directives: Vec>, +) -> Result { + let context = inkwell::context::Context::create(); + let module = context.create_module(LLVM_UNNAMED); + let builder = context.create_builder(); + let mut emit_ctx = ModuleEmitContext::new(&context, module, builder, id_defs); + for directive in directives { + match directive { + Directive::Variable(..) => todo!(), + Directive::Method(method) => emit_ctx.emit_method(method)?, + } + } + Ok(emit_ctx.module.write_bitcode_to_memory()) +} + +struct ModuleEmitContext<'ctx, 'input> { + context: &'ctx Context, + module: module::Module<'ctx>, + builder: Builder<'ctx>, + id_defs: &'ctx GlobalStringIdResolver<'input>, + resolver: ResolveIdent<'ctx>, +} + +impl<'ctx, 'input> ModuleEmitContext<'ctx, 'input> { + fn new( + context: &'ctx Context, + module: module::Module<'ctx>, + builder: Builder<'ctx>, + id_defs: &'ctx GlobalStringIdResolver<'input>, + ) -> Self { + ModuleEmitContext { + context: &context, + module, + builder, + id_defs, + resolver: ResolveIdent::new(&id_defs), + } + } + + fn kernel_call_convention() -> u32 { + LLVMCallConv::LLVMAMDGPUKERNELCallConv as u32 + } + + fn func_call_convention() -> u32 { + LLVMCallConv::LLVMCCallConv as u32 + } + + fn emit_method(&mut self, method: Function<'input>) -> Result<(), TranslateError> { + let func_decl = method.func_decl.borrow(); + let fn_ = self.module.add_function( + method + .import_as + .as_deref() + .unwrap_or_else(|| match func_decl.name { + ast::MethodName::Kernel(name) => name, + ast::MethodName::Func(id) => self.id_defs.reverse_variables[&id], + }), + self.function_type( + func_decl.return_arguments.iter().map(|v| &v.v_type), + func_decl.input_arguments.iter().map(|v| &v.v_type), + ), + None, + ); + for (i, param) in func_decl.input_arguments.iter().enumerate() { + let value = fn_ + .get_nth_param(i as u32) + .ok_or_else(|| error_unreachable())?; + value.set_name(self.resolver.get_or_add(param.name)); + self.resolver.register(param.name, value); + } + fn_.set_call_conventions(if func_decl.name.is_kernel() { + Self::kernel_call_convention() + } else { + Self::func_call_convention() + }); + if let Some(statements) = method.body { + let entry_bb = self.context.append_basic_block(fn_, LLVM_UNNAMED); + let variables_builder = self.context.create_builder(); + variables_builder.position_at_end(entry_bb); + let real_bb = self.context.append_basic_block(fn_, LLVM_UNNAMED); + self.builder.position_at_end(real_bb); + let mut method_emitter = MethodEmitContext::new(self, fn_, variables_builder); + for statement in statements { + method_emitter.emit_statement(statement)?; + } + } + Ok(()) + } + + fn function_type<'a>( + &self, + return_args: impl ExactSizeIterator, + input_args: impl ExactSizeIterator, + ) -> FunctionType<'ctx> { + if return_args.len() == 0 { + let input_args = input_args + .map(|type_| match type_ { + ast::Type::Scalar(scalar) => match scalar { + ast::ScalarType::Pred => { + BasicMetadataTypeEnum::from(self.context.bool_type()) + } + ast::ScalarType::S8 | ast::ScalarType::B8 | ast::ScalarType::U8 => { + BasicMetadataTypeEnum::from(self.context.i8_type()) + } + ast::ScalarType::B16 | ast::ScalarType::U16 | ast::ScalarType::S16 => { + BasicMetadataTypeEnum::from(self.context.i16_type()) + } + ast::ScalarType::S32 | ast::ScalarType::B32 | ast::ScalarType::U32 => { + BasicMetadataTypeEnum::from(self.context.i32_type()) + } + ast::ScalarType::U64 | ast::ScalarType::S64 | ast::ScalarType::B64 => { + BasicMetadataTypeEnum::from(self.context.i64_type()) + } + ast::ScalarType::B128 => { + BasicMetadataTypeEnum::from(self.context.i128_type()) + } + ast::ScalarType::F16 => { + BasicMetadataTypeEnum::from(self.context.f16_type()) + } + ast::ScalarType::F32 => { + BasicMetadataTypeEnum::from(self.context.f32_type()) + } + ast::ScalarType::F64 => { + BasicMetadataTypeEnum::from(self.context.f64_type()) + } + ast::ScalarType::BF16 => { + BasicMetadataTypeEnum::from(unsafe { FloatType::new(LLVMBFloatType()) }) + } + ast::ScalarType::U16x2 => todo!(), + ast::ScalarType::S16x2 => todo!(), + ast::ScalarType::F16x2 => todo!(), + ast::ScalarType::BF16x2 => todo!(), + }, + ast::Type::Vector(_, _) => todo!(), + ast::Type::Array(_, _, _) => todo!(), + ast::Type::Pointer(_, _) => todo!(), + }) + .collect::>(); + return self.context.void_type().fn_type(&*input_args, false); + } + todo!() + } + + fn get_type(&self, type_: &ast::Type) -> FunctionType<'ctx> { + match type_ { + ast::Type::Scalar(_) => todo!(), + ast::Type::Vector(_, _) => todo!(), + ast::Type::Array(_, _, _) => todo!(), + ast::Type::Pointer(_, _) => todo!(), + } + } +} + +struct MethodEmitContext<'a, 'ctx, 'input> { + context: &'ctx Context, + module: &'a module::Module<'ctx>, + method: FunctionValue<'ctx>, + builder: &'a Builder<'ctx>, + id_defs: &'a GlobalStringIdResolver<'input>, + variables_builder: Builder<'ctx>, + resolver: &'a mut ResolveIdent<'ctx>, +} + +impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { + fn new( + parent: &'a mut ModuleEmitContext<'ctx, 'input>, + method: FunctionValue<'ctx>, + variables_builder: Builder<'ctx>, + ) -> MethodEmitContext<'a, 'ctx, 'input> { + MethodEmitContext { + context: &parent.context, + module: &parent.module, + builder: &parent.builder, + id_defs: parent.id_defs, + variables_builder, + resolver: &mut parent.resolver, + method, + } + } + + fn emit_statement( + &mut self, + statement: Statement, SpirvWord>, + ) -> Result<(), TranslateError> { + Ok(match statement { + Statement::Variable(var) => self.emit_variable(var)?, + Statement::Label(label) => self.emit_label(label), + Statement::Instruction(inst) => self.emit_instruction(inst)?, + Statement::Conditional(_) => todo!(), + Statement::LoadVar(var) => self.emit_load_variable(var)?, + Statement::StoreVar(store) => self.emit_store_var(store)?, + Statement::Conversion(conversion) => self.emit_conversion(conversion)?, + Statement::Constant(constant) => self.emit_constant(constant)?, + Statement::RetValue(_, _) => todo!(), + Statement::PtrAccess(_) => todo!(), + Statement::RepackVector(_) => todo!(), + Statement::FunctionPointer(_) => todo!(), + }) + } + + fn emit_variable(&mut self, var: ast::Variable) -> Result<(), TranslateError> { + let alloca = unsafe { + PointerValue::new(LLVMZludaBuildAlloca( + self.builder.as_mut_ptr(), + get_type::(&self.context, &var.v_type)?.as_type_ref(), + get_state_space(var.state_space)? as u32, + self.resolver.get_or_add_raw(var.name), + )) + }; + self.resolver.register(var.name, alloca); + if let Some(align) = var.align { + let alloca = alloca.as_instruction().ok_or_else(|| error_unreachable())?; + alloca + .set_alignment(align) + .map_err(|_| error_unreachable())?; + } + if !var.array_init.is_empty() { + todo!() + } + Ok(()) + } + + fn emit_label(&mut self, label: SpirvWord) { + let block = self + .context + .append_basic_block(self.method, self.resolver.get_or_add(label)); + self.builder.position_at_end(block); + } + + fn emit_store_var(&mut self, store: StoreVarDetails) -> Result<(), TranslateError> { + let src1 = self.resolver.value(store.arg.src1)?; + let src2 = self.resolver.value(store.arg.src2)?; + self.builder + .build_store(src1.as_pointer()?, src2.as_basic()?) + .map_err(|_| error_unreachable())?; + Ok(()) + } + + fn emit_instruction( + &mut self, + inst: ast::Instruction, + ) -> Result<(), TranslateError> { + match inst { + ast::Instruction::Mov { data, arguments } => todo!(), + ast::Instruction::Ld { data, arguments } => self.emit_ld(data, arguments), + ast::Instruction::Add { data, arguments } => self.emit_add(data, arguments), + ast::Instruction::St { data, arguments } => todo!(), + ast::Instruction::Mul { data, arguments } => todo!(), + ast::Instruction::Setp { data, arguments } => todo!(), + ast::Instruction::SetpBool { data, arguments } => todo!(), + ast::Instruction::Not { data, arguments } => todo!(), + ast::Instruction::Or { data, arguments } => todo!(), + ast::Instruction::And { data, arguments } => todo!(), + ast::Instruction::Bra { arguments } => todo!(), + ast::Instruction::Call { data, arguments } => todo!(), + ast::Instruction::Cvt { data, arguments } => todo!(), + ast::Instruction::Shr { data, arguments } => todo!(), + ast::Instruction::Shl { data, arguments } => todo!(), + ast::Instruction::Ret { data } => todo!(), + ast::Instruction::Cvta { data, arguments } => todo!(), + ast::Instruction::Abs { data, arguments } => todo!(), + ast::Instruction::Mad { data, arguments } => todo!(), + ast::Instruction::Fma { data, arguments } => todo!(), + ast::Instruction::Sub { data, arguments } => todo!(), + ast::Instruction::Min { data, arguments } => todo!(), + ast::Instruction::Max { data, arguments } => todo!(), + ast::Instruction::Rcp { data, arguments } => todo!(), + ast::Instruction::Sqrt { data, arguments } => todo!(), + ast::Instruction::Rsqrt { data, arguments } => todo!(), + ast::Instruction::Selp { data, arguments } => todo!(), + ast::Instruction::Bar { data, arguments } => todo!(), + ast::Instruction::Atom { data, arguments } => todo!(), + ast::Instruction::AtomCas { data, arguments } => todo!(), + ast::Instruction::Div { data, arguments } => todo!(), + ast::Instruction::Neg { data, arguments } => todo!(), + ast::Instruction::Sin { data, arguments } => todo!(), + ast::Instruction::Cos { data, arguments } => todo!(), + ast::Instruction::Lg2 { data, arguments } => todo!(), + ast::Instruction::Ex2 { data, arguments } => todo!(), + ast::Instruction::Clz { data, arguments } => todo!(), + ast::Instruction::Brev { data, arguments } => todo!(), + ast::Instruction::Popc { data, arguments } => todo!(), + ast::Instruction::Xor { data, arguments } => todo!(), + ast::Instruction::Rem { data, arguments } => todo!(), + ast::Instruction::Bfe { data, arguments } => todo!(), + ast::Instruction::Bfi { data, arguments } => todo!(), + ast::Instruction::PrmtSlow { arguments } => todo!(), + ast::Instruction::Prmt { data, arguments } => todo!(), + ast::Instruction::Activemask { arguments } => todo!(), + ast::Instruction::Membar { data } => todo!(), + ast::Instruction::Trap {} => todo!(), + } + } + + fn emit_ld( + &mut self, + data: ast::LdDetails, + arguments: ast::LdArgs, + ) -> Result<(), TranslateError> { + if data.non_coherent { + todo!() + } + if data.qualifier != ast::LdStQualifier::Weak { + todo!() + } + let builder = self.builder; + let type_ = get_type::(&self.context, &data.typ)?; + let ptr = self.resolver.value(arguments.src)?.as_pointer()?; + self.resolver + .with_result(arguments.dst, |dst| builder.build_load(type_, ptr, dst)) + } + + fn emit_load_variable(&mut self, var: LoadVarDetails) -> Result<(), TranslateError> { + if var.member_index.is_some() { + todo!() + } + let builder = self.builder; + let type_ = get_type::(&self.context, &var.typ)?; + let ptr = self.resolver.value(var.arg.src)?.as_pointer()?; + self.resolver + .with_result(var.arg.dst, |dst| builder.build_load(type_, ptr, dst)) + } + + fn emit_conversion(&mut self, conversion: ImplicitConversion) -> Result<(), TranslateError> { + let builder = self.builder; + match conversion.kind { + ConversionKind::Default => todo!(), + ConversionKind::SignExtend => todo!(), + ConversionKind::BitToPtr => { + let src = self.resolver.value(conversion.src)?.as_int()?; + let type_ = get_pointer_type(self.context, conversion.to_space)?; + self.resolver.with_result(conversion.dst, |dst| { + builder.build_int_to_ptr(src, type_, dst) + }) + } + ConversionKind::PtrToPtr => todo!(), + ConversionKind::AddressOf => todo!(), + } + } + + fn emit_constant(&mut self, constant: ConstantDefinition) -> Result<(), TranslateError> { + let type_ = get_scalar_type::(&self.context, constant.typ); + let value: AnyValueEnum = match (type_, constant.value) { + (BasicTypeEnum::IntType(type_), ast::ImmediateValue::U64(x)) => { + type_.const_int(x, false).into() + } + (BasicTypeEnum::IntType(type_), ast::ImmediateValue::S64(x)) => { + type_.const_int(x as u64, false).into() + } + (BasicTypeEnum::FloatType(type_), ast::ImmediateValue::F32(x)) => { + type_.const_float(x as f64).into() + } + (BasicTypeEnum::FloatType(type_), ast::ImmediateValue::F64(x)) => { + type_.const_float(x).into() + } + _ => return Err(error_unreachable()), + }; + self.resolver.register(constant.dst, value); + Ok(()) + } + + fn emit_add( + &mut self, + data: ast::ArithDetails, + arguments: ast::AddArgs, + ) -> Result<(), TranslateError> { + let builder = self.builder; + let src1 = self.resolver.value(arguments.src1)?; + let src2 = self.resolver.value(arguments.src2)?; + let fn_ = match data { + ast::ArithDetails::Integer(integer) => Builder::build_int_add::>, + ast::ArithDetails::Float(float) => todo!(), + }; + self.resolver + .with_result(arguments.dst, |dst| fn_(builder, src1, src2, dst)) + } +} + +fn get_pointer_type<'ctx>( + context: &'ctx Context, + to_space: ast::StateSpace, +) -> Result, TranslateError> { + Ok(context.ptr_type(AddressSpace::from(get_state_space(to_space)?))) +} + +fn get_type< + 'ctx, + T: From> + + From> + + From> + + From> + + From>, +>( + context: &'ctx Context, + type_: &ast::Type, +) -> Result { + Ok(match type_ { + ast::Type::Scalar(scalar) => get_scalar_type(context, *scalar), + ast::Type::Vector(size, scalar) => { + let base_type = get_scalar_type::(context, *scalar); + let base_type = match base_type { + BasicTypeEnum::FloatType(t) => t.as_type_ref(), + BasicTypeEnum::IntType(t) => t.as_type_ref(), + _ => return Err(error_unreachable()), + }; + T::from(unsafe { VectorType::new(LLVMVectorType(base_type, *size as u32)) }) + } + ast::Type::Array(vec, scalar, dimensions) => { + let mut underlying_type = get_scalar_type::(context, *scalar); + if let Some(size) = vec { + underlying_type = BasicTypeEnum::VectorType(unsafe { + VectorType::new(LLVMVectorType( + match underlying_type { + BasicTypeEnum::FloatType(t) => t.as_type_ref(), + BasicTypeEnum::IntType(t) => t.as_type_ref(), + _ => return Err(error_unreachable()), + }, + size.get() as u32, + )) + }); + } + if dimensions.is_empty() { + return Ok(T::from(underlying_type.array_type(0))); + } + let llvm_type = dimensions + .iter() + .rfold(underlying_type.as_type_ref(), |result, dimension| unsafe { + LLVMArrayType2(result, *dimension as u64) + }); + T::from(unsafe { ArrayType::new(llvm_type) }) + } + ast::Type::Pointer(_, space) => { + T::from(context.ptr_type(AddressSpace::from(get_state_space(*space)?))) + } + }) +} + +fn get_scalar_type< + 'ctx, + T: From> + From> + From>, +>( + context: &'ctx Context, + type_: ast::ScalarType, +) -> T { + match type_ { + ast::ScalarType::Pred => T::from(context.bool_type()), + ast::ScalarType::S8 | ast::ScalarType::B8 | ast::ScalarType::U8 => { + T::from(context.i8_type()) + } + ast::ScalarType::B16 | ast::ScalarType::U16 | ast::ScalarType::S16 => { + T::from(context.i16_type()) + } + ast::ScalarType::S32 | ast::ScalarType::B32 | ast::ScalarType::U32 => { + T::from(context.i32_type()) + } + ast::ScalarType::U64 | ast::ScalarType::S64 | ast::ScalarType::B64 => { + T::from(context.i64_type()) + } + ast::ScalarType::B128 => T::from(context.i128_type()), + ast::ScalarType::F16 => T::from(context.f16_type()), + ast::ScalarType::F32 => T::from(context.f32_type()), + ast::ScalarType::F64 => T::from(context.f64_type()), + ast::ScalarType::BF16 => { + T::from(unsafe { FloatType::new(LLVMBFloatTypeInContext(context.as_ctx_ref())) }) + } + ast::ScalarType::U16x2 | ast::ScalarType::S16x2 => { + T::from(unsafe { VectorType::new(LLVMVectorType(context.i16_type().as_type_ref(), 2)) }) + } + ast::ScalarType::F16x2 => { + T::from(unsafe { VectorType::new(LLVMVectorType(context.f16_type().as_type_ref(), 2)) }) + } + ast::ScalarType::BF16x2 => T::from(unsafe { + VectorType::new(LLVMVectorType( + LLVMBFloatTypeInContext(context.as_ctx_ref()), + 2, + )) + }), + } +} + +fn get_state_space(space: ast::StateSpace) -> Result { + match space { + ast::StateSpace::Reg => Ok(PRIVATE_ADDRESS_SPACE), + ast::StateSpace::Generic => Ok(GENERIC_ADDRESS_SPACE), + ast::StateSpace::Sreg => Ok(PRIVATE_ADDRESS_SPACE), + ast::StateSpace::Param => Err(TranslateError::Todo), + ast::StateSpace::ParamEntry => Err(TranslateError::Todo), + ast::StateSpace::ParamFunc => Err(TranslateError::Todo), + ast::StateSpace::Local => Ok(PRIVATE_ADDRESS_SPACE), + ast::StateSpace::Global => Ok(GLOBAL_ADDRESS_SPACE), + ast::StateSpace::Const => Ok(CONSTANT_ADDRESS_SPACE), + ast::StateSpace::Shared => Ok(SHARED_ADDRESS_SPACE), + ast::StateSpace::SharedCta => Err(TranslateError::Todo), + ast::StateSpace::SharedCluster => Err(TranslateError::Todo), + } +} + +struct ResolveIdent<'ctx> { + words: HashMap, + values: HashMap>, +} + +impl<'ctx> ResolveIdent<'ctx> { + fn new<'input>(_id_defs: &GlobalStringIdResolver<'input>) -> Self { + ResolveIdent { + words: HashMap::new(), + values: HashMap::new(), + } + } + + fn get_or_ad_impl<'a, T>(&'a mut self, word: SpirvWord, fn_: impl FnOnce(&'a str) -> T) -> T { + match self.words.entry(word) { + hash_map::Entry::Occupied(entry) => fn_(entry.into_mut()), + hash_map::Entry::Vacant(entry) => { + let mut text = word.0.to_string(); + text.push('\0'); + fn_(entry.insert(text)) + } + } + } + + fn get_or_add(&mut self, word: SpirvWord) -> &str { + self.get_or_ad_impl(word, |x| x) + } + + fn get_or_add_raw(&mut self, word: SpirvWord) -> *const i8 { + self.get_or_add(word).as_ptr().cast() + } + + fn register(&mut self, word: SpirvWord, t: impl AnyValue<'ctx>) { + self.values.insert(word, t.as_any_value_enum()); + } + + fn value(&self, word: SpirvWord) -> Result, TranslateError> { + self.values + .get(&word) + .copied() + .ok_or_else(|| error_unreachable()) + } + + fn with_result>( + &mut self, + word: SpirvWord, + fn_: impl FnOnce(&str) -> Result, + ) -> Result<(), TranslateError> { + let t = self + .get_or_ad_impl(word, fn_) + .map_err(|_| error_unreachable())?; + self.register(word, t); + Ok(()) + } + + fn build_int_math>( + &mut self, + builder: &Builder<'ctx>, + dst: SpirvWord, + src1: SpirvWord, + src2: SpirvWord, + fn_: impl FnOnce(&Builder<'ctx>, T, T, &str) -> Result, + ) -> Result<(), TranslateError> { + let src1 = self.value(src1)?; + let src2 = self.value(src2)?; + self.with_result(dst, |dst| { + Ok(match (src1, src2) { + (AnyValueEnum::IntValue(src1), AnyValueEnum::IntValue(src2)) => { + AnyValueEnum::from(fn_(builder, src1, src2, dst)) + } + (AnyValueEnum::PointerValue(src1), AnyValueEnum::PointerValue(src2)) => { + AnyValueEnum::from(fn_(builder, src1, src2, dst)) + } + (AnyValueEnum::VectorValue(src1), AnyValueEnum::VectorValue(src2)) => { + AnyValueEnum::from(fn_(builder, src1, src2, dst)) + } + _ => return todo!(), + }) + }) + } + + fn build_float_math>( + &mut self, + fn_: impl FnOnce(&Builder<'ctx>, T, T, &str) -> Result, + ) -> Result<(), TranslateError> { + } +} + +trait AnyValueEnumExt<'ctx> { + fn as_array(self) -> Result, TranslateError>; + fn as_int(self) -> Result, TranslateError>; + fn as_float(self) -> Result, TranslateError>; + fn as_phi(self) -> Result, TranslateError>; + fn as_function(self) -> Result, TranslateError>; + fn as_pointer(self) -> Result, TranslateError>; + fn as_struct(self) -> Result, TranslateError>; + fn as_vector(self) -> Result, TranslateError>; + fn as_instruction(self) -> Result, TranslateError>; + fn as_basic(self) -> Result, TranslateError>; +} + +impl<'ctx> AnyValueEnumExt<'ctx> for AnyValueEnum<'ctx> { + fn as_array(self) -> Result, TranslateError> { + if let AnyValueEnum::ArrayValue(x) = self { + Ok(x) + } else { + Err(error_unreachable()) + } + } + + fn as_int(self) -> Result, TranslateError> { + if let AnyValueEnum::IntValue(x) = self { + Ok(x) + } else { + Err(error_unreachable()) + } + } + + fn as_float(self) -> Result, TranslateError> { + if let AnyValueEnum::FloatValue(x) = self { + Ok(x) + } else { + Err(error_unreachable()) + } + } + + fn as_phi(self) -> Result, TranslateError> { + if let AnyValueEnum::PhiValue(x) = self { + Ok(x) + } else { + Err(error_unreachable()) + } + } + + fn as_function(self) -> Result, TranslateError> { + if let AnyValueEnum::FunctionValue(x) = self { + Ok(x) + } else { + Err(error_unreachable()) + } + } + + fn as_pointer(self) -> Result, TranslateError> { + if let AnyValueEnum::PointerValue(x) = self { + Ok(x) + } else { + Err(error_unreachable()) + } + } + + fn as_struct(self) -> Result, TranslateError> { + if let AnyValueEnum::StructValue(x) = self { + Ok(x) + } else { + Err(error_unreachable()) + } + } + + fn as_vector(self) -> Result, TranslateError> { + if let AnyValueEnum::VectorValue(x) = self { + Ok(x) + } else { + Err(error_unreachable()) + } + } + + fn as_instruction(self) -> Result, TranslateError> { + if let AnyValueEnum::InstructionValue(x) = self { + Ok(x) + } else { + Err(error_unreachable()) + } + } + + fn as_basic(self) -> Result, TranslateError> { + BasicValueEnum::try_from(self).map_err(|_| error_unreachable()) + } +} diff --git a/ptx/src/pass/mod.rs b/ptx/src/pass/mod.rs index 2be6297a..66934343 100644 --- a/ptx/src/pass/mod.rs +++ b/ptx/src/pass/mod.rs @@ -1,3 +1,4 @@ +use llvm_zluda::inkwell::memory_buffer::MemoryBuffer; use ptx_parser as ast; use rspirv::{binary::Assemble, dr}; use std::hash::Hash; @@ -16,6 +17,7 @@ use std::{ mod convert_dynamic_shared_memory_usage; mod convert_to_stateful_memory_access; mod convert_to_typed; +mod emit_llvm; mod emit_spirv; mod expand_arguments; mod extract_globals; @@ -30,7 +32,7 @@ static ZLUDA_PTX_IMPL_INTEL: &'static [u8] = include_bytes!("../../lib/zluda_ptx static ZLUDA_PTX_IMPL_AMD: &'static [u8] = include_bytes!("../../lib/zluda_ptx_impl.bc"); const ZLUDA_PTX_PREFIX: &'static str = "__zluda_ptx_impl__"; -pub fn to_spirv_module<'input>(ast: ast::Module<'input>) -> Result { +pub fn to_llvm_module<'input>(ast: ast::Module<'input>) -> Result { let mut id_defs = GlobalStringIdResolver::<'input>::new(SpirvWord(1)); let mut ptx_impl_imports = HashMap::new(); let directives = ast @@ -56,17 +58,10 @@ pub fn to_spirv_module<'input>(ast: ast::Module<'input>) -> Result( } pub struct Module { - pub spirv: dr::Module, + pub llvm_ir: MemoryBuffer, pub kernel_info: HashMap, - pub should_link_ptx_impl: Option<(&'static [u8], &'static [u8])>, - pub build_options: CString, -} - -impl Module { - pub fn assemble(&self) -> Vec { - self.spirv.assemble() - } } struct GlobalStringIdResolver<'input> { current_id: SpirvWord, variables: HashMap, SpirvWord>, - reverse_variables: HashMap, + pub(crate) reverse_variables: HashMap, variables_type_check: HashMap>, special_registers: SpecialRegistersMap, fns: HashMap>, diff --git a/ptx/src/test/spirv_run/mod.rs b/ptx/src/test/spirv_run/mod.rs index a798720b..e0982ffe 100644 --- a/ptx/src/test/spirv_run/mod.rs +++ b/ptx/src/test/spirv_run/mod.rs @@ -2,6 +2,7 @@ use crate::pass; use crate::ptx; use crate::translate; use hip_runtime_sys::hipError_t; +use llvm_zluda::inkwell::memory_buffer::MemoryBuffer; use rspirv::{ binary::{Assemble, Disassemble}, dr::{Block, Function, Instruction, Loader, Operand}, @@ -31,7 +32,7 @@ macro_rules! test_ptx { ($fn_name:ident, $input:expr, $output:expr) => { paste::item! { #[test] - fn [<$fn_name _ptx>]() -> Result<(), Box> { + fn [<$fn_name _hip>]() -> Result<(), Box> { let ptx = include_str!(concat!(stringify!($fn_name), ".ptx")); let input = $input; let mut output = $output; @@ -48,29 +49,9 @@ macro_rules! test_ptx { test_cuda_assert(stringify!($fn_name), ptx, &input, &mut output) } } - - paste::item! { - #[test] - fn [<$fn_name _spvtxt>]() -> Result<(), Box> { - let ptx_txt = include_str!(concat!(stringify!($fn_name), ".ptx")); - let spirv_file_name = concat!(stringify!($fn_name), ".spvtxt"); - let spirv_txt = include_bytes!(concat!(stringify!($fn_name), ".spvtxt")); - test_spvtxt_assert(ptx_txt, spirv_txt, spirv_file_name) - } - } }; - ($fn_name:ident) => { - paste::item! { - #[test] - fn [<$fn_name _spvtxt>]() -> Result<(), Box> { - let ptx_txt = include_str!(concat!(stringify!($fn_name), ".ptx")); - let spirv_file_name = concat!(stringify!($fn_name), ".spvtxt"); - let spirv_txt = include_bytes!(concat!(stringify!($fn_name), ".spvtxt")); - test_spvtxt_assert(ptx_txt, spirv_txt, spirv_file_name) - } - } - }; + ($fn_name:ident) => {}; } test_ptx!(ld_st, [1u64], [1u64]); @@ -255,13 +236,11 @@ fn test_hip_assert< input: &[Input], output: &mut [Output], ) -> Result<(), Box> { - let mut errors = Vec::new(); - let ast = ptx::ModuleParser::new().parse(&mut errors, ptx_text)?; - assert!(errors.len() == 0); - let zluda_module = translate::to_spirv_module(ast)?; + let ast = ptx_parser::parse_module_checked(ptx_text).unwrap(); + let llvm_ir = pass::to_llvm_module(ast).unwrap(); let name = CString::new(name)?; - let result = run_hip(name.as_c_str(), zluda_module, input, output) - .map_err(|err| DisplayError { err })?; + let result = + run_hip(name.as_c_str(), llvm_ir, input, output).map_err(|err| DisplayError { err })?; assert_eq!(result.as_slice(), output); Ok(()) } @@ -283,18 +262,6 @@ fn test_cuda_assert< Ok(()) } -macro_rules! hip_call { - ($expr:expr) => { - #[allow(unused_unsafe)] - { - let err = unsafe { $expr }; - if err != hip_runtime_sys::hipError_t::hipSuccess { - return Result::Err(err); - } - } - }; -} - macro_rules! cuda_call { ($expr:expr) => { #[allow(unused_unsafe)] @@ -344,124 +311,120 @@ fn run_cuda + Copy + Debug, Output: From + Copy + Debug + De fn run_hip + Copy + Debug, Output: From + Copy + Debug + Default>( name: &CStr, - module: translate::Module, + module: pass::Module, input: &[Input], output: &mut [Output], ) -> Result, hipError_t> { use hip_runtime_sys::*; - hip_call! { hipInit(0) }; - let spirv = module.spirv.assemble(); + unsafe { hipInit(0) }.unwrap(); let mut result = vec![0u8.into(); output.len()]; { let dev = 0; let mut stream = ptr::null_mut(); - hip_call! { hipStreamCreate(&mut stream) }; + unsafe { hipStreamCreate(&mut stream) }.unwrap(); let mut dev_props = unsafe { mem::zeroed() }; - hip_call! { hipGetDeviceProperties(&mut dev_props, dev) }; - let elf_module = compile_amd(&dev_props, &*spirv, module.should_link_ptx_impl) - .map_err(|_| hipError_t::hipErrorUnknown)?; + unsafe { hipGetDevicePropertiesR0600(&mut dev_props, dev) }.unwrap(); + let elf_module = unsafe { compile_amd(&module.llvm_ir) }; let mut module = ptr::null_mut(); - hip_call! { hipModuleLoadData(&mut module, elf_module.as_ptr() as _) }; + unsafe { hipModuleLoadData(&mut module, elf_module.as_ptr() as _) }.unwrap(); let mut kernel = ptr::null_mut(); - hip_call! { hipModuleGetFunction(&mut kernel, module, name.as_ptr()) }; + unsafe { hipModuleGetFunction(&mut kernel, module, name.as_ptr()) }.unwrap(); let mut inp_b = ptr::null_mut(); - hip_call! { hipMalloc(&mut inp_b, input.len() * mem::size_of::()) }; + unsafe { hipMalloc(&mut inp_b, input.len() * mem::size_of::()) }.unwrap(); let mut out_b = ptr::null_mut(); - hip_call! { hipMalloc(&mut out_b, output.len() * mem::size_of::()) }; - hip_call! { hipMemcpyWithStream(inp_b, input.as_ptr() as _, input.len() * mem::size_of::(), hipMemcpyKind::hipMemcpyHostToDevice, stream) }; - hip_call! { hipMemset(out_b, 0, output.len() * mem::size_of::()) }; + unsafe { hipMalloc(&mut out_b, output.len() * mem::size_of::()) }.unwrap(); + unsafe { + hipMemcpyWithStream( + inp_b, + input.as_ptr() as _, + input.len() * mem::size_of::(), + hipMemcpyKind::hipMemcpyHostToDevice, + stream, + ) + } + .unwrap(); + unsafe { hipMemset(out_b, 0, output.len() * mem::size_of::()) }.unwrap(); let mut args = [&inp_b, &out_b]; - hip_call! { hipModuleLaunchKernel(kernel, 1,1,1,1,1,1, 1024, stream, args.as_mut_ptr() as _, ptr::null_mut()) }; - hip_call! { hipMemcpyAsync(result.as_mut_ptr() as _, out_b, output.len() * mem::size_of::(), hipMemcpyKind::hipMemcpyDeviceToHost, stream) }; - hip_call! { hipStreamSynchronize(stream) }; - hip_call! { hipFree(inp_b) }; - hip_call! { hipFree(out_b) }; - hip_call! { hipModuleUnload(module) }; + unsafe { + hipModuleLaunchKernel( + kernel, + 1, + 1, + 1, + 1, + 1, + 1, + 1024, + stream, + args.as_mut_ptr() as _, + ptr::null_mut(), + ) + } + .unwrap(); + unsafe { + hipMemcpyAsync( + result.as_mut_ptr() as _, + out_b, + output.len() * mem::size_of::(), + hipMemcpyKind::hipMemcpyDeviceToHost, + stream, + ) + } + .unwrap(); + unsafe { hipStreamSynchronize(stream) }.unwrap(); + unsafe { hipFree(inp_b) }.unwrap(); + unsafe { hipFree(out_b) }.unwrap(); + unsafe { hipModuleUnload(module) }.unwrap(); } Ok(result) } -fn test_spvtxt_assert<'a>( - ptx_txt: &'a str, - spirv_txt: &'a [u8], - spirv_file_name: &'a str, -) -> Result<(), Box> { - let ast = ptx_parser::parse_module_checked(ptx_txt).unwrap(); - let spirv_module = pass::to_spirv_module(ast)?; - let spv_context = - unsafe { spirv_tools::spvContextCreate(spv_target_env::SPV_ENV_UNIVERSAL_1_3) }; - assert!(spv_context != ptr::null_mut()); - let mut spv_binary: spv_binary = ptr::null_mut(); - let result = unsafe { - spirv_tools::spvTextToBinary( - spv_context, - spirv_txt.as_ptr() as *const _, - spirv_txt.len(), - &mut spv_binary, - ptr::null_mut(), - ) - }; - if result != spv_result_t::SPV_SUCCESS { - panic!("{:?}\n{}", result, unsafe { - str::from_utf8_unchecked(spirv_txt) - }); - } - let mut parsed_spirv = Vec::::new(); - let result = unsafe { - spirv_tools::spvBinaryParse( - spv_context, - &mut parsed_spirv as *mut _ as *mut _, - (*spv_binary).code, - (*spv_binary).wordCount, - Some(parse_header_cb), - Some(parse_instruction_cb), - ptr::null_mut(), - ) - }; - assert!(result == spv_result_t::SPV_SUCCESS); - let mut loader = Loader::new(); - rspirv::binary::parse_words(&parsed_spirv, &mut loader)?; - let spvtxt_mod = loader.module(); - unsafe { spirv_tools::spvBinaryDestroy(spv_binary) }; - if !is_spirv_fns_equal(&spirv_module.spirv.functions, &spvtxt_mod.functions) { - // We could simply use ptx_mod.disassemble, but SPIRV-Tools text formattinmg is so much nicer - let spv_from_ptx_binary = spirv_module.spirv.assemble(); - let mut spv_text: spirv_tools::spv_text = ptr::null_mut(); - let result = unsafe { - spirv_tools::spvBinaryToText( - spv_context, - spv_from_ptx_binary.as_ptr(), - spv_from_ptx_binary.len(), - (spirv_tools::spv_binary_to_text_options_t::SPV_BINARY_TO_TEXT_OPTION_INDENT | spirv_tools::spv_binary_to_text_options_t::SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | spirv_tools::spv_binary_to_text_options_t::SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES).0, - &mut spv_text as *mut _, - ptr::null_mut() - ) - }; - unsafe { spirv_tools::spvContextDestroy(spv_context) }; - let spirv_text = if result == spv_result_t::SPV_SUCCESS { - let raw_text = unsafe { - std::slice::from_raw_parts((*spv_text).str_ as *const u8, (*spv_text).length) - }; - let spv_from_ptx_text = unsafe { str::from_utf8_unchecked(raw_text) }; - // TODO: stop leaking kernel text - Cow::Borrowed(spv_from_ptx_text) - } else { - Cow::Owned(spirv_module.spirv.disassemble()) - }; - if let Ok(dump_path) = env::var("ZLUDA_TEST_SPIRV_DUMP_DIR") { - let mut path = PathBuf::from(dump_path); - if let Ok(()) = fs::create_dir_all(&path) { - path.push(spirv_file_name); - #[allow(unused_must_use)] - { - fs::write(path, spirv_text.as_bytes()); - } - } - } - panic!("{}", spirv_text.to_string()); - } - unsafe { spirv_tools::spvContextDestroy(spv_context) }; - Ok(()) +unsafe fn compile_amd(buffer: &MemoryBuffer) -> Vec { + use amd_comgr_sys::*; + let mut data_set = mem::zeroed(); + amd_comgr_create_data_set(&mut data_set).unwrap(); + let mut data = mem::zeroed(); + amd_comgr_create_data(amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_BC, &mut data).unwrap(); + let buffer = buffer.as_slice(); + amd_comgr_set_data(data, buffer.len(), buffer.as_ptr().cast()).unwrap(); + amd_comgr_set_data_name(data, "zluda.bc\0".as_ptr().cast()).unwrap(); + amd_comgr_data_set_add(data_set, data).unwrap(); + let mut reloc_data = mem::zeroed(); + amd_comgr_create_data_set(&mut reloc_data).unwrap(); + let mut action_info = mem::zeroed(); + amd_comgr_create_action_info(&mut action_info).unwrap(); + amd_comgr_action_info_set_isa_name(action_info, "amdgcn-amd-amdhsa--gfx1030\0".as_ptr().cast()) + .unwrap(); + amd_comgr_do_action( + amd_comgr_action_kind_t::AMD_COMGR_ACTION_CODEGEN_BC_TO_RELOCATABLE, + action_info, + data_set, + reloc_data, + ) + .unwrap(); + let mut exec_data = mem::zeroed(); + amd_comgr_create_data_set(&mut exec_data).unwrap(); + amd_comgr_do_action( + amd_comgr_action_kind_t::AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_EXECUTABLE, + action_info, + reloc_data, + exec_data, + ) + .unwrap(); + let mut exec = mem::zeroed(); + amd_comgr_action_data_get_data( + exec_data, + amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_EXECUTABLE, + 0, + &mut exec, + ) + .unwrap(); + let mut size = mem::zeroed(); + amd_comgr_get_data(exec, &mut size, ptr::null_mut()).unwrap(); + let mut result: Vec = Vec::with_capacity(size); + result.set_len(size); + amd_comgr_get_data(exec, &mut size, result.as_mut_ptr().cast()).unwrap(); + result } struct EqMap @@ -654,110 +617,6 @@ const AMDGPU_BITCODE: [&'static str; 8] = [ ]; const AMDGPU_BITCODE_DEVICE_PREFIX: &'static str = "oclc_isa_version_"; -fn compile_amd( - device_pros: &hip::hipDeviceProp_t, - spirv_il: &[u32], - ptx_lib: Option<(&'static [u8], &'static [u8])>, -) -> io::Result> { - let null_terminator = device_pros - .gcnArchName - .iter() - .position(|&x| x == 0) - .unwrap(); - let gcn_arch_slice = unsafe { - slice::from_raw_parts(device_pros.gcnArchName.as_ptr() as _, null_terminator + 1) - }; - let device_name = - if let Ok(Ok(name)) = CStr::from_bytes_with_nul(gcn_arch_slice).map(|x| x.to_str()) { - name - } else { - return Err(io::Error::new(io::ErrorKind::Other, "")); - }; - let dir = tempfile::tempdir()?; - let mut spirv = NamedTempFile::new_in(&dir)?; - let llvm = NamedTempFile::new_in(&dir)?; - let spirv_il_u8 = unsafe { - slice::from_raw_parts( - spirv_il.as_ptr() as *const u8, - spirv_il.len() * mem::size_of::(), - ) - }; - spirv.write_all(spirv_il_u8)?; - let llvm_spirv_path = match env::var("LLVM_SPIRV") { - Ok(path) => Cow::Owned(path), - Err(_) => Cow::Borrowed(LLVM_SPIRV), - }; - let to_llvm_cmd = Command::new(&*llvm_spirv_path) - .arg("-r") - .arg("-o") - .arg(llvm.path()) - .arg(spirv.path()) - .status()?; - assert!(to_llvm_cmd.success()); - if cfg!(debug_assertions) { - persist_file(llvm.path())?; - } - let linked_binary = NamedTempFile::new_in(&dir)?; - let mut llvm_link = PathBuf::from(AMDGPU); - llvm_link.push("llvm"); - llvm_link.push("bin"); - llvm_link.push("llvm-link"); - let mut linker_cmd = Command::new(&llvm_link); - linker_cmd - .arg("--only-needed") - .arg("-o") - .arg(linked_binary.path()) - .arg(llvm.path()) - .args(get_bitcode_paths(device_name)); - if cfg!(debug_assertions) { - linker_cmd.arg("-v"); - } - let status = linker_cmd.status()?; - assert!(status.success()); - if cfg!(debug_assertions) { - persist_file(linked_binary.path())?; - } - let mut ptx_lib_bitcode = NamedTempFile::new_in(&dir)?; - let compiled_binary = NamedTempFile::new_in(&dir)?; - let mut clang_exe = PathBuf::from(AMDGPU); - clang_exe.push("llvm"); - clang_exe.push("bin"); - clang_exe.push("clang"); - let mut compiler_cmd = Command::new(&clang_exe); - compiler_cmd - .arg(format!("-mcpu={}", device_name)) - .arg("-ffp-contract=off") - .arg("-nogpulib") - .arg("-mno-wavefrontsize64") - .arg("-O3") - .arg("-Xlinker") - .arg("--no-undefined") - .arg("-target") - .arg(AMDGPU_TARGET) - .arg("-o") - .arg(compiled_binary.path()) - .arg("-x") - .arg("ir") - .arg(linked_binary.path()); - if let Some((_, bitcode)) = ptx_lib { - ptx_lib_bitcode.write_all(bitcode)?; - compiler_cmd.arg(ptx_lib_bitcode.path()); - }; - if cfg!(debug_assertions) { - compiler_cmd.arg("-v"); - } - let status = compiler_cmd.status()?; - assert!(status.success()); - let mut result = Vec::new(); - let compiled_bin_path = compiled_binary.path(); - let mut compiled_binary = File::open(compiled_bin_path)?; - compiled_binary.read_to_end(&mut result)?; - if cfg!(debug_assertions) { - persist_file(compiled_bin_path)?; - } - Ok(result) -} - fn persist_file(path: &Path) -> io::Result<()> { let mut persistent = PathBuf::from("/tmp/zluda"); std::fs::create_dir_all(&persistent)?; diff --git a/ptx_parser/src/ast.rs b/ptx_parser/src/ast.rs index d0dc303c..a90b21ef 100644 --- a/ptx_parser/src/ast.rs +++ b/ptx_parser/src/ast.rs @@ -1040,6 +1040,15 @@ pub enum MethodName<'input, ID> { Func(ID), } +impl<'input, ID> MethodName<'input, ID> { + pub fn is_kernel(&self) -> bool { + match self { + MethodName::Kernel(_) => true, + MethodName::Func(_) => false, + } + } +} + bitflags! { pub struct LinkingDirective: u8 { const NONE = 0b000; @@ -1128,7 +1137,7 @@ impl SetpData { state.errors.push(PtxError::NonF32Ftz); None } - _ => None + _ => None, }; let type_kind = type_.kind(); let cmp_op = if type_kind == ScalarKind::Float { From fb68c67adb6d86cf7c55c276036889290c6f818e Mon Sep 17 00:00:00 2001 From: Andrzej Janik Date: Wed, 11 Sep 2024 17:13:10 +0200 Subject: [PATCH 3/5] Successfully add two numbers --- ptx/src/pass/emit_llvm.rs | 78 ++++++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 18 deletions(-) diff --git a/ptx/src/pass/emit_llvm.rs b/ptx/src/pass/emit_llvm.rs index acadc4ac..5d1b0cd2 100644 --- a/ptx/src/pass/emit_llvm.rs +++ b/ptx/src/pass/emit_llvm.rs @@ -43,6 +43,10 @@ pub(super) fn run<'input>( Directive::Method(method) => emit_ctx.emit_method(method)?, } } + if let Err(err) = emit_ctx.module.verify() { + emit_ctx.module.print_to_stderr(); + panic!("{}", err); + } Ok(emit_ctx.module.write_bitcode_to_memory()) } @@ -107,15 +111,16 @@ impl<'ctx, 'input> ModuleEmitContext<'ctx, 'input> { Self::func_call_convention() }); if let Some(statements) = method.body { - let entry_bb = self.context.append_basic_block(fn_, LLVM_UNNAMED); + let variables_bb = self.context.append_basic_block(fn_, LLVM_UNNAMED); let variables_builder = self.context.create_builder(); - variables_builder.position_at_end(entry_bb); + variables_builder.position_at_end(variables_bb); let real_bb = self.context.append_basic_block(fn_, LLVM_UNNAMED); self.builder.position_at_end(real_bb); let mut method_emitter = MethodEmitContext::new(self, fn_, variables_builder); for statement in statements { method_emitter.emit_statement(statement)?; } + method_emitter.variables_builder.build_unconditional_branch(real_bb); } Ok(()) } @@ -234,7 +239,7 @@ impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { fn emit_variable(&mut self, var: ast::Variable) -> Result<(), TranslateError> { let alloca = unsafe { PointerValue::new(LLVMZludaBuildAlloca( - self.builder.as_mut_ptr(), + self.variables_builder.as_mut_ptr(), get_type::(&self.context, &var.v_type)?.as_type_ref(), get_state_space(var.state_space)? as u32, self.resolver.get_or_add_raw(var.name), @@ -257,6 +262,15 @@ impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { let block = self .context .append_basic_block(self.method, self.resolver.get_or_add(label)); + if self + .builder + .get_insert_block() + .unwrap() + .get_terminator() + .is_none() + { + self.builder.build_unconditional_branch(block); + } self.builder.position_at_end(block); } @@ -277,7 +291,7 @@ impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { ast::Instruction::Mov { data, arguments } => todo!(), ast::Instruction::Ld { data, arguments } => self.emit_ld(data, arguments), ast::Instruction::Add { data, arguments } => self.emit_add(data, arguments), - ast::Instruction::St { data, arguments } => todo!(), + ast::Instruction::St { data, arguments } => self.emit_st(data, arguments), ast::Instruction::Mul { data, arguments } => todo!(), ast::Instruction::Setp { data, arguments } => todo!(), ast::Instruction::SetpBool { data, arguments } => todo!(), @@ -289,7 +303,7 @@ impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { ast::Instruction::Cvt { data, arguments } => todo!(), ast::Instruction::Shr { data, arguments } => todo!(), ast::Instruction::Shl { data, arguments } => todo!(), - ast::Instruction::Ret { data } => todo!(), + ast::Instruction::Ret { data } => self.emit_ret(data), ast::Instruction::Cvta { data, arguments } => todo!(), ast::Instruction::Abs { data, arguments } => todo!(), ast::Instruction::Mad { data, arguments } => todo!(), @@ -398,15 +412,39 @@ impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { arguments: ast::AddArgs, ) -> Result<(), TranslateError> { let builder = self.builder; - let src1 = self.resolver.value(arguments.src1)?; - let src2 = self.resolver.value(arguments.src2)?; + let src1 = self.resolver.value(arguments.src1)?.as_int()?; + let src2 = self.resolver.value(arguments.src2)?.as_int()?; let fn_ = match data { - ast::ArithDetails::Integer(integer) => Builder::build_int_add::>, + ast::ArithDetails::Integer(integer) => Builder::build_int_add, ast::ArithDetails::Float(float) => todo!(), }; self.resolver .with_result(arguments.dst, |dst| fn_(builder, src1, src2, dst)) } + + fn emit_st( + &self, + data: ptx_parser::StData, + arguments: ptx_parser::StArgs, + ) -> Result<(), TranslateError> { + let builder = self.builder; + let src1 = self.resolver.value(arguments.src1)?.as_pointer()?; + let src2 = self.resolver.value(arguments.src2)?.as_basic()?; + if data.qualifier != ast::LdStQualifier::Weak { + todo!() + } + self.builder + .build_store(src1, src2) + .map_err(|_| error_unreachable())?; + Ok(()) + } + + fn emit_ret(&self, _data: ptx_parser::RetData) -> Result<(), TranslateError> { + self.builder + .build_return(None) + .map_err(|_| error_unreachable())?; + Ok(()) + } } fn get_pointer_type<'ctx>( @@ -583,37 +621,41 @@ impl<'ctx> ResolveIdent<'ctx> { Ok(()) } - fn build_int_math>( + fn build_int_math( &mut self, builder: &Builder<'ctx>, dst: SpirvWord, src1: SpirvWord, src2: SpirvWord, - fn_: impl FnOnce(&Builder<'ctx>, T, T, &str) -> Result, + fn_: impl IntMathOp<'ctx>, ) -> Result<(), TranslateError> { let src1 = self.value(src1)?; let src2 = self.value(src2)?; self.with_result(dst, |dst| { Ok(match (src1, src2) { (AnyValueEnum::IntValue(src1), AnyValueEnum::IntValue(src2)) => { - AnyValueEnum::from(fn_(builder, src1, src2, dst)) + AnyValueEnum::from(fn_.call(builder, src1, src2, dst)?) } (AnyValueEnum::PointerValue(src1), AnyValueEnum::PointerValue(src2)) => { - AnyValueEnum::from(fn_(builder, src1, src2, dst)) + AnyValueEnum::from(fn_.call(builder, src1, src2, dst)?) } (AnyValueEnum::VectorValue(src1), AnyValueEnum::VectorValue(src2)) => { - AnyValueEnum::from(fn_(builder, src1, src2, dst)) + AnyValueEnum::from(fn_.call(builder, src1, src2, dst)?) } _ => return todo!(), }) }) } +} - fn build_float_math>( - &mut self, - fn_: impl FnOnce(&Builder<'ctx>, T, T, &str) -> Result, - ) -> Result<(), TranslateError> { - } +trait IntMathOp<'ctx> { + fn call>( + self, + builder: &Builder<'ctx>, + src1: T, + src2: T, + dst: &str, + ) -> Result; } trait AnyValueEnumExt<'ctx> { From 631417b405a3bc21325c31d7a61e3d22eee1b87c Mon Sep 17 00:00:00 2001 From: Andrzej Janik Date: Thu, 12 Sep 2024 04:37:31 +0200 Subject: [PATCH 4/5] Remove inkwell --- .cargo/config.toml | 2 - llvm_zluda/Cargo.toml | 5 - llvm_zluda/src/lib.rs | 23 +- ptx/Cargo.toml | 2 +- ptx/src/pass/emit_llvm.rs | 756 ++++++++++++++++------------------ ptx/src/pass/mod.rs | 7 +- ptx/src/test/spirv_run/mod.rs | 9 +- 7 files changed, 367 insertions(+), 437 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index f03ab8cf..e69de29b 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +0,0 @@ -[patch.crates-io] -inkwell = { git = "https://github.com/vosen/inkwell.git", rev = "46027c2afb7e98976438cdcc41a2949dedb60b2e" } diff --git a/llvm_zluda/Cargo.toml b/llvm_zluda/Cargo.toml index 0e7f8a05..b285fc7d 100644 --- a/llvm_zluda/Cargo.toml +++ b/llvm_zluda/Cargo.toml @@ -15,8 +15,3 @@ features = [ "disable-alltargets-init", "no-llvm-linking" ] [build-dependencies] cmake = "0.1" cc = "1.0.69" - -[dependencies.inkwell] -version = "0.5" -default-features = false # default features contain all LLVM targets (x86, mips, riscv, etc.) -features = [ "llvm17-0-no-llvm-linking", "no-libffi-linking" ] diff --git a/llvm_zluda/src/lib.rs b/llvm_zluda/src/lib.rs index c72e2618..18072a85 100644 --- a/llvm_zluda/src/lib.rs +++ b/llvm_zluda/src/lib.rs @@ -1,15 +1,10 @@ -pub mod inkwell { - pub use inkwell::*; -} -pub mod llvm { - use llvm_sys::prelude::*; - pub use llvm_sys::*; - extern "C" { - pub fn LLVMZludaBuildAlloca( - B: LLVMBuilderRef, - Ty: LLVMTypeRef, - AddrSpace: u32, - Name: *const i8, - ) -> LLVMValueRef; - } +use llvm_sys::prelude::*; +pub use llvm_sys::*; +extern "C" { + pub fn LLVMZludaBuildAlloca( + B: LLVMBuilderRef, + Ty: LLVMTypeRef, + AddrSpace: u32, + Name: *const i8, + ) -> LLVMValueRef; } diff --git a/ptx/Cargo.toml b/ptx/Cargo.toml index 12f47ea3..d99a9f6a 100644 --- a/ptx/Cargo.toml +++ b/ptx/Cargo.toml @@ -2,7 +2,7 @@ name = "ptx" version = "0.0.0" authors = ["Andrzej Janik "] -edition = "2018" +edition = "2021" [lib] diff --git a/ptx/src/pass/emit_llvm.rs b/ptx/src/pass/emit_llvm.rs index 5d1b0cd2..44debbad 100644 --- a/ptx/src/pass/emit_llvm.rs +++ b/ptx/src/pass/emit_llvm.rs @@ -1,74 +1,207 @@ +// We use Raw LLVM-C bindings here because using inkwell is just not worth it. +// Specifically the issue is with builder functions. We maintain the mapping +// between ZLUDA identifiers and LLVM values. When using inkwell, LLVM values +// are kept as instances `AnyValueEnum`. Now look at the signature of +// `Builder::build_int_add(...)`: +// pub fn build_int_add>(&self, lhs: T, rhs: T, name: &str, ) -> Result +// At this point both lhs and rhs are `AnyValueEnum`. To call +// `build_int_add(...)` we would have to do something like this: +// if let (Ok(lhs), Ok(rhs)) = (lhs.as_int(), rhs.as_int()) { +// builder.build_int_add(lhs, rhs, dst)?; +// } else if let (Ok(lhs), Ok(rhs)) = (lhs.as_pointer(), rhs.as_pointer()) { +// builder.build_int_add(lhs, rhs, dst)?; +// } else if let (Ok(lhs), Ok(rhs)) = (lhs.as_vector(), rhs.as_vector()) { +// builder.build_int_add(lhs, rhs, dst)?; +// } else { +// return Err(error_unrachable()); +// } +// while with plain LLVM-C it's just: +// unsafe { LLVMBuildAdd(builder, lhs, rhs, dst) }; + use std::convert::{TryFrom, TryInto}; +use std::ffi::CStr; +use std::ops::Deref; use std::ptr; use super::*; -use llvm_zluda::inkwell::builder::{Builder, BuilderError}; -use llvm_zluda::inkwell::context::{AsContextRef, Context}; -use llvm_zluda::inkwell::memory_buffer::MemoryBuffer; -use llvm_zluda::inkwell::types::{ - ArrayType, AsTypeRef, BasicMetadataTypeEnum, BasicType, BasicTypeEnum, FloatType, FunctionType, - IntType, PointerType, VectorType, VoidType, -}; -use llvm_zluda::inkwell::values::{ - AnyValue, AnyValueEnum, ArrayValue, BasicValueEnum, FloatMathValue, FloatValue, FunctionValue, - InstructionValue, IntMathValue, IntValue, PhiValue, PointerValue, StructValue, VectorValue, -}; -use llvm_zluda::inkwell::{self, module, AddressSpace}; -use llvm_zluda::llvm::core::{ - LLVMArrayType2, LLVMBFloatType, LLVMBFloatTypeInContext, LLVMVectorType, -}; -use llvm_zluda::llvm::prelude::*; -use llvm_zluda::llvm::{LLVMCallConv, LLVMZludaBuildAlloca}; - -const LLVM_UNNAMED: &str = "\0"; +use llvm_zluda::analysis::{LLVMVerifierFailureAction, LLVMVerifyModule}; +use llvm_zluda::bit_writer::LLVMWriteBitcodeToMemoryBuffer; +use llvm_zluda::core::*; +use llvm_zluda::prelude::*; +use llvm_zluda::{LLVMCallConv, LLVMZludaBuildAlloca}; + +const LLVM_UNNAMED: &CStr = c""; // https://llvm.org/docs/AMDGPUUsage.html#address-spaces -const GENERIC_ADDRESS_SPACE: u16 = 0; -const GLOBAL_ADDRESS_SPACE: u16 = 1; -const SHARED_ADDRESS_SPACE: u16 = 3; -const CONSTANT_ADDRESS_SPACE: u16 = 4; -const PRIVATE_ADDRESS_SPACE: u16 = 5; +const GENERIC_ADDRESS_SPACE: u32 = 0; +const GLOBAL_ADDRESS_SPACE: u32 = 1; +const SHARED_ADDRESS_SPACE: u32 = 3; +const CONSTANT_ADDRESS_SPACE: u32 = 4; +const PRIVATE_ADDRESS_SPACE: u32 = 5; + +struct Context(LLVMContextRef); + +impl Context { + fn new() -> Self { + Self(unsafe { LLVMContextCreate() }) + } + + fn get(&self) -> LLVMContextRef { + self.0 + } +} + +impl Drop for Context { + fn drop(&mut self) { + unsafe { + LLVMContextDispose(self.0); + } + } +} + +struct Module(LLVMModuleRef); + +impl Module { + fn new(ctx: &Context, name: &CStr) -> Self { + Self(unsafe { LLVMModuleCreateWithNameInContext(name.as_ptr(), ctx.get()) }) + } + + fn get(&self) -> LLVMModuleRef { + self.0 + } + + fn verify(&self) -> Result<(), Message> { + let mut err = ptr::null_mut(); + let error = unsafe { + LLVMVerifyModule( + self.get(), + LLVMVerifierFailureAction::LLVMReturnStatusAction, + &mut err, + ) + }; + if error == 1 && err != ptr::null_mut() { + Err(Message(unsafe { CStr::from_ptr(err) })) + } else { + Ok(()) + } + } + + fn write_bitcode_to_memory(&self) -> MemoryBuffer { + let memory_buffer = unsafe { LLVMWriteBitcodeToMemoryBuffer(self.get()) }; + MemoryBuffer(memory_buffer) + } + + fn write_to_stderr(&self) { + unsafe { LLVMDumpModule(self.get()) }; + } +} + +impl Drop for Module { + fn drop(&mut self) { + unsafe { + LLVMDisposeModule(self.0); + } + } +} + +struct Builder(LLVMBuilderRef); + +impl Builder { + fn new(ctx: &Context) -> Self { + Self::new_raw(ctx.get()) + } + + fn new_raw(ctx: LLVMContextRef) -> Self { + Self(unsafe { LLVMCreateBuilderInContext(ctx) }) + } + + fn get(&self) -> LLVMBuilderRef { + self.0 + } +} + +impl Drop for Builder { + fn drop(&mut self) { + unsafe { + LLVMDisposeBuilder(self.0); + } + } +} + +struct Message(&'static CStr); + +impl Drop for Message { + fn drop(&mut self) { + unsafe { + LLVMDisposeMessage(self.0.as_ptr().cast_mut()); + } + } +} + +impl std::fmt::Debug for Message { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Debug::fmt(&self.0, f) + } +} + +pub struct MemoryBuffer(LLVMMemoryBufferRef); + +impl Drop for MemoryBuffer { + fn drop(&mut self) { + unsafe { + LLVMDisposeMemoryBuffer(self.0); + } + } +} + +impl Deref for MemoryBuffer { + type Target = [u8]; + + fn deref(&self) -> &Self::Target { + let data = unsafe { LLVMGetBufferStart(self.0) }; + let len = unsafe { LLVMGetBufferSize(self.0) }; + unsafe { std::slice::from_raw_parts(data.cast(), len) } + } +} pub(super) fn run<'input>( id_defs: &GlobalStringIdResolver<'input>, call_map: MethodsCallMap<'input>, directives: Vec>, ) -> Result { - let context = inkwell::context::Context::create(); - let module = context.create_module(LLVM_UNNAMED); - let builder = context.create_builder(); - let mut emit_ctx = ModuleEmitContext::new(&context, module, builder, id_defs); + let context = Context::new(); + let module = Module::new(&context, LLVM_UNNAMED); + let mut emit_ctx = ModuleEmitContext::new(&context, &module, id_defs); for directive in directives { match directive { Directive::Variable(..) => todo!(), Directive::Method(method) => emit_ctx.emit_method(method)?, } } - if let Err(err) = emit_ctx.module.verify() { - emit_ctx.module.print_to_stderr(); - panic!("{}", err); + module.write_to_stderr(); + if let Err(err) = module.verify() { + panic!("{:?}", err); } - Ok(emit_ctx.module.write_bitcode_to_memory()) + Ok(module.write_bitcode_to_memory()) } -struct ModuleEmitContext<'ctx, 'input> { - context: &'ctx Context, - module: module::Module<'ctx>, - builder: Builder<'ctx>, - id_defs: &'ctx GlobalStringIdResolver<'input>, - resolver: ResolveIdent<'ctx>, +struct ModuleEmitContext<'a, 'input> { + context: LLVMContextRef, + module: LLVMModuleRef, + builder: Builder, + id_defs: &'a GlobalStringIdResolver<'input>, + resolver: ResolveIdent, } -impl<'ctx, 'input> ModuleEmitContext<'ctx, 'input> { +impl<'a, 'input> ModuleEmitContext<'a, 'input> { fn new( - context: &'ctx Context, - module: module::Module<'ctx>, - builder: Builder<'ctx>, - id_defs: &'ctx GlobalStringIdResolver<'input>, + context: &Context, + module: &Module, + id_defs: &'a GlobalStringIdResolver<'input>, ) -> Self { ModuleEmitContext { - context: &context, - module, - builder, + context: context.get(), + module: module.get(), + builder: Builder::new(context), id_defs, resolver: ResolveIdent::new(&id_defs), } @@ -84,85 +217,86 @@ impl<'ctx, 'input> ModuleEmitContext<'ctx, 'input> { fn emit_method(&mut self, method: Function<'input>) -> Result<(), TranslateError> { let func_decl = method.func_decl.borrow(); - let fn_ = self.module.add_function( - method - .import_as - .as_deref() - .unwrap_or_else(|| match func_decl.name { - ast::MethodName::Kernel(name) => name, - ast::MethodName::Func(id) => self.id_defs.reverse_variables[&id], - }), - self.function_type( - func_decl.return_arguments.iter().map(|v| &v.v_type), - func_decl.input_arguments.iter().map(|v| &v.v_type), - ), - None, + let name = method + .import_as + .as_deref() + .unwrap_or_else(|| match func_decl.name { + ast::MethodName::Kernel(name) => name, + ast::MethodName::Func(id) => self.id_defs.reverse_variables[&id], + }); + let name = CString::new(name).map_err(|_| error_unreachable())?; + let fn_type = self.function_type( + func_decl.return_arguments.iter().map(|v| &v.v_type), + func_decl.input_arguments.iter().map(|v| &v.v_type), ); + let fn_ = unsafe { LLVMAddFunction(self.module, name.as_ptr(), fn_type) }; for (i, param) in func_decl.input_arguments.iter().enumerate() { - let value = fn_ - .get_nth_param(i as u32) - .ok_or_else(|| error_unreachable())?; - value.set_name(self.resolver.get_or_add(param.name)); + let value = unsafe { LLVMGetParam(fn_, i as u32) }; + let name = self.resolver.get_or_add(param.name); + unsafe { LLVMSetValueName2(value, name.as_ptr().cast(), name.len()) }; self.resolver.register(param.name, value); } - fn_.set_call_conventions(if func_decl.name.is_kernel() { + let call_conv = if func_decl.name.is_kernel() { Self::kernel_call_convention() } else { Self::func_call_convention() - }); + }; + unsafe { LLVMSetFunctionCallConv(fn_, call_conv) }; if let Some(statements) = method.body { - let variables_bb = self.context.append_basic_block(fn_, LLVM_UNNAMED); - let variables_builder = self.context.create_builder(); - variables_builder.position_at_end(variables_bb); - let real_bb = self.context.append_basic_block(fn_, LLVM_UNNAMED); - self.builder.position_at_end(real_bb); + let variables_bb = + unsafe { LLVMAppendBasicBlockInContext(self.context, fn_, LLVM_UNNAMED.as_ptr()) }; + let variables_builder = Builder::new_raw(self.context); + unsafe { LLVMPositionBuilderAtEnd(variables_builder.get(), variables_bb) }; + let real_bb = + unsafe { LLVMAppendBasicBlockInContext(self.context, fn_, LLVM_UNNAMED.as_ptr()) }; + unsafe { LLVMPositionBuilderAtEnd(self.builder.get(), real_bb) }; let mut method_emitter = MethodEmitContext::new(self, fn_, variables_builder); for statement in statements { method_emitter.emit_statement(statement)?; } - method_emitter.variables_builder.build_unconditional_branch(real_bb); + unsafe { LLVMBuildBr(method_emitter.variables_builder.get(), real_bb) }; } Ok(()) } - fn function_type<'a>( + fn function_type( &self, return_args: impl ExactSizeIterator, input_args: impl ExactSizeIterator, - ) -> FunctionType<'ctx> { + ) -> LLVMTypeRef { if return_args.len() == 0 { - let input_args = input_args + let mut input_args = input_args .map(|type_| match type_ { ast::Type::Scalar(scalar) => match scalar { ast::ScalarType::Pred => { - BasicMetadataTypeEnum::from(self.context.bool_type()) + unsafe { LLVMInt1TypeInContext(self.context) } } ast::ScalarType::S8 | ast::ScalarType::B8 | ast::ScalarType::U8 => { - BasicMetadataTypeEnum::from(self.context.i8_type()) + unsafe { LLVMInt8TypeInContext(self.context) } } ast::ScalarType::B16 | ast::ScalarType::U16 | ast::ScalarType::S16 => { - BasicMetadataTypeEnum::from(self.context.i16_type()) + unsafe { LLVMInt16TypeInContext(self.context) } } ast::ScalarType::S32 | ast::ScalarType::B32 | ast::ScalarType::U32 => { - BasicMetadataTypeEnum::from(self.context.i32_type()) + unsafe { LLVMInt32TypeInContext(self.context) } } ast::ScalarType::U64 | ast::ScalarType::S64 | ast::ScalarType::B64 => { - BasicMetadataTypeEnum::from(self.context.i64_type()) + unsafe { LLVMInt64TypeInContext(self.context) } } ast::ScalarType::B128 => { - BasicMetadataTypeEnum::from(self.context.i128_type()) + unsafe { LLVMInt128TypeInContext(self.context) } } ast::ScalarType::F16 => { - BasicMetadataTypeEnum::from(self.context.f16_type()) + unsafe { LLVMHalfTypeInContext(self.context) } } ast::ScalarType::F32 => { - BasicMetadataTypeEnum::from(self.context.f32_type()) + unsafe { LLVMFloatTypeInContext(self.context) } } ast::ScalarType::F64 => { - BasicMetadataTypeEnum::from(self.context.f64_type()) + unsafe { LLVMDoubleTypeInContext(self.context) } } ast::ScalarType::BF16 => { - BasicMetadataTypeEnum::from(unsafe { FloatType::new(LLVMBFloatType()) }) + unsafe { LLVMBFloatTypeInContext(self.context) } } ast::ScalarType::U16x2 => todo!(), ast::ScalarType::S16x2 => todo!(), @@ -174,41 +308,39 @@ impl<'ctx, 'input> ModuleEmitContext<'ctx, 'input> { ast::Type::Pointer(_, _) => todo!(), }) .collect::>(); - return self.context.void_type().fn_type(&*input_args, false); + return unsafe { + LLVMFunctionType( + LLVMVoidTypeInContext(self.context), + input_args.as_mut_ptr(), + input_args.len() as u32, + 0, + ) + }; } todo!() } - - fn get_type(&self, type_: &ast::Type) -> FunctionType<'ctx> { - match type_ { - ast::Type::Scalar(_) => todo!(), - ast::Type::Vector(_, _) => todo!(), - ast::Type::Array(_, _, _) => todo!(), - ast::Type::Pointer(_, _) => todo!(), - } - } } -struct MethodEmitContext<'a, 'ctx, 'input> { - context: &'ctx Context, - module: &'a module::Module<'ctx>, - method: FunctionValue<'ctx>, - builder: &'a Builder<'ctx>, +struct MethodEmitContext<'a, 'input> { + context: LLVMContextRef, + module: LLVMModuleRef, + method: LLVMValueRef, + builder: LLVMBuilderRef, id_defs: &'a GlobalStringIdResolver<'input>, - variables_builder: Builder<'ctx>, - resolver: &'a mut ResolveIdent<'ctx>, + variables_builder: Builder, + resolver: &'a mut ResolveIdent, } -impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { - fn new( - parent: &'a mut ModuleEmitContext<'ctx, 'input>, - method: FunctionValue<'ctx>, - variables_builder: Builder<'ctx>, - ) -> MethodEmitContext<'a, 'ctx, 'input> { +impl<'a, 'input> MethodEmitContext<'a, 'input> { + fn new<'x>( + parent: &'a mut ModuleEmitContext<'x, 'input>, + method: LLVMValueRef, + variables_builder: Builder, + ) -> MethodEmitContext<'a, 'input> { MethodEmitContext { - context: &parent.context, - module: &parent.module, - builder: &parent.builder, + context: parent.context, + module: parent.module, + builder: parent.builder.get(), id_defs: parent.id_defs, variables_builder, resolver: &mut parent.resolver, @@ -238,19 +370,16 @@ impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { fn emit_variable(&mut self, var: ast::Variable) -> Result<(), TranslateError> { let alloca = unsafe { - PointerValue::new(LLVMZludaBuildAlloca( - self.variables_builder.as_mut_ptr(), - get_type::(&self.context, &var.v_type)?.as_type_ref(), - get_state_space(var.state_space)? as u32, + LLVMZludaBuildAlloca( + self.variables_builder.get(), + get_type(self.context, &var.v_type)?, + get_state_space(var.state_space)?, self.resolver.get_or_add_raw(var.name), - )) + ) }; self.resolver.register(var.name, alloca); if let Some(align) = var.align { - let alloca = alloca.as_instruction().ok_or_else(|| error_unreachable())?; - alloca - .set_alignment(align) - .map_err(|_| error_unreachable())?; + unsafe { LLVMSetAlignment(alloca, align) }; } if !var.array_init.is_empty() { todo!() @@ -259,27 +388,24 @@ impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { } fn emit_label(&mut self, label: SpirvWord) { - let block = self - .context - .append_basic_block(self.method, self.resolver.get_or_add(label)); - if self - .builder - .get_insert_block() - .unwrap() - .get_terminator() - .is_none() - { - self.builder.build_unconditional_branch(block); + let block = unsafe { + LLVMAppendBasicBlockInContext( + self.context, + self.method, + self.resolver.get_or_add_raw(label), + ) + }; + let last_block = unsafe { LLVMGetInsertBlock(self.builder) }; + if unsafe { LLVMGetBasicBlockTerminator(last_block) } == ptr::null_mut() { + unsafe { LLVMBuildBr(self.builder, block) }; } - self.builder.position_at_end(block); + unsafe { LLVMPositionBuilderAtEnd(self.builder, block) }; } fn emit_store_var(&mut self, store: StoreVarDetails) -> Result<(), TranslateError> { - let src1 = self.resolver.value(store.arg.src1)?; - let src2 = self.resolver.value(store.arg.src2)?; - self.builder - .build_store(src1.as_pointer()?, src2.as_basic()?) - .map_err(|_| error_unreachable())?; + let ptr = self.resolver.value(store.arg.src1)?; + let value = self.resolver.value(store.arg.src2)?; + unsafe { LLVMBuildStore(self.builder, value, ptr) }; Ok(()) } @@ -303,7 +429,7 @@ impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { ast::Instruction::Cvt { data, arguments } => todo!(), ast::Instruction::Shr { data, arguments } => todo!(), ast::Instruction::Shl { data, arguments } => todo!(), - ast::Instruction::Ret { data } => self.emit_ret(data), + ast::Instruction::Ret { data } => Ok(self.emit_ret(data)), ast::Instruction::Cvta { data, arguments } => todo!(), ast::Instruction::Abs { data, arguments } => todo!(), ast::Instruction::Mad { data, arguments } => todo!(), @@ -351,10 +477,12 @@ impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { todo!() } let builder = self.builder; - let type_ = get_type::(&self.context, &data.typ)?; - let ptr = self.resolver.value(arguments.src)?.as_pointer()?; - self.resolver - .with_result(arguments.dst, |dst| builder.build_load(type_, ptr, dst)) + let type_ = get_type(self.context, &data.typ)?; + let ptr = self.resolver.value(arguments.src)?; + self.resolver.with_result(arguments.dst, |dst| unsafe { + LLVMBuildLoad2(builder, type_, ptr, dst) + }); + Ok(()) } fn emit_load_variable(&mut self, var: LoadVarDetails) -> Result<(), TranslateError> { @@ -362,10 +490,12 @@ impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { todo!() } let builder = self.builder; - let type_ = get_type::(&self.context, &var.typ)?; - let ptr = self.resolver.value(var.arg.src)?.as_pointer()?; - self.resolver - .with_result(var.arg.dst, |dst| builder.build_load(type_, ptr, dst)) + let type_ = get_type(self.context, &var.typ)?; + let ptr = self.resolver.value(var.arg.src)?; + self.resolver.with_result(var.arg.dst, |dst| unsafe { + LLVMBuildLoad2(builder, type_, ptr, dst) + }); + Ok(()) } fn emit_conversion(&mut self, conversion: ImplicitConversion) -> Result<(), TranslateError> { @@ -374,11 +504,12 @@ impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { ConversionKind::Default => todo!(), ConversionKind::SignExtend => todo!(), ConversionKind::BitToPtr => { - let src = self.resolver.value(conversion.src)?.as_int()?; + let src = self.resolver.value(conversion.src)?; let type_ = get_pointer_type(self.context, conversion.to_space)?; - self.resolver.with_result(conversion.dst, |dst| { - builder.build_int_to_ptr(src, type_, dst) - }) + self.resolver.with_result(conversion.dst, |dst| unsafe { + LLVMBuildIntToPtr(builder, src, type_, dst) + }); + Ok(()) } ConversionKind::PtrToPtr => todo!(), ConversionKind::AddressOf => todo!(), @@ -386,21 +517,12 @@ impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { } fn emit_constant(&mut self, constant: ConstantDefinition) -> Result<(), TranslateError> { - let type_ = get_scalar_type::(&self.context, constant.typ); - let value: AnyValueEnum = match (type_, constant.value) { - (BasicTypeEnum::IntType(type_), ast::ImmediateValue::U64(x)) => { - type_.const_int(x, false).into() - } - (BasicTypeEnum::IntType(type_), ast::ImmediateValue::S64(x)) => { - type_.const_int(x as u64, false).into() - } - (BasicTypeEnum::FloatType(type_), ast::ImmediateValue::F32(x)) => { - type_.const_float(x as f64).into() - } - (BasicTypeEnum::FloatType(type_), ast::ImmediateValue::F64(x)) => { - type_.const_float(x).into() - } - _ => return Err(error_unreachable()), + let type_ = get_scalar_type(self.context, constant.typ); + let value = match constant.value { + ast::ImmediateValue::U64(x) => unsafe { LLVMConstInt(type_, x, 0) }, + ast::ImmediateValue::S64(x) => unsafe { LLVMConstInt(type_, x as u64, 0) }, + ast::ImmediateValue::F32(x) => unsafe { LLVMConstReal(type_, x as f64) }, + ast::ImmediateValue::F64(x) => unsafe { LLVMConstReal(type_, x) }, }; self.resolver.register(constant.dst, value); Ok(()) @@ -412,14 +534,16 @@ impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { arguments: ast::AddArgs, ) -> Result<(), TranslateError> { let builder = self.builder; - let src1 = self.resolver.value(arguments.src1)?.as_int()?; - let src2 = self.resolver.value(arguments.src2)?.as_int()?; + let src1 = self.resolver.value(arguments.src1)?; + let src2 = self.resolver.value(arguments.src2)?; let fn_ = match data { - ast::ArithDetails::Integer(integer) => Builder::build_int_add, - ast::ArithDetails::Float(float) => todo!(), + ast::ArithDetails::Integer(integer) => LLVMBuildAdd, + ast::ArithDetails::Float(float) => LLVMBuildFAdd, }; - self.resolver - .with_result(arguments.dst, |dst| fn_(builder, src1, src2, dst)) + self.resolver.with_result(arguments.dst, |dst| unsafe { + fn_(builder, src1, src2, dst) + }); + Ok(()) } fn emit_st( @@ -427,129 +551,80 @@ impl<'a, 'ctx, 'input> MethodEmitContext<'a, 'ctx, 'input> { data: ptx_parser::StData, arguments: ptx_parser::StArgs, ) -> Result<(), TranslateError> { - let builder = self.builder; - let src1 = self.resolver.value(arguments.src1)?.as_pointer()?; - let src2 = self.resolver.value(arguments.src2)?.as_basic()?; + let ptr = self.resolver.value(arguments.src1)?; + let value = self.resolver.value(arguments.src2)?; if data.qualifier != ast::LdStQualifier::Weak { todo!() } - self.builder - .build_store(src1, src2) - .map_err(|_| error_unreachable())?; + unsafe { LLVMBuildStore(self.builder, value, ptr) }; Ok(()) } - fn emit_ret(&self, _data: ptx_parser::RetData) -> Result<(), TranslateError> { - self.builder - .build_return(None) - .map_err(|_| error_unreachable())?; - Ok(()) + fn emit_ret(&self, _data: ptx_parser::RetData) { + unsafe { LLVMBuildRetVoid(self.builder) }; } } fn get_pointer_type<'ctx>( - context: &'ctx Context, + context: LLVMContextRef, to_space: ast::StateSpace, -) -> Result, TranslateError> { - Ok(context.ptr_type(AddressSpace::from(get_state_space(to_space)?))) +) -> Result { + Ok(unsafe { LLVMPointerTypeInContext(context, get_state_space(to_space)?) }) } -fn get_type< - 'ctx, - T: From> - + From> - + From> - + From> - + From>, ->( - context: &'ctx Context, - type_: &ast::Type, -) -> Result { +fn get_type(context: LLVMContextRef, type_: &ast::Type) -> Result { Ok(match type_ { ast::Type::Scalar(scalar) => get_scalar_type(context, *scalar), ast::Type::Vector(size, scalar) => { - let base_type = get_scalar_type::(context, *scalar); - let base_type = match base_type { - BasicTypeEnum::FloatType(t) => t.as_type_ref(), - BasicTypeEnum::IntType(t) => t.as_type_ref(), - _ => return Err(error_unreachable()), - }; - T::from(unsafe { VectorType::new(LLVMVectorType(base_type, *size as u32)) }) + let base_type = get_scalar_type(context, *scalar); + unsafe { LLVMVectorType(base_type, *size as u32) } } ast::Type::Array(vec, scalar, dimensions) => { - let mut underlying_type = get_scalar_type::(context, *scalar); + let mut underlying_type = get_scalar_type(context, *scalar); if let Some(size) = vec { - underlying_type = BasicTypeEnum::VectorType(unsafe { - VectorType::new(LLVMVectorType( - match underlying_type { - BasicTypeEnum::FloatType(t) => t.as_type_ref(), - BasicTypeEnum::IntType(t) => t.as_type_ref(), - _ => return Err(error_unreachable()), - }, - size.get() as u32, - )) - }); + underlying_type = unsafe { LLVMVectorType(underlying_type, size.get() as u32) }; } if dimensions.is_empty() { - return Ok(T::from(underlying_type.array_type(0))); + return Ok(unsafe { LLVMArrayType2(underlying_type, 0) }); } - let llvm_type = dimensions + dimensions .iter() - .rfold(underlying_type.as_type_ref(), |result, dimension| unsafe { + .rfold(underlying_type, |result, dimension| unsafe { LLVMArrayType2(result, *dimension as u64) - }); - T::from(unsafe { ArrayType::new(llvm_type) }) - } - ast::Type::Pointer(_, space) => { - T::from(context.ptr_type(AddressSpace::from(get_state_space(*space)?))) + }) } + ast::Type::Pointer(_, space) => get_pointer_type(context, *space)?, }) } -fn get_scalar_type< - 'ctx, - T: From> + From> + From>, ->( - context: &'ctx Context, - type_: ast::ScalarType, -) -> T { +fn get_scalar_type(context: LLVMContextRef, type_: ast::ScalarType) -> LLVMTypeRef { match type_ { - ast::ScalarType::Pred => T::from(context.bool_type()), - ast::ScalarType::S8 | ast::ScalarType::B8 | ast::ScalarType::U8 => { - T::from(context.i8_type()) - } - ast::ScalarType::B16 | ast::ScalarType::U16 | ast::ScalarType::S16 => { - T::from(context.i16_type()) - } - ast::ScalarType::S32 | ast::ScalarType::B32 | ast::ScalarType::U32 => { - T::from(context.i32_type()) - } - ast::ScalarType::U64 | ast::ScalarType::S64 | ast::ScalarType::B64 => { - T::from(context.i64_type()) - } - ast::ScalarType::B128 => T::from(context.i128_type()), - ast::ScalarType::F16 => T::from(context.f16_type()), - ast::ScalarType::F32 => T::from(context.f32_type()), - ast::ScalarType::F64 => T::from(context.f64_type()), - ast::ScalarType::BF16 => { - T::from(unsafe { FloatType::new(LLVMBFloatTypeInContext(context.as_ctx_ref())) }) - } - ast::ScalarType::U16x2 | ast::ScalarType::S16x2 => { - T::from(unsafe { VectorType::new(LLVMVectorType(context.i16_type().as_type_ref(), 2)) }) - } - ast::ScalarType::F16x2 => { - T::from(unsafe { VectorType::new(LLVMVectorType(context.f16_type().as_type_ref(), 2)) }) - } - ast::ScalarType::BF16x2 => T::from(unsafe { - VectorType::new(LLVMVectorType( - LLVMBFloatTypeInContext(context.as_ctx_ref()), - 2, - )) - }), + ast::ScalarType::Pred => unsafe { LLVMInt1TypeInContext(context) }, + ast::ScalarType::S8 | ast::ScalarType::B8 | ast::ScalarType::U8 => unsafe { + LLVMInt8TypeInContext(context) + }, + ast::ScalarType::B16 | ast::ScalarType::U16 | ast::ScalarType::S16 => unsafe { + LLVMInt16TypeInContext(context) + }, + ast::ScalarType::S32 | ast::ScalarType::B32 | ast::ScalarType::U32 => unsafe { + LLVMInt32TypeInContext(context) + }, + ast::ScalarType::U64 | ast::ScalarType::S64 | ast::ScalarType::B64 => unsafe { + LLVMInt64TypeInContext(context) + }, + ast::ScalarType::B128 => unsafe { LLVMInt128TypeInContext(context) }, + ast::ScalarType::F16 => unsafe { LLVMHalfTypeInContext(context) }, + ast::ScalarType::F32 => unsafe { LLVMFloatTypeInContext(context) }, + ast::ScalarType::F64 => unsafe { LLVMDoubleTypeInContext(context) }, + ast::ScalarType::BF16 => unsafe { LLVMBFloatTypeInContext(context) }, + ast::ScalarType::U16x2 => todo!(), + ast::ScalarType::S16x2 => todo!(), + ast::ScalarType::F16x2 => todo!(), + ast::ScalarType::BF16x2 => todo!(), } } -fn get_state_space(space: ast::StateSpace) -> Result { +fn get_state_space(space: ast::StateSpace) -> Result { match space { ast::StateSpace::Reg => Ok(PRIVATE_ADDRESS_SPACE), ast::StateSpace::Generic => Ok(GENERIC_ADDRESS_SPACE), @@ -566,12 +641,12 @@ fn get_state_space(space: ast::StateSpace) -> Result { } } -struct ResolveIdent<'ctx> { +struct ResolveIdent { words: HashMap, - values: HashMap>, + values: HashMap, } -impl<'ctx> ResolveIdent<'ctx> { +impl ResolveIdent { fn new<'input>(_id_defs: &GlobalStringIdResolver<'input>) -> Self { ResolveIdent { words: HashMap::new(), @@ -580,14 +655,15 @@ impl<'ctx> ResolveIdent<'ctx> { } fn get_or_ad_impl<'a, T>(&'a mut self, word: SpirvWord, fn_: impl FnOnce(&'a str) -> T) -> T { - match self.words.entry(word) { - hash_map::Entry::Occupied(entry) => fn_(entry.into_mut()), + let str = match self.words.entry(word) { + hash_map::Entry::Occupied(entry) => entry.into_mut(), hash_map::Entry::Vacant(entry) => { let mut text = word.0.to_string(); text.push('\0'); - fn_(entry.insert(text)) + entry.insert(text) } - } + }; + fn_(&str[..str.len() - 1]) } fn get_or_add(&mut self, word: SpirvWord) -> &str { @@ -598,153 +674,19 @@ impl<'ctx> ResolveIdent<'ctx> { self.get_or_add(word).as_ptr().cast() } - fn register(&mut self, word: SpirvWord, t: impl AnyValue<'ctx>) { - self.values.insert(word, t.as_any_value_enum()); + fn register(&mut self, word: SpirvWord, v: LLVMValueRef) { + self.values.insert(word, v); } - fn value(&self, word: SpirvWord) -> Result, TranslateError> { + fn value(&self, word: SpirvWord) -> Result { self.values .get(&word) .copied() .ok_or_else(|| error_unreachable()) } - fn with_result>( - &mut self, - word: SpirvWord, - fn_: impl FnOnce(&str) -> Result, - ) -> Result<(), TranslateError> { - let t = self - .get_or_ad_impl(word, fn_) - .map_err(|_| error_unreachable())?; + fn with_result(&mut self, word: SpirvWord, fn_: impl FnOnce(*const i8) -> LLVMValueRef) { + let t = self.get_or_ad_impl(word, |dst| fn_(dst.as_ptr().cast())); self.register(word, t); - Ok(()) - } - - fn build_int_math( - &mut self, - builder: &Builder<'ctx>, - dst: SpirvWord, - src1: SpirvWord, - src2: SpirvWord, - fn_: impl IntMathOp<'ctx>, - ) -> Result<(), TranslateError> { - let src1 = self.value(src1)?; - let src2 = self.value(src2)?; - self.with_result(dst, |dst| { - Ok(match (src1, src2) { - (AnyValueEnum::IntValue(src1), AnyValueEnum::IntValue(src2)) => { - AnyValueEnum::from(fn_.call(builder, src1, src2, dst)?) - } - (AnyValueEnum::PointerValue(src1), AnyValueEnum::PointerValue(src2)) => { - AnyValueEnum::from(fn_.call(builder, src1, src2, dst)?) - } - (AnyValueEnum::VectorValue(src1), AnyValueEnum::VectorValue(src2)) => { - AnyValueEnum::from(fn_.call(builder, src1, src2, dst)?) - } - _ => return todo!(), - }) - }) - } -} - -trait IntMathOp<'ctx> { - fn call>( - self, - builder: &Builder<'ctx>, - src1: T, - src2: T, - dst: &str, - ) -> Result; -} - -trait AnyValueEnumExt<'ctx> { - fn as_array(self) -> Result, TranslateError>; - fn as_int(self) -> Result, TranslateError>; - fn as_float(self) -> Result, TranslateError>; - fn as_phi(self) -> Result, TranslateError>; - fn as_function(self) -> Result, TranslateError>; - fn as_pointer(self) -> Result, TranslateError>; - fn as_struct(self) -> Result, TranslateError>; - fn as_vector(self) -> Result, TranslateError>; - fn as_instruction(self) -> Result, TranslateError>; - fn as_basic(self) -> Result, TranslateError>; -} - -impl<'ctx> AnyValueEnumExt<'ctx> for AnyValueEnum<'ctx> { - fn as_array(self) -> Result, TranslateError> { - if let AnyValueEnum::ArrayValue(x) = self { - Ok(x) - } else { - Err(error_unreachable()) - } - } - - fn as_int(self) -> Result, TranslateError> { - if let AnyValueEnum::IntValue(x) = self { - Ok(x) - } else { - Err(error_unreachable()) - } - } - - fn as_float(self) -> Result, TranslateError> { - if let AnyValueEnum::FloatValue(x) = self { - Ok(x) - } else { - Err(error_unreachable()) - } - } - - fn as_phi(self) -> Result, TranslateError> { - if let AnyValueEnum::PhiValue(x) = self { - Ok(x) - } else { - Err(error_unreachable()) - } - } - - fn as_function(self) -> Result, TranslateError> { - if let AnyValueEnum::FunctionValue(x) = self { - Ok(x) - } else { - Err(error_unreachable()) - } - } - - fn as_pointer(self) -> Result, TranslateError> { - if let AnyValueEnum::PointerValue(x) = self { - Ok(x) - } else { - Err(error_unreachable()) - } - } - - fn as_struct(self) -> Result, TranslateError> { - if let AnyValueEnum::StructValue(x) = self { - Ok(x) - } else { - Err(error_unreachable()) - } - } - - fn as_vector(self) -> Result, TranslateError> { - if let AnyValueEnum::VectorValue(x) = self { - Ok(x) - } else { - Err(error_unreachable()) - } - } - - fn as_instruction(self) -> Result, TranslateError> { - if let AnyValueEnum::InstructionValue(x) = self { - Ok(x) - } else { - Err(error_unreachable()) - } - } - - fn as_basic(self) -> Result, TranslateError> { - BasicValueEnum::try_from(self).map_err(|_| error_unreachable()) } } diff --git a/ptx/src/pass/mod.rs b/ptx/src/pass/mod.rs index 66934343..3aa3b0a6 100644 --- a/ptx/src/pass/mod.rs +++ b/ptx/src/pass/mod.rs @@ -1,4 +1,3 @@ -use llvm_zluda::inkwell::memory_buffer::MemoryBuffer; use ptx_parser as ast; use rspirv::{binary::Assemble, dr}; use std::hash::Hash; @@ -17,7 +16,7 @@ use std::{ mod convert_dynamic_shared_memory_usage; mod convert_to_stateful_memory_access; mod convert_to_typed; -mod emit_llvm; +pub(crate) mod emit_llvm; mod emit_spirv; mod expand_arguments; mod extract_globals; @@ -182,7 +181,7 @@ fn to_ssa<'input, 'b>( } pub struct Module { - pub llvm_ir: MemoryBuffer, + pub llvm_ir: emit_llvm::MemoryBuffer, pub kernel_info: HashMap, } @@ -598,6 +597,7 @@ fn error_unreachable() -> TranslateError { TranslateError::Unreachable } +#[cfg(debug_assertions)] fn error_unknown_symbol() -> TranslateError { panic!() } @@ -607,6 +607,7 @@ fn error_unknown_symbol() -> TranslateError { TranslateError::UnknownSymbol } +#[cfg(debug_assertions)] fn error_mismatched_type() -> TranslateError { panic!() } diff --git a/ptx/src/test/spirv_run/mod.rs b/ptx/src/test/spirv_run/mod.rs index e0982ffe..2e6c910b 100644 --- a/ptx/src/test/spirv_run/mod.rs +++ b/ptx/src/test/spirv_run/mod.rs @@ -2,7 +2,6 @@ use crate::pass; use crate::ptx; use crate::translate; use hip_runtime_sys::hipError_t; -use llvm_zluda::inkwell::memory_buffer::MemoryBuffer; use rspirv::{ binary::{Assemble, Disassemble}, dr::{Block, Function, Instruction, Loader, Operand}, @@ -379,21 +378,21 @@ fn run_hip + Copy + Debug, Output: From + Copy + Debug + Def Ok(result) } -unsafe fn compile_amd(buffer: &MemoryBuffer) -> Vec { +unsafe fn compile_amd(buffer: &pass::emit_llvm::MemoryBuffer) -> Vec { use amd_comgr_sys::*; let mut data_set = mem::zeroed(); amd_comgr_create_data_set(&mut data_set).unwrap(); let mut data = mem::zeroed(); amd_comgr_create_data(amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_BC, &mut data).unwrap(); - let buffer = buffer.as_slice(); + let buffer = &**buffer; amd_comgr_set_data(data, buffer.len(), buffer.as_ptr().cast()).unwrap(); - amd_comgr_set_data_name(data, "zluda.bc\0".as_ptr().cast()).unwrap(); + amd_comgr_set_data_name(data, c"zluda.bc".as_ptr()).unwrap(); amd_comgr_data_set_add(data_set, data).unwrap(); let mut reloc_data = mem::zeroed(); amd_comgr_create_data_set(&mut reloc_data).unwrap(); let mut action_info = mem::zeroed(); amd_comgr_create_action_info(&mut action_info).unwrap(); - amd_comgr_action_info_set_isa_name(action_info, "amdgcn-amd-amdhsa--gfx1030\0".as_ptr().cast()) + amd_comgr_action_info_set_isa_name(action_info, c"amdgcn-amd-amdhsa--gfx1030".as_ptr()) .unwrap(); amd_comgr_do_action( amd_comgr_action_kind_t::AMD_COMGR_ACTION_CODEGEN_BC_TO_RELOCATABLE, From 3ce365c9a6884d179c25fdaa8381c5d196ad542d Mon Sep 17 00:00:00 2001 From: Andrzej Janik Date: Fri, 13 Sep 2024 01:03:38 +0200 Subject: [PATCH 5/5] Wrap comgr in a separate library, move bindgen output to ext --- Cargo.toml | 4 +- comgr/Cargo.toml | 10 ++ comgr/src/lib.rs | 125 ++++++++++++++++++ .../amd_comgr-sys}/Cargo.toml | 0 {amd_comgr-sys => ext/amd_comgr-sys}/README | 0 {amd_comgr-sys => ext/amd_comgr-sys}/build.rs | 0 .../amd_comgr-sys}/lib/amd_comgr_2.def | 0 .../amd_comgr-sys}/lib/amd_comgr_2.lib | Bin .../amd_comgr-sys}/src/amd_comgr.rs | 4 + .../amd_comgr-sys}/src/lib.rs | 0 .../hip_runtime-sys}/Cargo.toml | 0 .../hip_runtime-sys}/README | 0 .../hip_runtime-sys}/build.rs | 0 .../include/hip_runtime_api.h | 0 .../hip_runtime-sys}/lib/amdhip64_6.def | 0 .../hip_runtime-sys}/lib/amdhip64_6.lib | Bin .../hip_runtime-sys}/src/hip_runtime_api.rs | 5 +- .../hip_runtime-sys}/src/lib.rs | 0 ptx/Cargo.toml | 4 +- ptx/src/test/spirv_run/mod.rs | 54 +------- zluda/Cargo.toml | 2 +- 21 files changed, 154 insertions(+), 54 deletions(-) create mode 100644 comgr/Cargo.toml create mode 100644 comgr/src/lib.rs rename {amd_comgr-sys => ext/amd_comgr-sys}/Cargo.toml (100%) rename {amd_comgr-sys => ext/amd_comgr-sys}/README (100%) rename {amd_comgr-sys => ext/amd_comgr-sys}/build.rs (100%) rename {amd_comgr-sys => ext/amd_comgr-sys}/lib/amd_comgr_2.def (100%) rename {amd_comgr-sys => ext/amd_comgr-sys}/lib/amd_comgr_2.lib (100%) rename {amd_comgr-sys => ext/amd_comgr-sys}/src/amd_comgr.rs (99%) rename {amd_comgr-sys => ext/amd_comgr-sys}/src/lib.rs (100%) rename {hip_runtime-sys => ext/hip_runtime-sys}/Cargo.toml (100%) rename {hip_runtime-sys => ext/hip_runtime-sys}/README (100%) rename {hip_runtime-sys => ext/hip_runtime-sys}/build.rs (100%) rename {hip_runtime-sys => ext/hip_runtime-sys}/include/hip_runtime_api.h (100%) rename {hip_runtime-sys => ext/hip_runtime-sys}/lib/amdhip64_6.def (100%) rename {hip_runtime-sys => ext/hip_runtime-sys}/lib/amdhip64_6.lib (100%) rename {hip_runtime-sys => ext/hip_runtime-sys}/src/hip_runtime_api.rs (99%) rename {hip_runtime-sys => ext/hip_runtime-sys}/src/lib.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 350d568f..93585a18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,10 +3,12 @@ resolver = "2" members = [ + "ext/hip_runtime-sys", + "ext/amd_comgr-sys", + "comgr", "cuda_base", "cuda_types", "detours-sys", - "hip_runtime-sys", "level_zero-sys", "level_zero", "spirv_tools-sys", diff --git a/comgr/Cargo.toml b/comgr/Cargo.toml new file mode 100644 index 00000000..250bd0a5 --- /dev/null +++ b/comgr/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "comgr" +version = "0.0.0" +authors = ["Andrzej Janik "] +edition = "2021" + +[lib] + +[dependencies] +amd_comgr-sys = { path = "../ext/amd_comgr-sys" } \ No newline at end of file diff --git a/comgr/src/lib.rs b/comgr/src/lib.rs new file mode 100644 index 00000000..f27a127f --- /dev/null +++ b/comgr/src/lib.rs @@ -0,0 +1,125 @@ +use amd_comgr_sys::*; +use std::{ffi::CStr, mem, ptr}; + +struct Data(amd_comgr_data_t); + +impl Data { + fn new( + kind: amd_comgr_data_kind_t, + name: &CStr, + content: &[u8], + ) -> Result { + let mut data = unsafe { mem::zeroed() }; + unsafe { amd_comgr_create_data(kind, &mut data) }?; + unsafe { amd_comgr_set_data_name(data, name.as_ptr()) }?; + unsafe { amd_comgr_set_data(data, content.len(), content.as_ptr().cast()) }?; + Ok(Self(data)) + } + + fn get(&self) -> amd_comgr_data_t { + self.0 + } + + fn copy_content(&self) -> Result, amd_comgr_status_s> { + let mut size = unsafe { mem::zeroed() }; + unsafe { amd_comgr_get_data(self.get(), &mut size, ptr::null_mut()) }?; + let mut result: Vec = Vec::with_capacity(size); + unsafe { result.set_len(size) }; + unsafe { amd_comgr_get_data(self.get(), &mut size, result.as_mut_ptr().cast()) }?; + Ok(result) + } +} + +struct DataSet(amd_comgr_data_set_t); + +impl DataSet { + fn new() -> Result { + let mut data_set = unsafe { mem::zeroed() }; + unsafe { amd_comgr_create_data_set(&mut data_set) }?; + Ok(Self(data_set)) + } + + fn add(&self, data: &Data) -> Result<(), amd_comgr_status_s> { + unsafe { amd_comgr_data_set_add(self.get(), data.get()) } + } + + fn get(&self) -> amd_comgr_data_set_t { + self.0 + } + + fn get_data( + &self, + kind: amd_comgr_data_kind_t, + index: usize, + ) -> Result { + let mut data = unsafe { mem::zeroed() }; + unsafe { amd_comgr_action_data_get_data(self.get(), kind, index, &mut data) }?; + Ok(Data(data)) + } +} + +impl Drop for DataSet { + fn drop(&mut self) { + unsafe { amd_comgr_destroy_data_set(self.get()).ok() }; + } +} + +struct ActionInfo(amd_comgr_action_info_t); + +impl ActionInfo { + fn new() -> Result { + let mut action = unsafe { mem::zeroed() }; + unsafe { amd_comgr_create_action_info(&mut action) }?; + Ok(Self(action)) + } + + fn set_isa_name(&self, isa: &CStr) -> Result<(), amd_comgr_status_s> { + let mut full_isa = "amdgcn-amd-amdhsa--".to_string().into_bytes(); + full_isa.extend(isa.to_bytes_with_nul()); + unsafe { amd_comgr_action_info_set_isa_name(self.get(), full_isa.as_ptr().cast()) } + } + + fn get(&self) -> amd_comgr_action_info_t { + self.0 + } +} + +impl Drop for ActionInfo { + fn drop(&mut self) { + unsafe { amd_comgr_destroy_action_info(self.get()).ok() }; + } +} + +pub fn compile_bitcode(gcn_arch: &CStr, buffer: &[u8]) -> Result, amd_comgr_status_s> { + use amd_comgr_sys::*; + let bitcode_data_set = DataSet::new()?; + let bitcode_data = Data::new( + amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_BC, + c"zluda.bc", + buffer, + )?; + bitcode_data_set.add(&bitcode_data)?; + let reloc_data_set = DataSet::new()?; + let action_info = ActionInfo::new()?; + action_info.set_isa_name(gcn_arch)?; + unsafe { + amd_comgr_do_action( + amd_comgr_action_kind_t::AMD_COMGR_ACTION_CODEGEN_BC_TO_RELOCATABLE, + action_info.get(), + bitcode_data_set.get(), + reloc_data_set.get(), + ) + }?; + let exec_data_set = DataSet::new()?; + unsafe { + amd_comgr_do_action( + amd_comgr_action_kind_t::AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_EXECUTABLE, + action_info.get(), + reloc_data_set.get(), + exec_data_set.get(), + ) + }?; + let executable = + exec_data_set.get_data(amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_EXECUTABLE, 0)?; + executable.copy_content() +} diff --git a/amd_comgr-sys/Cargo.toml b/ext/amd_comgr-sys/Cargo.toml similarity index 100% rename from amd_comgr-sys/Cargo.toml rename to ext/amd_comgr-sys/Cargo.toml diff --git a/amd_comgr-sys/README b/ext/amd_comgr-sys/README similarity index 100% rename from amd_comgr-sys/README rename to ext/amd_comgr-sys/README diff --git a/amd_comgr-sys/build.rs b/ext/amd_comgr-sys/build.rs similarity index 100% rename from amd_comgr-sys/build.rs rename to ext/amd_comgr-sys/build.rs diff --git a/amd_comgr-sys/lib/amd_comgr_2.def b/ext/amd_comgr-sys/lib/amd_comgr_2.def similarity index 100% rename from amd_comgr-sys/lib/amd_comgr_2.def rename to ext/amd_comgr-sys/lib/amd_comgr_2.def diff --git a/amd_comgr-sys/lib/amd_comgr_2.lib b/ext/amd_comgr-sys/lib/amd_comgr_2.lib similarity index 100% rename from amd_comgr-sys/lib/amd_comgr_2.lib rename to ext/amd_comgr-sys/lib/amd_comgr_2.lib diff --git a/amd_comgr-sys/src/amd_comgr.rs b/ext/amd_comgr-sys/src/amd_comgr.rs similarity index 99% rename from amd_comgr-sys/src/amd_comgr.rs rename to ext/amd_comgr-sys/src/amd_comgr.rs index b80be7b7..9548fa95 100644 --- a/amd_comgr-sys/src/amd_comgr.rs +++ b/ext/amd_comgr-sys/src/amd_comgr.rs @@ -27,6 +27,10 @@ impl amd_comgr_status_s { #[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)] pub struct amd_comgr_status_s(pub ::std::num::NonZeroU32); type amd_comgr_status_t = Result<(), self::amd_comgr_status_s>; +// Size check +const _: fn() = || { + let _ = std::mem::transmute::; +}; impl amd_comgr_language_s { #[doc = " No high level language."] pub const AMD_COMGR_LANGUAGE_NONE: amd_comgr_language_s = amd_comgr_language_s(0); diff --git a/amd_comgr-sys/src/lib.rs b/ext/amd_comgr-sys/src/lib.rs similarity index 100% rename from amd_comgr-sys/src/lib.rs rename to ext/amd_comgr-sys/src/lib.rs diff --git a/hip_runtime-sys/Cargo.toml b/ext/hip_runtime-sys/Cargo.toml similarity index 100% rename from hip_runtime-sys/Cargo.toml rename to ext/hip_runtime-sys/Cargo.toml diff --git a/hip_runtime-sys/README b/ext/hip_runtime-sys/README similarity index 100% rename from hip_runtime-sys/README rename to ext/hip_runtime-sys/README diff --git a/hip_runtime-sys/build.rs b/ext/hip_runtime-sys/build.rs similarity index 100% rename from hip_runtime-sys/build.rs rename to ext/hip_runtime-sys/build.rs diff --git a/hip_runtime-sys/include/hip_runtime_api.h b/ext/hip_runtime-sys/include/hip_runtime_api.h similarity index 100% rename from hip_runtime-sys/include/hip_runtime_api.h rename to ext/hip_runtime-sys/include/hip_runtime_api.h diff --git a/hip_runtime-sys/lib/amdhip64_6.def b/ext/hip_runtime-sys/lib/amdhip64_6.def similarity index 100% rename from hip_runtime-sys/lib/amdhip64_6.def rename to ext/hip_runtime-sys/lib/amdhip64_6.def diff --git a/hip_runtime-sys/lib/amdhip64_6.lib b/ext/hip_runtime-sys/lib/amdhip64_6.lib similarity index 100% rename from hip_runtime-sys/lib/amdhip64_6.lib rename to ext/hip_runtime-sys/lib/amdhip64_6.lib diff --git a/hip_runtime-sys/src/hip_runtime_api.rs b/ext/hip_runtime-sys/src/hip_runtime_api.rs similarity index 99% rename from hip_runtime-sys/src/hip_runtime_api.rs rename to ext/hip_runtime-sys/src/hip_runtime_api.rs index edc367a3..56d8557d 100644 --- a/hip_runtime-sys/src/hip_runtime_api.rs +++ b/ext/hip_runtime-sys/src/hip_runtime_api.rs @@ -994,7 +994,10 @@ pub struct hipErrorCode_t(pub ::std::num::NonZeroU32); #[doc = " HIP error type\n"] #[must_use] pub type hipError_t = Result<(), hipErrorCode_t>; - +// Size check +const _: fn() = || { + let _ = std::mem::transmute::; +}; impl hipDeviceAttribute_t { pub const hipDeviceAttributeCudaCompatibleBegin: hipDeviceAttribute_t = hipDeviceAttribute_t(0); } diff --git a/hip_runtime-sys/src/lib.rs b/ext/hip_runtime-sys/src/lib.rs similarity index 100% rename from hip_runtime-sys/src/lib.rs rename to ext/hip_runtime-sys/src/lib.rs diff --git a/ptx/Cargo.toml b/ptx/Cargo.toml index d99a9f6a..2e2995fa 100644 --- a/ptx/Cargo.toml +++ b/ptx/Cargo.toml @@ -27,8 +27,8 @@ version = "0.19.12" features = ["lexer"] [dev-dependencies] -hip_runtime-sys = { path = "../hip_runtime-sys" } -amd_comgr-sys = { path = "../amd_comgr-sys" } +hip_runtime-sys = { path = "../ext/hip_runtime-sys" } +comgr = { path = "../comgr" } spirv_tools-sys = { path = "../spirv_tools-sys" } tempfile = "3" paste = "1.0" diff --git a/ptx/src/test/spirv_run/mod.rs b/ptx/src/test/spirv_run/mod.rs index 2e6c910b..69dd2065 100644 --- a/ptx/src/test/spirv_run/mod.rs +++ b/ptx/src/test/spirv_run/mod.rs @@ -323,7 +323,11 @@ fn run_hip + Copy + Debug, Output: From + Copy + Debug + Def unsafe { hipStreamCreate(&mut stream) }.unwrap(); let mut dev_props = unsafe { mem::zeroed() }; unsafe { hipGetDevicePropertiesR0600(&mut dev_props, dev) }.unwrap(); - let elf_module = unsafe { compile_amd(&module.llvm_ir) }; + let elf_module = comgr::compile_bitcode( + unsafe { CStr::from_ptr(dev_props.gcnArchName.as_ptr()) }, + &*module.llvm_ir, + ) + .unwrap(); let mut module = ptr::null_mut(); unsafe { hipModuleLoadData(&mut module, elf_module.as_ptr() as _) }.unwrap(); let mut kernel = ptr::null_mut(); @@ -378,54 +382,6 @@ fn run_hip + Copy + Debug, Output: From + Copy + Debug + Def Ok(result) } -unsafe fn compile_amd(buffer: &pass::emit_llvm::MemoryBuffer) -> Vec { - use amd_comgr_sys::*; - let mut data_set = mem::zeroed(); - amd_comgr_create_data_set(&mut data_set).unwrap(); - let mut data = mem::zeroed(); - amd_comgr_create_data(amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_BC, &mut data).unwrap(); - let buffer = &**buffer; - amd_comgr_set_data(data, buffer.len(), buffer.as_ptr().cast()).unwrap(); - amd_comgr_set_data_name(data, c"zluda.bc".as_ptr()).unwrap(); - amd_comgr_data_set_add(data_set, data).unwrap(); - let mut reloc_data = mem::zeroed(); - amd_comgr_create_data_set(&mut reloc_data).unwrap(); - let mut action_info = mem::zeroed(); - amd_comgr_create_action_info(&mut action_info).unwrap(); - amd_comgr_action_info_set_isa_name(action_info, c"amdgcn-amd-amdhsa--gfx1030".as_ptr()) - .unwrap(); - amd_comgr_do_action( - amd_comgr_action_kind_t::AMD_COMGR_ACTION_CODEGEN_BC_TO_RELOCATABLE, - action_info, - data_set, - reloc_data, - ) - .unwrap(); - let mut exec_data = mem::zeroed(); - amd_comgr_create_data_set(&mut exec_data).unwrap(); - amd_comgr_do_action( - amd_comgr_action_kind_t::AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_EXECUTABLE, - action_info, - reloc_data, - exec_data, - ) - .unwrap(); - let mut exec = mem::zeroed(); - amd_comgr_action_data_get_data( - exec_data, - amd_comgr_data_kind_t::AMD_COMGR_DATA_KIND_EXECUTABLE, - 0, - &mut exec, - ) - .unwrap(); - let mut size = mem::zeroed(); - amd_comgr_get_data(exec, &mut size, ptr::null_mut()).unwrap(); - let mut result: Vec = Vec::with_capacity(size); - result.set_len(size); - amd_comgr_get_data(exec, &mut size, result.as_mut_ptr().cast()).unwrap(); - result -} - struct EqMap where T: Eq + Copy + Hash, diff --git a/zluda/Cargo.toml b/zluda/Cargo.toml index 9d242c5b..837b7343 100644 --- a/zluda/Cargo.toml +++ b/zluda/Cargo.toml @@ -9,7 +9,7 @@ name = "zluda" [dependencies] ptx = { path = "../ptx" } -hip_runtime-sys = { path = "../hip_runtime-sys" } +hip_runtime-sys = { path = "../ext/hip_runtime-sys" } lazy_static = "1.4" num_enum = "0.4" lz4-sys = "1.9"