Merge pull request #1976 from Flakebi/amdgpu-intrinsics

Add amdgpu intrinsics
This commit is contained in:
Sayantan Chakraborty 2025-12-19 20:02:31 +00:00 committed by GitHub
commit 6adebf5685
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 1100 additions and 2 deletions

View file

@ -84,6 +84,8 @@ jobs:
os: ubuntu-latest
- tuple: nvptx64-nvidia-cuda
os: ubuntu-latest
- tuple: amdgcn-amd-amdhsa
os: ubuntu-latest
- tuple: thumbv6m-none-eabi
os: ubuntu-latest
- tuple: thumbv7m-none-eabi
@ -201,6 +203,10 @@ jobs:
tuple: aarch64-apple-ios-macabi
os: macos-15
norun: true # https://github.com/rust-lang/stdarch/issues/1206
- target:
tuple: amdgcn-amd-amdhsa
os: ubuntu-latest
norun: true
steps:
- uses: actions/checkout@v4
@ -212,12 +218,17 @@ jobs:
- run: rustup target add ${{ matrix.target.tuple }}
shell: bash
if: matrix.build_std == ''
if: matrix.build_std == '' && matrix.target.tuple != 'amdgcn-amd-amdhsa'
- run: |
rustup component add rust-src
echo "CARGO_UNSTABLE_BUILD_STD=std" >> $GITHUB_ENV
shell: bash
if: matrix.build_std != ''
- run: |
rustup component add rust-src
echo "CARGO_UNSTABLE_BUILD_STD=core,alloc" >> $GITHUB_ENV
shell: bash
if: matrix.target.tuple == 'amdgcn-amd-amdhsa'
# Configure some env vars based on matrix configuration
- run: echo "PROFILE=${{matrix.profile}}" >> $GITHUB_ENV
@ -233,7 +244,7 @@ jobs:
if: matrix.disable_assert_instr != ''
- run: echo "NOSTD=1" >> $GITHUB_ENV
shell: bash
if: startsWith(matrix.target.tuple, 'thumb') || matrix.target.tuple == 'nvptx64-nvidia-cuda'
if: startsWith(matrix.target.tuple, 'thumb') || matrix.target.tuple == 'nvptx64-nvidia-cuda' || matrix.target.tuple == 'amdgcn-amd-amdhsa'
# Windows & OSX go straight to `run.sh` ...
- run: ./ci/run.sh

View file

@ -0,0 +1,5 @@
FROM ubuntu:25.10
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libc6-dev \
ca-certificates

View file

@ -15,6 +15,15 @@ dox() {
cargo clean --target "${1}"
if [ "${1}" == "amdgcn-amd-amdhsa" ]; then
if [ "$CI" != "" ]; then
rustup component add rust-src
fi
export CARGO_UNSTABLE_BUILD_STD=core
# amdgpu needs a target-cpu, any is fine
export RUSTFLAGS="${RUSTFLAGS} -Ctarget-cpu=gfx900"
fi
cargo build --verbose --target "${1}" --manifest-path crates/core_arch/Cargo.toml
cargo doc --verbose --target "${1}" --manifest-path crates/core_arch/Cargo.toml
}
@ -33,6 +42,7 @@ if [ -z "$1" ]; then
#dox mips64-unknown-linux-gnuabi64
dox wasm32-unknown-unknown
dox nvptx64-nvidia-cuda
dox amdgcn-amd-amdhsa
else
dox "${1}"
fi

View file

@ -42,6 +42,9 @@ case ${TARGET} in
armv7-*eabihf | thumbv7-*eabihf)
export RUSTFLAGS="${RUSTFLAGS} -Ctarget-feature=+neon"
;;
amdgcn-*)
export RUSTFLAGS="${RUSTFLAGS} -Ctarget-cpu=gfx1200"
;;
# Some of our test dependencies use the deprecated `gcc` crates which
# doesn't detect RISC-V compilers automatically, so do it manually here.
riscv*)

File diff suppressed because it is too large Load diff

View file

@ -185,6 +185,7 @@ others at:
* [`x86_64`]
* [`arm`]
* [`aarch64`]
* [`amdgpu`]
* [`riscv32`]
* [`riscv64`]
* [`mips`]
@ -201,6 +202,7 @@ others at:
[`x86_64`]: ../../core/arch/x86_64/index.html
[`arm`]: ../../core/arch/arm/index.html
[`aarch64`]: ../../core/arch/aarch64/index.html
[`amdgpu`]: ../../core/arch/amdgpu/index.html
[`riscv32`]: ../../core/arch/riscv32/index.html
[`riscv64`]: ../../core/arch/riscv64/index.html
[`mips`]: ../../core/arch/mips/index.html

View file

@ -279,6 +279,16 @@ pub mod arch {
pub use crate::core_arch::nvptx::*;
}
/// Platform-specific intrinsics for the `amdgpu` platform.
///
/// See the [module documentation](../index.html) for more details.
#[cfg(any(target_arch = "amdgpu", doc))]
#[doc(cfg(target_arch = "amdgpu"))]
#[unstable(feature = "stdarch_amdgpu", issue = "149988")]
pub mod amdgpu {
pub use crate::core_arch::amdgpu::*;
}
/// Platform-specific intrinsics for the `loongarch32` platform.
///
/// See the [module documentation](../index.html) for more details.
@ -354,6 +364,10 @@ mod powerpc64;
#[doc(cfg(target_arch = "nvptx64"))]
mod nvptx;
#[cfg(any(target_arch = "amdgpu", doc))]
#[doc(cfg(target_arch = "amdgpu"))]
mod amdgpu;
#[cfg(any(target_arch = "loongarch32", doc))]
#[doc(cfg(target_arch = "loongarch32"))]
mod loongarch32;