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)
- Building Enzyme CMake - Undefined symbol: main HOT 3
- Unnecessary caching for recursive functions
- Bug in Enzyme gsl branch HOT 6
- compilation slowdown associated with PreserveNVVMNewPM HOT 1
- Is this N/3 correct? HOT 10
- incorrect derivative of function that returns struct HOT 2
- C++ interface templates appear to be broken HOT 9
- `std::vector.push_back()` causes segementation fault in Enzyme HOT 4
- EnzymeCreateForwardDiff missing from CApi.h HOT 1
- Clarify usage through linking HOT 10
- Failing unittest Enzyme/ReverseMode/gsl_sf_legendre_array_e.ll
- Enzyme C++ sugar for vector input/outputs HOT 2
- Batching for Vector Intrinsics
- Syntax for custom forward rule in C? HOT 4
- How to use enzyme in my makefile? HOT 2
- Compiling with -O{1,2,3} breaks custom rule that works with -O0 HOT 2
- incorrect gradient for if statement HOT 2
- Failure with new c++ sugar
- Enzyme TA expectations/issues HOT 5
- C++ interface TODO list HOT 11
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.