Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-45132: [C++][Gandiva] Update LLVM to 18.1 #45114

Merged
merged 9 commits into from
Feb 3, 2025

Conversation

lriggs
Copy link
Contributor

@lriggs lriggs commented Dec 27, 2024

Rationale for this change

#37848 upgraded the JIT compiler for LLVM/Gandiva code which presented linking errors with newer version of LLVM. Some Gandiva tests were disabled, and here at Dremio I am running into the same linking problem when trying to build with an updated Arrow library. After reading some threads on the LLVM discord server it appears that updating to LLVM 18.1 will fix the symbol issue. I tested locally and was able to re-enable the disabled java tests which were showing the unexported ORC symbol issue.

More discussion in apache/arrow-java#63.

What changes are included in this PR?

Updating vcpkg and pinning LLVM to 18.1 Notably I found encountered some build problems using the newest vcpkg update, which appeared to be related to the updated gRPC libraries. My Arrow jar CI build was timing out in this case with no clear error in the logs. The vcpkg version included here has the LLVM 18 update but not the gRPC update (which isn't needed for this issue).

Are these changes tested?

Covered by existing tests. Will also re-enable the disabled Java tests in a future change.

Are there any user-facing changes?

No.

@lriggs lriggs requested a review from wjones127 as a code owner December 27, 2024 23:14
Copy link

⚠️ GitHub issue #55 has been automatically assigned in GitHub to PR creator.

Copy link

⚠️ GitHub issue #43981 has no components, please add labels for components.

@kou
Copy link
Member

kou commented Dec 28, 2024

Could you open a new issue for this?
GH-43981 doesn't exist in apache/arrow now.

Copy link

⚠️ GitHub issue #55 has been automatically assigned in GitHub to PR creator.

Copy link

⚠️ GitHub issue #43981 has no components, please add labels for components.

@kou kou changed the title GH-43981 [Gandiva] Revert LVVM JIT upgrade. GH-45132: [C++][Gandiva] Revert LVVM JIT upgrade Dec 31, 2024
Copy link

⚠️ GitHub issue #45132 has been automatically assigned in GitHub to PR creator.

@kou
Copy link
Member

kou commented Dec 31, 2024

We have AddAbsoluteSymbol() helper:

void AddAbsoluteSymbol(llvm::orc::LLJIT& lljit, const std::string& name,
void* function_ptr) {
llvm::orc::MangleAndInterner mangle(lljit.getExecutionSession(), lljit.getDataLayout());
// https://github.com/llvm/llvm-project/commit/8b1771bd9f304be39d4dcbdcccedb6d3bcd18200#diff-77984a824d9182e5c67a481740f3bc5da78d5bd4cf6e1716a083ddb30a4a4931
// LLVM 17 introduced ExecutorSymbolDef and move most of ORC APIs to ExecutorAddr
#if LLVM_VERSION_MAJOR >= 17
llvm::orc::ExecutorSymbolDef symbol(
llvm::orc::ExecutorAddr(reinterpret_cast<uint64_t>(function_ptr)),
llvm::JITSymbolFlags::Exported);
#else
llvm::JITEvaluatedSymbol symbol(reinterpret_cast<llvm::JITTargetAddress>(function_ptr),
llvm::JITSymbolFlags::Exported);
#endif
auto error = lljit.getMainJITDylib().define(
llvm::orc::absoluteSymbols({{mangle(name), symbol}}));
llvm::cantFail(std::move(error));
}

Can we register llvm_orc_registerEHFrameSectionWrapper() and needed symbols manually instead?

@lriggs
Copy link
Contributor Author

lriggs commented Jan 2, 2025

We have AddAbsoluteSymbol() helper:

void AddAbsoluteSymbol(llvm::orc::LLJIT& lljit, const std::string& name,
void* function_ptr) {
llvm::orc::MangleAndInterner mangle(lljit.getExecutionSession(), lljit.getDataLayout());
// https://github.com/llvm/llvm-project/commit/8b1771bd9f304be39d4dcbdcccedb6d3bcd18200#diff-77984a824d9182e5c67a481740f3bc5da78d5bd4cf6e1716a083ddb30a4a4931
// LLVM 17 introduced ExecutorSymbolDef and move most of ORC APIs to ExecutorAddr
#if LLVM_VERSION_MAJOR >= 17
llvm::orc::ExecutorSymbolDef symbol(
llvm::orc::ExecutorAddr(reinterpret_cast<uint64_t>(function_ptr)),
llvm::JITSymbolFlags::Exported);
#else
llvm::JITEvaluatedSymbol symbol(reinterpret_cast<llvm::JITTargetAddress>(function_ptr),
llvm::JITSymbolFlags::Exported);
#endif
auto error = lljit.getMainJITDylib().define(
llvm::orc::absoluteSymbols({{mangle(name), symbol}}));
llvm::cantFail(std::move(error));
}

Can we register llvm_orc_registerEHFrameSectionWrapper() and needed symbols manually instead?

Good idea, I'll try it.

@pitrou pitrou changed the title GH-45132: [C++][Gandiva] Revert LVVM JIT upgrade GH-45132: [C++][Gandiva] Revert LLVM JIT upgrade Jan 6, 2025
@lriggs lriggs force-pushed the apache_main_lriggs branch from 150d723 to 3bb3cc0 Compare January 24, 2025 23:32
@lriggs
Copy link
Contributor Author

lriggs commented Jan 24, 2025

I didn't have any luck trying to register the symbols since this error was happening when creating the llvm object, before registration could be done. My latest change updates to llvm 18.1 which seems to fix the symbol issue.

@lriggs lriggs changed the title GH-45132: [C++][Gandiva] Revert LLVM JIT upgrade GH-45132: [C++][Gandiva] Update LLVM to 18.1 Jan 24, 2025
Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! LLVM 18.1 has a fix of this!?

BTW, can we update our default LLVM?

diff --git a/.env b/.env
index 0651d189c2..73644c0d1f 100644
--- a/.env
+++ b/.env
@@ -62,8 +62,7 @@ GCC=
 HDFS=3.2.1
 JDK=11
 KARTOTHEK=latest
-# LLVM 12 and GCC 11 reports -Wmismatched-new-delete.
-LLVM=14
+LLVM=18
 MAVEN=3.8.7
 NODE=18
 NUMBA=latest

@kou
Copy link
Member

kou commented Jan 25, 2025

@github-actions crossbow submit -g wheel

@github-actions github-actions bot removed the awaiting review Awaiting review label Jan 25, 2025
@lriggs
Copy link
Contributor Author

lriggs commented Feb 1, 2025

@kou I think this is ready now. The CI failures don't seem related to my changes (and some of the passed earlier). Can you rerun those tests, or is there a way to know that they aren't related to my change?

@kou
Copy link
Member

kou commented Feb 1, 2025

@github-actions crossbow submit -g wheel

Copy link

github-actions bot commented Feb 1, 2025

Revision: 55e0c81

Submitted crossbow builds: ursacomputing/crossbow @ actions-9d3e8e6b6f

Task Status
python-sdist GitHub Actions
wheel-macos-monterey-cp310-cp310-amd64 GitHub Actions
wheel-macos-monterey-cp310-cp310-arm64 GitHub Actions
wheel-macos-monterey-cp311-cp311-amd64 GitHub Actions
wheel-macos-monterey-cp311-cp311-arm64 GitHub Actions
wheel-macos-monterey-cp312-cp312-amd64 GitHub Actions
wheel-macos-monterey-cp312-cp312-arm64 GitHub Actions
wheel-macos-monterey-cp313-cp313-amd64 GitHub Actions
wheel-macos-monterey-cp313-cp313-arm64 GitHub Actions
wheel-macos-monterey-cp313-cp313t-amd64 GitHub Actions
wheel-macos-monterey-cp313-cp313t-arm64 GitHub Actions
wheel-macos-monterey-cp39-cp39-amd64 GitHub Actions
wheel-macos-monterey-cp39-cp39-arm64 GitHub Actions
wheel-manylinux-2-28-cp310-cp310-amd64 GitHub Actions
wheel-manylinux-2-28-cp310-cp310-arm64 GitHub Actions
wheel-manylinux-2-28-cp311-cp311-amd64 GitHub Actions
wheel-manylinux-2-28-cp311-cp311-arm64 GitHub Actions
wheel-manylinux-2-28-cp312-cp312-amd64 GitHub Actions
wheel-manylinux-2-28-cp312-cp312-arm64 GitHub Actions
wheel-manylinux-2-28-cp313-cp313-amd64 GitHub Actions
wheel-manylinux-2-28-cp313-cp313-arm64 GitHub Actions
wheel-manylinux-2-28-cp313-cp313t-amd64 GitHub Actions
wheel-manylinux-2-28-cp313-cp313t-arm64 GitHub Actions
wheel-manylinux-2-28-cp39-cp39-amd64 GitHub Actions
wheel-manylinux-2-28-cp39-cp39-arm64 GitHub Actions
wheel-manylinux-2014-cp310-cp310-amd64 GitHub Actions
wheel-manylinux-2014-cp310-cp310-arm64 GitHub Actions
wheel-manylinux-2014-cp311-cp311-amd64 GitHub Actions
wheel-manylinux-2014-cp311-cp311-arm64 GitHub Actions
wheel-manylinux-2014-cp312-cp312-amd64 GitHub Actions
wheel-manylinux-2014-cp312-cp312-arm64 GitHub Actions
wheel-manylinux-2014-cp313-cp313-amd64 GitHub Actions
wheel-manylinux-2014-cp313-cp313-arm64 GitHub Actions
wheel-manylinux-2014-cp313-cp313t-amd64 GitHub Actions
wheel-manylinux-2014-cp313-cp313t-arm64 GitHub Actions
wheel-manylinux-2014-cp39-cp39-amd64 GitHub Actions
wheel-manylinux-2014-cp39-cp39-arm64 GitHub Actions
wheel-windows-cp310-cp310-amd64 GitHub Actions
wheel-windows-cp311-cp311-amd64 GitHub Actions
wheel-windows-cp312-cp312-amd64 GitHub Actions
wheel-windows-cp313-cp313-amd64 GitHub Actions
wheel-windows-cp313-cp313t-amd64 GitHub Actions
wheel-windows-cp39-cp39-amd64 GitHub Actions

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Thanks!

@github-actions github-actions bot added awaiting review Awaiting review awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Feb 1, 2025
@github-actions github-actions bot added awaiting review Awaiting review and removed awaiting review Awaiting review awaiting merge Awaiting merge labels Feb 3, 2025
@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Feb 3, 2025
@kou kou merged commit 31747f0 into apache:main Feb 3, 2025
15 checks passed
@kou kou removed the awaiting committer review Awaiting committer review label Feb 3, 2025
Copy link

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 31747f0.

There were 8 benchmark results with an error:

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

lidavidm pushed a commit to apache/arrow-java that referenced this pull request Feb 19, 2025
Fixes GH-55.

### Rationale for this change
I fixed the linking error here:
apache/arrow#45114

### What changes are included in this PR?
Reenabling some disabled tests.

### Are these changes tested?
Yes, they are tests.

### Are there any user-facing changes?
No.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants