Gate amdgcn GPU-sort kernel behind default-on 'gpu-sort' feature

The kernel is built at compile time by the external amdgpu_kernel_finalize!
proc-macro via a nested nightly+build-std cargo build; that nested build
inherits the parent rustc env and drops off nightly on Windows/MSVC
(E0463 can't find crate for core). GPU sort is unused by LLM inference, so
gating the kernel (empty fallback) lets the crate build on every host while
keeping it default-on for native Linux users.
This commit is contained in:
2026-06-21 21:32:53 -07:00
parent 490346c497
commit 8e7a802800
9 changed files with 5197 additions and 51 deletions
+6 -1
View File
@@ -23,12 +23,17 @@ paste = "1.0.15"
bindgen = "0.71.1"
[features]
default = ["macros", "miopen"]
default = ["macros", "miopen", "gpu-sort"]
rocm_smi = ["dep:rocm_smi_lib"]
miopen = []
rocprofiler = []
rocsolver = []
macros=["dep:rocm_kernel_macros"]
# Embeds the amdgcn GPU bitonic-sort kernel (built via the rocm_kernel_macros
# proc-macro). Default-on; turn off for hosts where the kernel's nested
# nightly+build-std cargo build is unavailable (e.g. Windows/MSVC) — GPU sort
# then becomes a runtime no-op, which inference workloads never hit.
gpu-sort = ["macros"]
[workspace]
members = [
+1648 -12
View File
File diff suppressed because it is too large Load Diff
+10
View File
@@ -102,11 +102,21 @@ macro_rules! impl_gpu_sort_allowed {
impl_gpu_sort_allowed!(i8, i16, i32, i64, u8, u16, u32, u64, f32, f64);
// The embedded amdgcn sort kernel is built at compile time by the external
// `amdgpu_kernel_finalize!` proc-macro, whose nested `cargo build` inherits the
// parent rustc env and falls off the nightly+build-std toolchain on non-Linux
// hosts (Windows/MSVC: "can't find crate for `core`"). GPU sort is never used by
// LLM inference, so gate the kernel behind the (default-on) `gpu-sort` feature;
// with it off, `sort()` is a runtime no-op (empty kernel) but the crate builds
// everywhere. No call sites change.
#[cfg(feature = "gpu-sort")]
pub(crate) const SORTING_KERNEL: &[u8] = include_bytes!(amdgpu_kernel_finalize!(
path = __build_in_kernels_sorting,
dir = __build_in_kernels_sorting,
binary_name = sorting
));
#[cfg(not(feature = "gpu-sort"))]
pub(crate) const SORTING_KERNEL: &[u8] = &[];
pub(crate) fn sort<T>(mem: &mut DeviceMemory<T>, stream: &Stream, ascending: bool) -> Result<()> {
let module = Module::load_data(SORTING_KERNEL)?;
+555 -10
View File
File diff suppressed because one or more lines are too long
+364 -18
View File
File diff suppressed because it is too large Load Diff
+46
View File
@@ -5,30 +5,35 @@
pub struct rocfft_plan_t {
_unused: [u8; 0],
}
#[doc = " @brief Pointer type to plan structure\n @details This type is used to declare a plan handle that can be initialized\n with ::rocfft_plan_create."]
pub type rocfft_plan = *mut rocfft_plan_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct rocfft_plan_description_t {
_unused: [u8; 0],
}
#[doc = " @brief Pointer type to plan description structure\n @details This type is used to declare a plan description handle that can be\n initialized with ::rocfft_plan_description_create."]
pub type rocfft_plan_description = *mut rocfft_plan_description_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct rocfft_execution_info_t {
_unused: [u8; 0],
}
#[doc = " @brief Pointer type to execution info structure\n @details This type is used to declare an execution info handle that can be\n initialized with ::rocfft_execution_info_create."]
pub type rocfft_execution_info = *mut rocfft_execution_info_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct rocfft_field_t {
_unused: [u8; 0],
}
#[doc = " @brief Pointer type to a rocFFT field structure.\n\n @details rocFFT fields are used to hold data decomposition information which is then passed to a\n \\ref rocfft_plan via a \\ref rocfft_plan_description\n\n @warning Experimental! This feature is part of an experimental API preview."]
pub type rocfft_field = *mut rocfft_field_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct rocfft_brick_t {
_unused: [u8; 0],
}
#[doc = " @brief Pointer type to a rocFFT brick structure.\n\n @details rocFFT bricks are used to describe the data decomposition of fields.\n\n @warning Experimental! This feature is part of an experimental API preview."]
pub type rocfft_brick = *mut rocfft_brick_t;
pub const rocfft_status_e_rocfft_status_success: rocfft_status_e = 0;
pub const rocfft_status_e_rocfft_status_failure: rocfft_status_e = 1;
@@ -39,7 +44,9 @@ pub const rocfft_status_e_rocfft_status_invalid_strides: rocfft_status_e = 5;
pub const rocfft_status_e_rocfft_status_invalid_distance: rocfft_status_e = 6;
pub const rocfft_status_e_rocfft_status_invalid_offset: rocfft_status_e = 7;
pub const rocfft_status_e_rocfft_status_invalid_work_buffer: rocfft_status_e = 8;
#[doc = " @brief rocFFT status/error codes"]
pub type rocfft_status_e = ::std::os::raw::c_uint;
#[doc = " @brief rocFFT status/error codes"]
pub use self::rocfft_status_e as rocfft_status;
pub const rocfft_transform_type_e_rocfft_transform_type_complex_forward: rocfft_transform_type_e =
0;
@@ -47,16 +54,22 @@ pub const rocfft_transform_type_e_rocfft_transform_type_complex_inverse: rocfft_
1;
pub const rocfft_transform_type_e_rocfft_transform_type_real_forward: rocfft_transform_type_e = 2;
pub const rocfft_transform_type_e_rocfft_transform_type_real_inverse: rocfft_transform_type_e = 3;
#[doc = " @brief Type of transform"]
pub type rocfft_transform_type_e = ::std::os::raw::c_uint;
#[doc = " @brief Type of transform"]
pub use self::rocfft_transform_type_e as rocfft_transform_type;
pub const rocfft_precision_e_rocfft_precision_single: rocfft_precision_e = 0;
pub const rocfft_precision_e_rocfft_precision_double: rocfft_precision_e = 1;
pub const rocfft_precision_e_rocfft_precision_half: rocfft_precision_e = 2;
#[doc = " @brief Precision"]
pub type rocfft_precision_e = ::std::os::raw::c_uint;
#[doc = " @brief Precision"]
pub use self::rocfft_precision_e as rocfft_precision;
pub const rocfft_result_placement_e_rocfft_placement_inplace: rocfft_result_placement_e = 0;
pub const rocfft_result_placement_e_rocfft_placement_notinplace: rocfft_result_placement_e = 1;
#[doc = " @brief Result placement\n @details Declares where the output of the transform should be\n placed. Note that input buffers may still be overwritten\n during execution of a transform, even if the transform is not\n in-place."]
pub type rocfft_result_placement_e = ::std::os::raw::c_uint;
#[doc = " @brief Result placement\n @details Declares where the output of the transform should be\n placed. Note that input buffers may still be overwritten\n during execution of a transform, even if the transform is not\n in-place."]
pub use self::rocfft_result_placement_e as rocfft_result_placement;
pub const rocfft_array_type_e_rocfft_array_type_complex_interleaved: rocfft_array_type_e = 0;
pub const rocfft_array_type_e_rocfft_array_type_complex_planar: rocfft_array_type_e = 1;
@@ -64,19 +77,26 @@ pub const rocfft_array_type_e_rocfft_array_type_real: rocfft_array_type_e = 2;
pub const rocfft_array_type_e_rocfft_array_type_hermitian_interleaved: rocfft_array_type_e = 3;
pub const rocfft_array_type_e_rocfft_array_type_hermitian_planar: rocfft_array_type_e = 4;
pub const rocfft_array_type_e_rocfft_array_type_unset: rocfft_array_type_e = 5;
#[doc = " @brief Array type"]
pub type rocfft_array_type_e = ::std::os::raw::c_uint;
#[doc = " @brief Array type"]
pub use self::rocfft_array_type_e as rocfft_array_type;
pub const rocfft_comm_type_e_rocfft_comm_none: rocfft_comm_type_e = 0;
pub const rocfft_comm_type_e_rocfft_comm_mpi: rocfft_comm_type_e = 1;
#[doc = " @brief Communicator type for distributed transforms"]
pub type rocfft_comm_type_e = ::std::os::raw::c_uint;
#[doc = " @brief Communicator type for distributed transforms"]
pub use self::rocfft_comm_type_e as rocfft_comm_type;
unsafe extern "C" {
#[doc = " @brief Library setup function, called once in program before start of\n library use"]
pub fn rocfft_setup() -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Library cleanup function, called once in program after end of library\n use"]
pub fn rocfft_cleanup() -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Create an FFT plan\n\n @details This API creates a plan, which the user can execute\n subsequently. This function takes many of the fundamental\n parameters needed to specify a transform.\n\n The dimensions parameter can take a value of 1, 2, or 3. The\n 'lengths' array specifies the size of data in each dimension. Note\n that lengths[0] is the size of the innermost dimension, lengths[1]\n is the next higher dimension and so on (column-major ordering).\n\n The 'number_of_transforms' parameter specifies how many\n transforms (of the same kind) needs to be computed. By specifying\n a value greater than 1, a batch of transforms can be computed\n with a single API call.\n\n Additionally, a handle to a plan description can be passed for\n more detailed transforms. For simple transforms, this parameter\n can be set to NULL.\n\n The plan must be destroyed with a call to ::rocfft_plan_destroy.\n\n @param[out] plan plan handle\n @param[in] placement placement of result\n @param[in] transform_type type of transform\n @param[in] precision precision\n @param[in] dimensions dimensions\n @param[in] lengths dimensions-sized array of transform lengths\n @param[in] number_of_transforms number of transforms\n @param[in] description description handle created by\n rocfft_plan_description_create; can be\n NULL for simple transforms"]
pub fn rocfft_plan_create(
plan: *mut rocfft_plan,
placement: rocfft_result_placement,
@@ -89,6 +109,7 @@ unsafe extern "C" {
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Execute an FFT plan\n\n @details This API executes an FFT plan on buffers given by the user.\n\n If the transform is in-place, only the input buffer is needed and\n the output buffer parameter can be set to NULL. For not in-place\n transforms, output buffers have to be specified.\n\n Input and output buffers are arrays of pointers. Interleaved\n array formats are the default, and require just one pointer per\n input or output buffer. Planar array formats require two\n pointers per input or output buffer - real and imaginary\n pointers, in that order.\n\n If fields have been set for transform input or output, these\n arrays have one pointer per brick in the input or output field,\n provided in the order that the bricks were added to the field.\n\n Note that input buffers may still be overwritten during execution\n of a transform, even if the transform is not in-place.\n\n The final parameter in this function is a rocfft_execution_info\n handle. This optional parameter serves as a way for the user to control\n execution streams and work buffers.\n\n @param[in] plan plan handle\n @param[in,out] in_buffer array (of size 1 for interleaved data, of size 2\n for planar data, or one per brick if an input field is set) of input buffers\n @param[in,out] out_buffer array (of size 1 for interleaved data, of size 2\n for planar data, or one per brick if an output field is set) of output buffers,\n ignored for in-place transforms\n @param[in] info execution info handle created by\n rocfft_execution_info_create"]
pub fn rocfft_execute(
plan: rocfft_plan,
in_buffer: *mut *mut ::std::os::raw::c_void,
@@ -97,15 +118,18 @@ unsafe extern "C" {
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Destroy an FFT plan\n @details This API frees the plan after it is no longer needed.\n @param[in] plan plan handle"]
pub fn rocfft_plan_destroy(plan: rocfft_plan) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Set scaling factor.\n @details rocFFT multiplies each element of the result by the given factor at the end of the transform.\n\n The supplied factor must be a finite number. That is, it must neither be infinity nor NaN.\n\n @param[in] description description handle\n @param[in] scale_factor scaling factor"]
pub fn rocfft_plan_description_set_scale_factor(
description: rocfft_plan_description,
scale_factor: f64,
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Set advanced data layout parameters on a plan description\n\n @details This API specifies advanced layout of input/output\n buffers for a plan description.\n\n The following parameters are supported for inputs and outputs:\n\n * Array type (real, hermitian, or complex data, in either\n interleaved or planar format).\n * Real forward transforms require real input and hermitian output.\n * Real inverse transforms require hermitian input and real output.\n * Complex transforms require complex input and output.\n * Hermitian and complex data defaults to interleaved if a specific\nformat is not specified.\n * Offset of first data element in the data buffer. Defaults to 0 if unspecified.\n * Stride between consecutive elements in each dimension. Defaults to packed data\nlayout consistent with the type of transform and its placement (requested at\nplan creation), if unspecified.\n * Distance between consecutive batches. Zero values are interpreted as defaults\nto be deduced from the corresponding length and stride along the last transform\ndimension.\n\n Not all combinations of array types are supported and error codes\n will be returned for unsupported cases.\n\n Offset, stride, and distance for either input or output provided\n here is ignored if a field is set for the corresponding input or\n output.\n @note Non-zero offsets are not supported yet.\n\n @param[in, out] description description handle\n @param[in] in_array_type array type of input buffer\n @param[in] out_array_type array type of output buffer\n @param[in] in_offsets offsets, in element units, to start of data in input buffer\n @param[in] out_offsets offsets, in element units, to start of data in output buffer\n @param[in] in_strides_size size of in_strides array (must be equal to transform dimensions)\n @param[in] in_strides array of strides, in each dimension, of\n input buffer; if set to null ptr library chooses defaults\n @param[in] in_distance distance between start of each data instance in input buffer\n @param[in] out_strides_size size of out_strides array (must be\n equal to transform dimensions)\n @param[in] out_strides array of strides, in each dimension, of\n output buffer; if set to null ptr library chooses defaults\n @param[in] out_distance distance between start of each data instance in output buffer"]
pub fn rocfft_plan_description_set_data_layout(
description: rocfft_plan_description,
in_array_type: rocfft_array_type,
@@ -121,16 +145,20 @@ unsafe extern "C" {
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Create a rocfft field struct.\n\n @warning Experimental! This feature is part of an experimental API preview."]
pub fn rocfft_field_create(field: *mut rocfft_field) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Destroy a rocfft field struct\n\n The field struct can be destroyed after being added to the plan description; it is not used for\n plan execution.\n\n @warning Experimental! This feature is part of an experimental API preview."]
pub fn rocfft_field_destroy(field: rocfft_field) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Get library version string\n\n @param[in, out] buf buffer that receives the version string\n @param[in] len length of buf, minimum 30 characters"]
pub fn rocfft_get_version_string(buf: *mut ::std::os::raw::c_char, len: usize)
-> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Set the communication library for distributed transforms.\n\n @details Set the multi-processing communication library for a plan.\n\n Multi-processing communication libraries require library-specific\n handle to also be specified. For MPI libraries, this is a\n pointer to an MPI communicator.\n\n @param[in] description description handle\n @param[in] comm_type communicator type\n @param[in] comm_handle handle to communication-library-specific state\n"]
pub fn rocfft_plan_description_set_comm(
description: rocfft_plan_description,
comm_type: rocfft_comm_type,
@@ -138,6 +166,7 @@ unsafe extern "C" {
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Define a brick as part of a decomposition of a field.\n\n Fields can contain a full-dimensional data distribution. The\n decomposition is specified by providing a lower coordinate and an\n upper coordinate in the field's index space. The lower coordinate\n is inclusive (contained within the brick) and the upper coordinate\n is exclusive (first index past the end of the brick).\n\n One must also provide a stride for the brick data which specifies\n how the brick's data is arranged in memory.\n\n All coordinates and strides must include batch dimensions, and are in\n column-major order (fastest-moving dimension first).\n\n A HIP device ID is also provided - each brick may reside on a\n different device.\n\n All arrays may be re-used or freed immediately after the function returns.\n\n @param[out] brick: brick structure\n @param[in] field_lower: array of length `dim_with_batch` specifying the lower index\n (inclusive) for the brick in the field's index space.\n @param[in] field_upper: array of length `dim_with_batch` specifying the upper index\n (exclusive) for the brick in the field's index space.\n @param[in] brick_stride: array of length `dim_with_batch` specifying the brick's stride in memory\n @param[in] dim_with_batch: length of the arrays; this must match the dimension of\n the FFT plus one for the batch dimension.\n @param[in] deviceID: HIP device ID for the device on which the brick's data is resident.\n\n @warning Experimental! This feature is part of an experimental API preview."]
pub fn rocfft_brick_create(
brick: *mut rocfft_brick,
field_lower: *const usize,
@@ -148,47 +177,58 @@ unsafe extern "C" {
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Deallocate a brick created with rocfft_brick_create.\n\n @warning Experimental! This feature is part of an experimental API preview."]
pub fn rocfft_brick_destroy(brick: rocfft_brick) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Add a brick to a field.\n\n Note that the order in which the bricks are added is significant;\n the pointers provided for each brick to ::rocfft_execute are in\n the same order that the bricks were added to the field.\n\n The brick may be added to another field or destroyed any time\n after this function returns.\n\n @param[in, out] field: \\ref rocfft_field struct which holds the brick decomposition.\n @param[in] brick: \\ref rocfft_brick struct to add to the field.\n\n @warning Experimental! This feature is part of an experimental API preview."]
pub fn rocfft_field_add_brick(field: rocfft_field, brick: rocfft_brick) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Add a \\ref rocfft_field to a \\ref rocfft_plan_description as an input.\n\n The field may be reused or freed immediately after the function returns.\n\n @param[in, out] description: \\ref rocfft_plan_description that will pass the field information to plan creation\n @param[in] field: \\ref rocfft_field struct added as an input field\n\n @warning Experimental! This feature is part of an experimental API preview."]
pub fn rocfft_plan_description_add_infield(
description: rocfft_plan_description,
field: rocfft_field,
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Add a \\ref rocfft_field to a \\ref rocfft_plan_description as an output.\n\n The field may be reused or freed immediately after the function returns.\n\n @param[in, out] description: \\ref rocfft_plan_description that will pass the field information to plan creation\n @param[in] field: \\ref rocfft_field struct added as an output field\n\n @warning Experimental! This feature is part of an experimental API preview."]
pub fn rocfft_plan_description_add_outfield(
description: rocfft_plan_description,
field: rocfft_field,
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Get work buffer size on current HIP device\n @details Get the work buffer size required for a plan on the current HIP device.\n\n Work memory may be required on any device(s) with input or output\n data for the transform, and also the current device when the plan\n was created. If the FFT plan uses multiple devices then this\n function can be called repeatedly with each of those devices as\n the current HIP device, to know the complete work memory\n requirements for all devices.\n\n @param[in] plan plan handle\n @param[out] size_in_bytes size of needed work buffer in bytes"]
pub fn rocfft_plan_get_work_buffer_size(
plan: rocfft_plan,
size_in_bytes: *mut usize,
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Print all plan information\n @details Prints plan details to stdout, to aid debugging\n @param[in] plan plan handle"]
pub fn rocfft_plan_get_print(plan: rocfft_plan) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Create plan description\n @details This API creates a plan description with which the user\n can set extra plan properties. The plan description must be freed\n with a call to ::rocfft_plan_description_destroy.\n @param[out] description plan description handle"]
pub fn rocfft_plan_description_create(
description: *mut rocfft_plan_description,
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Destroy a plan description\n @details This API frees the plan description. A plan description\n can be freed any time after it is passed to ::rocfft_plan_create.\n @param[in] description plan description handle"]
pub fn rocfft_plan_description_destroy(description: rocfft_plan_description) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Create execution info\n @details This API creates an execution info with which the user\n can control plan execution and work buffers. The execution info must be freed\n with a call to ::rocfft_execution_info_destroy.\n @param[out] info execution info handle"]
pub fn rocfft_execution_info_create(info: *mut rocfft_execution_info) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Destroy an execution info\n @details This API frees the execution info. An execution info\n object can be freed any time after it is passed to\n ::rocfft_execute.\n @param[in] info execution info handle"]
pub fn rocfft_execution_info_destroy(info: rocfft_execution_info) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Set work buffer in execution info for the current HIP device\n\n @details This is one of the execution info functions to specify\n optional additional information to control execution. This API\n provides a work buffer for the transform. It must be called\n before ::rocfft_execute.\n\n Work memory may be required on any device(s) with input or output\n data for the transform, and also the current device when the plan\n was created. If the FFT plan uses multiple devices then this\n function can be called repeatedly with each of those devices as\n the current HIP device, to set work memory for all devices.\n\n When a non-zero value is obtained from\n ::rocfft_plan_get_work_buffer_size, that means the library needs a\n work buffer to compute the transform. In this case, the user\n should allocate the work buffer and pass it to the library via\n this API.\n\n If a work buffer is required for the transform but is not\n specified using this function, ::rocfft_execute will automatically\n allocate the required buffer and free it when execution is\n finished.\n\n Users should allocate their own work buffers if they need precise\n control over the lifetimes of those buffers, or if multiple plans\n need to share the same buffer.\n\n @param[in] info execution info handle\n @param[in] work_buffer work buffer\n @param[in] size_in_bytes size of work buffer in bytes"]
pub fn rocfft_execution_info_set_work_buffer(
info: rocfft_execution_info,
work_buffer: *mut ::std::os::raw::c_void,
@@ -196,12 +236,14 @@ unsafe extern "C" {
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Set stream in execution info\n @details Associates an existing compute stream to a plan. This\n must be called before the call to ::rocfft_execute.\n\n Once the association is made, execution of the FFT will run the\n computation through the specified stream.\n\n The stream must be of type hipStream_t. It is an error to pass\n the address of a hipStream_t object.\n\n @param[in] info execution info handle\n @param[in] stream underlying compute stream"]
pub fn rocfft_execution_info_set_stream(
info: rocfft_execution_info,
stream: *mut ::std::os::raw::c_void,
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Set a load callback for a plan execution (experimental)\n @details This function specifies a user-defined callback function\n that is run to load input from global memory at the start of the\n transform. Callbacks are an experimental feature in rocFFT.\n\n Callback function pointers/data are given as arrays, with one\n function/data pointer per brick in the input field of the plan.\n Load callbacks require at least one brick in the input field to\n be assigned to the current device used at plan creation. A plan\n with no input field specified is considered to have one brick on\n the current device used at plan creation.\n\n All functions in the array must perform the same logical\n operation. That is, any function in the array must be\n substitutable for any other function in the array if the data\n being loaded were moved to another brick.\n\n The provided function pointers replace any previously-specified\n load callback for this execution info handle.\n\n Load callbacks have the following signature:\n\n @code\n Tdata load_cb(Tdata* data, size_t offset, void* cbdata, void* sharedMem);\n @endcode\n\n 'Tdata' is the type of a single element of the input buffer. It is\n the caller's responsibility to ensure that the function type is\n appropriate for the plan (for example, a single-precision\n real-to-complex transform would load single-precision real\n elements).\n\n A null value for 'cb_functions' may be specified to clear any\n previously registered load callback. 'cb_data' may be null if\n the functions require no additional pointer to be passed to them.\n\n Currently, 'shared_mem_bytes' must be 0. Callbacks are not\n supported on transforms that use planar formats for either input\n or output.\n\n @param[in] info execution info handle\n @param[in] cb_functions callback function pointers\n @param[in] cb_data callback function data, passed to the function pointer when it is called\n @param[in] shared_mem_bytes amount of shared memory to allocate for the callback function to use"]
pub fn rocfft_execution_info_set_load_callback(
info: rocfft_execution_info,
cb_functions: *mut *mut ::std::os::raw::c_void,
@@ -210,6 +252,7 @@ unsafe extern "C" {
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Set a store callback for a plan execution (experimental)\n @details This function specifies a user-defined callback function\n that is run to store output to global memory at the end of the\n transform. Callbacks are an experimental feature in rocFFT.\n\n Callback function pointers/data are given as arrays, with one\n function/data pointer per brick in the output field of the plan.\n Store callbacks require at least one brick in the output field to\n be assigned to the current device used at plan creation. A plan\n with no output field specified is considered to have one brick on\n the current device used at plan creation.\n\n All functions in the array must perform the same logical\n operation. That is, any function in the array must be\n substitutable for any other function in the array if the data\n being stored were moved to another brick.\n\n The provided function pointers replace any previously-specified\n store callback for this execution info handle.\n\n Store callbacks have the following signature:\n\n @code\n void store_cb(Tdata* data, size_t offset, Tdata element, void* cbdata, void* sharedMem);\n @endcode\n\n 'Tdata' is the type of a single element of the output buffer. It is\n the caller's responsibility to ensure that the function type is\n appropriate for the plan (for example, a single-precision\n real-to-complex transform would store single-precision complex\n elements).\n\n A null value for 'cb_functions' may be specified to clear any\n previously registered load callback. 'cb_data' may be null if\n the functions require no additional pointer to be passed to them.\n\n Currently, 'shared_mem_bytes' must be 0. Callbacks are not\n supported on transforms that use planar formats for either input\n or output.\n\n @param[in] info execution info handle\n @param[in] cb_functions callback function pointers\n @param[in] cb_data callback function data, passed to the function pointer when it is called\n @param[in] shared_mem_bytes amount of shared memory to allocate for the callback function to use"]
pub fn rocfft_execution_info_set_store_callback(
info: rocfft_execution_info,
cb_functions: *mut *mut ::std::os::raw::c_void,
@@ -218,15 +261,18 @@ unsafe extern "C" {
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Serialize compiled kernel cache\n\n @details Serialize rocFFT's cache of compiled kernels into a\n buffer. This buffer is allocated by rocFFT and must be freed\n with a call to ::rocfft_cache_buffer_free. The length of the\n buffer in bytes is written to 'buffer_len_bytes'."]
pub fn rocfft_cache_serialize(
buffer: *mut *mut ::std::os::raw::c_void,
buffer_len_bytes: *mut usize,
) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Free cache serialization buffer\n\n @details Deallocate a buffer allocated by ::rocfft_cache_serialize."]
pub fn rocfft_cache_buffer_free(buffer: *mut ::std::os::raw::c_void) -> rocfft_status;
}
unsafe extern "C" {
#[doc = " @brief Deserialize a buffer into the compiled kernel cache.\n\n @details Kernels in the buffer that match already-cached kernels\n will replace those kernels that are in the cache. Already-cached\n kernels that do not match those in the buffer are unmodified by\n this operation. The cache is unmodified if either a null buffer\n pointer or a zero length is passed."]
pub fn rocfft_cache_deserialize(
buffer: *const ::std::os::raw::c_void,
buffer_len_bytes: usize,
+74 -2
View File
@@ -1,21 +1,28 @@
/* automatically generated by rust-bindgen 0.71.1 */
#[doc = " \\brief Represents a discrete probability distribution"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct rocrand_discrete_distribution_st {
#[doc = " Number of entries in the probability table"]
pub size: ::std::os::raw::c_uint,
#[doc = " The distribution can be offset"]
pub offset: ::std::os::raw::c_uint,
#[doc = " Alias table"]
pub alias: *mut ::std::os::raw::c_uint,
#[doc = "Probability data for the alias table"]
pub probability: *mut f64,
#[doc = " Cumulative distribution function"]
pub cdf: *mut f64,
}
pub type rocrand_discrete_distribution = *mut rocrand_discrete_distribution_st;
pub type uint4 = u128;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Debug)]
pub struct __half {
pub _address: u8,
pub __x: ::std::os::raw::c_ushort,
}
#[doc = " \\cond ROCRAND_DOCS_TYPEDEFS\n rocRAND half type (derived from HIP)"]
pub type half = __half;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
@@ -28,42 +35,73 @@ pub type hipStream_t = *mut ihipStream_t;
pub struct rocrand_generator_base_type {
_unused: [u8; 0],
}
#[doc = " \\cond ROCRAND_DOCS_TYPEDEFS\n rocRAND random number generator (opaque)"]
pub type rocrand_generator = *mut rocrand_generator_base_type;
#[doc = "< No errors"]
pub const rocrand_status_ROCRAND_STATUS_SUCCESS: rocrand_status = 0;
#[doc = "< Header file and linked library version do not match"]
pub const rocrand_status_ROCRAND_STATUS_VERSION_MISMATCH: rocrand_status = 100;
#[doc = "< Generator was not created using rocrand_create_generator"]
pub const rocrand_status_ROCRAND_STATUS_NOT_CREATED: rocrand_status = 101;
#[doc = "< Memory allocation failed during execution"]
pub const rocrand_status_ROCRAND_STATUS_ALLOCATION_FAILED: rocrand_status = 102;
#[doc = "< Generator type is wrong"]
pub const rocrand_status_ROCRAND_STATUS_TYPE_ERROR: rocrand_status = 103;
#[doc = "< Argument out of range"]
pub const rocrand_status_ROCRAND_STATUS_OUT_OF_RANGE: rocrand_status = 104;
pub const rocrand_status_ROCRAND_STATUS_LENGTH_NOT_MULTIPLE: rocrand_status = 105;
#[doc = "< GPU does not have double precision"]
pub const rocrand_status_ROCRAND_STATUS_DOUBLE_PRECISION_REQUIRED: rocrand_status = 106;
#[doc = "< Kernel launch failure"]
pub const rocrand_status_ROCRAND_STATUS_LAUNCH_FAILURE: rocrand_status = 107;
#[doc = "< Internal library error"]
pub const rocrand_status_ROCRAND_STATUS_INTERNAL_ERROR: rocrand_status = 108;
#[doc = " \\brief rocRAND function call status type"]
pub type rocrand_status = ::std::os::raw::c_uint;
#[doc = "< Default pseudorandom generator"]
pub const rocrand_rng_type_ROCRAND_RNG_PSEUDO_DEFAULT: rocrand_rng_type = 400;
#[doc = "< XORWOW pseudorandom generator"]
pub const rocrand_rng_type_ROCRAND_RNG_PSEUDO_XORWOW: rocrand_rng_type = 401;
#[doc = "< MRG32k3a pseudorandom generator"]
pub const rocrand_rng_type_ROCRAND_RNG_PSEUDO_MRG32K3A: rocrand_rng_type = 402;
#[doc = "< Mersenne Twister MTGP32 pseudorandom generator"]
pub const rocrand_rng_type_ROCRAND_RNG_PSEUDO_MTGP32: rocrand_rng_type = 403;
#[doc = "< PHILOX-4x32-10 pseudorandom generator"]
pub const rocrand_rng_type_ROCRAND_RNG_PSEUDO_PHILOX4_32_10: rocrand_rng_type = 404;
#[doc = "< MRG31k3p pseudorandom generator"]
pub const rocrand_rng_type_ROCRAND_RNG_PSEUDO_MRG31K3P: rocrand_rng_type = 405;
#[doc = "< LFSR113 pseudorandom generator"]
pub const rocrand_rng_type_ROCRAND_RNG_PSEUDO_LFSR113: rocrand_rng_type = 406;
#[doc = "< Mersenne Twister MT19937 pseudorandom generator"]
pub const rocrand_rng_type_ROCRAND_RNG_PSEUDO_MT19937: rocrand_rng_type = 407;
pub const rocrand_rng_type_ROCRAND_RNG_PSEUDO_THREEFRY2_32_20: rocrand_rng_type = 408;
pub const rocrand_rng_type_ROCRAND_RNG_PSEUDO_THREEFRY2_64_20: rocrand_rng_type = 409;
pub const rocrand_rng_type_ROCRAND_RNG_PSEUDO_THREEFRY4_32_20: rocrand_rng_type = 410;
pub const rocrand_rng_type_ROCRAND_RNG_PSEUDO_THREEFRY4_64_20: rocrand_rng_type = 411;
#[doc = "< Default quasirandom generator"]
pub const rocrand_rng_type_ROCRAND_RNG_QUASI_DEFAULT: rocrand_rng_type = 500;
#[doc = "< Sobol32 quasirandom generator"]
pub const rocrand_rng_type_ROCRAND_RNG_QUASI_SOBOL32: rocrand_rng_type = 501;
#[doc = "< Scrambled Sobol32 quasirandom generator"]
pub const rocrand_rng_type_ROCRAND_RNG_QUASI_SCRAMBLED_SOBOL32: rocrand_rng_type = 502;
#[doc = "< Sobol64 quasirandom generator"]
pub const rocrand_rng_type_ROCRAND_RNG_QUASI_SOBOL64: rocrand_rng_type = 504;
#[doc = "< Scrambled Sobol64 quasirandom generator"]
pub const rocrand_rng_type_ROCRAND_RNG_QUASI_SCRAMBLED_SOBOL64: rocrand_rng_type = 505;
#[doc = " \\brief rocRAND generator type"]
pub type rocrand_rng_type = ::std::os::raw::c_uint;
#[doc = "< Best ordering for pseudorandom results"]
pub const rocrand_ordering_ROCRAND_ORDERING_PSEUDO_BEST: rocrand_ordering = 100;
#[doc = "< Default ordering for pseudorandom results"]
pub const rocrand_ordering_ROCRAND_ORDERING_PSEUDO_DEFAULT: rocrand_ordering = 101;
#[doc = "< Fast lower quality pseudorandom results"]
pub const rocrand_ordering_ROCRAND_ORDERING_PSEUDO_SEEDED: rocrand_ordering = 102;
#[doc = "< Legacy ordering for pseudorandom results"]
pub const rocrand_ordering_ROCRAND_ORDERING_PSEUDO_LEGACY: rocrand_ordering = 103;
pub const rocrand_ordering_ROCRAND_ORDERING_PSEUDO_DYNAMIC: rocrand_ordering = 104;
#[doc = "< n-dimensional ordering for quasirandom results"]
pub const rocrand_ordering_ROCRAND_ORDERING_QUASI_DEFAULT: rocrand_ordering = 201;
#[doc = " \\brief rocRAND generator ordering"]
pub type rocrand_ordering = ::std::os::raw::c_uint;
pub const rocrand_direction_vector_set_ROCRAND_DIRECTION_VECTORS_32_JOEKUO6:
rocrand_direction_vector_set = 101;
@@ -73,29 +111,35 @@ pub const rocrand_direction_vector_set_ROCRAND_DIRECTION_VECTORS_64_JOEKUO6:
rocrand_direction_vector_set = 103;
pub const rocrand_direction_vector_set_ROCRAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6:
rocrand_direction_vector_set = 104;
#[doc = " \\brief rocRAND vector set"]
pub type rocrand_direction_vector_set = ::std::os::raw::c_uint;
unsafe extern "C" {
#[doc = " \\brief Creates a new random number generator.\n\n Creates a new pseudo random number generator of type \\p rng_type\n and returns it in \\p generator.\n\n Values for \\p rng_type are:\n - ROCRAND_RNG_PSEUDO_XORWOW\n - ROCRAND_RNG_PSEUDO_MRG31K3P\n - ROCRAND_RNG_PSEUDO_MRG32K3A\n - ROCRAND_RNG_PSEUDO_MTGP32\n - ROCRAND_RNG_PSEUDO_PHILOX4_32_10\n - ROCRAND_RNG_PSEUDO_LFSR113\n - ROCRAND_RNG_PSEUDO_THREEFRY2_32_20\n - ROCRAND_RNG_PSEUDO_THREEFRY2_64_20\n - ROCRAND_RNG_PSEUDO_THREEFRY4_32_20\n - ROCRAND_RNG_PSEUDO_THREEFRY4_64_20\n - ROCRAND_RNG_QUASI_SOBOL32\n - ROCRAND_RNG_QUASI_SCRAMBLED_SOBOL32\n - ROCRAND_RNG_QUASI_SOBOL64\n - ROCRAND_RNG_QUASI_SCRAMBLED_SOBOL64\n\n \\param generator Pointer to generator\n \\param rng_type Type of generator to create\n\n \\return\n - ROCRAND_STATUS_ALLOCATION_FAILED, if memory could not be allocated \\n\n - ROCRAND_STATUS_VERSION_MISMATCH if the header file version does not match the\n dynamically linked library version \\n\n - ROCRAND_STATUS_TYPE_ERROR if the value for \\p rng_type is invalid \\n\n - ROCRAND_STATUS_SUCCESS if generator was created successfully \\n\n"]
pub fn rocrand_create_generator(
generator: *mut rocrand_generator,
rng_type: rocrand_rng_type,
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Creates a new host random number generator.\n\n Creates a new pseudo random number generator of type \\p rng_type\n and returns it in \\p generator. This generator is executed on the host rather than\n on a device, and it is enqueued on the stream associated with the generator.\n\n All generators are supported.\n\n \\param generator Pointer to generator\n \\param rng_type Type of generator to create\n\n \\return\n - ROCRAND_STATUS_ALLOCATION_FAILED, if memory could not be allocated \\n\n - ROCRAND_STATUS_VERSION_MISMATCH if the header file version does not match the\n dynamically linked library version \\n\n - ROCRAND_STATUS_TYPE_ERROR if the value for \\p rng_type is invalid \\n\n - ROCRAND_STATUS_SUCCESS if generator was created successfully \\n\n"]
pub fn rocrand_create_generator_host(
generator: *mut rocrand_generator,
rng_type: rocrand_rng_type,
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Creates a new host random number generator, similar to `rocrand_create_generator_host`.\n The exception is that, instead of enqueuing the host function in the stream,\n execution happens synchronously with respect to the calling thread and the stream is ignored."]
pub fn rocrand_create_generator_host_blocking(
generator: *mut rocrand_generator,
rng_type: rocrand_rng_type,
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Destroys random number generator.\n\n Destroys random number generator and frees related memory.\n\n \\param generator Generator to be destroyed\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_SUCCESS if generator was destroyed successfully \\n"]
pub fn rocrand_destroy_generator(generator: rocrand_generator) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Generates uniformly distributed 32-bit unsigned integers.\n\n Generates \\p n uniformly distributed 32-bit unsigned integers and\n saves them to \\p output_data.\n\n Generated numbers are between \\p 0 and \\p 2^32, including \\p 0 and\n excluding \\p 2^32.\n\n \\param generator Generator to use\n \\param output_data Pointer to memory to store generated numbers\n \\param n Number of 32-bit unsigned integers to generate\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if \\p n is not a multiple of the dimension\n of used quasi-random generator \\n\n - ROCRAND_STATUS_SUCCESS if random numbers were successfully generated \\n"]
pub fn rocrand_generate(
generator: rocrand_generator,
output_data: *mut ::std::os::raw::c_uint,
@@ -103,6 +147,7 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Generates uniformly distributed 64-bit unsigned integers.\n\n Generates \\p n uniformly distributed 64-bit unsigned integers and\n saves them to \\p output_data.\n\n Generated numbers are between \\p 0 and \\p 2^64, including \\p 0 and\n excluding \\p 2^64.\n\n \\param generator Generator to use\n \\param output_data Pointer to memory to store generated numbers\n \\param n Number of 64-bit unsigned integers to generate\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if \\p n is not a multiple of the dimension\n of used quasi-random generator \\n\n - ROCRAND_TYPE_ERROR if the generator can't natively generate 64-bit random numbers \\n\n - ROCRAND_STATUS_SUCCESS if random numbers were successfully generated \\n"]
pub fn rocrand_generate_long_long(
generator: rocrand_generator,
output_data: *mut ::std::os::raw::c_ulonglong,
@@ -110,6 +155,7 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Generates uniformly distributed 8-bit unsigned integers.\n\n Generates \\p n uniformly distributed 8-bit unsigned integers and\n saves them to \\p output_data.\n\n Generated numbers are between \\p 0 and \\p 2^8, including \\p 0 and\n excluding \\p 2^8.\n\n \\param generator Generator to use\n \\param output_data Pointer to memory to store generated numbers\n \\param n Number of 8-bit unsigned integers to generate\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if \\p n is not a multiple of the dimension\n of used quasi-random generator \\n\n - ROCRAND_STATUS_SUCCESS if random numbers were successfully generated \\n"]
pub fn rocrand_generate_char(
generator: rocrand_generator,
output_data: *mut ::std::os::raw::c_uchar,
@@ -117,6 +163,7 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Generates uniformly distributed 16-bit unsigned integers.\n\n Generates \\p n uniformly distributed 16-bit unsigned integers and\n saves them to \\p output_data.\n\n Generated numbers are between \\p 0 and \\p 2^16, including \\p 0 and\n excluding \\p 2^16.\n\n \\param generator Generator to use\n \\param output_data Pointer to memory to store generated numbers\n \\param n Number of 16-bit unsigned integers to generate\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if \\p n is not a multiple of the dimension\n of used quasi-random generator \\n\n - ROCRAND_STATUS_SUCCESS if random numbers were successfully generated \\n"]
pub fn rocrand_generate_short(
generator: rocrand_generator,
output_data: *mut ::std::os::raw::c_ushort,
@@ -124,6 +171,7 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Generates uniformly distributed \\p float values.\n\n Generates \\p n uniformly distributed 32-bit floating-point values\n and saves them to \\p output_data.\n\n Generated numbers are between \\p 0.0f and \\p 1.0f, excluding \\p 0.0f and\n including \\p 1.0f.\n\n \\param generator Generator to use\n \\param output_data Pointer to memory to store generated numbers\n \\param n Number of <tt>float</tt>s to generate\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if \\p n is not a multiple of the dimension\n of used quasi-random generator \\n\n - ROCRAND_STATUS_SUCCESS if random numbers were successfully generated \\n"]
pub fn rocrand_generate_uniform(
generator: rocrand_generator,
output_data: *mut f32,
@@ -131,6 +179,7 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Generates uniformly distributed double-precision floating-point values.\n\n Generates \\p n uniformly distributed 64-bit double-precision floating-point\n values and saves them to \\p output_data.\n\n Generated numbers are between \\p 0.0 and \\p 1.0, excluding \\p 0.0 and\n including \\p 1.0.\n\n \\param generator Generator to use\n \\param output_data Pointer to memory to store generated numbers\n \\param n Number of <tt>double</tt>s to generate\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if \\p n is not a multiple of the dimension\n of used quasi-random generator \\n\n - ROCRAND_STATUS_SUCCESS if random numbers were successfully generated \\n"]
pub fn rocrand_generate_uniform_double(
generator: rocrand_generator,
output_data: *mut f64,
@@ -138,6 +187,7 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Generates uniformly distributed half-precision floating-point values.\n\n Generates \\p n uniformly distributed 16-bit half-precision floating-point\n values and saves them to \\p output_data.\n\n Generated numbers are between \\p 0.0 and \\p 1.0, excluding \\p 0.0 and\n including \\p 1.0.\n\n \\param generator Generator to use\n \\param output_data Pointer to memory to store generated numbers\n \\param n Number of <tt>half</tt>s to generate\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if \\p n is not a multiple of the dimension\n of used quasi-random generator \\n\n - ROCRAND_STATUS_SUCCESS if random numbers were successfully generated \\n"]
pub fn rocrand_generate_uniform_half(
generator: rocrand_generator,
output_data: *mut half,
@@ -145,6 +195,7 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Generates normally distributed \\p float values.\n\n Generates \\p n normally distributed distributed 32-bit floating-point\n values and saves them to \\p output_data.\n\n \\param generator Generator to use\n \\param output_data Pointer to memory to store generated numbers\n \\param n Number of <tt>float</tt>s to generate\n \\param mean Mean value of normal distribution\n \\param stddev Standard deviation value of normal distribution\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if \\p n is not a multiple of the dimension\n of used quasi-random generator \\n\n - ROCRAND_STATUS_SUCCESS if random numbers were successfully generated \\n"]
pub fn rocrand_generate_normal(
generator: rocrand_generator,
output_data: *mut f32,
@@ -154,6 +205,7 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Generates normally distributed \\p double values.\n\n Generates \\p n normally distributed 64-bit double-precision floating-point\n numbers and saves them to \\p output_data.\n\n \\param generator Generator to use\n \\param output_data Pointer to memory to store generated numbers\n \\param n Number of <tt>double</tt>s to generate\n \\param mean Mean value of normal distribution\n \\param stddev Standard deviation value of normal distribution\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if \\p n is not a multiple of the dimension\n of used quasi-random generator \\n\n - ROCRAND_STATUS_SUCCESS if random numbers were successfully generated \\n"]
pub fn rocrand_generate_normal_double(
generator: rocrand_generator,
output_data: *mut f64,
@@ -163,6 +215,7 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Generates normally distributed \\p half values.\n\n Generates \\p n normally distributed 16-bit half-precision floating-point\n numbers and saves them to \\p output_data.\n\n \\param generator Generator to use\n \\param output_data Pointer to memory to store generated numbers\n \\param n Number of <tt>half</tt>s to generate\n \\param mean Mean value of normal distribution\n \\param stddev Standard deviation value of normal distribution\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if \\p n is not a multiple of the dimension\n of used quasi-random generator \\n\n - ROCRAND_STATUS_SUCCESS if random numbers were successfully generated \\n"]
pub fn rocrand_generate_normal_half(
generator: rocrand_generator,
output_data: *mut half,
@@ -172,6 +225,7 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Generates log-normally distributed \\p float values.\n\n Generates \\p n log-normally distributed 32-bit floating-point values\n and saves them to \\p output_data.\n\n \\param generator Generator to use\n \\param output_data Pointer to memory to store generated numbers\n \\param n Number of <tt>float</tt>s to generate\n \\param mean Mean value of log normal distribution\n \\param stddev Standard deviation value of log normal distribution\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if \\p n is not a multiple of the dimension\n of used quasi-random generator \\n\n - ROCRAND_STATUS_SUCCESS if random numbers were successfully generated \\n"]
pub fn rocrand_generate_log_normal(
generator: rocrand_generator,
output_data: *mut f32,
@@ -181,6 +235,7 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Generates log-normally distributed \\p double values.\n\n Generates \\p n log-normally distributed 64-bit double-precision floating-point\n values and saves them to \\p output_data.\n\n \\param generator Generator to use\n \\param output_data Pointer to memory to store generated numbers\n \\param n Number of <tt>double</tt>s to generate\n \\param mean Mean value of log normal distribution\n \\param stddev Standard deviation value of log normal distribution\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if \\p n is not a multiple of the dimension\n of used quasi-random generator \\n\n - ROCRAND_STATUS_SUCCESS if random numbers were successfully generated \\n"]
pub fn rocrand_generate_log_normal_double(
generator: rocrand_generator,
output_data: *mut f64,
@@ -190,6 +245,7 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Generates log-normally distributed \\p half values.\n\n Generates \\p n log-normally distributed 16-bit half-precision floating-point\n values and saves them to \\p output_data.\n\n \\param generator Generator to use\n \\param output_data Pointer to memory to store generated numbers\n \\param n Number of <tt>half</tt>s to generate\n \\param mean Mean value of log normal distribution\n \\param stddev Standard deviation value of log normal distribution\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if \\p n is not a multiple of the dimension\n of used quasi-random generator \\n\n - ROCRAND_STATUS_SUCCESS if random numbers were successfully generated \\n"]
pub fn rocrand_generate_log_normal_half(
generator: rocrand_generator,
output_data: *mut half,
@@ -199,6 +255,7 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Generates Poisson-distributed 32-bit unsigned integers.\n\n Generates \\p n Poisson-distributed 32-bit unsigned integers and\n saves them to \\p output_data.\n\n \\param generator Generator to use\n \\param output_data Pointer to memory to store generated numbers\n \\param n Number of 32-bit unsigned integers to generate\n \\param lambda lambda for the Poisson distribution\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_OUT_OF_RANGE if lambda is non-positive \\n\n - ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if \\p n is not a multiple of the dimension\n of used quasi-random generator \\n\n - ROCRAND_STATUS_SUCCESS if random numbers were successfully generated \\n"]
pub fn rocrand_generate_poisson(
generator: rocrand_generator,
output_data: *mut ::std::os::raw::c_uint,
@@ -207,48 +264,58 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Initializes the generator's state on GPU or host.\n\n Initializes the generator's state on GPU or host. User it not\n required to call this function before using a generator.\n\n If rocrand_initialize() was not called for a generator, it will be\n automatically called by functions which generates random numbers like\n rocrand_generate(), rocrand_generate_uniform() etc.\n\n \\param generator Generator to initialize\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed \\n\n - ROCRAND_STATUS_SUCCESS if the seeds were generated successfully \\n"]
pub fn rocrand_initialize_generator(generator: rocrand_generator) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Sets the current stream for kernel launches.\n\n Sets the current stream for all kernel launches of the generator.\n All functions will use this stream.\n\n \\param generator Generator to modify\n \\param stream Stream to use or NULL for default stream\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_SUCCESS if stream was set successfully \\n"]
pub fn rocrand_set_stream(generator: rocrand_generator, stream: hipStream_t) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Sets the seed of a pseudo-random number generator.\n\n Sets the seed of the pseudo-random number generator.\n\n - This operation resets the generator's internal state.\n - This operation does not change the generator's offset.\n\n For an MRG32K3a or MRG31K3p generator the seed value can't be zero. If \\p seed is\n equal to zero and generator's type is ROCRAND_RNG_PSEUDO_MRG32K3A or ROCRAND_RNG_PSEUDO_MRG31K3P,\n value \\p 12345 is used as seed instead.\n\n For a LFSR113 generator seed values must be larger than 1, 7, 15,\n 127. The \\p seed upper and lower 32 bits used as first and\n second seed value. If those values smaller than 2 and/or 8, those\n are increased with 1 and/or 7.\n\n \\param generator Pseudo-random number generator\n \\param seed New seed value\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_TYPE_ERROR if the generator is a quasi-random number generator \\n\n - ROCRAND_STATUS_SUCCESS if seed was set successfully \\n"]
pub fn rocrand_set_seed(
generator: rocrand_generator,
seed: ::std::os::raw::c_ulonglong,
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Sets the seeds of a pseudo-random number generator.\n\n Sets the seed of the pseudo-random number generator. Currently only for LFSR113\n\n - This operation resets the generator's internal state.\n - This operation does not change the generator's offset.\n\n Only usable for LFSR113.\n\n For a LFSR113 generator seed values must be bigger than 1, 7, 15,\n 127. If those values smaller, than the requested minimum values [2, 8, 16, 128], then\n it will be increased with the minimum values minus 1 [1, 7, 15, 127].\n\n \\param generator Pseudo-random number generator\n \\param seed New seed value\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_TYPE_ERROR if the generator is a quasi-random number generator \\n\n - ROCRAND_STATUS_SUCCESS if seed was set successfully \\n"]
pub fn rocrand_set_seed_uint4(generator: rocrand_generator, seed: uint4) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Sets the offset of a random number generator.\n\n Sets the absolute offset of the random number generator.\n\n - This operation resets the generator's internal state.\n - This operation does not change the generator's seed.\n\n Absolute offset cannot be set if generator's type is ROCRAND_RNG_PSEUDO_MTGP32 or\n ROCRAND_RNG_PSEUDO_LFSR113.\n\n \\param generator Random number generator\n \\param offset New absolute offset\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_SUCCESS if offset was successfully set \\n\n - ROCRAND_STATUS_TYPE_ERROR if generator's type is ROCRAND_RNG_PSEUDO_MTGP32 or\n ROCRAND_RNG_PSEUDO_LFSR113"]
pub fn rocrand_set_offset(
generator: rocrand_generator,
offset: ::std::os::raw::c_ulonglong,
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Sets the ordering of a random number generator.\n\n Sets the ordering of the results of a random number generator.\n\n - This operation resets the generator's internal state.\n - This operation does not change the generator's seed.\n\n \\param generator Random number generator\n \\param order New ordering of results\n\n The ordering choices for pseudorandom sequences are the following.\n Note that not all generators support all orderings. For details, see\n the Programmer's Guide in the documentation.\n - ROCRAND_ORDERING_PSEUDO_DEFAULT\n - ROCRAND_ORDERING_PSEUDO_LEGACY\n - ROCRAND_ORDERING_PSEUDO_BEST\n - ROCRAND_ORDERING_PSEUDO_SEEDED\n - ROCRAND_ORDERING_PSEUDO_DYNAMIC\n\n For quasirandom sequences there is only one ordering, ROCRAND_ORDERING_QUASI_DEFAULT.\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_OUT_OF_RANGE if the ordering is not valid \\n\n - ROCRAND_STATUS_SUCCESS if the ordering was successfully set \\n\n - ROCRAND_STATUS_TYPE_ERROR if generator's type is not valid"]
pub fn rocrand_set_ordering(
generator: rocrand_generator,
order: rocrand_ordering,
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Set the number of dimensions of a quasi-random number generator.\n\n Set the number of dimensions of a quasi-random number generator.\n Supported values of \\p dimensions are 1 to 20000.\n\n - This operation resets the generator's internal state.\n - This operation does not change the generator's offset.\n\n \\param generator Quasi-random number generator\n \\param dimensions Number of dimensions\n\n \\return\n - ROCRAND_STATUS_NOT_CREATED if the generator wasn't created \\n\n - ROCRAND_STATUS_TYPE_ERROR if the generator is not a quasi-random number generator \\n\n - ROCRAND_STATUS_OUT_OF_RANGE if \\p dimensions is out of range \\n\n - ROCRAND_STATUS_SUCCESS if the number of dimensions was set successfully \\n"]
pub fn rocrand_set_quasi_random_generator_dimensions(
generator: rocrand_generator,
dimensions: ::std::os::raw::c_uint,
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Returns the version number of the library.\n\n Returns in \\p version the version number of the dynamically linked\n rocRAND library.\n\n \\param version Version of the library\n\n \\return\n - ROCRAND_STATUS_OUT_OF_RANGE if \\p version is NULL \\n\n - ROCRAND_STATUS_SUCCESS if the version number was successfully returned \\n"]
pub fn rocrand_get_version(version: *mut ::std::os::raw::c_int) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Construct the histogram for a Poisson distribution.\n\n Construct the histogram for the Poisson distribution with lambda \\p lambda.\n\n \\param lambda lambda for the Poisson distribution\n \\param discrete_distribution pointer to the histogram in device memory\n\n \\return\n - ROCRAND_STATUS_ALLOCATION_FAILED if memory could not be allocated \\n\n - ROCRAND_STATUS_OUT_OF_RANGE if \\p discrete_distribution pointer was null \\n\n - ROCRAND_STATUS_OUT_OF_RANGE if lambda is non-positive \\n\n - ROCRAND_STATUS_SUCCESS if the histogram was constructed successfully \\n"]
pub fn rocrand_create_poisson_distribution(
lambda: f64,
discrete_distribution: *mut rocrand_discrete_distribution,
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Construct the histogram for a custom discrete distribution.\n\n Construct the histogram for the discrete distribution of \\p size\n 32-bit unsigned integers from the range [\\p offset, \\p offset + \\p size)\n using \\p probabilities as probabilities.\n\n \\param probabilities probabilities of the the distribution in host memory\n \\param size size of \\p probabilities\n \\param offset offset of values\n \\param discrete_distribution pointer to the histogram in device memory\n\n \\return\n - ROCRAND_STATUS_ALLOCATION_FAILED if memory could not be allocated \\n\n - ROCRAND_STATUS_OUT_OF_RANGE if \\p discrete_distribution pointer was null \\n\n - ROCRAND_STATUS_OUT_OF_RANGE if \\p size was zero \\n\n - ROCRAND_STATUS_SUCCESS if the histogram was constructed successfully \\n"]
pub fn rocrand_create_discrete_distribution(
probabilities: *const f64,
size: ::std::os::raw::c_uint,
@@ -257,28 +324,33 @@ unsafe extern "C" {
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Destroy the histogram array for a discrete distribution.\n\n Destroy the histogram array for a discrete distribution created by\n rocrand_create_poisson_distribution.\n\n \\param discrete_distribution pointer to the histogram in device memory\n\n \\return\n - ROCRAND_STATUS_OUT_OF_RANGE if \\p discrete_distribution was null \\n\n - ROCRAND_STATUS_SUCCESS if the histogram was destroyed successfully \\n"]
pub fn rocrand_destroy_discrete_distribution(
discrete_distribution: rocrand_discrete_distribution,
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Get the vector for 32-bit (scrambled-)sobol generation.\n\n \\param vectors location where to write the vector pointer to\n\n \\param set which direction vector set to use\n\n \\return\n - ROCRAND_STATUS_OUT_OF_RANGE if \\p set was invalid for this method \\n\n - ROCRAND_STATUS_SUCCESS if the pointer was set succesfully \\n"]
pub fn rocrand_get_direction_vectors32(
vectors: *mut *const ::std::os::raw::c_uint,
set: rocrand_direction_vector_set,
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Get the vector for 64-bit (scrambled-)sobol generation.\n\n \\param vectors location where to write the vector pointer to\n\n \\param set which direction vector set to use\n\n \\return\n - ROCRAND_STATUS_OUT_OF_RANGE if \\p set was invalid for this method \\n\n - ROCRAND_STATUS_SUCCESS if the pointer was set succesfully \\n"]
pub fn rocrand_get_direction_vectors64(
vectors: *mut *const ::std::os::raw::c_ulonglong,
set: rocrand_direction_vector_set,
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Get the scramble constants for 32-bit scrambled sobol generation.\n\n \\param constants location where to write the constants pointer to\n\n \\return\n - ROCRAND_STATUS_SUCCESS if the pointer was set succesfully \\n"]
pub fn rocrand_get_scramble_constants32(
constants: *mut *const ::std::os::raw::c_uint,
) -> rocrand_status;
}
unsafe extern "C" {
#[doc = " \\brief Get the scramble constants for 64-bit scrambled sobol generation.\n\n \\param constants location where to write the constants pointer to\n\n \\return\n - ROCRAND_STATUS_SUCCESS if the pointer was set succesfully \\n"]
pub fn rocrand_get_scramble_constants64(
constants: *mut *const ::std::os::raw::c_ulonglong,
) -> rocrand_status;
File diff suppressed because one or more lines are too long
+1214 -8
View File
File diff suppressed because one or more lines are too long