diff --git a/.gitmodules b/.gitmodules index 8617643a12029..ca54203dbdf9c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -24,8 +24,8 @@ shallow = true [submodule "src/llvm-project"] path = src/llvm-project - url = https://github.com/rust-lang/llvm-project.git - branch = rustc/21.1-2025-08-01 + url = https://github.com/fineg74/llvm-project.git + branch = l0RTL shallow = true [submodule "src/doc/embedded-book"] path = src/doc/embedded-book diff --git a/bootstrap.example.toml b/bootstrap.example.toml index e0cbb0c0e747c..c8be474fb18a5 100644 --- a/bootstrap.example.toml +++ b/bootstrap.example.toml @@ -126,7 +126,7 @@ # the resulting rustc being unable to compile for the disabled architectures. # # To add support for new targets, see https://rustc-dev-guide.rust-lang.org/building/new-target.html. -#llvm.targets = "AArch64;AMDGPU;ARM;BPF;Hexagon;LoongArch;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86" +#llvm.targets = "AArch64;AMDGPU;ARM;BPF;Hexagon;LoongArch;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SPIRV;SystemZ;WebAssembly;X86" # LLVM experimental targets to build support for. These targets are specified in # the same format as above, but since these targets are experimental, they are diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index c3c1caf086f09..a4a3228edea0c 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -701,6 +701,7 @@ pub(crate) fn to_llvm_calling_convention(sess: &Session, abi: CanonAbi) -> llvm: CanonAbi::GpuKernel => match &sess.target.arch { Arch::AmdGpu => llvm::AmdgpuKernel, Arch::Nvptx64 => llvm::PtxKernel, + Arch::SpirV => llvm::SpirKernel, arch => panic!("Architecture {arch} does not support GpuKernel calling convention"), }, CanonAbi::Interrupt(interrupt_kind) => match interrupt_kind { diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 454d5c4ffb249..075d8da23bc26 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -173,6 +173,7 @@ pub(crate) enum CallConv { Msp430Intr = 69, X86_ThisCall = 70, PtxKernel = 71, + SpirKernel = 76, X86_64_SysV = 78, X86_64_Win64 = 79, X86_VectorCall = 80, diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs index c58dd64cca5f7..769d9483a0c9a 100644 --- a/compiler/rustc_llvm/build.rs +++ b/compiler/rustc_llvm/build.rs @@ -15,6 +15,7 @@ const OPTIONAL_COMPONENTS: &[&str] = &[ "csky", "mips", "powerpc", + "spirv", "systemz", "webassembly", "msp430", diff --git a/compiler/rustc_llvm/src/lib.rs b/compiler/rustc_llvm/src/lib.rs index a565e1feeb5e5..96fc826f1df00 100644 --- a/compiler/rustc_llvm/src/lib.rs +++ b/compiler/rustc_llvm/src/lib.rs @@ -167,6 +167,13 @@ pub fn initialize_available_targets() { LLVMInitializePowerPCAsmPrinter, LLVMInitializePowerPCAsmParser ); + init_target!( + llvm_component = "spirv", + LLVMInitializeSPIRVTargetInfo, + LLVMInitializeSPIRVTarget, + LLVMInitializeSPIRVTargetMC, + LLVMInitializeSPIRVAsmPrinter + ); init_target!( llvm_component = "systemz", LLVMInitializeSystemZTargetInfo, diff --git a/compiler/rustc_target/src/callconv/mod.rs b/compiler/rustc_target/src/callconv/mod.rs index 6c8e0e181c4a4..9c10efad539e7 100644 --- a/compiler/rustc_target/src/callconv/mod.rs +++ b/compiler/rustc_target/src/callconv/mod.rs @@ -28,6 +28,7 @@ mod riscv; mod s390x; mod sparc; mod sparc64; +mod spirv; mod wasm; mod x86; mod x86_64; @@ -702,7 +703,8 @@ impl<'a, Ty> FnAbi<'a, Ty> { Arch::RiscV32 | Arch::RiscV64 => riscv::compute_abi_info(cx, self), Arch::Wasm32 | Arch::Wasm64 => wasm::compute_abi_info(cx, self), Arch::Bpf => bpf::compute_abi_info(cx, self), - arch @ (Arch::SpirV | Arch::Other(_)) => { + Arch::SpirV => spirv::compute_abi_info(cx, self), + arch @ Arch::Other(_) => { panic!("no lowering implemented for {arch}") } } diff --git a/compiler/rustc_target/src/callconv/spirv.rs b/compiler/rustc_target/src/callconv/spirv.rs new file mode 100644 index 0000000000000..98ab3ce8eb746 --- /dev/null +++ b/compiler/rustc_target/src/callconv/spirv.rs @@ -0,0 +1,40 @@ +use rustc_abi::{HasDataLayout, TyAbiInterface}; + +use crate::callconv::{ArgAbi, FnAbi}; + +fn classify_ret<'a, Ty, C>(_cx: &C, ret: &mut ArgAbi<'a, Ty>) +where + Ty: TyAbiInterface<'a, C> + Copy, + C: HasDataLayout, +{ + ret.extend_integer_width_to(32); +} + +fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) +where + Ty: TyAbiInterface<'a, C> + Copy, + C: HasDataLayout, +{ + if arg.layout.pass_indirectly_in_non_rustic_abis(cx) { + arg.make_indirect(); + return; + } + arg.extend_integer_width_to(32); +} + +pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) +where + Ty: TyAbiInterface<'a, C> + Copy, + C: HasDataLayout, +{ + if !fn_abi.ret.is_ignore() { + classify_ret(cx, &mut fn_abi.ret); + } + + for arg in fn_abi.args.iter_mut() { + if arg.is_ignore() { + continue; + } + classify_arg(cx, arg); + } +} diff --git a/compiler/rustc_target/src/spec/abi_map.rs b/compiler/rustc_target/src/spec/abi_map.rs index d7fc18cd3761e..59129be470eb3 100644 --- a/compiler/rustc_target/src/spec/abi_map.rs +++ b/compiler/rustc_target/src/spec/abi_map.rs @@ -60,6 +60,7 @@ impl AbiMap { Arch::Msp430 => ArchKind::Msp430, Arch::Nvptx64 => ArchKind::Nvptx, Arch::RiscV32 | Arch::RiscV64 => ArchKind::Riscv, + Arch::SpirV => ArchKind::Spirv, Arch::X86 => ArchKind::X86, Arch::X86_64 => ArchKind::X86_64, _ => ArchKind::Other, @@ -131,7 +132,9 @@ impl AbiMap { /* gpu */ (ExternAbi::PtxKernel, ArchKind::Nvptx) => CanonAbi::GpuKernel, - (ExternAbi::GpuKernel, ArchKind::Amdgpu | ArchKind::Nvptx) => CanonAbi::GpuKernel, + (ExternAbi::GpuKernel, ArchKind::Amdgpu | ArchKind::Nvptx | ArchKind::Spirv) => { + CanonAbi::GpuKernel + } (ExternAbi::PtxKernel | ExternAbi::GpuKernel, _) => return AbiMapping::Invalid, /* x86 */ @@ -203,6 +206,7 @@ enum ArchKind { LoongArch, Msp430, Nvptx, + Spirv, Riscv, X86, X86_64, diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index c5a7f119118c9..3bb8a691f1ee0 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1720,6 +1720,9 @@ supported_targets! { ("amdgcn-amd-amdhsa", amdgcn_amd_amdhsa), + ("spirv64-intel-unknown", spirv64_intel_unknown), + ("spirv-unknown-vulkan1.3", spirv_unknown_vulkan1_3), + ("xtensa-esp32-none-elf", xtensa_esp32_none_elf), ("xtensa-esp32-espidf", xtensa_esp32_espidf), ("xtensa-esp32s2-none-elf", xtensa_esp32s2_none_elf), @@ -1995,6 +1998,7 @@ crate::target_spec_enum! { VexOs = "vexos", VisionOs = "visionos", Vita = "vita", + Vulkan = "vulkan", VxWorks = "vxworks", Wasi = "wasi", WatchOs = "watchos", @@ -2919,8 +2923,8 @@ impl Target { ); check_eq!( self.is_like_gpu, - self.arch == Arch::Nvptx64 || self.arch == Arch::AmdGpu, - "`is_like_gpu` must be set if and only if `target` is `nvptx64` or `amdgcn`" + self.arch == Arch::AmdGpu || self.arch == Arch::Nvptx64 || self.arch == Arch::SpirV, + "`is_like_gpu` must be set if and only if `target` is `amdgcn`, `nvptx64`, or `spirv`" ); check_eq!( self.is_like_windows, @@ -3271,6 +3275,7 @@ impl Target { fn can_use_os_unknown(&self) -> bool { self.llvm_target == "wasm32-unknown-unknown" || self.llvm_target == "wasm64-unknown-unknown" + || self.llvm_target == "spirv64-intel-unknown" || (self.env == Env::Sgx && self.vendor == "fortanix") } diff --git a/compiler/rustc_target/src/spec/targets/spirv64_intel_unknown.rs b/compiler/rustc_target/src/spec/targets/spirv64_intel_unknown.rs new file mode 100644 index 0000000000000..480b08e5a58f9 --- /dev/null +++ b/compiler/rustc_target/src/spec/targets/spirv64_intel_unknown.rs @@ -0,0 +1,36 @@ +use crate::spec::{Arch, LinkerFlavor, Os, PanicStrategy, Target, TargetMetadata, TargetOptions}; + +pub(crate) fn target() -> Target { + Target { + llvm_target: "spirv64-intel-unknown".into(), + metadata: TargetMetadata { + description: Some("SPIR-V with Intel GPU extensions".into()), + tier: Some(3), + host_tools: Some(false), + std: Some(false), + }, + pointer_width: 64, + data_layout: "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G1-P9-A0".into(), + arch: Arch::SpirV, + options: TargetOptions { + os: Os::Unknown, + vendor: "intel".into(), + linker_flavor: LinkerFlavor::Llbc, + max_atomic_width: Some(32), + panic_strategy: PanicStrategy::Abort, + // Allow `cdylib` crate type. + dynamic_linking: true, + obj_is_bitcode: true, + only_cdylib: true, + dll_prefix: "".into(), + dll_suffix: ".spvt".into(), + is_like_gpu: true, + // The LLVM backend does not support stack canaries for this target + supports_stack_protector: false, + + // Static initializers must not have cycles on this target + static_initializer_must_be_acyclic: true, + ..Default::default() + }, + } +} diff --git a/compiler/rustc_target/src/spec/targets/spirv_unknown_vulkan1_3.rs b/compiler/rustc_target/src/spec/targets/spirv_unknown_vulkan1_3.rs new file mode 100644 index 0000000000000..1068ff99e60ef --- /dev/null +++ b/compiler/rustc_target/src/spec/targets/spirv_unknown_vulkan1_3.rs @@ -0,0 +1,36 @@ +use crate::spec::{Arch, LinkerFlavor, Os, PanicStrategy, Target, TargetMetadata, TargetOptions}; + +pub(crate) fn target() -> Target { + Target { + llvm_target: "spirv-unknown-vulkan1.3".into(), + metadata: TargetMetadata { + description: Some("Vulkan 1.3".into()), + tier: Some(3), + host_tools: Some(false), + std: Some(false), + }, + pointer_width: 64, + data_layout: "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G10".into(), + arch: Arch::SpirV, + options: TargetOptions { + os: Os::Vulkan, + vendor: "unknown".into(), + linker_flavor: LinkerFlavor::Llbc, + max_atomic_width: Some(32), + panic_strategy: PanicStrategy::Abort, + // Allow `cdylib` crate type. + dynamic_linking: true, + obj_is_bitcode: true, + only_cdylib: true, + dll_prefix: "".into(), + dll_suffix: ".spvt".into(), + is_like_gpu: true, + // The LLVM backend does not support stack canaries for this target + supports_stack_protector: false, + + // Static initializers must not have cycles on this target + static_initializer_must_be_acyclic: true, + ..Default::default() + }, + } +} diff --git a/library/compiler-builtins/compiler-builtins/build.rs b/library/compiler-builtins/compiler-builtins/build.rs index 6e1d230e3cd26..2f100a1d74dba 100644 --- a/library/compiler-builtins/compiler-builtins/build.rs +++ b/library/compiler-builtins/compiler-builtins/build.rs @@ -39,6 +39,7 @@ fn main() { || (target.triple.contains("sgx") && target.triple.contains("fortanix")) || target.triple.contains("-none") || target.triple.contains("nvptx") + || target.triple.contains("spirv") || target.triple.contains("uefi") || target.triple.contains("xous") { @@ -67,7 +68,7 @@ fn main() { // Don't use a C compiler for these targets: // // * nvptx - everything is bitcode, not compatible with mixed C/Rust - if !target.arch.contains("nvptx") { + if !target.arch.contains("nvptx") && !target.arch.contains("spirv") { #[cfg(feature = "c")] c::compile(&llvm_target, &target); } diff --git a/library/core/src/ffi/va_list.rs b/library/core/src/ffi/va_list.rs index d0f155316a109..2a917cf6e08c0 100644 --- a/library/core/src/ffi/va_list.rs +++ b/library/core/src/ffi/va_list.rs @@ -299,6 +299,7 @@ impl<'f> VaList<'f> { // Checks (via an assert in `compiler/rustc_ty_utils/src/abi.rs`) that the C ABI for the current // target correctly implements `rustc_pass_indirectly_in_non_rustic_abis`. +#[cfg(not(target_arch = "spirv"))] const _: () = { #[repr(C)] #[rustc_pass_indirectly_in_non_rustic_abis] diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index 93b65dbec905e..3ce1f728b90cb 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -330,7 +330,7 @@ impl Step for Llvm { Some(s) => s, None => { "AArch64;AMDGPU;ARM;BPF;Hexagon;LoongArch;MSP430;Mips;NVPTX;PowerPC;RISCV;\ - Sparc;SystemZ;WebAssembly;X86" + Sparc;SPIRV;SystemZ;WebAssembly;X86" } }; @@ -1050,9 +1050,15 @@ impl Step for OmpOffload { .profile(profile) .env("LLVM_CONFIG_REAL", &host_llvm_config) .define("LLVM_ENABLE_ASSERTIONS", "ON") - .define("LLVM_ENABLE_RUNTIMES", "openmp;offload") + .define("LLVM_ENABLE_RUNTIMES", "openmp;offload;libsycl") + .define("LLVM_RUNTIME_TARGETS", "spirv64-intel-unknown") + .define("LIBOMPTARGET_PLUGINS_TO_BUILD", "level_zero") + .define("RUNTIMES_spirv64-intel-unknown_LLVM_ENABLE_RUNTIMES", "openmp") .define("LLVM_INCLUDE_TESTS", "OFF") .define("OFFLOAD_INCLUDE_TESTS", "OFF") + .define("CMAKE_C_COMPILER", "clang") + .define("CMAKE_CXX_COMPILER", "clang++") + .define("OFFLOAD_INCLUDE_TESTS", "OFF") .define("OPENMP_STANDALONE_BUILD", "ON") .define("LLVM_ROOT", builder.llvm_out(target).join("build")) .define("LLVM_DIR", llvm_cmake_dir); diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index 7150b2b0d59f2..dc3c51ab7bf6f 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -259,6 +259,10 @@ impl Cargo { let target = self.target; let compiler = self.compiler; + if target.contains("spirv") { + return self; + } + // Dealing with rpath here is a little special, so let's go into some // detail. First off, `-rpath` is a linker option on Unix platforms // which adds to the runtime dynamic loader path when looking for diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs index 235bbf8ddb783..22d898cbb6dfd 100644 --- a/src/bootstrap/src/core/sanity.rs +++ b/src/bootstrap/src/core/sanity.rs @@ -43,6 +43,8 @@ const STAGE0_MISSING_TARGETS: &[&str] = &[ "thumbv7r-none-eabi", "thumbv7r-none-eabihf", "thumbv8r-none-eabihf", + "spirv-unknown-vulkan1.3", + "spirv64-intel-unknown", ]; /// Minimum version threshold for libstdc++ required when using prebuilt LLVM @@ -249,6 +251,10 @@ than building it. continue; } + if target.contains("spirv") { + continue; + } + // skip check for cross-targets if skip_target_sanity && target != &build.host_target { continue; @@ -357,7 +363,7 @@ than building it. } } - if (target.contains("-none-") || target.contains("nvptx")) + if (target.contains("-none-") || target.contains("nvptx") || target.contains("spirv")) && build.no_std(*target) == Some(false) { panic!("All the *-none-* and nvptx* targets are no-std targets") diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs index 0662ae304ac06..a0b6cab254c92 100644 --- a/src/bootstrap/src/utils/cc_detect.rs +++ b/src/bootstrap/src/utils/cc_detect.rs @@ -105,6 +105,10 @@ pub fn fill_target_compiler(build: &mut Build, target: TargetSelection) { cfg.compiler(cc); } + if target.contains("spirv") { + return; + } + let compiler = cfg.get_compiler(); let ar = if let ar @ Some(..) = config.and_then(|c| c.ar.clone()) { ar diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs index c670ae88fc549..8d76145935cac 100644 --- a/src/bootstrap/src/utils/helpers.rs +++ b/src/bootstrap/src/utils/helpers.rs @@ -219,6 +219,7 @@ pub fn use_host_linker(target: TargetSelection) -> bool { !(target.contains("emscripten") || target.contains("wasm32") || target.contains("nvptx") + || target.contains("spirv") || target.contains("fortanix") || target.contains("fuchsia") || target.contains("bpf") diff --git a/src/build_helper/src/targets.rs b/src/build_helper/src/targets.rs index cccc413368bc9..ed9037a56a7be 100644 --- a/src/build_helper/src/targets.rs +++ b/src/build_helper/src/targets.rs @@ -7,5 +7,6 @@ pub fn target_supports_std(target_tuple: &str) -> bool { !(target_tuple.contains("-none") || target_tuple.contains("nvptx") - || target_tuple.contains("switch")) + || target_tuple.contains("switch") + || target_tuple.contains("spirv")) } diff --git a/src/ci/docker/scripts/build-clang.sh b/src/ci/docker/scripts/build-clang.sh index 905c407730429..67a3253dec44c 100755 --- a/src/ci/docker/scripts/build-clang.sh +++ b/src/ci/docker/scripts/build-clang.sh @@ -5,7 +5,8 @@ set -ex source shared.sh # Try to keep the LLVM version here in sync with src/ci/scripts/install-clang.sh -LLVM=llvmorg-21.1.0-rc2 +#LLVM=llvmorg-21.1.0-rc2 +LLVM=9e78d8a4fb0739455ecdfd1751b347fbd7038c13 mkdir llvm-project cd llvm-project diff --git a/src/doc/rustc-dev-guide/src/offload/usage.md b/src/doc/rustc-dev-guide/src/offload/usage.md index 4d3222123aaff..4d1665fbb960c 100644 --- a/src/doc/rustc-dev-guide/src/offload/usage.md +++ b/src/doc/rustc-dev-guide/src/offload/usage.md @@ -7,6 +7,8 @@ We currently work on launching the following Rust kernel on the GPU. To follow a #![feature(abi_gpu_kernel)] #![feature(rustc_attrs)] #![feature(core_intrinsics)] +#![feature(rustc_private)] +#![allow(internal_features)] #![no_std] #[cfg(target_os = "linux")] @@ -56,8 +58,8 @@ fn main() { } #[inline(never)] -unsafe fn kernel(x: *mut [f64; 256]) { - core::intrinsics::offload(_kernel_1, [256, 1, 1], [32, 1, 1], (x,)) +pub unsafe fn kernel(x: *mut [f64; 256]) { + core::intrinsics::offload(kernel_1, [256, 1, 1], [32, 1, 1], (x,)) } #[cfg(target_os = "linux")] @@ -78,20 +80,24 @@ pub extern "gpu-kernel" fn kernel_1(x: *mut [f64; 256]) { It is important to use a clang compiler build on the same llvm as rustc. Just calling clang without the full path will likely use your system clang, which probably will be incompatible. So either substitute clang/lld invocations below with absolute path, or set your `PATH` accordingly. First we generate the device (gpu) code. Replace the target-cpu with the right code for your gpu. +Replace the $target according to your gpu vendor: +* AMD: amdgcn-amd-amdhsa +* NVIDIA: nvptx64-nvidia-cuda +* INTEL: spirv64-intel-unknown (doesn't need target cpu) ``` -RUSTFLAGS="-Ctarget-cpu=gfx90a --emit=llvm-bc,llvm-ir -Zoffload=Device -Csave-temps -Zunstable-options" cargo +offload build -Zunstable-options -r -v --target amdgcn-amd-amdhsa -Zbuild-std=core +RUSTFLAGS="-Ctarget-cpu=gfx90a --emit=llvm-bc,llvm-ir -Zoffload=Device -Csave-temps -Zunstable-options" cargo +offload build -Zunstable-options -r -v --target $target -Zbuild-std=core ``` You might afterwards need to copy your target/release/deps/.bc to lib.bc for now, before the next step. Now we generate the host (cpu) code. ``` -RUSTFLAGS="--emit=llvm-bc,llvm-ir -Csave-temps -Zoffload=Host=/p/lustre1/drehwald1/prog/offload/r/target/amdgcn-amd-amdhsa/release/deps/host.out -Zunstable-options" cargo +offload build -r +RUSTFLAGS="--emit=llvm-bc,llvm-ir -Csave-temps -Zoffload=Host=/p/lustre1/drehwald1/prog/offload/r/target/$target/release/deps/host.out -Zunstable-options" cargo +offload build -r ``` This call also does a lot of work and generates multiple intermediate files for llvm offload. While we integrated most offload steps into rustc by now, one binary invocation still remains for now: ``` -"clang-linker-wrapper" "--should-extract=gfx90a" "--device-compiler=amdgcn-amd-amdhsa=-g" "--device-compiler=amdgcn-amd-amdhsa=-save-temps=cwd" "--device-linker=amdgcn-amd-amdhsa=-lompdevice" "--host-triple=x86_64-unknown-linux-gnu" "--save-temps" "--linker-path=/ABSOlUTE_PATH_TO/rust/build/x86_64-unknown-linux-gnu/lld/bin/ld.lld" "--hash-style=gnu" "--eh-frame-hdr" "-m" "elf_x86_64" "-pie" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "bare" "/lib/../lib64/Scrt1.o" "/lib/../lib64/crti.o" "/ABSOLUTE_PATH_TO/crtbeginS.o" "-L/ABSOLUTE_PATH_TO/rust/build/x86_64-unknown-linux-gnu/llvm/bin/../lib/x86_64-unknown-linux-gnu" "-L/ABSOLUTE_PATH_TO/rust/build/x86_64-unknown-linux-gnu/llvm/lib/clang/21/lib/x86_64-unknown-linux-gnu" "-L/lib/../lib64" "-L/usr/lib64" "-L/lib" "-L/usr/lib" "target//release/host.o" "-lstdc++" "-lm" "-lomp" "-lomptarget" "-L/ABSOLUTE_PATH_TO/rust/build/x86_64-unknown-linux-gnu/llvm/lib" "-lgcc_s" "-lgcc" "-lpthread" "-lc" "-lgcc_s" "-lgcc" "/ABSOLUTE_PATH_TO/crtendS.o" "/lib/../lib64/crtn.o" +"clang-linker-wrapper" "--should-extract=gfx90a" "--device-compiler=$target=-g" "--device-compiler=$target=-save-temps=cwd" "--device-linker=$target=-lompdevice" "--host-triple=x86_64-unknown-linux-gnu" "--save-temps" "--linker-path=/ABSOlUTE_PATH_TO/rust/build/x86_64-unknown-linux-gnu/lld/bin/ld.lld" "--hash-style=gnu" "--eh-frame-hdr" "-m" "elf_x86_64" "-pie" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "bare" "/lib/../lib64/Scrt1.o" "/lib/../lib64/crti.o" "/ABSOLUTE_PATH_TO/crtbeginS.o" "-L/ABSOLUTE_PATH_TO/rust/build/x86_64-unknown-linux-gnu/llvm/bin/../lib/x86_64-unknown-linux-gnu" "-L/ABSOLUTE_PATH_TO/rust/build/x86_64-unknown-linux-gnu/llvm/lib/clang/21/lib/x86_64-unknown-linux-gnu" "-L/lib/../lib64" "-L/usr/lib64" "-L/lib" "-L/usr/lib" "target//release/host.o" "-lstdc++" "-lm" "-lomp" "-lomptarget" "-L/ABSOLUTE_PATH_TO/rust/build/x86_64-unknown-linux-gnu/llvm/lib" "-lgcc_s" "-lgcc" "-lpthread" "-lc" "-lgcc_s" "-lgcc" "/ABSOLUTE_PATH_TO/crtendS.o" "/lib/../lib64/crtn.o" ``` You can try to find the paths to those files on your system. However, I recommend to not fix the paths, but rather just re-generate them by copying a bare-mode openmp example and compiling it with your clang. By adding `-###` to your clang invocation, you can see the invidual steps. diff --git a/src/llvm-project b/src/llvm-project index 00d23d10dc48c..bb719bed6ca80 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 00d23d10dc48c6bb9d57ba96d4a748d85d77d0c7 +Subproject commit bb719bed6ca80e5dd4157690f22de601da8975a4 diff --git a/src/tools/tidy/src/target_specific_tests.rs b/src/tools/tidy/src/target_specific_tests.rs index 11138de5de764..3a5cc900c7678 100644 --- a/src/tools/tidy/src/target_specific_tests.rs +++ b/src/tools/tidy/src/target_specific_tests.rs @@ -115,6 +115,7 @@ fn arch_to_llvm_component(arch: &str) -> String { _ if arch.starts_with("mips") => "mips".into(), _ if arch.starts_with("powerpc") => "powerpc".into(), _ if arch.starts_with("riscv") => "riscv".into(), + _ if arch.starts_with("spirv") => "spirv".into(), _ => arch.to_ascii_lowercase(), } } diff --git a/tests/assembly-llvm/targets/targets-spirv.rs b/tests/assembly-llvm/targets/targets-spirv.rs new file mode 100644 index 0000000000000..5704d790dbddd --- /dev/null +++ b/tests/assembly-llvm/targets/targets-spirv.rs @@ -0,0 +1,29 @@ +// @ add-minicore +//@ assembly-output: emit-asm +//@ revisions: spirv_unknown_vulkan1_3 +//@ [spirv_unknown_vulkan1_3] compile-flags: --target spirv-unknown-vulkan1.3 +//@ [spirv_unknown_vulkan1_3] needs-llvm-components: spirv + +// Sanity-check that each target can produce assembly code. + +#![feature(no_core, lang_items, never_type)] +#![no_std] +// #![no_core] +#![crate_type = "lib"] + +pub enum A { + Foo(u8), + Bar(u32), +} + +// extern crate minicore; +// use minicore::*; +#[unsafe(no_mangle)] +pub fn test(x: &mut A) -> u8 { + match x { + A::Foo(x) => *x, + A::Bar(b) => *b as u8 + 2, + } +} + +// CHECK: what diff --git a/tests/assembly-llvm/targets/targets-spirv64-intel.rs b/tests/assembly-llvm/targets/targets-spirv64-intel.rs new file mode 100644 index 0000000000000..6a3f4ca9fc1a3 --- /dev/null +++ b/tests/assembly-llvm/targets/targets-spirv64-intel.rs @@ -0,0 +1,21 @@ +//@ add-minicore +//@ assembly-output: emit-asm +//@ revisions: spirv64_intel_unknown +//@ [spirv64_intel_unknown] compile-flags: --target spirv64-intel-unknown +//@ [spirv64_intel_unknown] needs-llvm-components: spirv + +// Sanity-check that each target can produce assembly code. + +#![feature(no_core, lang_items, never_type)] +#![no_std] +#![no_core] +#![crate_type = "lib"] + +extern crate minicore; +use minicore::*; + +pub fn test() -> u8 { + 42 +} + +// CHECK: OpCapability Kernel diff --git a/tests/codegen-llvm/gpu-kernel-abi.rs b/tests/codegen-llvm/gpu-kernel-abi.rs index 828b10c37880d..894447fded2d8 100644 --- a/tests/codegen-llvm/gpu-kernel-abi.rs +++ b/tests/codegen-llvm/gpu-kernel-abi.rs @@ -1,11 +1,13 @@ // Checks that the gpu-kernel calling convention correctly translates to LLVM calling conventions. //@ add-minicore -//@ revisions: amdgpu nvptx +//@ revisions: amdgpu nvptx spirv //@ [amdgpu] compile-flags: --crate-type=rlib --target=amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 //@ [amdgpu] needs-llvm-components: amdgpu //@ [nvptx] compile-flags: --crate-type=rlib --target=nvptx64-nvidia-cuda //@ [nvptx] needs-llvm-components: nvptx +//@ [spirv] compile-flags: --crate-type=rlib --target=spirv64-intel-unknown +//@ [spirv] needs-llvm-components: spirv #![feature(no_core, lang_items, abi_gpu_kernel)] #![no_core] @@ -14,5 +16,6 @@ use minicore::*; // amdgpu: define amdgpu_kernel void @fun(i32 // nvptx: define ptx_kernel void @fun(i32 +// spirv: define spir_kernel void @fun(i32 #[no_mangle] pub extern "gpu-kernel" fn fun(_: i32) {} diff --git a/tests/codegen-llvm/gpu_offload/scalar_device.rs b/tests/codegen-llvm/gpu_offload/scalar_device.rs index 61772d4040636..79c7a2969cee2 100644 --- a/tests/codegen-llvm/gpu_offload/scalar_device.rs +++ b/tests/codegen-llvm/gpu_offload/scalar_device.rs @@ -1,9 +1,11 @@ //@ add-minicore -//@ revisions: amdgpu nvptx +//@ revisions: amdgpu nvptx spirv //@[nvptx] compile-flags: -Copt-level=0 -Zunstable-options -Zoffload=Device --target nvptx64-nvidia-cuda --crate-type=rlib //@[nvptx] needs-llvm-components: nvptx //@[amdgpu] compile-flags: -Copt-level=0 -Zunstable-options -Zoffload=Device --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 --crate-type=rlib //@[amdgpu] needs-llvm-components: amdgpu +//@[spirv] compile-flags: -Copt-level=0 -Zunstable-options -Zoffload=Device --target spirv64-intel-unknown --crate-type=rlib +//@[spirv] needs-llvm-components: spirv //@ no-prefer-dynamic //@ needs-offload @@ -18,6 +20,7 @@ extern crate minicore; // CHECK: ; Function Attrs // nvptx-NEXT: define ptx_kernel void @foo(ptr %dyn_ptr, ptr %0, i64 %1) // amdgpu-NEXT: define amdgpu_kernel void @foo(ptr %dyn_ptr, ptr %0, i64 %1) +// spirv-NEXT: define spir_kernel void @foo(ptr %dyn_ptr, ptr %0, i64 %1) // CHECK-NEXT: entry: // CHECK-NEXT: %2 = trunc i64 %1 to i32 // CHECK-NEXT: %3 = bitcast i32 %2 to float diff --git a/tests/ui/check-cfg/cfg-crate-features.stderr b/tests/ui/check-cfg/cfg-crate-features.stderr index 242883995488e..dd603f67f7eb0 100644 --- a/tests/ui/check-cfg/cfg-crate-features.stderr +++ b/tests/ui/check-cfg/cfg-crate-features.stderr @@ -24,7 +24,7 @@ warning: unexpected `cfg` condition value: `does_not_exist` LL | #![cfg(not(target(os = "does_not_exist")))] | ^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qurt`, `redox`, `rtems`, `solaris`, and `solid_asp3` and 14 more + = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qurt`, `redox`, `rtems`, `solaris`, and `solid_asp3` and 15 more = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr index 229390ab4600c..3d3df11ea1423 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr @@ -14,7 +14,7 @@ warning: unexpected `cfg` condition value: `value` LL | #[cfg(target_vendor = "value")] | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `openwrt`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `vex`, `win7`, and `wrs` + = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `intel`, `kmc`, `mti`, `nintendo`, `nvidia`, `openwrt`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `vex`, `win7`, and `wrs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `feature` diff --git a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr index 9281392b59ec3..e947eb17571c3 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr @@ -15,7 +15,7 @@ warning: unexpected `cfg` condition value: `value` LL | #[cfg(target_vendor = "value")] | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `openwrt`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `vex`, `win7`, and `wrs` + = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `intel`, `kmc`, `mti`, `nintendo`, `nvidia`, `openwrt`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `vex`, `win7`, and `wrs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `unk` diff --git a/tests/ui/check-cfg/exhaustive-names-values.full.stderr b/tests/ui/check-cfg/exhaustive-names-values.full.stderr index 9281392b59ec3..e947eb17571c3 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.full.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.full.stderr @@ -15,7 +15,7 @@ warning: unexpected `cfg` condition value: `value` LL | #[cfg(target_vendor = "value")] | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `openwrt`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `vex`, `win7`, and `wrs` + = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `intel`, `kmc`, `mti`, `nintendo`, `nvidia`, `openwrt`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `vex`, `win7`, and `wrs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `unk` diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr index efa0a7f4af9ac..6bd01d1b2240f 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -138,7 +138,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_arch = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_arch` are: `aarch64`, `amdgpu`, `arm`, `arm64ec`, `avr`, `bpf`, `csky`, `hexagon`, `loongarch32`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`, and `xtensa` + = note: expected values for `target_arch` are: `aarch64`, `amdgpu`, `arm`, `arm64ec`, `avr`, `bpf`, `csky`, `hexagon`, `loongarch32`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `spirv`, `wasm32`, `wasm64`, `x86`, `x86_64`, and `xtensa` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` @@ -201,7 +201,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_os = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qurt`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` + = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qurt`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vulkan`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` @@ -230,7 +230,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_vendor = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `openwrt`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `vex`, `win7`, and `wrs` + = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `intel`, `kmc`, `mti`, `nintendo`, `nvidia`, `openwrt`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `vex`, `win7`, and `wrs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` @@ -274,7 +274,7 @@ LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` | | | help: there is a expected value with a similar name: `"linux"` | - = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qurt`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` + = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qurt`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vulkan`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` = note: see for more information about checking conditional configuration warning: 28 warnings emitted diff --git a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.HOST.stderr b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.HOST.stderr index bbc6251601910..02d9316d9da6b 100644 --- a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.HOST.stderr +++ b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.HOST.stderr @@ -1,11 +1,11 @@ error[E0570]: "gpu-kernel" is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:17:8 + --> $DIR/feature-gate-abi_gpu_kernel.rs:19:8 | LL | extern "gpu-kernel" fn f1(_: ()) {} | ^^^^^^^^^^^^ error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:17:8 + --> $DIR/feature-gate-abi_gpu_kernel.rs:19:8 | LL | extern "gpu-kernel" fn f1(_: ()) {} | ^^^^^^^^^^^^ @@ -15,13 +15,13 @@ LL | extern "gpu-kernel" fn f1(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0570]: "gpu-kernel" is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:22:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:24:12 | LL | extern "gpu-kernel" fn m1(_: ()); | ^^^^^^^^^^^^ error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:22:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:24:12 | LL | extern "gpu-kernel" fn m1(_: ()); | ^^^^^^^^^^^^ @@ -31,13 +31,13 @@ LL | extern "gpu-kernel" fn m1(_: ()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0570]: "gpu-kernel" is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:25:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:27:12 | LL | extern "gpu-kernel" fn dm1(_: ()) {} | ^^^^^^^^^^^^ error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:25:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:27:12 | LL | extern "gpu-kernel" fn dm1(_: ()) {} | ^^^^^^^^^^^^ @@ -47,13 +47,13 @@ LL | extern "gpu-kernel" fn dm1(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0570]: "gpu-kernel" is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:33:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:35:12 | LL | extern "gpu-kernel" fn m1(_: ()) {} | ^^^^^^^^^^^^ error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:33:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:35:12 | LL | extern "gpu-kernel" fn m1(_: ()) {} | ^^^^^^^^^^^^ @@ -63,13 +63,13 @@ LL | extern "gpu-kernel" fn m1(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0570]: "gpu-kernel" is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:39:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:41:12 | LL | extern "gpu-kernel" fn im1(_: ()) {} | ^^^^^^^^^^^^ error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:39:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:41:12 | LL | extern "gpu-kernel" fn im1(_: ()) {} | ^^^^^^^^^^^^ @@ -79,13 +79,13 @@ LL | extern "gpu-kernel" fn im1(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0570]: "gpu-kernel" is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:44:18 + --> $DIR/feature-gate-abi_gpu_kernel.rs:46:18 | LL | type A1 = extern "gpu-kernel" fn(_: ()); | ^^^^^^^^^^^^ error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:44:18 + --> $DIR/feature-gate-abi_gpu_kernel.rs:46:18 | LL | type A1 = extern "gpu-kernel" fn(_: ()); | ^^^^^^^^^^^^ @@ -95,13 +95,13 @@ LL | type A1 = extern "gpu-kernel" fn(_: ()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0570]: "gpu-kernel" is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:48:8 + --> $DIR/feature-gate-abi_gpu_kernel.rs:50:8 | LL | extern "gpu-kernel" {} | ^^^^^^^^^^^^ error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:48:8 + --> $DIR/feature-gate-abi_gpu_kernel.rs:50:8 | LL | extern "gpu-kernel" {} | ^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.SPIRV.stderr b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.SPIRV.stderr new file mode 100644 index 0000000000000..5157b2c2198fa --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.SPIRV.stderr @@ -0,0 +1,73 @@ +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change + --> $DIR/feature-gate-abi_gpu_kernel.rs:19:8 + | +LL | extern "gpu-kernel" fn f1(_: ()) {} + | ^^^^^^^^^^^^ + | + = note: see issue #135467 for more information + = help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change + --> $DIR/feature-gate-abi_gpu_kernel.rs:24:12 + | +LL | extern "gpu-kernel" fn m1(_: ()); + | ^^^^^^^^^^^^ + | + = note: see issue #135467 for more information + = help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change + --> $DIR/feature-gate-abi_gpu_kernel.rs:27:12 + | +LL | extern "gpu-kernel" fn dm1(_: ()) {} + | ^^^^^^^^^^^^ + | + = note: see issue #135467 for more information + = help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change + --> $DIR/feature-gate-abi_gpu_kernel.rs:35:12 + | +LL | extern "gpu-kernel" fn m1(_: ()) {} + | ^^^^^^^^^^^^ + | + = note: see issue #135467 for more information + = help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change + --> $DIR/feature-gate-abi_gpu_kernel.rs:41:12 + | +LL | extern "gpu-kernel" fn im1(_: ()) {} + | ^^^^^^^^^^^^ + | + = note: see issue #135467 for more information + = help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change + --> $DIR/feature-gate-abi_gpu_kernel.rs:46:18 + | +LL | type A1 = extern "gpu-kernel" fn(_: ()); + | ^^^^^^^^^^^^ + | + = note: see issue #135467 for more information + = help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change + --> $DIR/feature-gate-abi_gpu_kernel.rs:50:8 + | +LL | extern "gpu-kernel" {} + | ^^^^^^^^^^^^ + | + = note: see issue #135467 for more information + = help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs index d442c9317f64e..aed8c48cf6b7b 100644 --- a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs +++ b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs @@ -1,10 +1,12 @@ -//@ revisions: HOST AMDGPU NVPTX +//@ revisions: HOST AMDGPU NVPTX SPIRV //@ add-minicore //@ compile-flags: --crate-type=rlib //@[AMDGPU] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx1100 //@[AMDGPU] needs-llvm-components: amdgpu //@[NVPTX] compile-flags: --target nvptx64-nvidia-cuda //@[NVPTX] needs-llvm-components: nvptx +//@[SPIRV] compile-flags: --target spirv64-intel-unknown +//@[SPIRV] needs-llvm-components: spirv //@ ignore-backends: gcc #![feature(no_core, lang_items)]