Add implicit interfaces for function hooks in Fortran module#2809
Add implicit interfaces for function hooks in Fortran module#2809joewallwork wants to merge 27 commits into
Conversation
|
Huh, looks like ifx doesn't like externals with leading underscores. I hadn't tested this with that compiler yet (just flang). |
d249dc7 to
3c11497
Compare
Fixed in 237ebc6 by prepending with |
|
I don't understand why the I don't see this error when building locally and running the test with IFX. |
sigh gotta love ifx. In the logs we also see |
| ! RUN: if [ %llvmver -ge 13 ]; then ifx -flto -O1 -c %s -o /dev/stdout | %opt %loadEnzyme -enzyme -o %t && ifx -flto -O1 %t -o %t1 && %t1 | FileCheck %s; fi | ||
| ! RUN: if [ %llvmver -ge 13 ]; then ifx -flto -O2 -c %s -o /dev/stdout | %opt %loadEnzyme -enzyme -o %t && ifx -flto -O2 %t -o %t1 && %t1 | FileCheck %s; fi | ||
| ! RUN: if [ %llvmver -ge 13 ]; then ifx -flto -O3 -c %s -o /dev/stdout | %opt %loadEnzyme -enzyme -o %t && ifx -flto -O3 %t -o %t1 && %t1 | FileCheck %s; fi | ||
| ! RUN: if [ %llvmver -ge 13 ]; then ifx -flto -O0 -c %loadFortran %s -o /dev/stdout | %opt %loadEnzyme -enzyme -o %t && ifx -flto -O0 %t -o %t1 && %t1 | FileCheck %s; fi |
There was a problem hiding this comment.
! RUN: if [ %llvmver -ge 13 ]; then ifx -flto -O0 -c %loadFortran %s -o /dev/stdout | %opt %loadEnzyme -enzyme -o %t && ifx -flto -O0 %t -o %t1 && %t1 | FileCheck %s; fi
We should detect which fortran compiler we are using based CMAKE_FC_COMPILER_ID which should be IntelLLVM and then define a substition for %fc
| run: | | ||
| rm -rf build && mkdir build && cd build | ||
| cmake ../enzyme -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm -DLLVM_EXTERNAL_LIT=`which lit` -DENZYME_IFX=ON | ||
| cmake ../enzyme -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm -DLLVM_EXTERNAL_LIT=`which lit` -DENZYME_FORTRAN=ON -DENZYME_IFX=ON |
There was a problem hiding this comment.
-DCMAKE_FC_COMPILER=ifx and later we can generalize the workflow to also support flang
Co-authored-by: Valentin Churavy <v.churavy@gmail.com>
|
Hm ifx still doesn't seem happy. I should have some time to debug later in the week. |
|
Currently we test Fortran integration with LLVM 15, we eventually need to update that. I just wanted to use an Enzyme build with LLVM 21 and ran into |
|
To debug the current failure: So the additional indirection is hiding things. |
|
So the issue only exists at at |
|
I was playing around with: and variations thereof, but nothing seems to stick. Adding does work but is kinda silly. The options I see is:
|
Alas. My debugging today has also not really revealed any ways forward with ifx. I'll work on setting up a flang CI so that we can test the bindings under that compiler (works fine for me so far) and I guess we can return to ifx later. |
Closes #2808.
Merges into #2807.As mentioned in the issue, it turns out that the interfacing to the special Enzyme function hooks can be done using implicit interfaces in Fortran. That is, you can get away without providing an explicit
interfaceblock like is done in the examples so long as you declarefor example.
Checklist
enzymemodulesquareexampleHooking up in the
allocatableArraySimpleexample will require fixing #2820.