Skip to content

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

Merged
kou merged 9 commits into
apache:mainfrom
lriggs:apache_main_lriggs
Feb 3, 2025
Merged

GH-45132: [C++][Gandiva] Update LLVM to 18.1#45114
kou merged 9 commits into
apache:mainfrom
lriggs:apache_main_lriggs

Conversation

@lriggs

@lriggslriggs commented Dec 27, 2024

Copy link
Copy Markdown
Contributor

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.

@github-actions

Copy link
Copy Markdown

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

@github-actions

Copy link
Copy Markdown

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

@kou

kou commented Dec 28, 2024

Copy link
Copy Markdown
Member

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

@github-actions

Copy link
Copy Markdown

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

@github-actions

Copy link
Copy Markdown

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

@koukou changed the title GH-43981 [Gandiva] Revert LVVM JIT upgrade.GH-45132: [C++][Gandiva] Revert LVVM JIT upgradeDec 31, 2024
@github-actions

Copy link
Copy Markdown

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

@kou

kou commented Dec 31, 2024

Copy link
Copy Markdown
Member

We have AddAbsoluteSymbol() helper:

voidAddAbsoluteSymbol(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
Copy Markdown
ContributorAuthor

We have AddAbsoluteSymbol() helper:

voidAddAbsoluteSymbol(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.

@pitroupitrou changed the title GH-45132: [C++][Gandiva] Revert LVVM JIT upgradeGH-45132: [C++][Gandiva] Revert LLVM JIT upgradeJan 6, 2025
@lriggs

Copy link
Copy Markdown
ContributorAuthor

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.

@lriggslriggs changed the title GH-45132: [C++][Gandiva] Revert LLVM JIT upgradeGH-45132: [C++][Gandiva] Update LLVM to 18.1Jan 24, 2025

@koukou left a comment

Copy link
Copy Markdown
Member

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

Comment threadci/docker/java-jni-manylinux-201x.dockerfile Outdated
Comment thread.env Outdated
Comment threaddocker-compose.yml Outdated
@kou

kou commented Jan 25, 2025

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g wheel

@github-actionsgithub-actionsBot removed the awaiting review Awaiting review label Jan 25, 2025
@lriggs

Copy link
Copy Markdown
ContributorAuthor

@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

kou commented Feb 1, 2025

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g wheel

@github-actions

Copy link
Copy Markdown

Revision: 55e0c81

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

TaskStatus
python-sdistGitHub Actions
wheel-macos-monterey-cp310-cp310-amd64GitHub Actions
wheel-macos-monterey-cp310-cp310-arm64GitHub Actions
wheel-macos-monterey-cp311-cp311-amd64GitHub Actions
wheel-macos-monterey-cp311-cp311-arm64GitHub Actions
wheel-macos-monterey-cp312-cp312-amd64GitHub Actions
wheel-macos-monterey-cp312-cp312-arm64GitHub Actions
wheel-macos-monterey-cp313-cp313-amd64GitHub Actions
wheel-macos-monterey-cp313-cp313-arm64GitHub Actions
wheel-macos-monterey-cp313-cp313t-amd64GitHub Actions
wheel-macos-monterey-cp313-cp313t-arm64GitHub Actions
wheel-macos-monterey-cp39-cp39-amd64GitHub Actions
wheel-macos-monterey-cp39-cp39-arm64GitHub Actions
wheel-manylinux-2-28-cp310-cp310-amd64GitHub Actions
wheel-manylinux-2-28-cp310-cp310-arm64GitHub Actions
wheel-manylinux-2-28-cp311-cp311-amd64GitHub Actions
wheel-manylinux-2-28-cp311-cp311-arm64GitHub Actions
wheel-manylinux-2-28-cp312-cp312-amd64GitHub Actions
wheel-manylinux-2-28-cp312-cp312-arm64GitHub Actions
wheel-manylinux-2-28-cp313-cp313-amd64GitHub Actions
wheel-manylinux-2-28-cp313-cp313-arm64GitHub Actions
wheel-manylinux-2-28-cp313-cp313t-amd64GitHub Actions
wheel-manylinux-2-28-cp313-cp313t-arm64GitHub Actions
wheel-manylinux-2-28-cp39-cp39-amd64GitHub Actions
wheel-manylinux-2-28-cp39-cp39-arm64GitHub Actions
wheel-manylinux-2014-cp310-cp310-amd64GitHub Actions
wheel-manylinux-2014-cp310-cp310-arm64GitHub Actions
wheel-manylinux-2014-cp311-cp311-amd64GitHub Actions
wheel-manylinux-2014-cp311-cp311-arm64GitHub Actions
wheel-manylinux-2014-cp312-cp312-amd64GitHub Actions
wheel-manylinux-2014-cp312-cp312-arm64GitHub Actions
wheel-manylinux-2014-cp313-cp313-amd64GitHub Actions
wheel-manylinux-2014-cp313-cp313-arm64GitHub Actions
wheel-manylinux-2014-cp313-cp313t-amd64GitHub Actions
wheel-manylinux-2014-cp313-cp313t-arm64GitHub Actions
wheel-manylinux-2014-cp39-cp39-amd64GitHub Actions
wheel-manylinux-2014-cp39-cp39-arm64GitHub Actions
wheel-windows-cp310-cp310-amd64GitHub Actions
wheel-windows-cp311-cp311-amd64GitHub Actions
wheel-windows-cp312-cp312-amd64GitHub Actions
wheel-windows-cp313-cp313-amd64GitHub Actions
wheel-windows-cp313-cp313t-amd64GitHub Actions
wheel-windows-cp39-cp39-amd64GitHub Actions

kou
kou approved these changes Feb 1, 2025

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

Thanks!

Comment thread.env
@github-actionsgithub-actionsBot added awaiting review Awaiting review awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Feb 1, 2025
@github-actionsgithub-actionsBot added awaiting review Awaiting review and removed awaiting review Awaiting review awaiting merge Awaiting merge labels Feb 3, 2025
@github-actionsgithub-actionsBot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Feb 3, 2025
@kou
kou merged commit 31747f0 into apache:mainFeb 3, 2025
@koukou removed the awaiting committer review Awaiting committer review label Feb 3, 2025
@conbench-apache-arrow

Copy link
Copy Markdown

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
FixesGH-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 freeto 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

@lriggs@kou@h-vetinari