-
Notifications
You must be signed in to change notification settings - Fork 169
Add implicit interfaces for function hooks in Fortran module #2809
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
Merged
Merged
Changes from 24 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
8052bde
Add enzyme_mod containing activity descriptor bindings
joewallwork 47c59bd
Hook Fortran bindings up in build system
joewallwork 27b7edc
Rename enzyme_mod->enzyme
joewallwork eec1139
Use implicit interface in square example
joewallwork b34ce86
Add bindings for __enzyme_autodiff and __enzyme_fwddiff to the Fortra…
joewallwork 3c11497
Use __enzyme_autodiff binding in square example
joewallwork 237ebc6
Prepend function hooks with f
joewallwork 2338caf
Trigger Fortran CI on changes to enzyme/Fortran
joewallwork 3219957
Merge branch 'main' into 2808_fortran-implicit-interfaces
joewallwork 16090da
Reorder to compile Fortran module before tests
joewallwork b7685e0
Drop duplicate option
joewallwork 96ddb90
Build with ENZYME_FORTRAN=ON in CI
joewallwork 7a84258
Only build Fortran tests if ENZYME_FORTRAN
joewallwork 89abe9f
Remove CMake commands not needed
joewallwork 981e5c0
Use enzyme.mod in Fortran square test
joewallwork 9822b1c
Add back in CMake from Fortran subdir
joewallwork 48db7db
Drop unrelated editor changes
joewallwork 9f65061
Fixes for root CMakeLists
joewallwork ebcfca1
Add messages for building Fortran bindings and tests
joewallwork db7cbff
Move message into Fortran subdir
joewallwork be84f81
Make EnzymeFortran a shared object
joewallwork e6e07ca
Try putting module in modules dir
joewallwork 2be33a7
Introduce another module for function hooks to facilitate aliasing
joewallwork 6847dd6
Add EnzymeFortran to test dependencies
joewallwork 090547b
Apply suggestions from code review
joewallwork b50179c
Set CMake Fortran compiler in test suite
joewallwork fa15388
Hook Fortran compiler up in test suite
joewallwork 57855fa
Revert to f__enzyme_autodiff
joewallwork 9c5e14a
Merge branch 'main' into 2808_fortran-implicit-interfaces
joewallwork 53ea72d
Revert 57855fae9cb71c56bcf18383c6b92e009f2b522c
joewallwork c76b261
Disable -O0 test for now
joewallwork 42d8f08
Drop unnecessary semicolon
joewallwork 70a98be
Add README for Fortran bindings
joewallwork File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| ! ===- enzyme_function_hooks.f90 - Fortran bindings function hooks --------=== ! | ||
| ! | ||
| ! Enzyme Project | ||
| ! | ||
| ! Part of the Enzyme Project, under the Apache License v2.0 with LLVM | ||
| ! Exceptions. See https://llvm.org/LICENSE.txt for license information. | ||
| ! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| ! | ||
| ! If using this code in an academic setting, please cite the following: | ||
| ! @misc{enzymeGithub, | ||
| ! author = {William S. Moses and Valentin Churavy}, | ||
| ! title = {Enzyme: High Performance Automatic Differentiation of LLVM}, | ||
| ! year = {2020}, | ||
| ! howpublished = {\url{https://github.com/wsmoses/Enzyme}}, | ||
| ! note = {commit xxxxxxx} | ||
| ! } | ||
| ! | ||
| ! ===----------------------------------------------------------------------=== ! | ||
| ! | ||
| ! This file provides Fortran bindings for Enzyme's function hooks. | ||
| ! | ||
| ! The fact that the double-underscore function hook names appears in the | ||
| ! implicit interfaces defined in this module is sufficient to get Enzyme to be | ||
| ! applied in the appropriate way. We provide cleaner bindings without | ||
| ! double-underscores in the main Fortran Enzyme module in enzyme.f90. | ||
| ! | ||
| ! ===----------------------------------------------------------------------=== ! | ||
| module enzyme_function_hooks | ||
|
vchuravy marked this conversation as resolved.
|
||
| implicit none | ||
| private | ||
|
|
||
| ! Bindings for function hooks | ||
| ! NOTE: Leading underscores are not permitted by some Fortran compilers so we | ||
| ! prepend with 'f' in the Fortran versions of the function hooks. | ||
| public :: f__enzyme_autodiff | ||
| public :: f__enzyme_fwddiff | ||
| external :: f__enzyme_autodiff | ||
| external :: f__enzyme_fwddiff | ||
| end module enzyme_function_hooks | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| message("Building Fortran tests") | ||
|
|
||
| add_subdirectory(ForwardMode) | ||
| add_subdirectory(ReverseMode) | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.