Skip to content

Commit 8badb14

Browse files
committed
Add the gpu version of the kernel which was missing in the docs
1 parent f036a30 commit 8badb14

File tree

1 file changed

+7
-0
lines changed
  • src/doc/rustc-dev-guide/src/offload

1 file changed

+7
-0
lines changed

src/doc/rustc-dev-guide/src/offload/usage.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ fn main() {
5656
unsafe extern "C" {
5757
pub fn kernel_1(array_b: *mut [f64; 256]);
5858
}
59+
60+
#[cfg(not(target_os = "linux"))]
61+
#[unsafe(no_mangle)]
62+
#[inline(never)]
63+
pub extern "gpu-kernel" fn kernel_1(x: *mut [f64; 256]) {
64+
unsafe { (*x)[0] = 21.0 };
65+
}
5966
```
6067

6168
## Compile instructions

0 commit comments

Comments
 (0)