From 51ad07d1fbffd41c758eba172aa77ebba3204924 Mon Sep 17 00:00:00 2001 From: Yong He Date: Sun, 23 Feb 2025 10:31:05 -0800 Subject: 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. --- source/slang/slang-ir-autodiff.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source/slang/slang-ir-autodiff.cpp') 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(globalInst)) { - if (auto decor = intf->findDecoration()) + if (auto decor = intf->findDecoration()) { 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(item->getBaseType()) && !as(item->getBaseType())) @@ -1314,6 +1311,7 @@ void DifferentiableTypeConformanceContext::setFunc(IRGlobalValueWithCode* func) addTypeToDictionary((IRType*)diffType, diffWitness); } } +#endif } } } -- cgit v1.2.3