Comments (6)
Integers are presently assumed to be inactive (and thus don't impact the derivative computation).
Allowing active integers is certainly something worth including as we add support for custom accumulations
I'm curious, is there a bigger application use of integers of the differentiable types you have in mind (I haven't been searching, but haven't seen one offhand so it would be helpful to understand).
from enzyme.
Integers are presently assumed to be inactive (and thus don't impact the derivative computation).
I see, is this something that is "easily" switched on or is it a bigger feature that needs implementation?
I'm curious, is there a bigger application use of integers of the differentiable types you have in mind (I haven't been searching, but haven't seen one offhand so it would be helpful to understand).
My situation is I have a large existing algorithm that I would like to differentiate. The algorithm uses a mix of types and it would be ideal if I could differentiate it "as is".
I wonder if re-writing the types to floats/doubles inside of Enzyme would be a possible solution?
from enzyme.
Re active integers, I think three things would need to be added:
- Active integers as distinct from inactive integers added to type analysis [in particular differing TBAA parsing]
- A new enzyme_activeint metadata for the calling convention (the way you're passing Enzyme's default calling convention explicitly assumes integers as inactive since the default case of passing a size of an array is more common and thus makes more sense as the default).
- Adjoints for integer operations [add, etc -- most of which can copy the floating variants [fadd], with things like sqrt obviously not needing implementation]
A codebase that uses a mix of types may not actually use active integers, even if it uses integers as part of the computation. The reason for this is a float => integer cast representing a round/floor correctly has a derivative of 0 (or technically a delta function). Thus I'm a bit curious more some more info (also feel free to email me [email protected] if that's preferable / you don't want to share globally on github).
Re your last question, rewriting the types to float/double, however, should probably just work.
from enzyme.
Thanks for the details, I will pursue the second option of converting all types to doubles and see if that works for my applications.
from enzyme.
Re-opening this issue to preserve active integer type support as being on the radar. I (and several other contributors) likely won't have time to add such support until after the SuperComputing conference deadline, but hopefully can return to this afterwards.
from enzyme.
Moreover, it should be relatively easy to add support via LLVM's existing fixed point intrinsics (https://llvm.org/docs/LangRef.html#fixed-point-arithmetic-intrinsics).
The question then for your case would be much simpler, assuming you can modify your code to cause those intrinsics to be emitted.
from enzyme.
Related Issues (20)
- Adjust tablegen to handle mutations during fwd-mode
- Incorrect value error HOT 11
- OpenMP Parallelization Support for CLASS
- differentiate reduction function with CUDA atomicAdd HOT 8
- sqrt behavior at 0 HOT 30
- Store not perssisted in reverse pass of rematerialized value
- inspect tape size with LLVM 9 HOT 3
- Enzyme hangs when using CoDiPack forward AD type in function HOT 7
- Support for Cuda Graphs to be able to AD Codes based on [AMReX](https://github.com/AMReX-Codes/amrex)
- `__enzyme_allocation_like` fails to detect null pointer argument index HOT 1
- faddeeva_erfc and friends not handled for macOS aarch64 HOT 7
- Create a default CustomErrorHandler using EmitFailure
- enzyme error when differentiating stateful lambda, but no problems with explicitly defined functor HOT 3
- compiler crash on simple `__enzyme_fwddiff()` call
- `__enzyme_autodiff` w/ `enzyme_out` + pass by reference crashes HOT 1
- Lookup undef error HOT 3
- Crashing input on LLVM 16 HOT 3
- No ClangEnzyme-<version>.so library created when compiling the code on MacOSX HOT 6
- No reverse pass found for Petsc Functions HOT 9
- Merge-Queue rerunning CI HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enzyme.