Giter Club home page Giter Club logo

Comments (6)

wsmoses avatar wsmoses commented on May 27, 2024

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.

bear24rw avatar bear24rw commented on May 27, 2024

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.

wsmoses avatar wsmoses commented on May 27, 2024

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.

bear24rw avatar bear24rw commented on May 27, 2024

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.

wsmoses avatar wsmoses commented on May 27, 2024

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.

wsmoses avatar wsmoses commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.