diff options
| author | Yong He <yonghe@outlook.com> | 2023-03-16 23:46:14 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-16 23:46:14 -0700 |
| commit | 9476d4543f4336a66308e55f722b0b0b2bd69dd2 (patch) | |
| tree | ff3a0514249f5c3975177bf053c5cb038e37acc8 /source/slang/slang-check-decl.cpp | |
| parent | 77d3630eef4ea1c4b0424a46526a6be476a89230 (diff) | |
Fix Phi simplification bug. (#2710)
* Fix Phi simplification bug.
* Fix up.
* Fix.
* Fix.
* Fix.
* Fix.
* Fix.
* Fix test.
* Fix test.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index ea8bec2bb..2613e6430 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -3324,6 +3324,7 @@ namespace Slang { VarDecl* indexVar = nullptr; auto forStmt = synth.emitFor(synth.emitIntConst(0), synth.emitGetArrayLengthExpr(leftValue), indexVar); + addModifier(forStmt, synth.getBuilder()->create<ForceUnrollAttribute>()); auto innerLeft = synth.emitIndexExpr(leftValue, synth.emitVarExpr(indexVar)); for (auto& arg : args) { @@ -3358,6 +3359,7 @@ namespace Slang // We synthesize a memberwise dispatch to compute each field of `TResult`, // resulting an implementation of the form: // ``` + // [BackwardDifferentiable] // static TResult requiredMethod(TParam1 p0, TParam2 p1, ...) // { // TResult result; @@ -3389,6 +3391,9 @@ namespace Slang ThisExpr* synThis = nullptr; auto synFunc = synthesizeMethodSignatureForRequirementWitness( context, requirementDeclRef.as<FuncDecl>(), synArgs, synThis); + + addModifier(synFunc, m_astBuilder->create<BackwardDifferentiableAttribute>()); + synFunc->parentDecl = context->parentDecl; synth.pushContainerScope(synFunc); auto blockStmt = m_astBuilder->create<BlockStmt>(); |
