Bug 110323

Summary: mesa-19.0.1 fails to compile with llvm-8.0.0 and Gallium swr driver
Product: Mesa Reporter: john.frankish
Component: Drivers/Gallium/swrAssignee: mesa-dev
Status: RESOLVED MOVED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: 19.0   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description john.frankish 2019-04-04 12:37:14 UTC
compiling with:

CC="gcc -flto -fuse-linker-plugin -mtune=generic -Os -pipe -DUSE_DRICONF" CXX="g++ -flto -fuse-linker-plugin -mtune=generic -Os -pipe -fno-exceptions -DUSE_DRICONF" ./configure --prefix=/usr/local -disable-static --localstatedir=/var --sysconfdir=/etc --enable-osmesa --enable-xa --enable-glx-tls --with-platforms="drm,wayland,surfaceless,x11" --with-gallium-drivers="i915,nouveau,r300,r600,radeonsi,svga,swrast,swr" --with-vulkan-drivers="intel,radeon" --enable-autotools

make fails with the error below - it does not fail without the swr driver requested.

libtool: compile:  g++ -flto -fuse-linker-plugin -mtune=generic -Os -pipe -fno-exceptions -fno-rtti -DUSE_DRICONF -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"19.0.1\" "-DPACKAGE_STRING=\"Mesa 19.0.1\"" "-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"19.0.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DYYTEXT_POINTER=1 -DHAVE___BUILTIN_BSWAP32=1 -DHAVE___BUILTIN_BSWAP64=1 -DHAVE___BUILTIN_CLZ=1 -DHAVE___BUILTIN_CLZLL=1 -DHAVE___BUILTIN_CTZ=1 -DHAVE___BUILTIN_EXPECT=1 -DHAVE___BUILTIN_FFS=1 -DHAVE___BUILTIN_FFSLL=1 -DHAVE___BUILTIN_POPCOUNT=1 -DHAVE___BUILTIN_POPCOUNTLL=1 -DHAVE___BUILTIN_UNREACHABLE=1 -DHAVE_FUNC_ATTRIBUTE_CONST=1 -DHAVE_FUNC_ATTRIBUTE_FLATTEN=1 -DHAVE_FUNC_ATTRIBUTE_FORMAT=1 -DHAVE_FUNC_ATTRIBUTE_MALLOC=1 -DHAVE_FUNC_ATTRIBUTE_PACKED=1 -DHAVE_FUNC_ATTRIBUTE_PURE=1 -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL=1 -DHAVE_FUNC_ATTRIBUTE_UNUSED=1 -DHAVE_FUNC_ATTRIBUTE_VISIBILITY=1 -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT=1 -DHAVE_FUNC_ATTRIBUTE_WEAK=1 -DHAVE_FUNC_ATTRIBUTE_ALIAS=1 -DHAVE_FUNC_ATTRIBUTE_NORETURN=1 -DMAJOR_IN_SYSMACROS=1 -DHAVE_ENDIAN_H=1 -DHAVE_DLADDR=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -I. -mavx -fno-strict-aliasing -I./include -I../../../../src -I../../../../include -I../../../../src/gallium/include -I../../../../src/gallium/auxiliary -I../../../../src/gallium/drivers -I../../../../src/gallium/winsys -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DNDEBUG -DUSE_X86_64_ASM -DHAVE_SYS_SYSCTL_H -DHAVE_DLFCN_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE -DHAVE_STRTOD_L -DHAVE_DL_ITERATE_PHDR -DHAVE_POSIX_MEMALIGN -DHAVE_ZLIB -DHAVE_PTHREAD_SETAFFINITY -DHAVE_LINUX_FUTEX_H -DHAVE_LIBDRM -DGLX_USE_DRM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DHAVE_DRM_PLATFORM -DHAVE_WAYLAND_PLATFORM -DWL_HIDE_DEPRECATED -DHAVE_SURFACELESS_PLATFORM -DHAVE_X11_PLATFORM -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS -DENABLE_SHADER_CACHE -DHAVE_MINCORE -DHAVE_ST_VDPAU -DHAVE_LLVM=0x0800 -DMESA_LLVM_VERSION_PATCH=0 -fvisibility=hidden -I/usr/local/include -std=c++11 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I./rasterizer/codegen -I./rasterizer/core -I./rasterizer/jitter -I./rasterizer/archrast -I./rasterizer -I./rasterizer/core -I./rasterizer/codegen -I./rasterizer/jitter -I./rasterizer/archrast -DHAVE_SWR_AVX -DHAVE_SWR_AVX2 -Wall -fno-math-errno -fno-trapping-math -Wno-missing-field-initializers -Wno-format-truncation -MT libmesaswr_la-swr_shader.lo -MD -MP -MF .deps/libmesaswr_la-swr_shader.Tpo -c swr_shader.cpp  -fPIC -DPIC -o .libs/libmesaswr_la-swr_shader.o
In file included from ./rasterizer/jitter/builder.h:157,
                 from swr_shader.cpp:35:
