Bug 97542 - mesa-12.0.1 with llvm-3.9.0_rc3 - src/gallium/state_trackers/clover/llvm/invocation.cpp:212:75: error: no matching function for call to clang::CompilerInvocation::setLangDefaults
Summary: mesa-12.0.1 with llvm-3.9.0_rc3 - src/gallium/state_trackers/clover/llvm/invo...
Status: RESOLVED WONTFIX
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: 12.0
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-30 07:01 UTC by Dennis Schridde
Modified: 2017-03-22 16:21 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments
build.log (xz-compressed) (52.69 KB, application/x-xz)
2016-08-30 07:01 UTC, Dennis Schridde
Details
mesa-12.0.1-llvm-3.9.0_rc3-compatibility.patch (652 bytes, patch)
2016-08-30 07:02 UTC, Dennis Schridde
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Schridde 2016-08-30 07:01:30 UTC
Created attachment 126117 [details]
build.log (xz-compressed)

/var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/gallium/state_trackers/clover/llvm/invocation.cpp: In function ‘llvm::Module* {anonymous}::compile_llvm(llvm::LLVMContext&, const string&, const header_map&, const string&, const string&, const string&, const string&, unsigned int (&)[7], unsigned int&, std::__cxx11::string&)’:
/var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/gallium/state_trackers/clover/llvm/invocation.cpp:212:75: error: no matching function for call to ‘clang::CompilerInvocation::setLangDefaults(clang::LangOptions&, clang::InputKind, llvm::Triple, clang::LangStandard::Kind)’
                                         clang::LangStandard::lang_opencl11);
                                                                           ^
In file included from /usr/include/clang/Frontend/CompilerInstance.h:17:0,
                 from /var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/gallium/state_trackers/clover/llvm/invocation.cpp:25:
