Skip to content

Add auto-bitcasts between x86amx and i32x256 for AMX intrinsics #140763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sayantn
Copy link
Contributor

@sayantn sayantn commented May 7, 2025

I tried adding support for AMX Tile types to Rust. They are very simple - the LLVM intrinsics operate on x86amx types, and all that is needed for us to call those intrinsics is inserting bitcasts to/from x86amx and i32x256 before and after the function call (as in this file in LLVM)

I tested the codegen for this fragment
test.rs

#![feature(
    link_llvm_intrinsics,
    abi_unadjusted,
    x86_amx_intrinsics,
    repr_simd,
    simd_ffi
)]
#![allow(internal_features)]

#[repr(simd)]
pub struct Tile([u32; 256]);

#[allow(improper_ctypes)]
unsafe extern "unadjusted" {
    #[link_name = "llvm.x86.tdpbuud.internal"]
    fn tdpbuud(m: u16, n: u16, k: u16, a: Tile, b: Tile, c: Tile) -> Tile;
}

#[unsafe(no_mangle)]
#[target_feature(enable = "amx-int8")]
pub fn foo(m: u16, n: u16, k: u16, a: Tile, b: Tile, c: Tile) -> Tile {
    unsafe { tdpbuud(m, n, k, a, b, c) }
}

The LLVM IR generated is (output of rustc +stage1 --emit=llvm-ir --crate-type=rlib test.rs && cat test.ll)

; ModuleID = 'test.4707fbd51808b46e-cgu.0'
source_filename = "test.4707fbd51808b46e-cgu.0"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nonlazybind uwtable
define void @foo(ptr sret([1024 x i8]) align 1024 %_0, i16 %m, i16 %n, i16 %k, ptr align 1024 %a, ptr align 1024 %b, ptr align 1024 %c) unnamed_addr #0 {
start:
  %0 = load <256 x i32>, ptr %a, align 1024
  %1 = load <256 x i32>, ptr %b, align 1024
  %2 = load <256 x i32>, ptr %c, align 1024
  %3 = call x86_amx @llvm.x86.cast.vector.to.tile.v256i32(<256 x i32> %0)
  %4 = call x86_amx @llvm.x86.cast.vector.to.tile.v256i32(<256 x i32> %1)
  %5 = call x86_amx @llvm.x86.cast.vector.to.tile.v256i32(<256 x i32> %2)
  %6 = call x86_amx @llvm.x86.tdpbuud.internal(i16 %m, i16 %n, i16 %k, x86_amx %3, x86_amx %4, x86_amx %5) #1
  %7 = call <256 x i32> @llvm.x86.cast.tile.to.vector.v256i32(x86_amx %6)
  store <256 x i32> %7, ptr %_0, align 1024
  ret void
}

; Function Attrs: nounwind
declare x86_amx @llvm.x86.tdpbuud.internal(i16, i16, i16, x86_amx, x86_amx, x86_amx) unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare x86_amx @llvm.x86.cast.vector.to.tile.v256i32(<256 x i32>) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare <256 x i32> @llvm.x86.cast.tile.to.vector.v256i32(x86_amx) #2

attributes #0 = { nonlazybind uwtable "probe-stack"="inline-asm" "target-cpu"="x86-64" "target-features"="+amx-int8,+amx-tile" }
attributes #1 = { nounwind }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(none) }

!llvm.module.flags = !{!0, !1}
!llvm.ident = !{!2}

!0 = !{i32 8, !"PIC Level", i32 2}
!1 = !{i32 2, !"RtLibUseGOT", i32 1}
!2 = !{!"rustc version 1.89.0-dev"}

and the ASM generated is (output of rustc +stage1 --emit=asm --crate-type=rlib -O test.rs && cat test.s)

	.file	"test.4707fbd51808b46e-cgu.0"
	.section	.text.foo,"ax",@progbits
	.globl	foo
	.p2align	4
	.type	foo,@function
