diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2025-01-02 14:29:57 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-02 12:29:57 -0800 |
| commit | d48cd130aacbab34bb98d51bb237ad38ff37348c (patch) | |
| tree | 9fc9643233ad0cd7ff1aa65155f9f5ca64f677f7 /source/slang/slang-ir-autodiff-transcriber-base.cpp | |
| parent | e3b71cf0356692bda5f0b3a06aed9d49ad3314a4 (diff) | |
Correct IR generation for no-diff pointer type (#5976)
* Correct IR generation for no-diff pointer type
Close #5805
There is an issue on checking whether a pointer type parameter
is no_diff, we should first check whether this parameter is
an Attribute type first, then check the data type.
In the back-propagate pass, for the pointer type parameter, we should
load this parameter to a temp variable, then pass it to the primal
function call. Otherwise, the temp variable will no be initialized,
which will cause the following calculation wrong.
Diffstat (limited to 'source/slang/slang-ir-autodiff-transcriber-base.cpp')
| -rw-r--r-- | source/slang/slang-ir-autodiff-transcriber-base.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/slang/slang-ir-autodiff-transcriber-base.cpp b/source/slang/slang-ir-autodiff-transcriber-base.cpp index ada35689c..1b3825a7d 100644 --- a/source/slang/slang-ir-autodiff-transcriber-base.cpp +++ b/source/slang/slang-ir-autodiff-transcriber-base.cpp @@ -565,6 +565,9 @@ IRType* AutoDiffTranscriberBase::tryGetDiffPairType(IRBuilder* builder, IRType* // If this is a PtrType (out, inout, etc..), then create diff pair from // value type and re-apply the appropropriate PtrType wrapper. // + if (isNoDiffType(originalType)) + return nullptr; + if (auto origPtrType = as<IRPtrTypeBase>(originalType)) { if (auto diffPairValueType = tryGetDiffPairType(builder, origPtrType->getValueType())) |
