pub unsafe trait KernelSignature: 'static {
type Arguments<'a>;
type RawArguments: Copy + 'static;
const PARAMETERS: &'static [ParameterLayout];
const REQUIREMENTS: LaunchRequirements;
// Required methods
fn raw_arguments(
arguments: Self::Arguments<'_>,
context: &Arc<Context>,
) -> Result<Self::RawArguments>;
fn encode<R>(
arguments: Self::RawArguments,
f: impl FnOnce(KernelParameters<'_>) -> R,
) -> R;
}Expand description
A kernel ABI and its launch requirements.
§Safety
encode must encode exactly PARAMETERS, in order, using the declared CUDA representation and access modes.
raw_arguments must preserve that order and check every typed view’s actual context.
By-value representations must contain no uninitialized bytes.
The requirements must describe the kernel being bound.
This contract does not certify argument-dependent memory bounds or output coverage.
Required Associated Constants§
Sourceconst PARAMETERS: &'static [ParameterLayout]
const PARAMETERS: &'static [ParameterLayout]
Host ABI layouts of the CUDA parameters, in declaration order.
Sourceconst REQUIREMENTS: LaunchRequirements
const REQUIREMENTS: LaunchRequirements
Indexing and execution requirements checked when binding a launch configuration.
Required Associated Types§
Sourcetype RawArguments: Copy + 'static
type RawArguments: Copy + 'static
CUDA parameter values, including raw device addresses, in declaration order.
Required Methods§
Sourcefn raw_arguments(
arguments: Self::Arguments<'_>,
context: &Arc<Context>,
) -> Result<Self::RawArguments>
fn raw_arguments( arguments: Self::Arguments<'_>, context: &Arc<Context>, ) -> Result<Self::RawArguments>
Checks device-view contexts and converts typed arguments into CUDA parameter values.
§Errors
Returns an error if a typed device view belongs to another context or the implementation cannot convert the supplied values to its raw argument representation. Implementations may impose additional argument-specific checks.
Sourcefn encode<R>(
arguments: Self::RawArguments,
f: impl FnOnce(KernelParameters<'_>) -> R,
) -> R
fn encode<R>( arguments: Self::RawArguments, f: impl FnOnce(KernelParameters<'_>) -> R, ) -> R
Copies raw argument values into storage valid for the duration of f.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".