Skip to content

Conversation

ZuseZ4
Copy link
Collaborator

@ZuseZ4 ZuseZ4 commented Aug 7, 2025

Rust recently updated to llvm 21: rust-lang/rust#143684
This caused build failures in the BCLoader.

[6/8] Building CXX object BCLoad/CMakeFiles/EnzymeBCLoad-21.dir/BCLoader.cpp.o
FAILED: BCLoad/CMakeFiles/EnzymeBCLoad-21.dir/BCLoader.cpp.o
/usr/bin/c++ -DENZYME_VERSION_MAJOR=0 -DENZYME_VERSION_MINOR=0 -DENZYME_VERSION_PATCH=79 -DEnzymeBCLoad_21_EXPORTS -I/home/gh-Sa4dUs/rust/build/aarch64-unknown-linux-gnu/llvm/include -I/home/gh-Sa4dUs/rust/build/aarch64-unknown-linux-gnu/enzyme/build/include -I/home/gh-Sa4dUs/rust/build/aarch64-unknown-linux-gnu/enzyme/build/BCLoad/gsl -Wall -fno-rtti -ffunction-sections -fdata-sections -fPIC -Werror=unused-variable -Werror=dangling-else -Werror=unused-but-set-variable -Werror=return-type -Werror=nonnull -Werror=unused-result -Werror=reorder -Werror=switch -O2 -std=gnu++17 -fPIC   -D_GNU_SOURCE -D_DEBUG -D_GLIBCXX_ASSERTIONS -DEXPERIMENTAL_KEY_INSTRUCTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -MD -MT BCLoad/CMakeFiles/EnzymeBCLoad-21.dir/BCLoader.cpp.o -MF BCLoad/CMakeFiles/EnzymeBCLoad-21.dir/BCLoader.cpp.o.d -o BCLoad/CMakeFiles/EnzymeBCLoad-21.dir/BCLoader.cpp.o -c /home/gh-Sa4dUs/rust/src/tools/enzyme/enzyme/BCLoad/BCLoader.cpp
/home/gh-Sa4dUs/rust/src/tools/enzyme/enzyme/BCLoad/BCLoader.cpp: In function 'bool provideDefinitions(llvm::Module&, std::set<std::__cxx11::basic_string<char> >, std::vector<std::__cxx11::basic_string<char> >&)':
/home/gh-Sa4dUs/rust/src/tools/enzyme/enzyme/BCLoad/BCLoader.cpp:135:25: error: cannot convert 'const char [1]' to 'llvm::Triple'
  135 |     BC->setTargetTriple("");
      |                         ^~
      |                         |
      |                         const char [1]
In file included from /home/gh-Sa4dUs/rust/src/tools/enzyme/enzyme/BCLoad/BCLoader.cpp:2:
/home/gh-Sa4dUs/rust/build/aarch64-unknown-linux-gnu/llvm/include/llvm/IR/Module.h:324:31: note:   initializing argument 1 of 'void llvm::Module::setTargetTriple(llvm::Triple)'
  324 |   void setTargetTriple(Triple T) { TargetTriple = std::move(T); }
      |                        ~~~~~~~^
ninja: build stopped: subcommand failed.

The failure should be fixed independently, but afaik on the Rust side we don't use the BCloader, so I think there is no reason to build it in the first place. With this patch, rust bootstrap works again, so I merged rust-lang#29 for now, but would like to upstream it.

Relatedly, I should probably disable the following:

[116/144] Performing download step (git clone) for 'fblas'
Cloning into 'fblas'...
HEAD is now at 94f7c31 fix
[125/144] Performing download step (git clone) for 'gsl64'
Cloning into 'gsl64'...
HEAD is now at 5805b83 Remove short circuit
Submodule 'ampl/thirdparty/asl' (https://github.com/ampl/asl.git) registered for path 'ampl/thirdparty/asl'
Cloning into '/prog/rust/build/x86_64-unknown-linux-gnu/enzyme/build/BCLoad/gsl64/src/gsl64/ampl/thirdparty/asl'...
Submodule path 'ampl/thirdparty/asl': checked out 'dd1c4c4e5647ead51169caad280c36a88d0f0237'
[128/144] Performing download step (git clone) for 'gsl'
Cloning into 'gsl'...
HEAD is now at 5805b83 Remove short circuit
Submodule 'ampl/thirdparty/asl' (https://github.com/ampl/asl.git) registered for path 'ampl/thirdparty/asl'
Cloning into 'prog/rust/build/x86_64-unknown-linux-gnu/enzyme/build/BCLoad/gsl/src/gsl/ampl/thirdparty/asl'...
Submodule path 'ampl/thirdparty/asl': checked out 'dd1c4c4e5647ead51169caad280c36a88d0f0237'

(The toolchain size increase of ~9 MiB through Enzyme currently is the only reason why std::autodiff isn't enabled in nightly by default, so that's somewhat relevant.)

@ZuseZ4 ZuseZ4 requested a review from wsmoses August 7, 2025 23:13
@wsmoses
Copy link
Member

wsmoses commented Aug 7, 2025

this is fine, but also could you add the fix for the bcloader on llvm21 (presumably BC->setTargetTriple(""); becomes BC->setTargetTriple(llvm::Triple("")); )

@wsmoses
Copy link
Member

wsmoses commented Aug 7, 2025

also probably add LLVM 21 integration test CI, so then this will be caught in the future?

@ZuseZ4
Copy link
Collaborator Author

ZuseZ4 commented Aug 24, 2025

I've added your fix, it works locally from LLVM15 onwards, but somehow Julia seems unhappy. So I just limited the fix to 21+.

@ZuseZ4 ZuseZ4 enabled auto-merge August 24, 2025 20:38
@ZuseZ4 ZuseZ4 added this pull request to the merge queue Aug 24, 2025
@wsmoses wsmoses removed this pull request from the merge queue due to a manual request Aug 24, 2025
@wsmoses
Copy link
Member

wsmoses commented Aug 24, 2025

can you also add the LLVM21 test to confirm this builds as expected?

@ZuseZ4
Copy link
Collaborator Author

ZuseZ4 commented Aug 24, 2025

We don't have LLVM-21 CI, and touching enzyme CI is a bit beyond the time I have atm.

@wsmoses
Copy link
Member

wsmoses commented Aug 24, 2025

it should just be adding it to the relevant yml file

@ZuseZ4
Copy link
Collaborator Author

ZuseZ4 commented Sep 16, 2025

ping @wsmoses this keeps comming up

@wsmoses wsmoses merged commit 76026d5 into EnzymeAD:main Sep 16, 2025
23 checks passed
@ZuseZ4
Copy link
Collaborator Author

ZuseZ4 commented Sep 16, 2025

thx

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.

2 participants