Fix LLVM IR expectations for the autodiff generic test - #156754
Conversation
| // F64-NEXT: start: | ||
| // F64-NEXT: {{(tail )?}}call {{(fastcc )?}}void @diffe_{{.*}}(double {{.*}}, ptr {{.*}}) | ||
| // F64-NEXT: ret void | ||
| // F64-NEXT: {{(tail )?}}call {{.*}} @diffe_{{.*}} |
There was a problem hiding this comment.
I'm still learning what level of detail LLVM IR checks should usually assert.
Since the exact return type and arg types of the generated @diffe_ call seem somewhat fragile here, would it be better to avoid checking them?
Is it enough for this test to only check that a diffe_ function is called?
There was a problem hiding this comment.
I changed my mind
Clarify the return types in LLVM IR for autodiff generic test
3c06aea to
fe4fd3f
Compare
|
I tested this PR still works after enzyme submodule update: #157716 |
|
☔ The latest upstream changes (presumably #158811) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
|
Hello, may I ask how to run the test? I've tried with this in profile = "compiler" # Includes one of the default files in src/bootstrap/defaults
change-id = "ignore"
llvm.enzyme = true
llvm.download-ci-llvm = false
rust.verbose-tests=trueand I build like this: ./x test ./tests/codegen-llvm/autodiff/generic.rsbut I get this error: [39/40] Linking CXX shared library Enzyme/libEnzyme-23.so
FAILED: Enzyme/libEnzyme-23.so
: && /usr/bin/c++ -fPIC -Wall -fno-rtti -Wno-deprecated -ffunction-sections -fdata-sections -fPIC -m64 -w -Werror=implicit-fallthrough -Werror=unused-variable -Werror=dangling-else -Werror=unused-but-set-variable -Werror=return-type -Werror=nonnull -Werror=unused-result -Werror=reorder -Werror=switch -O2 -shared -Wl,-soname,libEnzyme-23.so -o Enzyme/libEnzyme-23.so Enzyme/CMakeFiles/Enzyme-23.dir/ActivityAnalysis.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/ActivityAnalysisPrinter.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/CApi.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/CacheUtility.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/CallDerivatives.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/DiffeGradientUtils.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/DifferentialUseAnalysis.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/Enzyme.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/EnzymeLogic.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/FixupJuliaCallingConvention.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/FunctionUtils.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/GradientUtils.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/InstructionBatcher.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/JLInstSimplify.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/MustExitScalarEvolution.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/PreserveNVVM.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/SimpleGVN.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/TraceGenerator.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/TraceInterface.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/TraceUtils.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/Utils.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/TypeAnalysis/TypeTree.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/TypeAnalysis/TypeAnalysis.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/TypeAnalysis/TypeAnalysisPrinter.cpp.o Enzyme/CMakeFiles/Enzyme-23.dir/TypeAnalysis/RustDebugInfo.cpp.o -lLLVM && :
/usr/bin/ld: cannot find -lLLVM: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.it says I tested on a clean checkout of 887804d. |
|
https://rustc-dev-guide.rust-lang.org/autodiff/installation.html#build-instructions I think you might be missing |
|
Thanks, that worked 👍 Triage: Is this blocked from review somehow? Or haven't you just had time to review this yet? |
|
This PR is outdated and I forgot to close it |
Relax the LLVM IR checks for
d_square::<f64>so they do not depend on the exact return type or argument ABI(which I don't think are necessary to check here) of the generated@diffe_call.Also add checks that
square::<f64>is generated, sinced_square::<f64>needs thef64monomorphization even thoughsquare::<f64>is not called directly. I thought it seems natural to check it, but let me know if we do not need it.I tested it works on my local(aarch64 mac) and dev-desktop(x86_64 linux)
r? @ZuseZ4