diff options
| author | Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> | 2024-07-10 16:49:41 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-10 13:49:41 -0700 |
| commit | 45ef0ce906c93c16495755fec2e597573e8631c4 (patch) | |
| tree | ddb0ed618683488893d1c076f95b8e6e9e14d8ff /source/slang/slang-lower-to-ir.cpp | |
| parent | 16a47816747ca9a9de67b842a73f0e981dbc8b91 (diff) | |
Fix lowering of associated types and synthesis of dispatch functions. (#4568)
* Treat global variables and parameters as non-differentiable when checking derivative data-flow
Global parameters are by-default not differentiable (even if they are of a differentiable type), because our auto-diff passes do not touch anything outside of function bodies.
The solution is to use wrapper objects with differentiable getter/setter methods (and we should provide a few such objects in the stdlib).
Fixes: #3289
This is a potentially breaking change: User code that was previously working with global variables of a differentiable type will now throw an error (previously the gradient would be dropped without warning). The solution is to use `detach()` to keep same behavior as before or rewrite the access using differentiable getter/setter methods.
* Fix issues with lookup witness lowering
* Update slang-ir-lower-witness-lookup.cpp
* Add tests
* Update slang-ir-lower-witness-lookup.cpp
* Cleanup
* Update nested-assoc-types.slang
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index 6fa2ce67f..d8d573d63 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -10288,7 +10288,7 @@ static void _addFlattenedTupleArgs( bool isAbstractWitnessTable(IRInst* inst) { - if (as<IRThisTypeWitness>(inst)) + if (as<IRThisTypeWitness>(inst) || as<IRInterfaceRequirementEntry>(inst)) return true; if (auto lookup = as<IRLookupWitnessMethod>(inst)) return isAbstractWitnessTable(lookup->getWitnessTable()); |