/usr/include/clang/Frontend/CompilerInvocation.h:160:15: note: candidate: static void clang::CompilerInvocation::setLangDefaults(clang::LangOptions&, clang::InputKind, const llvm::Triple&, clang::PreprocessorOptions&, clang::LangStandard::Kind)
   static void setLangDefaults(LangOptions &Opts, InputKind IK,
               ^
/usr/include/clang/Frontend/CompilerInvocation.h:160:15: note:   no known conversion for argument 4 from ‘clang::LangStandard::Kind’ to ‘clang::PreprocessorOptions&’
Comment 1 Dennis Schridde 2016-08-30 07:02:05 UTC
Created attachment 126118 [details] [review]
mesa-12.0.1-llvm-3.9.0_rc3-compatibility.patch

Attached patch fixes the issue.
Comment 2 Michel Dänzer 2016-08-30 07:19:03 UTC
Mesa releases can't support unreleased version of LLVM.

That said, this problem is fixed in Mesa Git master, and LLVM 3.9 will be supported by the next major release of Mesa (12.1 or 13).
Comment 3 Dennis Schridde 2016-08-30 08:02:10 UTC
(In reply to Michel Dänzer from comment #2)
> Mesa releases can't support unreleased version of LLVM.

As the code in the affected area is guarded with #if HAVE_LLVM >= 0x0309, I assumed Mesa developers were trying to do just that and my patch would be helpful in case you'd release a version 12.0.2.

Thanks for your quick feedback!
Comment 4 Vedran Miletić 2016-08-30 12:23:56 UTC
(In reply to Dennis Schridde from comment #3)
> (In reply to Michel Dänzer from comment #2)
> > Mesa releases can't support unreleased version of LLVM.
> 
> As the code in the affected area is guarded with #if HAVE_LLVM >= 0x0309, I
> assumed Mesa developers were trying to do just that and my patch would be
> helpful in case you'd release a version 12.0.2.
> 
> Thanks for your quick feedback!

We could do that once LLVM 3.9 is out. Michel, thoughts?
Comment 5 Michel Dänzer 2016-08-31 02:38:10 UTC
(In reply to Vedran Miletić from comment #4)
> We could do that once LLVM 3.9 is out. Michel, thoughts?

It would require backporting all changes from master which are needed for LLVM 3.9. If any of them are missed, there might be subtle issues.

Personally, I think it's not worth bothering. The next major Mesa release shouldn't be too far away, and distros tend to take a while to build Mesa against new LLVM releases anyway.
Comment 6 Daniel Exner 2016-09-05 21:17:03 UTC
Well, I just wanted to bump llvm to the _released_ 3.9.0 and hit this bug when trying to recompile mesa 12.0.2.

Perhaps it should be noted somewhere that mesa minor version releases only support the llvm release of the mayor they belong to.
Comment 7 Dennis Schridde 2016-09-06 17:31:03 UTC
(In reply to Daniel Exner from comment #6)
> Well, I just wanted to bump llvm to the _released_ 3.9.0 and hit this bug
> when trying to recompile mesa 12.0.2.
> 
> Perhaps it should be noted somewhere that mesa minor version releases only
> support the llvm release of the mayor they belong to.

Shouldn't ./configure check whether the installed version of LLVM is supported? That's what Rust does.
Comment 8 Vedran Miletić 2016-09-06 18:08:13 UTC
(In reply to Dennis Schridde from comment #7)
> Shouldn't ./configure check whether the installed version of LLVM is
> supported? That's what Rust does.

There are basically two options:
1) Fail explicitly on LLVM version that is not released, even if a certain snapshot of LLVM can work.
2) Allow using Mesa with a snapshot that happens to carry the same version number but different API.

Mesa does 2) now, and I prefer it to 1).
Comment 9 Timo Aaltonen 2016-09-07 11:21:28 UTC
So Debian and Ubuntu would like to switch to llvm 3.9 which is why I'm reopening this. There's no word on 12.1 release schedule and it would be too late for Ubuntu 16.10 anyway, so backporting fixes to 12.0-branch would be needed.

I added 82e0bbd01abfb20 and that fixed the build. Would be nice to know what else is needed to avoid "subtle issues".
Comment 10 Vedran Miletić 2016-09-07 18:21:38 UTC
(In reply to Dennis Schridde from comment #1)
> Created attachment 126118 [details] [review] [review]
> mesa-12.0.1-llvm-3.9.0_rc3-compatibility.patch
> 
> Attached patch fixes the issue.

Using LLVM release_39 branch with Mesa 12.0 branch and the attached patch seems to work on Fiji. I have tested clinfo, glxinfo, GNOME Shell and Talos Principle.
Comment 11 Clément Guérin 2016-10-03 20:33:32 UTC
Hello, I built mesa 12.0.3 against llvm 3.9.0 on arch linux. Rocket League and Portal were working properly, however Tomb Raider was crashing right before the Feral logo.
Comment 12 Alexander Tsoy 2016-10-05 03:10:46 UTC
(In reply to Clément Guérin from comment #11)
> Hello, I built mesa 12.0.3 against llvm 3.9.0 on arch linux. Rocket League
> and Portal were working properly, however Tomb Raider was crashing right
> before the Feral logo.

Tomb Raider's crash is caused by the following error:
"LLVM ERROR: branch size exceeds simm16"

Reverting relevant LLVM commit [1] workarounds this issue, however running Tomb Raider at Ultra settings completely hangs the GPU. Other settings works fine.

Another issue is the following warning which appear when running any GL app:
"Warning: LLVM emitted unknown config register: 0x4"

So yes, as Michel said, mesa-12.0 doesn't fully support llvm-3.9.

[1] https://github.com/llvm-mirror/llvm/commit/76e32dfbc0acecb33e2141a0c2faf5b23e1342fc
Comment 13 Christian 2017-01-06 21:04:26 UTC
Same problem, different version: 
mesa-13.0.2
llvm: sys-devel/llvm-3.9.1
sys-devel/clang-3.9.1-r100

Error:
libtool: compile:  x86_64-pc-linux-gnu-g++ -m32 -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"13.0.2\" "-DPACKAGE_STRING=\"Mesa 13.0.2\"" "-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"13.0.2\" -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 -DMAJOR_IN_SYSMACROS=1 -DHAVE_DLADDR=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_PTHREAD=1 -I. -I/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover -I/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/include -I/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src -I/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/include -I/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/drivers -I/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/auxiliary -I/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/winsys -I../../../../src -I/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover -std=c++11 -fvisibility=hidden -I/usr/include -std=c++11 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DNDEBUG -DTEXTURE_FLOAT_ENABLED -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DHAVE_XLOCALE_H -DHAVE_SYS_SYSCTL_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_DLOPEN -DHAVE_POSIX_MEMALIGN -DHAVE_LIBDRM -DHAVE_SHA1 -DGLX_USE_DRM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DHAVE_ALIAS -DHAVE_DRI3 -DHAVE_MINCORE -DHAVE_LLVM=0x0309 -DMESA_LLVM_VERSION_PATCH=1 -DLIBCLC_INCLUDEDIR=\"/usr/include/\" -DLIBCLC_LIBEXECDIR=\"/usr/lib/clc/\" -DCLANG_RESOURCE_DIR=\"/usr/lib/clang/3.9.1\" -mtune=k8 -O2 -pipe -ffat-lto-objects -Wall -fno-math-errno -fno-trapping-math -c /var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover/llvm/invocation.cpp  -fPIC -DPIC -o llvm/.libs/libclllvm_la-invocation.o
In file included from /var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover/llvm/metadata.hpp:31:0,
                 from /var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp:35:
/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover/llvm/compat.hpp: In function 'void clover::llvm::compat::set_lang_defaults(clang::CompilerInvocation&, clang::LangOptions&, clang::InputKind, const llvm::Triple&, clang::PreprocessorOptions&, clang::LangStandard::Kind)':
/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover/llvm/compat.hpp:72:58: error: no matching function for call to 'clang::CompilerInvocation::setLangDefaults(clang::LangOptions&, clang::InputKind&, const llvm::Triple&, clang::PreprocessorOptions&, clang::LangStandard::Kind&)'
             inv.setLangDefaults(lopts, ik, t, ppopts, std);
                                                          ^
In file included from /usr/local/include/clang/Frontend/CompilerInstance.h:17:0,
                 from /var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover/llvm/codegen.hpp:37,
                 from /var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp:34:
/usr/local/include/clang/Frontend/CompilerInvocation.h:157:15: note: candidate: static void clang::CompilerInvocation::setLangDefaults(clang::LangOptions&, clang::InputKind, clang::LangStandard::Kind)
   static void setLangDefaults(LangOptions &Opts, InputKind IK,
               ^
/usr/local/include/clang/Frontend/CompilerInvocation.h:157:15: note:   candidate expects 3 arguments, 5 provided
In file included from /var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover/llvm/metadata.hpp:31:0,
                 from /var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp:35:
/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover/llvm/compat.hpp: In function 'void clover::llvm::compat::add_link_bitcode_file(clang::CodeGenOptions&, const string&)':
/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover/llvm/compat.hpp:82:18: error: 'class clang::CodeGenOptions' has no member named 'LinkBitcodeFiles'
             opts.LinkBitcodeFiles.emplace_back(::llvm::Linker::Flags::None, path);
                  ^
/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover/llvm/compat.hpp:82:64: error: 'llvm::Linker::Flags' has not been declared
             opts.LinkBitcodeFiles.emplace_back(::llvm::Linker::Flags::None, path);
                                                                ^
/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover/llvm/compat.hpp: In function 'void clover::llvm::compat::add_internalize_pass(clover::llvm::compat::pass_manager&, const std::vector<std::__cxx11::basic_string<char> >&)':
/var/tmp/portage/media-libs/mesa-13.0.2/work/mesa-13.0.2/src/gallium/state_trackers/clover/llvm/compat.hpp:109:24: error: no matching function for call to 'createInternalizePass(clover::llvm::compat::add_internalize_pass(clover::llvm::compat::pass_manager&, const std::vector<std::__cxx11::basic_string<char> >&)::<lambda(const llvm::GlobalValue&)>)'
                       }));
                        ^
Comment 14 Michel Dänzer 2017-01-07 05:55:22 UTC
(In reply to Christian from comment #13)
> Same problem, different version: 
> mesa-13.0.2
> llvm: sys-devel/llvm-3.9.1

Actually, it looks like it picks up the headers from an older LLVM version for you. If you can't figure out why, ask for help on the mesa-dev mailing list, providing he corresponding config.log file.
Comment 15 Christian 2017-01-07 22:43:59 UTC
(In reply to Michel Dänzer from comment #14)
> (In reply to Christian from comment #13)
> > Same problem, different version: 
> > mesa-13.0.2
> > llvm: sys-devel/llvm-3.9.1
> 
> Actually, it looks like it picks up the headers from an older LLVM version
> for you. If you can't figure out why, ask for help on the mesa-dev mailing
> list, providing he corresponding config.log file.

Yes, you nailed it actually, problem solved, thanks for your reply.


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.