From 520a3c064c42e8cd50ef4fde21539870d5b19cb7 Mon Sep 17 00:00:00 2001 From: Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> Date: Wed, 19 Apr 2023 12:49:14 -0400 Subject: Fixed issue with function signatures in higher-order AD (#2814) Also added GetStringHash to non-differentiable insts Co-authored-by: Yong He --- source/slang/slang-ir.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source/slang/slang-ir.cpp') diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index dd3034da1..97109274f 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -3877,7 +3877,7 @@ namespace Slang IRInst* IRBuilder::emitDifferentialPairGetDifferential(IRType* diffType, IRInst* diffPair) { - SLANG_ASSERT(as(diffPair->getDataType())); + SLANG_ASSERT(as(diffPair->getDataType())); return emitIntrinsicInst( diffType, kIROp_DifferentialPairGetDifferential, @@ -3887,7 +3887,7 @@ namespace Slang IRInst* IRBuilder::emitDifferentialPairGetPrimal(IRInst* diffPair) { - auto valueType = cast(diffPair->getDataType())->getValueType(); + auto valueType = cast(diffPair->getDataType())->getValueType(); return emitIntrinsicInst( valueType, kIROp_DifferentialPairGetPrimal, @@ -3895,6 +3895,15 @@ namespace Slang &diffPair); } + IRInst* IRBuilder::emitDifferentialPairGetPrimal(IRType* primalType, IRInst* diffPair) + { + return emitIntrinsicInst( + primalType, + kIROp_DifferentialPairGetPrimal, + 1, + &diffPair); + } + IRInst* IRBuilder::emitDifferentialPairGetDifferentialUserCode(IRType* diffType, IRInst* diffPair) { SLANG_ASSERT(as(diffPair->getDataType())); @@ -7256,6 +7265,7 @@ namespace Slang case kIROp_TorchGetCudaStream: case kIROp_MakeTensorView: case kIROp_TorchTensorGetView: + case kIROp_GetStringHash: return false; case kIROp_ForwardDifferentiate: -- cgit v1.2.3