rust/compiler/rustc_codegen_ssa/src
许杰友 Jieyou Xu (Joe) 5e3eb25125
Rollup merge of #142097 - ZuseZ4:offload-host1, r=oli-obk
gpu offload host code generation

r? ghost

This will generate most of the host side code to use llvm's offload feature.
The first PR will only handle automatic mem-transfers to and from the device.
So if a user calls a kernel, we will copy inputs back and forth, but we won't do the actual kernel launch.
Before merging, we will use LLVM's Info infrastructure to verify that the memcopies match what openmp offloa generates in C++. `LIBOMPTARGET_INFO=-1 ./my_rust_binary` should print that a memcpy to and later from the device is happening.

A follow-up PR will generate the actual device-side kernel which will then do computations on the GPU.
A third PR will implement manual host2device and device2host functionality, but the goal is to minimize cases where a user has to overwrite our default handling due to performance issues.

I'm trying to get a full MVP out first, so this just recognizes GPU functions based on magic names. The final frontend will obviously move this over to use proper macros, like I'm already doing it for the autodiff work.
This work will also be compatible with std::autodiff, so one can differentiate GPU kernels.

Tracking:
- https://github.com/rust-lang/rust/issues/131513
2025-07-22 00:54:24 +08:00
..
back add -Zoffload=Enable flag behind -Zunstable-options, to enable gpu (host) code generation 2025-07-18 16:24:00 -07:00
debuginfo Flatten ifs in rustc_codegen_ssa 2025-03-17 18:56:52 +00:00
mir Ban projecting into SIMD types [MCP838] 2025-07-20 10:22:09 -07:00
traits Rollup merge of #143388 - bjorn3:lto_refactors, r=compiler-errors 2025-07-17 03:58:28 +02:00
assert_module_sources.rs Move methods from Map to TyCtxt, part 4. 2025-03-12 08:55:37 +11:00
base.rs Rollup merge of #143388 - bjorn3:lto_refactors, r=compiler-errors 2025-07-17 03:58:28 +02:00
codegen_attrs.rs use codegen_instance_attrs where an instance is (easily) available 2025-07-16 23:24:32 +02:00
common.rs Replace some Option<Span> with Span and use DUMMY_SP instead of None 2025-06-05 14:14:59 +00:00
errors.rs Port #[link_ordinal] to the new attribute parsing infrastructure. 2025-07-13 11:51:01 +02:00
lib.rs [Arm64EC] Only decorate functions with # 2025-06-23 12:38:35 -07:00
meth.rs Eliminate all direct uses of LLVMMDStringInContext2 2025-07-14 08:27:08 +00:00
mono_item.rs use codegen_instance_attrs where an instance is (easily) available 2025-07-16 23:24:32 +02:00
size_of_val.rs Replace some Option<Span> with Span and use DUMMY_SP instead of None 2025-06-05 14:14:59 +00:00
target_features.rs rustc_codegen_ssa: Don't skip target-features after crt-static 2025-07-18 18:59:13 +02:00