summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-autodiff.cpp
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2024-10-28 15:47:58 -0400
committerGitHub <noreply@github.com>2024-10-28 15:47:58 -0400
commitb61be5e6fb7fe1c4ec8228cdf73f49f11e5a0ac9 (patch)
tree0e392546b41a55d36a874f2a82110867e6dd422c /source/slang/slang-ir-autodiff.cpp
parent0557a199d2eb205bf133c8fc111cce3a19336fde (diff)
Assorted auto-diff enhancements for increased performance & more streamlined auto-diff results (#5394)
* Various AD enhancements * Fix issue with pt-loop test * Update pt-loop.slang * More fixes for perf. Final minimal context test now passes. * Fix issue with loop-elimination pass not running after dce * Try fix wgpu test by removing select operator * Disable wgpu * Delete out.wgsl * Remove comments * Update slang-ir-util.cpp * Fix header relative paths for slang-embed * Disbale wgpu for a few other tests * Better way of determining which params to ignore for side-effects * Update slang-ir-dce.cpp * Fix issue with circular reference from previous AD pass being left behind for the next AD pass * Update slang-ir-dce.cpp
Diffstat (limited to 'source/slang/slang-ir-autodiff.cpp')
-rw-r--r--source/slang/slang-ir-autodiff.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/source/slang/slang-ir-autodiff.cpp b/source/slang/slang-ir-autodiff.cpp
index bed6a68e4..975a6e554 100644
--- a/source/slang/slang-ir-autodiff.cpp
+++ b/source/slang/slang-ir-autodiff.cpp
@@ -6,6 +6,7 @@
#include "slang-ir-single-return.h"
#include "slang-ir-ssa-simplification.h"
#include "slang-ir-validate.h"
+#include "slang-ir-inline.h"
#include "../core/slang-performance-profiler.h"
namespace Slang
@@ -1511,6 +1512,7 @@ void stripTempDecorations(IRInst* inst)
case kIROp_RecomputeBlockDecoration:
case kIROp_AutoDiffOriginalValueDecoration:
case kIROp_BackwardDerivativePrimalReturnDecoration:
+ case kIROp_BackwardDerivativePrimalContextDecoration:
case kIROp_PrimalValueStructKeyDecoration:
case kIROp_PrimalElementTypeDecoration:
decor->removeAndDeallocate();
@@ -2283,12 +2285,15 @@ struct AutoDiffPass : public InstPassBase
}
}
- // Get rid of block-level decorations that are used to keep track of
- // different block types. These don't work well with the IR simplification
- // passes since they don't expect decorations in blocks.
- //
+
for (auto diffFunc : autodiffCleanupList)
+ {
+ // Get rid of block-level decorations that are used to keep track of
+ // different block types. These don't work well with the IR simplification
+ // passes since they don't expect decorations in blocks.
+ //
stripTempDecorations(diffFunc);
+ }
autodiffCleanupList.clear();
@@ -2300,9 +2305,7 @@ struct AutoDiffPass : public InstPassBase
break;
if (lowerIntermediateContextType(builder))
- {
hasChanges = true;
- }
// We have done transcribing the functions, now it is time to demote all DifferentialPair types
// and their operations down to DifferentialPairUserCodeType and *UserCode operations so they
@@ -2312,7 +2315,6 @@ struct AutoDiffPass : public InstPassBase
hasChanges |= changed;
}
-
return hasChanges;
}