summaryrefslogtreecommitdiffstats
path: root/source/slang/diff.meta.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-03-16 23:46:14 -0700
committerGitHub <noreply@github.com>2023-03-16 23:46:14 -0700
commit9476d4543f4336a66308e55f722b0b0b2bd69dd2 (patch)
treeff3a0514249f5c3975177bf053c5cb038e37acc8 /source/slang/diff.meta.slang
parent77d3630eef4ea1c4b0424a46526a6be476a89230 (diff)
Fix Phi simplification bug. (#2710)
* Fix Phi simplification bug. * Fix up. * Fix. * Fix. * Fix. * Fix. * Fix. * Fix test. * Fix test. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/diff.meta.slang')
-rw-r--r--source/slang/diff.meta.slang78
1 files changed, 0 insertions, 78 deletions
diff --git a/source/slang/diff.meta.slang b/source/slang/diff.meta.slang
index ada052cd8..a9b8209f3 100644
--- a/source/slang/diff.meta.slang
+++ b/source/slang/diff.meta.slang
@@ -1,8 +1,3 @@
-/// Modifer to mark a function for forward-mode differentiation.
-/// i.e. the compiler will automatically generate a new function
-/// that computes the jacobian-vector product of the original.
-__attributeTarget(FunctionDeclBase)
-attribute_syntax [ForwardDifferentiable] : ForwardDifferentiableAttribute;
// Custom Forward Derivative Function reference
__attributeTarget(FunctionDeclBase)
@@ -14,8 +9,6 @@ attribute_syntax [BackwardDerivative(function)] : BackwardDerivativeAttribute;
__attributeTarget(FunctionDeclBase)
attribute_syntax [PrimalSubstitute(function)] : PrimalSubstituteAttribute;
-__attributeTarget(FunctionDeclBase)
-attribute_syntax [BackwardDifferentiable] : BackwardDifferentiableAttribute;
__attributeTarget(FunctionDeclBase)
attribute_syntax [ForwardDerivativeOf(function)] : ForwardDerivativeOfAttribute;
@@ -33,77 +26,6 @@ attribute_syntax [DerivativeMember(memberName)] : DerivativeMemberAttribute;
__attributeTarget(FunctionDeclBase)
attribute_syntax [NoDiffThis] : NoDiffThisAttribute;
-
-/// Pair type that serves to wrap the primal and
-/// differential types of an arbitrary type T.
-
-__generic<T : IDifferentiable>
-__magic_type(DifferentialPairType)
-__intrinsic_type($(kIROp_DifferentialPairUserCodeType))
-struct DifferentialPair : IDifferentiable
-{
- typedef DifferentialPair<T.Differential> Differential;
- typedef T.Differential DifferentialElementType;
-
- __intrinsic_op($(kIROp_MakeDifferentialPairUserCode))
- __init(T _primal, T.Differential _differential);
-
- property p : T
- {
- __intrinsic_op($(kIROp_DifferentialPairGetPrimalUserCode))
- get;
- }
-
- property v : T
- {
- __intrinsic_op($(kIROp_DifferentialPairGetPrimalUserCode))
- get;
- }
-
- property d : T.Differential
- {
- __intrinsic_op($(kIROp_DifferentialPairGetDifferentialUserCode))
- get;
- }
-
- [__unsafeForceInlineEarly]
- T.Differential getDifferential()
- {
- return d;
- }
-
- [__unsafeForceInlineEarly]
- T getPrimal()
- {
- return p;
- }
-
- [__unsafeForceInlineEarly]
- static Differential dzero()
- {
- return Differential(T.dzero(), T.Differential.dzero());
- }
-
- [__unsafeForceInlineEarly]
- static Differential dadd(Differential a, Differential b)
- {
- return Differential(
- T.dadd(
- a.p,
- b.p
- ),
- T.Differential.dadd(a.d, b.d));
- }
-
- [__unsafeForceInlineEarly]
- static Differential dmul(This a, Differential b)
- {
- return Differential(
- T.dmul(a.p, b.p),
- T.Differential.dmul(a.d, b.d));
- }
-};
-
__generic<T: IDifferentiable>
__intrinsic_op($(kIROp_MakeDifferentialPairUserCode))
DifferentialPair<T> diffPair(T primal, T.Differential diff);