diff options
| author | Yong He <yonghe@outlook.com> | 2022-10-24 22:19:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-24 22:19:38 -0700 |
| commit | 41cb7c13e37ec32ffb6557d21da079d77151e136 (patch) | |
| tree | 38d2c44938e2679c42c5c0e73f5411e59015df93 /source/slang/slang-ast-modifier.h | |
| parent | 1093218d6f0e114eb9fa52d60ca525bf9dd9f98a (diff) | |
Rework differentiation of member access through `[DerivativeMember(DiffType.field)]` (#2460)
* wip: remove auto-diff for member access, add diff through property accessors.
* Fix getter-setter test.
* Fix getter-setter-multi test.
* Fix nested-jvp test.
* Use [DerivativeMember] attribute to differentiate through member access.
* Clean up.
* More cleanup.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ast-modifier.h')
| -rw-r--r-- | source/slang/slang-ast-modifier.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/slang/slang-ast-modifier.h b/source/slang/slang-ast-modifier.h index 8230f481e..b019953cb 100644 --- a/source/slang/slang-ast-modifier.h +++ b/source/slang/slang-ast-modifier.h @@ -32,6 +32,14 @@ class GloballyCoherentModifier : public Modifier { SLANG_AST_CLASS(GloballyCoher class ExternCppModifier : public Modifier { SLANG_AST_CLASS(ExternCppModifier)}; class JVPDerivativeModifier : public Modifier { SLANG_AST_CLASS(JVPDerivativeModifier)}; +// An `extern` variable in an extension is used to introduce additional attributes on an existing +// field. +class ExtensionExternVarModifier : public Modifier +{ + SLANG_AST_CLASS(ExtensionExternVarModifier) + DeclRef<Decl> originalDecl; +}; + // An 'ActualGlobal' is a global that is output as a normal global in CPU code. // Globals in HLSL/Slang are constant state passed into kernel execution class ActualGlobalModifier : public Modifier { SLANG_AST_CLASS(ActualGlobalModifier)}; @@ -951,6 +959,12 @@ class SpecializeAttribute : public Attribute SLANG_AST_CLASS(SpecializeAttribute) }; + /// An attribute that marks a type, function or variable as differentiable. +class DifferentiableAttribute : public Attribute +{ + SLANG_AST_CLASS(DifferentiableAttribute) +}; + class DllImportAttribute : public Attribute { SLANG_AST_CLASS(DllImportAttribute) @@ -965,6 +979,13 @@ class DllExportAttribute : public Attribute SLANG_AST_CLASS(DllExportAttribute) }; +class DerivativeMemberAttribute : public Attribute +{ + SLANG_AST_CLASS(DerivativeMemberAttribute) + + DeclRefExpr* memberDeclRef; +}; + /// An attribute that marks an interface type as a COM interface declaration. class ComInterfaceAttribute : public Attribute { |
