You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of rust-lang#134740 - Flakebi:amdgpu-target, r=workingjubilee
Add amdgpu target
Add amdgpu target to rustc and enable the LLVM target.
Fix compiling `core` with the amdgpu:
The amdgpu backend makes heavy use of different address spaces. This
leads to situations, where a pointer in one addrspace needs to be casted
to a pointer in a different addrspace. `bitcast` is invalid for this
case, `addrspacecast` needs to be used.
Fix compilation failures that created bitcasts for such cases by
creating pointer casts (which creates an `addrspacecast` under the hood)
instead.
MCP: rust-lang/compiler-team#823
Tracking issue: rust-lang#135024
Kinda related to the original amdgpu tracking issue rust-lang#51575 (though that one has been closed for a while).
AMD GPU target for compute/HSA (Heterogeneous System Architecture).
6
+
7
+
## Target maintainers
8
+
9
+
-[@Flakebi](https://github.com/Flakebi)
10
+
11
+
## Requirements
12
+
13
+
AMD GPUs can be targeted via cross-compilation.
14
+
Supported GPUs depend on the LLVM version that is used by Rust.
15
+
In general, most GPUs starting from gfx7 (Sea Islands/CI) are supported as compilation targets, though older GPUs are not supported by the latest host runtime.
16
+
Details about supported GPUs can be found in [LLVM’s documentation] and [ROCm documentation].
17
+
18
+
Binaries can be loaded by [HIP] or by the HSA runtime implemented in [ROCR-Runtime].
19
+
The format of binaries is a linked ELF.
20
+
21
+
Binaries must be built with no-std.
22
+
They can use `core` and `alloc` (`alloc` only if an allocator is supplied).
23
+
At least one function needs to use the `"gpu-kernel"` calling convention and should be marked with `no_mangle` for simplicity.
24
+
Functions using the `"gpu-kernel"` calling convention are kernel entrypoints and can be used from the host runtime.
25
+
26
+
## Building the target
27
+
28
+
The target is included in rustc.
29
+
30
+
## Building Rust programs
31
+
32
+
The amdgpu target supports many hardware generations, which need different binaries.
33
+
The generations are exposed as different target-cpus in the backend.
34
+
As there are many, Rust does not ship pre-compiled libraries for this target.
35
+
Therefore, you have to build your own copy of `core` by using `cargo -Zbuild-std=core` or similar.
0 commit comments