Skip to content

Overhaul user-defined override system for higher-order operators (e.g. fwd_diff) #6486

@saipraveenb25

Description

@saipraveenb25

Our higher-order operators such as fwd_diff and bwd_diff allow user-defined overrides on a per-function basis.

E.g. The [BackwardDerivative(deriv_fn)] decorator on fn says that bwd_diff(fn) should simply resolve to deriv_fn

For generically defined functions, we have a concept of "sub-type functions".
E.g.: A definition such as T f<T>(T x) { } works with any T, while T f<T : IFloat>(T x) works on a strict subset of possible specializations of the original 'f'.
We would like to be able to provide derivative overrides that apply to a sub-set of possible specializations of a function f

This needs some re-factoring of the current system where we associate each declaration with its derivative declaration.

We will instead need to construct this mapping at the relevant use-site of the declaration, and use the specialization arguments to determine which override applies.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions