Date: Mon, 04 Nov 2024 15:41:49 +0000 From: bugzilla-noreply@freebsd.org To: ports-bugs@FreeBSD.org Subject: [Bug 282543] graphics/openjph: Use AVX* instructions on default build on amd64 Message-ID: <bug-282543-7788@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D282543 Bug ID: 282543 Summary: graphics/openjph: Use AVX* instructions on default build on amd64 Product: Ports & Packages Version: Latest Hardware: amd64 URL: https://github.com/aous72/OpenJPH/issues/157 OS: Any Status: New Severity: Affects Some People Priority: --- Component: Individual Port(s) Assignee: sunpoet@FreeBSD.org Reporter: vvd@FreeBSD.org Flags: maintainer-feedback?(sunpoet@FreeBSD.org) Assignee: sunpoet@FreeBSD.org Flags: merge-quarterly? OS: FreeBSD 14.1 amd64. CPU: Core 2 Quad Q6600. Build OpenJPH 0.17.0 from ports without -march and with -march=3Dcore2 - sa= me result. Dependencies list: smplayer =3D> qt5 =3D> kf5-kimageformats =3D> libheif = =3D> OpenJPH. $ gdb smplayer GNU gdb (GDB) 15.1 [GDB v15.1 for FreeBSD] Copyright (C) 2024 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.htm= l> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-portbld-freebsd14.1". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from smplayer... (No debugging symbols found in smplayer) (gdb) run Starting program: /usr/local/bin/smplayer [New LWP 807958 of process 16273] Qt: Session management error: None of the authentication protocols specified are supported [New LWP 807959 of process 16273] This is SMPlayer v. 24.5.0 (revision 10277) running on FreeBSD [New LWP 807960 of process 16273] [Detaching after fork from child process 16274] Thread 1 received signal SIGILL, Illegal instruction. Privileged opcode. 0x000000081576a81a in ojph::local::initialize_tables_avx2() () from /usr/local/lib/libopenjph.so.0.17 $ valgrind smplayer ... vex amd64->IR: unhandled instruction bytes: 0xC5 0xF8 0x77 0xC3 0xC5 0xF8 0= x77 0xE8 0xDA 0x64 vex amd64->IR: REX=3D0 REX.W=3D0 REX.R=3D0 REX.X=3D0 REX.B=3D0 vex amd64->IR: VEX=3D0 VEX.L=3D0 VEX.nVVVV=3D0x0 ESC=3DNONE vex amd64->IR: PFX.66=3D0 PFX.F2=3D0 PFX.F3=3D0 =3D=3D16247=3D=3D valgrind: Unrecognised instruction at address 0x1b5f881a. =3D=3D16247=3D=3D at 0x1B5F881A: ojph::local::initialize_tables_avx2() (= in /usr/local/lib/libopenjph.so.0.17.0) =3D=3D16247=3D=3D by 0x400AF5C: ??? (in /libexec/ld-elf.so.1) =3D=3D16247=3D=3D by 0x400F3F2: ??? (in /libexec/ld-elf.so.1) =3D=3D16247=3D=3D by 0x400BF52: ??? (in /libexec/ld-elf.so.1) =3D=3D16247=3D=3D by 0x12D32276: ??? (in /usr/local/lib/libheif.so.1.19.= 1) =3D=3D16247=3D=3D by 0x12CBCB3B: heif_load_plugin (in /usr/local/lib/libheif.so.1.19.1) =3D=3D16247=3D=3D by 0x12CBC7DE: heif_load_plugins (in /usr/local/lib/libheif.so.1.19.1) =3D=3D16247=3D=3D by 0x12CBC5DE: heif_init (in /usr/local/lib/libheif.so= .1.19.1) =3D=3D16247=3D=3D by 0x12C1CADA: ??? (in /usr/local/lib/qt5/plugins/imageformats/kimg_heif.so) =3D=3D16247=3D=3D by 0x12C1CCD9: ??? (in /usr/local/lib/qt5/plugins/imageformats/kimg_heif.so) =3D=3D16247=3D=3D by 0x532D72F: ??? (in /usr/local/lib/qt5/libQt5Gui.so.= 5.15.15) =3D=3D16247=3D=3D by 0x532A4DF: QImageReader::supportedImageFormats() (in /usr/local/lib/qt5/libQt5Gui.so.5.15.15) =3D=3D16247=3D=3D Your program just tried to execute an instruction that Va= lgrind =3D=3D16247=3D=3D did not recognise. There are two possible reasons for th= is. =3D=3D16247=3D=3D 1. Your program has a bug and erroneously jumped to a non= -code =3D=3D16247=3D=3D location. If you are running Memcheck and you just sa= w a =3D=3D16247=3D=3D warning about a bad jump, it's probably your program's= fault. =3D=3D16247=3D=3D 2. The instruction is legitimate but Valgrind doesn't han= dle it, =3D=3D16247=3D=3D i.e. it's Valgrind's fault. If you think this is the = case or =3D=3D16247=3D=3D you are not sure, please let us know and we'll try to = fix it. =3D=3D16247=3D=3D Either way, Valgrind will now raise a SIGILL signal which= will =3D=3D16247=3D=3D probably kill your program. =3D=3D16247=3D=3D =3D=3D16247=3D=3D Process terminating with default action of signal 4 (SIGI= LL): dumping core =3D=3D16247=3D=3D Illegal opcode at address 0x1B5F881A =3D=3D16247=3D=3D at 0x1B5F881A: ojph::local::initialize_tables_avx2() (= in /usr/local/lib/libopenjph.so.0.17.0) =3D=3D16247=3D=3D by 0x400AF5C: ??? (in /libexec/ld-elf.so.1) =3D=3D16247=3D=3D by 0x400F3F2: ??? (in /libexec/ld-elf.so.1) =3D=3D16247=3D=3D by 0x400BF52: ??? (in /libexec/ld-elf.so.1) =3D=3D16247=3D=3D by 0x12D32276: ??? (in /usr/local/lib/libheif.so.1.19.= 1) =3D=3D16247=3D=3D by 0x12CBCB3B: heif_load_plugin (in /usr/local/lib/libheif.so.1.19.1) =3D=3D16247=3D=3D by 0x12CBC7DE: heif_load_plugins (in /usr/local/lib/libheif.so.1.19.1) =3D=3D16247=3D=3D by 0x12CBC5DE: heif_init (in /usr/local/lib/libheif.so= .1.19.1) =3D=3D16247=3D=3D by 0x12C1CADA: ??? (in /usr/local/lib/qt5/plugins/imageformats/kimg_heif.so) =3D=3D16247=3D=3D by 0x12C1CCD9: ??? (in /usr/local/lib/qt5/plugins/imageformats/kimg_heif.so) =3D=3D16247=3D=3D by 0x532D72F: ??? (in /usr/local/lib/qt5/libQt5Gui.so.= 5.15.15) =3D=3D16247=3D=3D by 0x532A4DF: QImageReader::supportedImageFormats() (in /usr/local/lib/qt5/libQt5Gui.so.5.15.15) ... AFAIU: 0xC5 0xF8 0x77 =3D vzeroupper from AVX. https://fuchsia.googlesource.com/third_party/llvm-project/+/refs/tags/llvmo= rg-13.0.0-rc1/llvm/test/CodeGen/X86/fma.ll?autodive=3D0%2F%2F%2F%2F%2F%2F%2= F%2F#665 https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#New_instructions Runtime detection of supported SIMD level in init_cpu_ext_level() work well, but OpenJPH still use instructions from unsupported SIMDs on current CPU. There are build options: option(OJPH_DISABLE_SIMD "Disables the use of SIMD instructions -- agnostic= to architectures" OFF) option(OJPH_DISABLE_SSE "Disables the use of SSE SIMD instructions and associated files" OFF) option(OJPH_DISABLE_SSE2 "Disables the use of SSE2 SIMD instructions and associated files" OFF) option(OJPH_DISABLE_SSSE3 "Disables the use of SSSE3 SIMD instructions and associated files" OFF) option(OJPH_DISABLE_SSE4 "Disables the use of SSE4 SIMD instructions and associated files" OFF) option(OJPH_DISABLE_AVX "Disables the use of AVX SIMD instructions and associated files" OFF) option(OJPH_DISABLE_AVX2 "Disables the use of AVX2 SIMD instructions and associated files" OFF) option(OJPH_DISABLE_AVX512 "Disables the use of AVX512 SIMD instructions and associated files" OFF) option(OJPH_DISABLE_NEON "Disables the use of NEON SIMD instructions and associated files" OFF) If I build with: CMAKE_ON=3DOJPH_DISABLE_SSE4 OJPH_DISABLE_AVX OJPH_DISABLE_AVX2 OJPH_DISABLE_AVX512 then smplayer run and work fine. Upstream issue: https://github.com/aous72/OpenJPH/issues/157 I can create (trivial) patch with all SIMD options for amd64. With default = ON OJPH_DISABLE_SSE and OJPH_DISABLE_SSE2 only. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-282543-7788>