Skip to content

Commit 312fe80

Browse files
committed
Improvements.
1 parent 8f1d9b3 commit 312fe80

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

source/slang/slang-ir-autodiff.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ void DifferentiableTypeConformanceContext::setFunc(IRGlobalValueWithCode* func)
12581258
}
12591259

12601260
addTypeToDictionary((IRType*)item->getBaseType(), item->getWitness());
1261-
1261+
#if 0
12621262
// TODO: Is this really needed?
12631263
if (!as<IRInterfaceType>(item->getBaseType()) &&
12641264
!as<IRAssociatedType>(item->getBaseType()))
@@ -1311,6 +1311,7 @@ void DifferentiableTypeConformanceContext::setFunc(IRGlobalValueWithCode* func)
13111311
addTypeToDictionary((IRType*)diffType, diffWitness);
13121312
}
13131313
}
1314+
#endif
13141315
}
13151316
}
13161317
}

source/slang/slang-ir-link.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct IRSharedSpecContext
6767

6868
void insertGlobalValueSymbol(IRSharedSpecContext* sharedContext, IRInst* gv);
6969

70-
struct WitnessTableCloenInfo : RefObject
70+
struct WitnessTableCloneInfo : RefObject
7171
{
7272
IRWitnessTable* clonedTable;
7373
IRWitnessTable* originalTable;
@@ -85,7 +85,7 @@ struct IRSpecContextBase
8585
List<IRModule*> irModules;
8686

8787
HashSet<UnownedStringSlice> deferredWitnessTableEntryKeys;
88-
List<RefPtr<WitnessTableCloenInfo>> witnessTables;
88+
List<RefPtr<WitnessTableCloneInfo>> witnessTables;
8989

9090
IRSpecSymbol* findSymbols(UnownedStringSlice mangledName)
9191
{
@@ -752,7 +752,7 @@ IRWitnessTable* cloneWitnessTableImpl(
752752
}
753753
cloneExtraDecorations(context, clonedTable, originalValues);
754754

755-
RefPtr<WitnessTableCloenInfo> witnessInfo = new WitnessTableCloenInfo();
755+
RefPtr<WitnessTableCloneInfo> witnessInfo = new WitnessTableCloneInfo();
756756
witnessInfo->clonedTable = clonedTable;
757757
witnessInfo->originalTable = originalTable;
758758

@@ -1971,6 +1971,11 @@ bool doesModuleUseAutodiff(IRInst* inst)
19711971
}
19721972
if (isImported)
19731973
continue;
1974+
for (auto decor : child->getDecorations())
1975+
{
1976+
if (isAutoDiffDecoration(decor))
1977+
return true;
1978+
}
19741979
if (doesModuleUseAutodiff(child))
19751980
return true;
19761981
}

source/slang/slang-lower-to-ir.cpp

+10-7
Original file line numberDiff line numberDiff line change
@@ -8186,13 +8186,16 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
81868186

81878187
// Make sure that all the entries in the witness table have been filled in,
81888188
// including any cases where there are sub-witness-tables for conformances
8189-
Dictionary<WitnessTable*, IRWitnessTable*> mapASTToIRWitnessTable;
8190-
lowerWitnessTable(
8191-
subContext,
8192-
inheritanceDecl->witnessTable,
8193-
irWitnessTable,
8194-
mapASTToIRWitnessTable);
8195-
8189+
bool isExplicitExtern = false;
8190+
if (!isImportedDecl(context, parentDecl, isExplicitExtern))
8191+
{
8192+
Dictionary<WitnessTable*, IRWitnessTable*> mapASTToIRWitnessTable;
8193+
lowerWitnessTable(
8194+
subContext,
8195+
inheritanceDecl->witnessTable,
8196+
irWitnessTable,
8197+
mapASTToIRWitnessTable);
8198+
}
81968199
irWitnessTable->moveToEnd();
81978200

81988201
return LoweredValInfo::simple(

0 commit comments

Comments
 (0)