Skip to content

[META][AutoDiff] Fix autodiff for classes and class-valued arguments #65012

@asl

Description

@asl

This is a meta-issue noting all kinds of issues related to differentiating of classes, class methods, etc. While the things are more or less working for ordinary functions and structs, there are lots of missed functionality related to classes.

  • Classes-type function arguments have reference semantics. Therefore they should be treated semantically similar to inout arguments, however, there are lots of subtle differences. In particular, we need to fix activity analysis for classes, determination of semantic results, etc.
  • There are lots of interesting special things around classes including e.g. accessors. Setters work by a chance (however, the activity analysis in anything involving setters is just plain wrong), and we do not support read / modify accessors.
  • To support read / modify accessors we need to implement missed pieces of functionality around differentiation of co-routines. While semantically it is unclear how one could derive a derivative of function that essentially might return different values in general, we can narrow down task to support only @yield_once co-routines, where everything essentially returns only once, there is no way to resume / abort co-routine, so they act as a normal functions and @yield_once is just a way to transfer ownership.

Related issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    AutoDiffbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions