rust/compiler/rustc_llvm
Stuart Cook 2b150f2c65
Rollup merge of #147936 - Sa4dUs:offload-intrinsic, r=ZuseZ4
Offload intrinsic

This PR implements the minimal mechanisms required to run a small subset of arbitrary offload kernels without relying on hardcoded names or metadata.

- `offload(kernel, (..args))`: an intrinsic that generates the necessary host-side LLVM-IR code.
- `rustc_offload_kernel`: a builtin attribute that marks device kernels to be handled appropriately.

Example usage (pseudocode):
```rust
fn kernel(x: *mut [f64; 128]) {
    core::intrinsics::offload(kernel_1, (x,))
}

#[cfg(target_os = "linux")]
extern "C" {
    pub fn kernel_1(array_b: *mut [f64; 128]);
}

#[cfg(not(target_os = "linux"))]
#[rustc_offload_kernel]
extern "gpu-kernel" fn kernel_1(x: *mut [f64; 128]) {
    unsafe { (*x)[0] = 21.0 };
}
```
2025-11-26 23:32:03 +11:00
..
llvm-wrapper Rollup merge of #147936 - Sa4dUs:offload-intrinsic, r=ZuseZ4 2025-11-26 23:32:03 +11:00
src Unify the configuration of the compiler docs 2025-11-05 11:25:27 +00:00
build.rs Only try to link against offload functions if llvm.enzyme is enabled 2025-11-23 00:19:53 -08:00
Cargo.toml Revert "Auto merge of #146186 - dpaoliello:cc, r=jieyouxu" 2025-10-30 22:46:35 +08:00