rust/compiler/rustc_abi
Jonathan Brouwer 6268b9118e
Rollup merge of #149991 - Flakebi:gpu-kernel-cc, r=workingjubilee
Add checks for gpu-kernel calling conv

The `gpu-kernel` calling convention has several restrictions that were not enforced by the compiler until now.
Add the following restrictions:

1. Cannot be async
2. Cannot be called
3. Cannot return values, return type must be `()` or `!`
4. Arguments should be simple, i.e. passed by value. More complicated types can work when you know what you are doing, but it is rather unintuitive, one needs to know ABI/compiler internals.
5. Export name should be unmangled, either through `no_mangle` or `export_name`. Kernels are searched by name on the CPU side, having a mangled name makes it hard to find and probably almost always unintentional.

Tracking issue: rust-lang/rust#135467
amdgpu target tracking issue: rust-lang/rust#135024

``@workingjubilee,`` these should be all the restrictions we talked about a year ago.

cc ``@RDambrosio016`` ``@kjetilkjeka`` for nvptx
2026-01-02 23:13:21 +01:00
..
src Rollup merge of #149991 - Flakebi:gpu-kernel-cc, r=workingjubilee 2026-01-02 23:13:21 +01:00
Cargo.toml Revert introduction of [workspace.dependencies]. 2025-09-02 19:12:54 +10:00