./rasterizer/jitter/gen_builder.hpp: In member function 'llvm::CallInst* SwrJit::Builder::BINARY_INTRINSIC(llvm::Intrinsic::ID, llvm::Value*, llvm::Value*, const llvm::Twine&)':
./rasterizer/jitter/gen_builder.hpp:231:59: error: no matching function for call to 'llvm::IRBuilder<>::CreateBinaryIntrinsic(llvm::Intrinsic::ID&, llvm::Value*&, llvm::Value*&, const llvm::Twine&)'
     return IRB()->CreateBinaryIntrinsic(ID, LHS, RHS, Name);
Comment 1 john.frankish 2019-04-09 12:31:12 UTC
Note that the same error occurs with meson, both autotools and meson builds using gcc-8.2.0

FAILED: src/gallium/drivers/swr/3eb908b@@mesaswr@sta/rasterizer_jitter_builder_mem.cpp.o 
g++ -mtune=generic -Os -pipe -fno-exceptions -fno-rtti -DUSE_DRICONF -Isrc/gallium/drivers/swr/3eb908b@@mesaswr@sta -Isrc/gallium/drivers/swr -I../src/gallium/drivers/swr -Isrc/../include -I../src/../include -Isrc -I../src -Isrc/mapi -I../src/mapi -Isrc/mesa -I../src/mesa -I../src/gallium/include -Isrc/gallium/auxiliary -I../src/gallium/auxiliary -Isrc/gallium/drivers/swr/rasterizer/codegen -I../src/gallium/drivers/swr/rasterizer/codegen -Isrc/gallium/drivers/swr/rasterizer/core -I../src/gallium/drivers/swr/rasterizer/core -Isrc/gallium/drivers/swr/rasterizer/jitter -I../src/gallium/drivers/swr/rasterizer/jitter -I../src/gallium/drivers/swr/rasterizer/archrast -Isrc/gallium/drivers/swr/rasterizer -I../src/gallium/drivers/swr/rasterizer -Isrc/gallium/drivers/swr/rasterizer/core/backends -I/usr/local/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=c++11 '-DPACKAGE_VERSION="19.0.1"' '-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa"' -DGLX_USE_TLS -DHAVE_ST_VDPAU -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -DHAVE_X11_PLATFORM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_DRM -DHAVE_DRM_PLATFORM -DHAVE_SURFACELESS_PLATFORM -DENABLE_SHADER_CACHE -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 -DHAVE___BUILTIN_CLZ -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE -DHAVE_FUNC_ATTRIBUTE_CONST -DHAVE_FUNC_ATTRIBUTE_FLATTEN -DHAVE_FUNC_ATTRIBUTE_MALLOC -DHAVE_FUNC_ATTRIBUTE_PURE -DHAVE_FUNC_ATTRIBUTE_UNUSED -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT -DHAVE_FUNC_ATTRIBUTE_WEAK -DHAVE_FUNC_ATTRIBUTE_FORMAT -DHAVE_FUNC_ATTRIBUTE_PACKED -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL -DHAVE_FUNC_ATTRIBUTE_VISIBILITY -DHAVE_FUNC_ATTRIBUTE_ALIAS -DHAVE_FUNC_ATTRIBUTE_NORETURN -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DUSE_X86_64_ASM -DMAJOR_IN_SYSMACROS -DHAVE_SYS_SYSCTL_H -DHAVE_LINUX_FUTEX_H -DHAVE_ENDIAN_H -DHAVE_DLFCN_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_POSIX_MEMALIGN -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE -DHAVE_STRTOD_L -DHAVE_DLADDR -DHAVE_DL_ITERATE_PHDR -DHAVE_ZLIB -DHAVE_PTHREAD -DHAVE_PTHREAD_SETAFFINITY -DHAVE_LIBDRM -DHAVE_LLVM=0x0800 -DMESA_LLVM_VERSION_PATCH=0 -DHAVE_WAYLAND_PLATFORM -DWL_HIDE_DEPRECATED -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS -Werror=return-type -fno-math-errno -fno-trapping-math -Wno-non-virtual-dtor -Wno-missing-field-initializers -Wno-format-truncation -fPIC -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -pthread -fvisibility=hidden -fvisibility=hidden -fno-strict-aliasing -mavx -DHAVE_SWR_AVX -DHAVE_SWR_AVX2 -MD -MQ 'src/gallium/drivers/swr/3eb908b@@mesaswr@sta/rasterizer_jitter_builder_mem.cpp.o' -MF 'src/gallium/drivers/swr/3eb908b@@mesaswr@sta/rasterizer_jitter_builder_mem.cpp.o.d' -o 'src/gallium/drivers/swr/3eb908b@@mesaswr@sta/rasterizer_jitter_builder_mem.cpp.o' -c ../src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
In file included from ../src/gallium/drivers/swr/rasterizer/jitter/builder.h:157,
                 from ../src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp:31:
