summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-autodiff.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-02-23 10:31:05 -0800
committerGitHub <noreply@github.com>2025-02-23 10:31:05 -0800
commit51ad07d1fbffd41c758eba172aa77ebba3204924 (patch)
treefadd788714c4ad37830846b0274d56b5ae1eff56 /source/slang/slang-ir-autodiff.cpp
parent0101e5ab59a1678ed7212913c3880edfaf039537 (diff)
Improve performance when compiling small shaders. (#6396)
Improve performance when compiling small shaders. Avoid copying witness table entries that are not getting used during linking. Avoid copying auto-diff related decorations and derivative functions during linking, if the user modules doesn't use autodiff. Cache operator overload resolution results on global session, so each new Session doesn't need to repetitively run through overload resolution from scratch.
Diffstat (limited to 'source/slang/slang-ir-autodiff.cpp')
-rw-r--r--source/slang/slang-ir-autodiff.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/source/slang/slang-ir-autodiff.cpp b/source/slang/slang-ir-autodiff.cpp
index 9075002e0..40dcb1b51 100644
--- a/source/slang/slang-ir-autodiff.cpp
+++ b/source/slang/slang-ir-autodiff.cpp
@@ -1026,12 +1026,9 @@ IRInst* AutoDiffSharedContext::findDifferentiableInterface()
{
for (auto globalInst : module->getGlobalInsts())
{
- // 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 (auto intf = as<IRInterfaceType>(globalInst))
{
- if (auto decor = intf->findDecoration<IRNameHintDecoration>())
+ if (auto decor = intf->findDecoration<IRKnownBuiltinDecoration>())
{
if (decor->getName() == toSlice("IDifferentiable"))
{
@@ -1261,7 +1258,7 @@ void DifferentiableTypeConformanceContext::setFunc(IRGlobalValueWithCode* func)
}
addTypeToDictionary((IRType*)item->getBaseType(), item->getWitness());
-
+#if 0
// TODO: Is this really needed?
if (!as<IRInterfaceType>(item->getBaseType()) &&
!as<IRAssociatedType>(item->getBaseType()))
@@ -1314,6 +1311,7 @@ void DifferentiableTypeConformanceContext::setFunc(IRGlobalValueWithCode* func)
addTypeToDictionary((IRType*)diffType, diffWitness);
}
}
+#endif
}
}
}