diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2025-08-18 12:30:10 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-18 09:30:10 -0700 |
| commit | 2f68f98a3d7d41c1daac07afab622c34f5c1b8d4 (patch) | |
| tree | 1d51bec5cc9f22f0bf6d2f12fc614cafed0c3d7b /source | |
| parent | cc93e2c3523f558ee85281f7fe98e220f058f5ed (diff) | |
Fix issue of double lowering issue a differentiable function (#8182)
Close #8054.
For detailed root cause is at:
https://github.com/shader-slang/slang/issues/8054#issuecomment-3189579508
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index 52d24ff7d..8e1f85f8e 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -10756,6 +10756,11 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo> }); } + // Register the value now, to avoid any possible infinite recursion when lowering the body + // or attributes. + IRFunc* irFunc = subBuilder->createFunc(); + context->setGlobalValue(decl, LoweredValInfo::simple(findOuterMostGeneric(irFunc))); + FuncDeclBaseTypeInfo info; _lowerFuncDeclBaseTypeInfo( subContext, @@ -10763,15 +10768,10 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo> info); // need to create an IR function here - - IRFunc* irFunc = subBuilder->createFunc(); addNameHint(subContext, irFunc, decl); addLinkageDecoration(subContext, irFunc, decl); maybeAddDebugLocationDecoration(subContext, irFunc); - // Register the value now, to avoid any possible infinite recursion when lowering the body - // or attributes. - context->setGlobalValue(decl, LoweredValInfo::simple(findOuterMostGeneric(irFunc))); // Always force inline diff setter accessor to prevent downstream compiler from complaining // fields are not fully initialized for the first `inout` parameter. |