../src/gallium/drivers/swr/rasterizer/jitter/gen_builder.hpp: In member function 'llvm::CallInst* SwrJit::Builder::BINARY_INTRINSIC(llvm::Intrinsic::ID, llvm::Value*, llvm::Value*, const llvm::Twine&)':
../src/gallium/drivers/swr/rasterizer/jitter/gen_builder.hpp:231:59: error: no matching function for call to 'llvm::IRBuilder<>::CreateBinaryIntrinsic(llvm::Intrinsic::ID&, llvm::Value*&, llvm::Value*&, const llvm::Twine&)'
     return IRB()->CreateBinaryIntrinsic(ID, LHS, RHS, Name);
Comment 2 Jan Zielinski 2019-04-17 16:32:29 UTC
I've reproduced the issue.

It is connected to auto-generated files in swr/rasterizer/jitter directory (gen_*). Those files may have to be regenerated when switching to a different LLVM version, but are not.

The workaround is to simply do 'rm src/gallium/drivers/swr/rasterizer/jitter/gen_*'. The files will be regenerated and the driver should build properly. 

The issue should be fixed soon.
Comment 3 john.frankish 2019-04-18 06:56:09 UTC
Thanks.

The workaround builds without error on 64-bit, but fails with 32-bit.

Note that with a 64-bit build, glxgears segfaults with software acceleration - is glxgears hardware acceleration only?

