diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-01-10 17:01:24 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-10 14:01:24 -0800 |
| commit | 20262684bcbb707d16669b2670039df870b65ca8 (patch) | |
| tree | 65eac7f67497cfac63542a8d15006e47595f8cf3 /source | |
| parent | 2f422087ed04940f6b6b351605e61d48ce1989ce (diff) | |
Small fixes around repro loading/autodiff (#2585)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Work around for some issue seen with a repro.
* Small improvement in doing IDifferentable check.
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-ir-autodiff.cpp | 11 | ||||
| -rw-r--r-- | source/slang/slang-repro.cpp | 9 |
2 files changed, 17 insertions, 3 deletions
diff --git a/source/slang/slang-ir-autodiff.cpp b/source/slang/slang-ir-autodiff.cpp index 53e2ed0be..94417ea00 100644 --- a/source/slang/slang-ir-autodiff.cpp +++ b/source/slang/slang-ir-autodiff.cpp @@ -309,10 +309,15 @@ IRInst* AutoDiffSharedContext::findDifferentiableInterface() // TODO: This seems like a particularly dangerous way to look for an interface. // See if we can lower IDifferentiable to a separate IR inst. // - if (globalInst->getOp() == kIROp_InterfaceType && - as<IRInterfaceType>(globalInst)->findDecoration<IRNameHintDecoration>()->getName() == "IDifferentiable") + if (auto intf = as<IRInterfaceType>(globalInst)) { - return globalInst; + if (auto decor = intf->findDecoration<IRNameHintDecoration>()) + { + if (decor->getName() == toSlice("IDifferentiable")) + { + return globalInst; + } + } } } } diff --git a/source/slang/slang-repro.cpp b/source/slang/slang-repro.cpp index f0df86129..fa997ba25 100644 --- a/source/slang/slang-repro.cpp +++ b/source/slang/slang-repro.cpp @@ -1065,6 +1065,15 @@ struct LoadContext for (const auto& pair : context.m_fileToPathInfoMap) { CacheFileSystem::PathInfo* pathInfo = pair.Value; + + // TODO(JS): It's not 100% clear why we are ending up + // with entries that don't have a unique identity. + // For now we ignore adding to the unique map, because + // if we do we'll have multiple entries with the same key + if (pathInfo->m_uniqueIdentity.getLength() == 0) + { + continue; + } SLANG_ASSERT(pathInfo->m_uniqueIdentity.getLength()); dstUniqueMap.Add(pathInfo->m_uniqueIdentity, pathInfo); } |