foo:
	.cfi_startproc
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rax
	xorps	%xmm0, %xmm0
	movups	%xmm0, -64(%rsp)
	movups	%xmm0, -48(%rsp)
	movups	%xmm0, -32(%rsp)
	movups	%xmm0, -16(%rsp)
	movb	$1, -64(%rsp)
	movw	%dx, -44(%rsp)
	movb	%sil, -15(%rsp)
	movw	%dx, -48(%rsp)
	movb	%sil, -16(%rsp)
	movzwl	%cx, %edi
	movw	%di, -46(%rsp)
	movq	16(%rsp), %r10
	movl	%edi, %r11d
	movb	%r11b, -14(%rsp)
	shrl	$2, %r11d
	movb	%r11b, -14(%rsp)
	movswq	%dx, %rbx
	ldtilecfg	-64(%rsp)
	tileloadd	(%r8,%rbx), %tmm0
	movswq	%cx, %rcx
	tileloadd	(%r9,%rcx), %tmm1
	tileloadd	(%r10,%rbx), %tmm2
	tdpbuud	%tmm2, %tmm1, %tmm0
	tilestored	%tmm0, (%rax,%rbx)
	popq	%rbx
	.cfi_def_cfa_offset 8
	tilerelease
	retq
.Lfunc_end0:
	.size	foo, .Lfunc_end0-foo
	.cfi_endproc

	.ident	"rustc version 1.89.0-dev"
	.section	".note.GNU-stack","",@progbits

(note: the tests were done on x86_64-unknown-linux-gnu)

This is pretty similar to the CLang codegen (https://godbolt.org/z/G19rjo3Ke).

Reviews are welcome, as I am not too confident in the code (I am still not sure if the checks for AMX are strict enough, I will try strengthen them).

Unresolved Questions

  • Are bitcast's good enough? CLang uses llvm.x86.cast.vector.to.tile.v256i32 and llvm.x86.cast.tile.to.vector.v256i32, is there any functional difference with bitcasts? turns out bitcast can cause miscompilation (https://reviews.llvm.org/D99152), so we have to use the amx-specific casts
  • Should we allow only i32x256, or all vector types of size 8192? The LLVM file I referenced only does this for i32x256, but there is really not a reason to be restrictive.

@rustbot label O-x86_64 T-compiler
r? codegen

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. O-x86_64 Target: x86-64 processors (like x86_64-*) (also known as amd64 and x64) labels May 7, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 8, 2025

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

@sayantn

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented May 8, 2025

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

@rust-log-analyzer

This comment has been minimized.

@sayantn sayantn changed the title Add auto-bitcasts from/to x86amx and i32x256 for AMX intrinsics Add auto-bitcasts from/to x86amx for i32x256 for AMX intrinsics May 8, 2025
@sayantn sayantn changed the title Add auto-bitcasts from/to x86amx for i32x256 for AMX intrinsics Add auto-bitcasts between x86amx and i32x256 for AMX intrinsics May 8, 2025
@sayantn

This comment has been minimized.

@dianqk
Copy link
Member

dianqk commented May 9, 2025

I think you can use LLVMGetIntrinsicDeclaration, LLVMGetIntrinsicDeclaration or some functions in Intrinsic.h in declare_raw_fn, as a reference: https://github.com/llvm/llvm-project/blob/d35ad58859c97521edab7b2eddfa9fe6838b9a5e/llvm/lib/AsmParser/LLParser.cpp#L330-L335.

@sayantn
Copy link
Contributor Author

sayantn commented May 9, 2025

That can be used to improve performance, I am not really focusing on performance in this PR. I want to currently emphasize the correctness of the codegen.

@sayantn
Copy link
Contributor Author

sayantn commented May 9, 2025

Oh wait, I probably misunderstood your comment, you meant using the llvm declaration by itself. Yeah, that would be better, thanks for the info. I will update the impl when I get the chance

@dianqk
Copy link
Member

dianqk commented May 15, 2025

Oh wait, I probably misunderstood your comment, you meant using the llvm declaration by itself. Yeah, that would be better, thanks for the info. I will update the impl when I get the chance

I think you can just focus on non-overloaded functions for this PR. Overloaded functions and type checking that checking Rust function signatures using LLVM defined can be subsequent PRs.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 15, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 15, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@sayantn

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] cc test:false 0.534
   Compiling compiler_builtins v0.1.159
[RUSTC-TIMING] build_script_build test:false 0.288
   Compiling rustc-std-workspace-core v1.99.0 (/checkout/library/rustc-std-workspace-core)