libtool: compile:  g++ -flto -fuse-linker-plugin -march=pentium-m -mtune=i686 -Os -pipe -fno-exceptions -fno-rtti -DUSE_DRICONF -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"19.0.1\" "-DPACKAGE_STRING=\"Mesa 19.0.1\"" "-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"19.0.1\" -D_FILE_OFFSET_BITS=64 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DYYTEXT_POINTER=1 -DHAVE___BUILTIN_BSWAP32=1 -DHAVE___BUILTIN_BSWAP64=1 -DHAVE___BUILTIN_CLZ=1 -DHAVE___BUILTIN_CLZLL=1 -DHAVE___BUILTIN_CTZ=1 -DHAVE___BUILTIN_EXPECT=1 -DHAVE___BUILTIN_FFS=1 -DHAVE___BUILTIN_FFSLL=1 -DHAVE___BUILTIN_POPCOUNT=1 -DHAVE___BUILTIN_POPCOUNTLL=1 -DHAVE___BUILTIN_UNREACHABLE=1 -DHAVE_FUNC_ATTRIBUTE_CONST=1 -DHAVE_FUNC_ATTRIBUTE_FLATTEN=1 -DHAVE_FUNC_ATTRIBUTE_FORMAT=1 -DHAVE_FUNC_ATTRIBUTE_MALLOC=1 -DHAVE_FUNC_ATTRIBUTE_PACKED=1 -DHAVE_FUNC_ATTRIBUTE_PURE=1 -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL=1 -DHAVE_FUNC_ATTRIBUTE_UNUSED=1 -DHAVE_FUNC_ATTRIBUTE_VISIBILITY=1 -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT=1 -DHAVE_FUNC_ATTRIBUTE_WEAK=1 -DHAVE_FUNC_ATTRIBUTE_ALIAS=1 -DHAVE_FUNC_ATTRIBUTE_NORETURN=1 -DMAJOR_IN_SYSMACROS=1 -DHAVE_ENDIAN_H=1 -DHAVE_DLADDR=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -I. -pthread -mavx -DKNOB_ARCH=KNOB_ARCH_AVX -fno-strict-aliasing -I./include -I../../../../src -I../../../../include -I../../../../src/gallium/include -I../../../../src/gallium/auxiliary -I../../../../src/gallium/drivers -I../../../../src/gallium/winsys -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DNDEBUG -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DHAVE_SYS_SYSCTL_H -DHAVE_DLFCN_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE -DHAVE_STRTOD_L -DHAVE_DL_ITERATE_PHDR -DHAVE_POSIX_MEMALIGN -DHAVE_ZLIB -DHAVE_PTHREAD_SETAFFINITY -DHAVE_LINUX_FUTEX_H -DHAVE_LIBDRM -DGLX_USE_DRM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DHAVE_DRM_PLATFORM -DHAVE_SURFACELESS_PLATFORM -DHAVE_X11_PLATFORM -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS -DENABLE_SHADER_CACHE -DHAVE_MINCORE -DHAVE_ST_VDPAU -DHAVE_LLVM=0x0800 -DMESA_LLVM_VERSION_PATCH=0 -fvisibility=hidden -I/usr/local/include -std=c++11 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I./rasterizer/codegen -I./rasterizer/core -I./rasterizer/jitter -I./rasterizer/archrast -I./rasterizer -I./rasterizer/core -I./rasterizer/codegen -I./rasterizer/jitter -I./rasterizer/archrast -Wall -fno-math-errno -fno-trapping-math -Wno-missing-field-initializers -Wno-format-truncation -MT rasterizer/core/libswrAVX_la-api.lo -MD -MP -MF rasterizer/core/.deps/libswrAVX_la-api.Tpo -c rasterizer/core/api.cpp  -fPIC -DPIC -o rasterizer/core/.libs/libswrAVX_la-api.o
In file included from ./rasterizer/common/simdintrin.h:28,
                 from ./rasterizer/core/format_types.h:31,
                 from ./rasterizer/core/format_traits.h:32,
                 from ./rasterizer/core/multisample.h:30,
                 from ./rasterizer/core/backend.h:33,
                 from rasterizer/core/api.cpp:35:
./rasterizer/common/simdlib.hpp: In member function 'uint32_t SIMDVecHash<SIMD_T>::operator()(Integer<SIMD_T>) const':
./rasterizer/common/simdlib.hpp:594:37: error: static assertion failed: This path only meant for 64-bit code
         static_assert(sizeof(void*) == 8, "This path only meant for 64-bit code");
                       ~~~~~~~~~~~~~~^~~~
./rasterizer/common/simdlib.hpp:603:21: error: there are no arguments to '_mm_crc32_u64' that depend on a template parameter, so a declaration of '_mm_crc32_u64' must be available [-fpermissive]
             crc32 = _mm_crc32_u64(crc32, pData[i]);
Comment 4 Jan Zielinski 2019-04-19 12:07:32 UTC
The 32-bit build is currently not supported on Linux. 

glxgears work with SWR. Can you share exact command line you use to run glxgears and the backtrace of the crash, if possible?
Comment 5 john.frankish 2019-04-20 05:12:17 UTC
Really? 32-bit swr was supported in mesa-18.0.0

It looks like I might have started glxgears incorrectly:

$ LIBGL_ALWAYS_SOFTWARE=true GALLIUM_DRIVER=swr glxgears

..segfaults

$ GALLIUM_DRIVER=swr glxgears

..works
Comment 6 Jan Zielinski 2019-04-23 18:57:31 UTC
That's correct, worked in 18.0.0 and 18.1.0. The change breaking 32-bit compilation was introduced in 18.2.0. 

It should be fixed in one of the upcoming releases. 

As a workaround (again!) to build 32-bit version you can simply remove SIMDVecHash struct definition from simdlib.hpp.
Comment 7 GitLab Migration User 2019-09-18 18:24:46 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/203.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.