summaryrefslogtreecommitdiff
path: root/source/slang/slang-lower-to-ir.cpp
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2022-06-25 15:45:34 -0400
committerGitHub <noreply@github.com>2022-06-25 12:45:34 -0700
commit8da47c460df01fad6f1d0614210a770f4781edb1 (patch)
tree170a5cc100c69e387e8c6d34217588ea00daed53 /source/slang/slang-lower-to-ir.cpp
parent0229784b93a43e17a088881e6be32b44fc6ce713 (diff)
Added basic auto-diff capabilities for local load/store and simple arithmetic. Also added type-checking during the semantic stage. (#2303)
* Added JVPTranscriber to handle differentiation of load, store, var, param and return instructions, as well as conversion of data and function types * Changed class names to be more in line with convention. Added correct type checking for __jvp() and verified that simple calls with only loads and stores are processed correctly * Added logic to differentiate basic arithmetic and literals inside IRConstruct and fixed the way parameters are differentiated Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
-rw-r--r--source/slang/slang-lower-to-ir.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp
index d845342f0..b7c5155b5 100644
--- a/source/slang/slang-lower-to-ir.cpp
+++ b/source/slang/slang-lower-to-ir.cpp
@@ -2943,13 +2943,13 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
// of the inner func-expr. This will be resolved
// to a concrete function during the derivative
// pass.
- LoweredValInfo visitJVPDerivativeOfExpr(JVPDerivativeOfExpr* expr)
+ LoweredValInfo visitJVPDifferentiateExpr(JVPDifferentiateExpr* expr)
{
- auto baseVal = lowerSubExpr(expr->baseFn);
+ auto baseVal = lowerSubExpr(expr->baseFunction);
SLANG_ASSERT(baseVal.flavor == LoweredValInfo::Flavor::Simple);
return LoweredValInfo::simple(
- getBuilder()->emitJVPDerivativeOfInst(
+ getBuilder()->emitJVPDifferentiateInst(
lowerType(context, expr->type),
baseVal.val));
}