Commit 29cfccd
authored
Unrolled build for #147936
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 };
}
```File tree
23 files changed
+531
-180
lines changed- compiler
- rustc_codegen_llvm
- src
- back
- builder
- llvm
- rustc_codegen_ssa/src
- rustc_feature/src
- rustc_hir_analysis/src/check
- rustc_llvm/llvm-wrapper
- rustc_middle/src
- middle
- ty
- rustc_span/src
- library/core/src/intrinsics
- src/doc/rustc-dev-guide/src/offload
- tests
- codegen-llvm/gpu_offload
- ui/offload
23 files changed
+531
-180
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
| |||
408 | 416 | | |
409 | 417 | | |
410 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
411 | 423 | | |
412 | 424 | | |
413 | 425 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
601 | 601 | | |
602 | 602 | | |
603 | 603 | | |
604 | | - | |
605 | 604 | | |
606 | 605 | | |
607 | 606 | | |
| |||
616 | 615 | | |
617 | 616 | | |
618 | 617 | | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | 618 | | |
627 | 619 | | |
628 | 620 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
712 | 712 | | |
713 | 713 | | |
714 | 714 | | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | | - | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
719 | 719 | | |
| 720 | + | |
720 | 721 | | |
721 | 722 | | |
722 | 723 | | |
| |||
0 commit comments