rustc: /checkout/src/llvm-project/llvm/lib/IR/Intrinsics.cpp:690: std::pair<ArrayRef<unsigned int>, StringRef> findTargetSubtable(StringRef): Assertion `Name.starts_with("llvm.")' failed.
[RUSTC-TIMING] rustc_std_workspace_core test:false 0.030
[RUSTC-TIMING] libc test:false 1.782
   Compiling alloc v0.0.0 (/checkout/library/alloc)
   Compiling cfg-if v1.0.0
   Compiling adler2 v2.0.0
   Compiling memchr v2.7.4
   Compiling rustc-demangle v0.1.24
   Compiling panic_abort v0.0.0 (/checkout/library/panic_abort)
rustc: /checkout/src/llvm-project/llvm/lib/IR/Intrinsics.cpp:690: std::pair<ArrayRef<unsigned int>, StringRef> findTargetSubtable(StringRef): Assertion `Name.starts_with("llvm.")' failed.
   Compiling unwind v0.0.0 (/checkout/library/unwind)
rustc: /checkout/src/llvm-project/llvm/lib/IR/Intrinsics.cpp:690: std::pair<ArrayRef<unsigned int>, StringRef> findTargetSubtable(StringRef): Assertion `Name.starts_with("llvm.")' failed.
[RUSTC-TIMING] cfg_if test:false 0.037
rustc: /checkout/src/llvm-project/llvm/lib/IR/Intrinsics.cpp:690: std::pair<ArrayRef<unsigned int>, StringRef> findTargetSubtable(StringRef): Assertion `Name.starts_with("llvm.")' failed.
[RUSTC-TIMING] unwind test:false 0.065
[RUSTC-TIMING] panic_abort test:false 0.308
rustc exited with signal: 6 (SIGABRT) (core dumped)
error: could not compile `panic_abort` (lib)

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc /checkout/obj/build/bootstrap/debug/rustc --crate-name panic_abort --edition=2024 library/panic_abort/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -C debug-assertions=on --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=9a687d0f894692a0 -C extra-filename=-1595625563df7550 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern compiler_builtins=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcompiler_builtins-3b881170269c3765.rmeta --extern core=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-cb7d263a0f2eedd1.rmeta -Csymbol-mangling-version=v0 '--check-cfg=cfg(feature,values(any()))' -Zunstable-options '--check-cfg=cfg(bootstrap)' -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Alinker-messages -Cembed-bitcode=yes -Cforce-frame-pointers=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-b88ca2fb4d6611a2/out` (exit status: 254)
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] adler2 test:false 0.391
rustc exited with signal: 6 (SIGABRT) (core dumped)
error: could not compile `adler2` (lib)

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc /checkout/obj/build/bootstrap/debug/rustc --crate-name adler2 --edition=2021 /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/adler2-2.0.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -C debug-assertions=on --cfg 'feature="compiler_builtins"' --cfg 'feature="core"' --cfg 'feature="rustc-dep-of-std"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("compiler_builtins", "core", "default", "rustc-dep-of-std", "std"))' -C metadata=055713c43b208f45 -C extra-filename=-1616880c6d69ee09 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C strip=debuginfo -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern compiler_builtins=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcompiler_builtins-3b881170269c3765.rmeta --extern core=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/librustc_std_workspace_core-1e0d89774044867a.rmeta --cap-lints allow -Csymbol-mangling-version=v0 '--check-cfg=cfg(feature,values(any()))' -Zunstable-options '--check-cfg=cfg(bootstrap)' -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Alinker-messages -Cembed-bitcode=yes -Cforce-frame-pointers=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-b88ca2fb4d6611a2/out` (exit status: 254)
rustc: /checkout/src/llvm-project/llvm/lib/IR/Intrinsics.cpp:690: std::pair<ArrayRef<unsigned int>, StringRef> findTargetSubtable(StringRef): Assertion `Name.starts_with("llvm.")' failed.
[RUSTC-TIMING] compiler_builtins test:false 3.297
rustc exited with signal: 6 (SIGABRT) (core dumped)
error: could not compile `compiler_builtins` (lib)

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc /checkout/obj/build/bootstrap/debug/rustc --crate-name compiler_builtins --edition=2021 /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/compiler_builtins-0.1.159/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=10000 --warn=unexpected_cfgs --check-cfg 'cfg(bootstrap)' --check-cfg 'cfg(target_os, values("cygwin"))' -C debug-assertions=on --cfg 'feature="c"' --cfg 'feature="compiler-builtins"' --cfg 'feature="default"' --cfg 'feature="rustc-dep-of-std"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("c", "compiler-builtins", "default", "mangled-names", "mem", "no-asm", "no-f16-f128", "rustc-dep-of-std", "unstable-public-internals"))' -C metadata=919ee2511425e9b1 -C extra-filename=-3b881170269c3765 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C strip=debuginfo -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern core=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/librustc_std_workspace_core-1e0d89774044867a.rmeta --cap-lints allow -Csymbol-mangling-version=v0 '--check-cfg=cfg(feature,values(any()))' -Zunstable-options '--check-cfg=cfg(bootstrap)' -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Alinker-messages -Cembed-bitcode=yes -Cforce-frame-pointers=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-b88ca2fb4d6611a2/out -l static=compiler-rt --cfg f16_enabled --cfg f128_enabled --cfg intrinsics_enabled --cfg arch_enabled --cfg optimizations_enabled --cfg 'feature="unstable-intrinsics"' --cfg 'feature="mem-unaligned"' --cfg '__absvdi2="optimized-c"' --cfg '__absvsi2="optimized-c"' --cfg '__absvti2="optimized-c"' --cfg '__addvdi3="optimized-c"' --cfg '__addvsi3="optimized-c"' --cfg '__addvti3="optimized-c"' --cfg '__cmpdi2="optimized-c"' --cfg '__cmpti2="optimized-c"' --cfg '__divdc3="optimized-c"' --cfg '__divsc3="optimized-c"' --cfg '__ffsti2="optimized-c"' --cfg '__int_util="optimized-c"' --cfg '__muldc3="optimized-c"' --cfg '__mulsc3="optimized-c"' --cfg '__mulvdi3="optimized-c"' --cfg '__mulvsi3="optimized-c"' --cfg '__mulvti3="optimized-c"' --cfg '__negdf2="optimized-c"' --cfg '__negdi2="optimized-c"' --cfg '__negsf2="optimized-c"' --cfg '__negti2="optimized-c"' --cfg '__negvdi2="optimized-c"' --cfg '__negvsi2="optimized-c"' --cfg '__negvti2="optimized-c"' --cfg '__paritydi2="optimized-c"' --cfg '__paritysi2="optimized-c"' --cfg '__parityti2="optimized-c"' --cfg '__popcountdi2="optimized-c"' --cfg '__popcountsi2="optimized-c"' --cfg '__popcountti2="optimized-c"' --cfg '__subvdi3="optimized-c"' --cfg '__subvsi3="optimized-c"' --cfg '__subvti3="optimized-c"' --cfg '__ucmpdi2="optimized-c"' --cfg '__ucmpti2="optimized-c"' --check-cfg 'cfg(__ashldi3, values("optimized-c"))' --check-cfg 'cfg(__ashlsi3, values("optimized-c"))' --check-cfg 'cfg(__ashrdi3, values("optimized-c"))' --check-cfg 'cfg(__ashrsi3, values("optimized-c"))' --check-cfg 'cfg(__bswapsi2, values("optimized-c"))' --check-cfg 'cfg(__bswapdi2, values("optimized-c"))' --check-cfg 'cfg(__bswapti2, values("optimized-c"))' --check-cfg 'cfg(__divdi3, values("optimized-c"))' --check-cfg 'cfg(__divsi3, values("optimized-c"))' --check-cfg 'cfg(__divmoddi4, values("optimized-c"))' --check-cfg 'cfg(__divmodsi4, values("optimized-c"))' --check-cfg 'cfg(__divmodsi4, values("optimized-c"))' --check-cfg 'cfg(__divmodti4, values("optimized-c"))' --check-cfg 'cfg(__lshrdi3, values("optimized-c"))' --check-cfg 'cfg(__lshrsi3, values("optimized-c"))' --check-cfg 'cfg(__moddi3, values("optimized-c"))' --check-cfg 'cfg(__modsi3, values("optimized-c"))' --check-cfg 'cfg(__muldi3, values("optimized-c"))' --check-cfg 'cfg(__udivdi3, values("optimized-c"))' --check-cfg 'cfg(__udivmoddi4, values("optimized-c"))' --check-cfg 'cfg(__udivmodsi4, values("optimized-c"))' --check-cfg 'cfg(__udivsi3, values("optimized-c"))' --check-cfg 'cfg(__umoddi3, values("optimized-c"))' --check-cfg 'cfg(__umodsi3, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas1_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas1_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas1_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas1_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas2_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas2_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas2_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas2_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas4_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas4_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas4_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas4_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas8_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas8_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas8_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas8_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas16_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas16_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas16_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas16_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd1_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd1_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd1_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd1_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd2_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd2_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd2_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd2_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd4_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd4_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd4_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd4_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd8_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd8_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd8_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd8_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr1_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr1_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr1_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr1_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr2_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr2_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr2_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr2_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr4_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr4_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr4_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr4_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr8_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr8_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr8_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr8_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor1_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor1_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor1_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor1_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor2_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor2_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor2_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor2_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor4_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor4_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor4_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor4_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor8_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor8_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor8_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor8_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset1_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset1_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset1_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset1_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset2_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset2_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset2_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset2_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset4_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset4_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset4_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset4_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset8_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset8_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset8_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset8_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp1_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp1_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp1_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp1_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp2_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp2_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp2_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp2_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp4_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp4_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp4_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp4_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp8_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp8_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp8_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp8_acq_rel, values("optimized-c"))' --check-cfg 'cfg(target_feature, values("vis3"))' --check-cfg 'cfg(feature, values("checked"))' --check-cfg 'cfg(assert_no_panic)' --check-cfg 'cfg(f16_enabled)' --check-cfg 'cfg(f128_enabled)' --check-cfg 'cfg(thumb)' --check-cfg 'cfg(thumb_1)' --check-cfg 'cfg(intrinsics_enabled)' --check-cfg 'cfg(arch_enabled)' --check-cfg 'cfg(optimizations_enabled)' --check-cfg 'cfg(feature, values("unstable-public-internals"))' --check-cfg 'cfg(optimizations_enabled)' --check-cfg 'cfg(x86_no_sse)' --check-cfg 'cfg(feature, values("mem-unaligned"))' --check-cfg 'cfg(kernel_user_helpers)'` (exit status: 254)
[RUSTC-TIMING] rustc_demangle test:false 0.854
rustc exited with signal: 6 (SIGABRT) (core dumped)
error: could not compile `rustc-demangle` (lib)

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc /checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_demangle --edition=2015 /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustc-demangle-0.1.24/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=s -C embed-bitcode=no -C codegen-units=1 -C debug-assertions=on --cfg 'feature="compiler_builtins"' --cfg 'feature="core"' --cfg 'feature="rustc-dep-of-std"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("compiler_builtins", "core", "rustc-dep-of-std", "std"))' -C metadata=590bbef5694c949d -C extra-filename=-66bd0a58031d0865 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C strip=debuginfo -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern compiler_builtins=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcompiler_builtins-3b881170269c3765.rmeta --extern core=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/librustc_std_workspace_core-1e0d89774044867a.rmeta --cap-lints allow -Csymbol-mangling-version=v0 '--check-cfg=cfg(feature,values(any()))' -Zunstable-options '--check-cfg=cfg(bootstrap)' -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Alinker-messages -Cembed-bitcode=yes -Cforce-frame-pointers=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-b88ca2fb4d6611a2/out` (exit status: 254)
rustc: /checkout/src/llvm-project/llvm/lib/IR/Intrinsics.cpp:690: std::pair<ArrayRef<unsigned int>, StringRef> findTargetSubtable(StringRef): Assertion `Name.starts_with("llvm.")' failed.
[RUSTC-TIMING] memchr test:false 1.390
rustc exited with signal: 6 (SIGABRT) (core dumped)
error: could not compile `memchr` (lib)

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc /checkout/obj/build/bootstrap/debug/rustc --crate-name memchr --edition=2021 /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/memchr-2.7.4/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -C debug-assertions=on --cfg 'feature="compiler_builtins"' --cfg 'feature="core"' --cfg 'feature="rustc-dep-of-std"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("alloc", "compiler_builtins", "core", "default", "libc", "logging", "rustc-dep-of-std", "std", "use_std"))' -C metadata=a4281632f15e4b30 -C extra-filename=-9e35bc9be68171bf --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern compiler_builtins=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcompiler_builtins-3b881170269c3765.rmeta --extern core=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/librustc_std_workspace_core-1e0d89774044867a.rmeta --cap-lints allow -Csymbol-mangling-version=v0 '--check-cfg=cfg(feature,values(any()))' -Zunstable-options '--check-cfg=cfg(bootstrap)' -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Alinker-messages -Cembed-bitcode=yes -Cforce-frame-pointers=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-b88ca2fb4d6611a2/out` (exit status: 254)
[RUSTC-TIMING] core test:false 31.954
rustc exited with signal: 6 (SIGABRT) (core dumped)
error: could not compile `core` (lib)

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc /checkout/obj/build/bootstrap/debug/rustc --crate-name core --edition=2024 library/core/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 --warn=unexpected_cfgs --check-cfg 'cfg(bootstrap)' --check-cfg 'cfg(no_fp_fmt_parse)' --check-cfg 'cfg(feature, values(any()))' --check-cfg 'cfg(target_has_reliable_f16)' --check-cfg 'cfg(target_has_reliable_f16_math)' --check-cfg 'cfg(target_has_reliable_f128)' --check-cfg 'cfg(target_has_reliable_f128_math)' -C debug-assertions=on --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("debug_refcell", "debug_typeid", "optimize_for_size", "panic_immediate_abort"))' -C metadata=4f9217aff00f2171 -C extra-filename=-cb7d263a0f2eedd1 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/release/deps -Csymbol-mangling-version=v0 '--check-cfg=cfg(feature,values(any()))' -Zunstable-options '--check-cfg=cfg(bootstrap)' -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Alinker-messages -Cembed-bitcode=yes -Cforce-frame-pointers=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo` (exit status: 254)
rustc: /checkout/src/llvm-project/llvm/lib/IR/Intrinsics.cpp:690: std::pair<ArrayRef<unsigned int>, StringRef> findTargetSubtable(StringRef): Assertion `Name.starts_with("llvm.")' failed.
[RUSTC-TIMING] alloc test:false 6.029
rustc exited with signal: 6 (SIGABRT) (core dumped)
error: could not compile `alloc` (lib)

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc /checkout/obj/build/bootstrap/debug/rustc --crate-name alloc --edition=2024 library/alloc/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 --warn=unexpected_cfgs --check-cfg 'cfg(bootstrap)' --check-cfg 'cfg(no_global_oom_handling)' --check-cfg 'cfg(no_rc)' --check-cfg 'cfg(no_sync)' -C debug-assertions=on --cfg 'feature="compiler-builtins-c"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("compiler-builtins-c", "compiler-builtins-mangled-names", "compiler-builtins-mem", "compiler-builtins-no-asm", "compiler-builtins-no-f16-f128", "optimize_for_size", "panic_immediate_abort"))' -C metadata=d20b7cfdc1de3e6a -C extra-filename=-63a6955d11f7f394 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern 'priv:compiler_builtins=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcompiler_builtins-3b881170269c3765.rmeta' --extern core=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-cb7d263a0f2eedd1.rmeta -Z unstable-options -Csymbol-mangling-version=v0 '--check-cfg=cfg(feature,values(any()))' -Zunstable-options '--check-cfg=cfg(bootstrap)' -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Alinker-messages -Cembed-bitcode=yes -Cforce-frame-pointers=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-b88ca2fb4d6611a2/out` (exit status: 254)
Build completed unsuccessfully in 0:05:37
  local time: Sun May 18 15:37:29 UTC 2025
  network time: Sun, 18 May 2025 15:37:29 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

@sayantn sayantn marked this pull request as draft May 19, 2025 07:23
@nikic
Copy link
Contributor

nikic commented May 19, 2025

@sayantn Taking the address of an intrinsic is invalid LLVM IR.

@sayantn
Copy link
Contributor Author

sayantn commented May 19, 2025

@nikic nice, one less thing to worry about ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-x86_64 Target: x86-64 processors (like x86_64-*) (also known as amd64 and x64) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants