Skip to content

Commit b34be91

Browse files
committed
Add intrinsic doc comment
1 parent 7666b58 commit b34be91

File tree

1 file changed

+25
-0
lines changed
  • library/core/src/intrinsics

1 file changed

+25
-0
lines changed

library/core/src/intrinsics/mod.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3294,6 +3294,31 @@ pub const fn copysignf128(x: f128, y: f128) -> f128;
32943294
#[rustc_intrinsic]
32953295
pub const fn autodiff<F, G, T: crate::marker::Tuple, R>(f: F, df: G, args: T) -> R;
32963296

3297+
/// Generates the LLVM body of a wrapper function to offload a kernel `f`.
3298+
///
3299+
/// Type Parameters:
3300+
/// - `F`: The kernel to offload. Must be a function item.
3301+
/// - `T`: A tuple of arguments passed to `f`.
3302+
/// - `R`: The return type of the kernel.
3303+
///
3304+
/// Example usage (pseudocode):
3305+
///
3306+
/// ```rust,ignore (pseudocode)
3307+
/// fn kernel(x: *mut [f64; 128]) {
3308+
/// core::intrinsics::offload(kernel_1, (x,))
3309+
/// }
3310+
///
3311+
/// #[cfg(target_os = "linux")]
3312+
/// extern "C" {
3313+
/// pub fn kernel_1(array_b: *mut [f64; 128]);
3314+
/// }
3315+
///
3316+
/// #[cfg(not(target_os = "linux"))]
3317+
/// #[rustc_offload_kernel]
3318+
/// extern "gpu-kernel" fn kernel_1(x: *mut [f64; 128]) {
3319+
/// unsafe { (*x)[0] = 21.0 };
3320+
/// }
3321+
/// ```
32973322
#[rustc_nounwind]
32983323
#[rustc_intrinsic]
32993324
pub const fn offload<F, T: crate::marker::Tuple, R>(f: F, args: T) -> R;

0 commit comments

Comments
 (0)