Switch to LLVM/clang 16 (16.0.3)#49678
Conversation
Since initial issue got resolved [1]. [1]: google/sanitizers#1540 Signed-off-by: Azat Khuzhin <[email protected]>
Signed-off-by: Azat Khuzhin <[email protected]>
|
This is an automated comment for commit e5c4eb3 with description of existing statuses. It's updated for the latest CI running
|
Otherwise you will get the following error:
CMake Error at /usr/lib/llvm-16/lib/cmake/clang/ClangTargets.cmake:792 (message):
The imported target "clangBasic" references the file
"/usr/lib/llvm-16/lib/libclangBasic.a"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/llvm-16/lib/cmake/clang/ClangTargets.cmake"
but not all the files it references.
Call Stack (most recent call first):
/usr/lib/llvm-16/lib/cmake/clang/ClangConfig.cmake:20 (include)
generator/CMakeLists.txt:7 (Find_Package)
Signed-off-by: Azat Khuzhin <[email protected]>
Signed-off-by: Azat Khuzhin <[email protected]>
By default woboq uses $version.$minor.$patch, while clang simply uses
$version:
CMake Error at generator/CMakeLists.txt:77 (message):
Could not find any clang builtins headers in
/usr/lib/llvm-16/lib/clang/16.0.4/include
# ls -d /usr/lib/llvm-16/lib/clang/16/include
/usr/lib/llvm-16/lib/clang/16/include
Signed-off-by: Azat Khuzhin <[email protected]>
From the release notes [1]:
To match GCC, __ppc64__ is no longer defined on PowerPC64 targets. Use __powerpc64__ instead.
[1]: https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html
Signed-off-by: Azat Khuzhin <[email protected]>
"The -fexperimental-new-pass-manager and -fno-legacy-pass-manager flags have been removed. These flags have been silently ignored since Clang 15." Signed-off-by: Azat Khuzhin <[email protected]>
Signed-off-by: Azat Khuzhin <[email protected]>
Signed-off-by: Azat Khuzhin <[email protected]>
…tFormat" Let's try to revert this quirk during upgrading to clang 16. This reverts commit c1e7016.
This comment was marked as outdated.
This comment was marked as outdated.
Conflicts: docker/test/codebrowser/Dockerfile
It is too noisy during upgrade:
$ grep error: build_log.log | awk '{print $NF}' | sort | uniq -c
1 [bugprone-standalone-empty,-warnings-as-errors]
1 [misc-misplaced-const,-warnings-as-errors]
2147 [misc-use-anonymous-namespace,-warnings-as-errors]
6 [modernize-loop-convert,-warnings-as-errors]
9 [readability-redundant-string-cstr,-warnings-as-errors]
Signed-off-by: Azat Khuzhin <[email protected]>
Signed-off-by: Azat Khuzhin <[email protected]>
Signed-off-by: Azat Khuzhin <[email protected]>
Signed-off-by: Azat Khuzhin <[email protected]>
Signed-off-by: Azat Khuzhin <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
…more time (sigh) This time, checked locally Signed-off-by: Azat Khuzhin <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
NgramDistanceImpl::unrollLowering() relies on the fact that PODArray has
padding and it is OK to access more items.
Here is an MSan report:
==656==WARNING: MemorySanitizer: use-of-uninitialized-value
0 0x557fd825485f in DB::NgramDistanceImpl<4ul, char8_t, false, true, false>::vectorConstant(DB::PODArray<char8_t, 4096ul, Allocator<false, false>, 63ul, 64ul> const&, DB::PODArray<unsigned long, 4096ul, Allocator<false, false>, 63ul, 64ul> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, DB::PODArray<float, 4096ul, Allocator<false, false>, 63ul, 64ul>&) (/usr/bin/clickhouse+0x124d885f) (BuildId: 76773125d8739591c75d4f4d263a2ffe7ca96855)
1 0x557fd824eb83 in DB::FunctionsStringSimilarity<DB::NgramDistanceImpl<4ul, char8_t, false, true, false>, DB::NameNgramSearchCaseInsensitive>::executeImpl(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName>> const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const (/usr/bin/clickhouse+0x124d2b83) (BuildId: 76773125d8739591c75d4f4d263a2ffe7ca96855)
2 0x557fd50023b7 in DB::FunctionToExecutableFunctionAdaptor::executeImpl() const (/usr/bin/clickhouse+0xf2863b7) (BuildId: 76773125d8739591c75d4f4d263a2ffe7ca96855)
Uninitialized value was stored to memory at
0 0x557fd4f8da5a in __msan_memcpy (/usr/bin/clickhouse+0xf211a5a) (BuildId: 76773125d8739591c75d4f4d263a2ffe7ca96855)
1 0x557fd8253803 in DB::NgramDistanceImpl<4ul, char8_t, false, true, false>::vectorConstant(DB::PODArray<char8_t, 4096ul, Allocator<false, false>, 63ul, 64ul> const&, DB::PODArray<unsigned long, 4096ul, Allocator<false, false>, 63ul, 64ul> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, DB::PODArray<float, 4096ul, Allocator<false, false>, 63ul, 64ul>&) (/usr/bin/clickhouse+0x124d7803) (BuildId: 76773125d8739591c75d4f4d263a2ffe7ca96855)
2 0x557fd824eb83 in DB::FunctionsStringSimilarity<DB::NgramDistanceImpl<4ul, char8_t, false, true, false>, DB::NameNgramSearchCaseInsensitive>::executeImpl(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName>> const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const (/usr/bin/clickhouse+0x124d2b83) (BuildId: 76773125d8739591c75d4f4d263a2ffe7ca96855)
3 0x557fd50023b7 in DB::FunctionToExecutableFunctionAdaptor::executeImpl() const (/usr/bin/clickhouse+0xf2863b7) (BuildId: 76773125d8739591c75d4f4d263a2ffe7ca96855)
Uninitialized value was stored to memory at
0 0x557fd4f8da5a in __msan_memcpy (/usr/bin/clickhouse+0xf211a5a) (BuildId: 76773125d8739591c75d4f4d263a2ffe7ca96855)
1 0x5580061699f5 in detail::memcpySmallAllowReadWriteOverflow15Impl(char*, char const*, long) build_docker/./src/Common/memcpySmall.h:42:13
2 0x5580061699f5 in memcpySmallAllowReadWriteOverflow15(void*, void const*, unsigned long) build_docker/./src/Common/memcpySmall.h:57:5
3 0x5580061699f5 in DB::ColumnString::replicate(DB::PODArray<unsigned long, 4096ul, Allocator<false, false>, 63ul, 64ul> const&) const build_docker/./src/Columns/ColumnString.cpp:462:13
4 0x558005d3fae4 in DB::ColumnConst::convertToFullColumn() const build_docker/./src/Columns/ColumnConst.cpp:48:18
Signed-off-by: Azat Khuzhin <[email protected]>
* u/master: enable used flags's reinit only when the hash talbe rehash Fix build of libfiu on clang-16 fix flaky test 02504_regexp_dictionary_ua_parser fix convertation Fix test that expected CH to apply a wrong optimization ActionsDAG: remove wrong optimization
|
Test failures looks unrelated:
It shows bunch of But, there is one failure of |
| url = https://github.com/VectorCamp/vectorscan | ||
| # FIXME: update once upstream fixes will be merged: | ||
| # - https://github.com/VectorCamp/vectorscan/pull/148 | ||
| # - https://github.com/VectorCamp/vectorscan/pull/149 |
There was a problem hiding this comment.
Just an interesting observation: "cmake/sanitize.cmake" sets -fsanitize-blacklist=${CMAKE_SOURCE_DIR}/tests/msan_suppressions.txt for msan. This file contains line fun:roseRunProgram that suppresses msan warnings in top-level (publicly callable) function "roseRunProgram ()" in rose/program_runtime.c. In other words, it achieves theoretically the same thing as VectorCamp/vectorscan#149.
But the GCC devs agree with your approach, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61978#c1 😄.
Anyways, once this PR is in, I can try to clean out msan_suppressions.txt, it seems redundant and un-obvious to have an alternative way to suppress msan warnings.
There was a problem hiding this comment.
Just an interesting observation: "cmake/sanitize.cmake" sets -fsanitize-blacklist=${CMAKE_SOURCE_DIR}/tests/msan_suppressions.txt for msan. This file contains line fun:roseRunProgram that suppresses msan warnings in top-level (publicly callable) function "roseRunProgram ()" in rose/program_runtime.c. In other words, it achieves theoretically the same thing as VectorCamp/vectorscan#149.
Hm, I totally forgot to look at MSan suppressions, thanks! I want check it again now, need to get full stack trace to compare why it does not work in debug build, and works in release.
There is actually one more fix for this - ClickHouse/boost#12, I tried to fix this in the small_vector, but since clang-16 it was not easy (I wrote about this in the vectorscan PR)
Anyways, once this PR is in, I can try to clean out msan_suppressions.txt, it seems redundant and un-obvious to have an alternative way to suppress msan warnings
Will take a look, but first, I need to check why it didn't work (maybe there is something more...)
There was a problem hiding this comment.
Looks like you already did this - #49829, thanks!
But the question why suppressions does not work, it still open.
| if constexpr (case_insensitive) | ||
| { | ||
| #if defined(MEMORY_SANITIZER) | ||
| /// Due to PODArray padding accessing more elements should be OK |
There was a problem hiding this comment.
Speaking of tests/msan_suppressions.txt, it contains another suppression
# We apply std::tolower to uninitialized padding, but don't use the result, so
# it is OK. Reproduce with "select ngramDistanceCaseInsensitive(materialize(''), '')"
fun:tolower
Looks like msan16 no longer picks these suppressions up.
| # FIXME: update once upstream fixes will be merged: | ||
| # - https://github.com/VectorCamp/vectorscan/pull/148 | ||
| # - https://github.com/VectorCamp/vectorscan/pull/149 | ||
| url = https://github.com/azat-ch/vectorscan |
There was a problem hiding this comment.
Sorry for being a bit late for the party, but there's no need to change the url. It is available all over the forks
There was a problem hiding this comment.
@Felixoid I don't mind leaving my fork, but a) I guess it is some kind of unspoken rule to use ClickHouse namespace for forks and b) it makes sense most of the time, since if fork will be removed, then you will not be able to download it (though personally I - not going to remove this forks, but still).
There was a problem hiding this comment.
I also don't mind too much. I would say the unspoken rule is "reference upstream if possible (= there are no custom patches), otherwise reference a fork in the ClickHouse organization".
Anyways, after making some silly mess, I now
- created https://github.com/ClickHouse/vectorscan/
- pushed your two fixes to branch ClickHouse/vectorscan/5.4.9 in this forked repo
- and referenced that fork + commit from ClickHouse (here).
Your two pushes against vectorscan upstream remain as is (fingers crossed they are merged).
woboq codebrowser uses clang tooling, which adds clang system includes (in Linux::AddClangSystemIncludeArgs()), because none of (-nostdinc, -nobuiltininc) is set. And later it will complain with -Wpoison-system-directories for added by itself includes in InitHeaderSearch::AddUnmappedPath(), because they are starts from one of the following: - /usr/include - /usr/local/include The interesting thing here is that it got broken only after upgrading to llvm 16 (in ClickHouse#49678), and the reason for this is that clang 15 build has system includes that does not trigger the warning - "/usr/lib/clang/15.0.7/include", while clang 16 has "/usr/include/clang/16.0.4/include" So let's simply disable this warning, but only for woboq. Signed-off-by: Azat Khuzhin <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Switch to LLVM/clang 16
Based on: #47709 (cc @alexey-milovidov )
Reverts: #43195
Fixes: #41500 (many thanks to @itrofimow for the patch!)
Closes: #46383 (cc @Felixoid )
Partially reverts: #42457/#40873 (workaround for emitting .debug_aranges), since patch had been merged to upstream) and included into LLVM 16
Blocks: #47783
Required fixes: