Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 936545 - sys-devel/llvm-17.0.6 test fail if LLVM_TARGETS : SPIRV
Summary: sys-devel/llvm-17.0.6 test fail if LLVM_TARGETS : SPIRV
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: LLVM support project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-23 10:40 UTC by Arniii
Modified: 2024-07-24 14:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
lzip tarball : emerge_--info.txt how_it_was_called.txt /var/tmp/portage/sys-devel/llvm-17.0.6/{temp/**,work/**.log} /var/log/portage/elog/sys-devel/llvm-17.0.6:20240723-090010.log /etc/portage/** (llvm-17.0.6_test_fail_SPIRV.tar.lz,708.21 KB, application/x-lzip)
2024-07-23 10:40 UTC, Arniii
Details
lzip tarball: emerge_--info.txt how_it_was_called.txt /var/tmp/portage/sys-devel/llvm-17.0.6/{temp/**,work/**.log} /var/log/portage/elog/sys-devel/llvm-17.0.6:20240723-231205.log /etc/portage/** (llvm-17.0.6_test_fail_SPIRV_-O2_-march=native_-ggdb3_-pipe.tar.lz,702.29 KB, application/x-lzip)
2024-07-24 08:00 UTC, Arniii
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arniii 2024-07-23 10:40:36 UTC
Created attachment 898187 [details]
lzip tarball : emerge_--info.txt how_it_was_called.txt /var/tmp/portage/sys-devel/llvm-17.0.6/{temp/**,work/**.log} /var/log/portage/elog/sys-devel/llvm-17.0.6:20240723-090010.log /etc/portage/**

I've added all LLVM_TARGETS to be included and there it is:

```
********************
Failed Tests (49):
  LLVM :: CodeGen/SPIRV/EnqueueEmptyKernel.ll
  LLVM :: CodeGen/SPIRV/SampledImageRetType.ll
  LLVM :: CodeGen/SPIRV/atomicrmw.ll
  LLVM :: CodeGen/SPIRV/constant/global-constants.ll
  LLVM :: CodeGen/SPIRV/constant/local-null-constants.ll
  LLVM :: CodeGen/SPIRV/function/alloca-load-store.ll
  LLVM :: CodeGen/SPIRV/half_extension.ll
  LLVM :: CodeGen/SPIRV/half_no_extension.ll
  LLVM :: CodeGen/SPIRV/image-unoptimized.ll
  LLVM :: CodeGen/SPIRV/image.ll
  LLVM :: CodeGen/SPIRV/image_decl_func_arg.ll
  LLVM :: CodeGen/SPIRV/image_dim.ll
  LLVM :: CodeGen/SPIRV/image_store.ll
  LLVM :: CodeGen/SPIRV/link-attribute.ll
  LLVM :: CodeGen/SPIRV/linked-list.ll
  LLVM :: CodeGen/SPIRV/literal-struct.ll
  LLVM :: CodeGen/SPIRV/llvm-intrinsics/memset.ll
  LLVM :: CodeGen/SPIRV/llvm-intrinsics/sqrt.ll
  LLVM :: CodeGen/SPIRV/opencl.queue_t.ll
  LLVM :: CodeGen/SPIRV/opencl/basic/get_global_offset.ll
  LLVM :: CodeGen/SPIRV/opencl/basic/progvar_prog_scope_init.ll
  LLVM :: CodeGen/SPIRV/opencl/basic/vstore_private.ll
  LLVM :: CodeGen/SPIRV/opencl/get_global_id.ll
  LLVM :: CodeGen/SPIRV/opencl/image.ll
  LLVM :: CodeGen/SPIRV/pstruct.ll
  LLVM :: CodeGen/SPIRV/read_image.ll
  LLVM :: CodeGen/SPIRV/struct.ll
  LLVM :: CodeGen/SPIRV/transcoding/BuildNDRange_2.ll
  LLVM :: CodeGen/SPIRV/transcoding/OpConstantSampler.ll
  LLVM :: CodeGen/SPIRV/transcoding/OpImageQuerySize.ll
  LLVM :: CodeGen/SPIRV/transcoding/OpImageReadMS.ll
  LLVM :: CodeGen/SPIRV/transcoding/OpImageSampleExplicitLod.ll
  LLVM :: CodeGen/SPIRV/transcoding/OpImageWrite.ll
  LLVM :: CodeGen/SPIRV/transcoding/OpenCL/atomic_cmpxchg.ll
  LLVM :: CodeGen/SPIRV/transcoding/OpenCL/atomic_legacy.ll
  LLVM :: CodeGen/SPIRV/transcoding/SampledImage.ll
  LLVM :: CodeGen/SPIRV/transcoding/block_w_struct_return.ll
  LLVM :: CodeGen/SPIRV/transcoding/check_ro_qualifier.ll
  LLVM :: CodeGen/SPIRV/transcoding/cl-types.ll
  LLVM :: CodeGen/SPIRV/transcoding/clk_event_t.ll
  LLVM :: CodeGen/SPIRV/transcoding/enqueue_kernel.ll
  LLVM :: CodeGen/SPIRV/transcoding/extract_insert_value.ll
  LLVM :: CodeGen/SPIRV/transcoding/get_image_num_mip_levels.ll
  LLVM :: CodeGen/SPIRV/transcoding/global_block.ll
  LLVM :: CodeGen/SPIRV/transcoding/image_get_size_with_access_qualifiers.ll
  LLVM :: CodeGen/SPIRV/transcoding/image_with_access_qualifiers.ll
  LLVM :: CodeGen/SPIRV/transcoding/optional-core-features-multiple.ll
  LLVM :: CodeGen/SPIRV/transcoding/spec_const.ll
  LLVM :: CodeGen/SPIRV/transcoding/spirv-private-array-initialization.ll


Testing Time: 171.74s
  Skipped          :    19
  Unsupported      :  1456
  Passed           : 53322
  Expectedly Failed:   159
  Failed           :    49

```

Also from build log it looks like it `llc` doesn't have `-opaque-pointers=0` option thus it fails.

For instance:
```
******************** TEST 'LLVM :: CodeGen/SPIRV/EnqueueEmptyKernel.ll' FAILED ********************
Script:
--
: 'RUN: at line 1';   /var/tmp/portage/sys-devel/llvm-17.0.6/work/llvm_build-abi_x86_32.x86/bin/llc -O0 -opaque-pointers=0 -mtriple=spirv64-unknown-unknown /var/tmp/portage/sys-devel/llvm-17.0.6/work/llvm/test/CodeGen/SPIRV/EnqueueEmptyKernel.ll -o - | /var/tmp/portage/sys-devel/llvm-17.0.6/work/llvm_build-abi_x86_32.x86/bin/FileCheck /var/tmp/portage/sys-devel/llvm-17.0.6/work/llvm/test/CodeGen/SPIRV/EnqueueEmptyKernel.ll --check-prefix=CHECK-SPIRV
--
Exit Code: 2

Command Output (stderr):
--
+ : 'RUN: at line 1'
+ /var/tmp/portage/sys-devel/llvm-17.0.6/work/llvm_build-abi_x86_32.x86/bin/llc -O0 -opaque-pointers=0 -mtriple=spirv64-unknown-unknown /var/tmp/portage/sys-devel/llvm-17.0.6/work/llvm/test/CodeGen/SPIRV/EnqueueEmptyKernel.ll -o -
+ /var/tmp/portage/sys-devel/llvm-17.0.6/work/llvm_build-abi_x86_32.x86/bin/FileCheck /var/tmp/portage/sys-devel/llvm-17.0.6/work/llvm/test/CodeGen/SPIRV/EnqueueEmptyKernel.ll --check-prefix=CHECK-SPIRV
llc: for the -o option: may not occur within a group!
llc: Unknown command line argument '-opaque-pointers=0'.  Try: '/var/tmp/portage/sys-devel/llvm-17.0.6/work/llvm_build-abi_x86_32.x86/bin/llc --help'
llc: Did you mean '-o'?
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /var/tmp/portage/sys-devel/llvm-17.0.6/work/llvm_build-abi_x86_32.x86/bin/FileCheck /var/tmp/portage/sys-devel/llvm-17.0.6/work/llvm/test/CodeGen/SPIRV/EnqueueEmptyKernel.ll --check-prefix=CHECK-SPIRV

```
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-23 11:13:41 UTC
You'll need to do some investigation here, I think. It passes fine for me. Have you unforced the LLVM targets? Maybe they're mismatched across the LLVM suite?

Historically, LLVM has been very prone to miscompilations (usually b/c of UB).
Comment 2 Arniii 2024-07-23 11:27:57 UTC
(In reply to Sam James from comment #1)
> You'll need to do some investigation here, I think. It passes fine for me.
> Have you unforced the LLVM targets? Maybe they're mismatched across the LLVM
> suite?
> 
> Historically, LLVM has been very prone to miscompilations (usually b/c of
> UB).

I had installed LLVM without additional LLVM_TARGETS, then I've added all LLVM_TARGETS for everything in the way:

from `/etc/portage/package.use/00llvm-targets` :
```
*/* LLVM_TARGETS: AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai LoongArch M68k MSP430 Mips NVPTX PowerPC RISCV SPIRV Sparc SystemZ VE WebAssembly X86 XCore Xtensa
```

Then I've tried emerge -avtbUDu @world and added clang-18 just to have it.
So, the resulting command you can see at the tarball at `how_it_was_called.txt` file:
`emerge -avtb =clang-18.1.8 -UDu @world `

```
[nomerge       ] sys-devel/clang-18.1.8:18/18.1::gentoo [17.0.6:17::gentoo, 19.0.0_pre20240706:19/19.0.0_pre20240706::gentoo] USE="doc extra (pie) static-analyzer test xml -debug* (-ieee-long-double) -verify-sig%" ABI_X86="(64) -32 (-x32)" LLVM_TARGETS="(AArch64) (AMDGPU) ARC* (ARM) (AVR) (BPF) CSKY* DirectX* (Hexagon) (Lanai) (LoongArch) M68k* (MSP430) (Mips) (NVPTX) (PowerPC) (RISCV) SPIRV* (Sparc) (SystemZ) (VE) (WebAssembly) (X86) (XCore) Xtensa*" PYTHON_SINGLE_TARGET="python3_12 -python3_10 -python3_11 -python3_13"
[ebuild  NS   ~]  sys-devel/clang-runtime-18.1.8:18::gentoo [17.0.6:17::gentoo, 19.0.0_pre20240706:19::gentoo] USE="compiler-rt libcxx openmp sanitize" ABI_X86="32 (64) (-x32)" 0 KiB
[ebuild  NS   ~]   sys-libs/compiler-rt-sanitizers-18.1.8:18::gentoo [17.0.6:17::gentoo, 19.0.0_pre20240706:19::gentoo] USE="asan cfi clang dfsan gwp-asan hwasan libfuzzer lsan memprof msan orc profile safestack scudo test* tsan ubsan xray -debug* (-shadowcallstack) -verify-sig% (-ctx-profile%*)" ABI_X86="32 (64)" 0 KiB
[ebuild  NS   ~]    sys-libs/compiler-rt-18.1.8:18::gentoo [17.0.6:17::gentoo, 19.0.0_pre20240706:19::gentoo] USE="clang test -debug* -verify-sig%" ABI_X86="32 (64)" 0 KiB
[ebuild  NS   ~]  sys-devel/clang-toolchain-symlinks-18:18::gentoo [17:17::gentoo, 19:19::gentoo] USE="native-symlinks -gcc-symlinks -multilib-symlinks" 0 KiB
[ebuild  NS   ~]   sys-devel/clang-18.1.8:18/18.1::gentoo [17.0.6:17::gentoo, 19.0.0_pre20240706:19/19.0.0_pre20240706::gentoo] USE="doc extra (pie) static-analyzer test xml -debug* (-ieee-long-double) -verify-sig%" ABI_X86="(64) -32 (-x32)" LLVM_TARGETS="(AArch64) (AMDGPU) ARC* (ARM) (AVR) (BPF) CSKY* DirectX* (Hexagon) (Lanai) (LoongArch) M68k* (MSP430) (Mips) (NVPTX) (PowerPC) (RISCV) SPIRV* (Sparc) (SystemZ) (VE) (WebAssembly) (X86) (XCore) Xtensa*" PYTHON_SINGLE_TARGET="python3_12 -python3_10 -python3_11 -python3_13" 0 KiB
[nomerge       ] sys-devel/clang-18.1.8:18/18.1::gentoo [17.0.6:17::gentoo, 19.0.0_pre20240706:19/19.0.0_pre20240706::gentoo] USE="doc extra (pie) static-analyzer test xml -debug* (-ieee-long-double) -verify-sig%" ABI_X86="(64) -32 (-x32)" LLVM_TARGETS="(AArch64) (AMDGPU) ARC* (ARM) (AVR) (BPF) CSKY* DirectX* (Hexagon) (Lanai) (LoongArch) M68k* (MSP430) (Mips) (NVPTX) (PowerPC) (RISCV) SPIRV* (Sparc) (SystemZ) (VE) (WebAssembly) (X86) (XCore) Xtensa*" PYTHON_SINGLE_TARGET="python3_12 -python3_10 -python3_11 -python3_13"
[nomerge       ]  sys-devel/lld-18.1.8:18/18.1::gentoo [17.0.6:17::gentoo, 19.0.0_pre20240706:19/19.0.0_pre20240706::gentoo] USE="test zstd -debug* -verify-sig%"
[ebuild  NS   ~]   sys-devel/lld-toolchain-symlinks-18:18::gentoo [17:17::gentoo, 19:19::gentoo] USE="native-symlinks -multilib-symlinks" 0 KiB
[ebuild  NS   ~]    sys-devel/lld-18.1.8:18/18.1::gentoo [17.0.6:17::gentoo, 19.0.0_pre20240706:19/19.0.0_pre20240706::gentoo] USE="test zstd -debug* -verify-sig%" 0 KiB
[ebuild     U ~]     sys-devel/llvm-18.1.8-r1:18/18.1::gentoo [18.1.3:18/18.1::gentoo] USE="binutils-plugin debuginfod* doc* libffi ncurses test* xml zstd -debug -exegesis -libedit -verify-sig -z3" ABI_X86="(64) -32* (-x32)" LLVM_TARGETS="(AArch64) (AMDGPU) ARC* (ARM) (AVR) (BPF) CSKY* DirectX* (Hexagon) (Lanai) (LoongArch) M68k* (MSP430) (Mips) (NVPTX) (PowerPC) (RISCV) SPIRV (Sparc) (SystemZ) (VE) (WebAssembly) (X86) (XCore) Xtensa*" 0 KiB
[nomerge       ] sys-devel/clang-runtime-17.0.6:17::gentoo  USE="compiler-rt libcxx openmp sanitize" ABI_X86="32 (64) (-x32)"
[nomerge       ]  sys-libs/libomp-19.0.0_pre20240706:0/19.0.0_pre20240706::gentoo  USE="debug gdb-plugin hwloc ompt test" ABI_X86="32 (64) (-x32)" PYTHON_SINGLE_TARGET="python3_12 -python3_10 -python3_11 -python3_13"
[nomerge       ]   dev-python/lit-19.0.0.9999::gentoo  USE="-test" PYTHON_TARGETS="python3_10 python3_11 python3_12 -python3_13"
[nomerge       ]    dev-vcs/git-2.44.2::gentoo  USE="blksha1 curl doc gpg iconv keyring nls pcre perl safe-directory test webdav -cgi -cvs -highlight -mediawiki -perforce (-selinux) -subversion -tk -xinetd" PYTHON_SINGLE_TARGET="python3_12 -python3_10 -python3_11"
[nomerge       ]     app-text/xmlto-0.0.28-r11::gentoo  USE="latex text"
[nomerge       ]      dev-texlive/texlive-formatsextra-2023_p62226-r1::gentoo  USE="doc -source"
[nomerge       ]       app-text/texlive-core-2023-r9::gentoo  USE="X cjk doc luajittex xetex -source -tk -xindy"
[nomerge       ]        dev-perl/File-HomeDir-1.6.0::gentoo  USE="test xdg" PERL_FEATURES="(-debug) -ithreads -quadmath"
[nomerge       ]         x11-misc/xdg-user-dirs-0.18::gentoo  USE="gtk"
[nomerge       ]          app-text/docbook-xml-dtd-4.3-r2:4.3::gentoo
[nomerge       ]           app-arch/unzip-6.0_p27-r1::gentoo  USE="bzip2 natspec (unicode)"
[nomerge       ]            dev-libs/libnatspec-0.3.0::gentoo  USE="doc"
[nomerge       ]             app-text/doxygen-1.9.8::gentoo  USE="doc dot doxysearch gui test -clang -debug"
[nomerge       ]              dev-qt/qtwidgets-5.15.14:5/5.15::gentoo  USE="X dbus gtk png test -debug -gles2-only"
[nomerge       ]               x11-libs/gtk+-3.24.41:3::gentoo  USE="X colord cups introspection test vim-syntax wayland xinerama (-aqua) -broadway -cloudproviders -examples -gtk-doc -sysprof" ABI_X86="32 (64) (-x32)"
[nomerge       ]                media-libs/mesa-24.1.3::gentoo  USE="X llvm opencl (opengl) proprietary-codecs vaapi vdpau vulkan wayland zstd -d3d9 -debug -lm-sensors -osmesa (-selinux) -test -unwind -valgrind -vulkan-overlay -xa" ABI_X86="32 (64) (-x32)" CPU_FLAGS_X86="sse2" LLVM_SLOT="17 -15 -16 (-18)" VIDEO_CARDS="intel -d3d12 (-freedreno) -lavapipe (-lima) -nouveau (-nvk) (-panfrost) -r300 -r600 -radeon -radeonsi (-v3d) (-vc4) -virgl (-vivante) -vmware -zink"
[ebuild   R    ]                 sys-devel/clang-17.0.6:17::gentoo  USE="doc extra (pie) static-analyzer test xml -debug (-ieee-long-double) -verify-sig" ABI_X86="32 (64) (-x32)" LLVM_TARGETS="(AArch64) (AMDGPU) ARC* (ARM) (AVR) (BPF) CSKY* DirectX* (Hexagon) (Lanai) (LoongArch) M68k* (MSP430) (Mips) (NVPTX) (PowerPC) (RISCV) SPIRV* (Sparc) (SystemZ) (VE) (WebAssembly) (X86) (XCore) Xtensa*" PYTHON_SINGLE_TARGET="python3_12 -python3_10 -python3_11" 0 KiB
[ebuild   R    ]                  sys-devel/llvm-17.0.6:17::gentoo  USE="binutils-plugin debuginfod doc libffi ncurses test xml zstd -debug -exegesis -libedit -verify-sig -xar -z3" ABI_X86="32 (64) (-x32)" LLVM_TARGETS="(AArch64) (AMDGPU) ARC* (ARM) (AVR) (BPF) CSKY* DirectX* (Hexagon) (Lanai) (LoongArch) M68k* (MSP430) (Mips) (NVPTX) (PowerPC) (RISCV) SPIRV* (Sparc) (SystemZ) (VE) (WebAssembly) (X86) (XCore) Xtensa*" 0 KiB
[ebuild   R   *]   sys-devel/clang-19.0.0_pre20240706:19/19.0.0_pre20240706::gentoo  USE="debug doc extra (pie) static-analyzer test xml (-ieee-long-double)" ABI_X86="(64) -32 (-x32)" LLVM_TARGETS="(AArch64) (AMDGPU) ARC* (ARM) (AVR) (BPF) CSKY* DirectX* (Hexagon) (Lanai) (LoongArch) M68k* (MSP430) (Mips) (NVPTX) (PowerPC) (RISCV) SPIRV* (Sparc) (SystemZ) (VE) (WebAssembly) (X86) (XCore) Xtensa*" PYTHON_SINGLE_TARGET="python3_12 -python3_10 -python3_11 -python3_13" 0 KiB
```
Comment 3 Arniii 2024-07-23 13:33:28 UTC
I cannot find anything that contain `llc` and `opaque-pointers` on the net: https://duckduckgo.com/?q=%22llc%22+llvm+%22opaque-pointers%22&ia=web

I believe there's no such option. I believe it's a problem inside of a CMakeLists.txt
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-23 13:34:17 UTC
```
$ rg opaque-pointer
llvm/docs/OpaquePointers.rst:109:pointer mode can be disabled using ``-opaque-pointers=0`` in
llvm/docs/OpaquePointers.rst:110:LLVM tools like ``opt``, or ``-Xclang -no-opaque-pointers`` in clang.
llvm/docs/OpaquePointers.rst:126:   ; Is automatically converted into the following if -opaque-pointers
llvm/docs/OpaquePointers.rst:247:or by passing ``-Xclang -no-opaque-pointers`` to a single clang invocation.
llvm/docs/OpaquePointers.rst:249:For users of the clang cc1 interface, ``-no-opaque-pointers`` can be passed.
llvm/docs/OpaquePointers.rst:253:Usage for LTO can be disabled by passing ``-Wl,-plugin-opt=no-opaque-pointers``
llvm/docs/OpaquePointers.rst:260:``-opaque-pointers=0``.
llvm/docs/OpaquePointers.rst:286:* The ``-no-opaque-pointers`` cc1 clang flag is no longer supported.
llvm/docs/OpaquePointers.rst:287:* The ``-opaque-pointers`` opt flag is no longer supported.
llvm/docs/OpaquePointers.rst:288:* The ``-plugin-opt=no-opaque-pointers`` LTO flag is no longer supported.
llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp:2806:  // pointer mode (-opaque-pointers=0).
llvm/lib/Target/DirectX/DXILPrepare.cpp:157:    // This code only gets hit in opaque-pointer mode, so the type of the
llvm/test/LTO/X86/mix-opaque-typed.ll:1:; RUN: llvm-as %S/Inputs/opaque-pointers.ll -o %t-opaque.bc
```

and as I said, tblgen and friends have been miscompiled before..
Comment 5 Arniii 2024-07-23 13:42:41 UTC
(In reply to Sam James from comment #4)

> and as I said, tblgen and friends have been miscompiled before..

Ok, and how to solve it?
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-23 13:44:00 UTC
First, try to complete the upgrade so your system is in a consistent state with tests off (so LLVM is built).

Then try build LLVM with minimal CFLAGS and see if it helps?
Comment 7 Arniii 2024-07-24 08:00:52 UTC
Created attachment 898261 [details]
lzip tarball: emerge_--info.txt how_it_was_called.txt /var/tmp/portage/sys-devel/llvm-17.0.6/{temp/**,work/**.log} /var/log/portage/elog/sys-devel/llvm-17.0.6:20240723-231205.log /etc/portage/**

(In reply to Sam James from comment #6)
> First, try to complete the upgrade so your system is in a consistent state
> with tests off (so LLVM is built).
> 
> Then try build LLVM with minimal CFLAGS and see if it helps?

So, I've finished `emerge -avtUDu @world` , then tried to compile with -O2 -pipe -march=native(verbosely) -ggdb3 . It still fails.