summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-serialize-container.cpp
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2025-07-17 14:59:33 +0800
committerGitHub <noreply@github.com>2025-07-17 06:59:33 +0000
commit28758e0e427ceca196937dc90efe3ab1cb35bd70 (patch)
tree7a609525e686772854d8cd82b7a91f69a97c0e30 /source/slang/slang-serialize-container.cpp
parent020a16072923a66ae0985be618fd32310aa87242 (diff)
Perf improvements to IR serialization (#7751)
* option to use riff as serialization backend * option to use riff as serialization backend * perf * shuffle code * perf improvements to deserialization * formatting * remove bit_cast * correct IR verification * neaten serialized format * fix peek module info * formatting * remove temporary profiling code * cleanup * fix wasm build * more explicit sizes * deserialize via fossil on 32 bit wasm * Make serialized modules Int size agnostic * reorder stable names to allow range based check for 64 bit constants * format * review comments * fix build * fix * c++17 compat slang-common.h
Diffstat (limited to 'source/slang/slang-serialize-container.cpp')
-rw-r--r--source/slang/slang-serialize-container.cpp23
1 files changed, 1 insertions, 22 deletions
diff --git a/source/slang/slang-serialize-container.cpp b/source/slang/slang-serialize-container.cpp
index 7325f6e42..535155c22 100644
--- a/source/slang/slang-serialize-container.cpp
+++ b/source/slang/slang-serialize-container.cpp
@@ -580,32 +580,11 @@ static void calcModuleInstructionList(IRModule* module, List<IRInst*>& instsOut)
instsOut.setCount(1);
instsOut[0] = nullptr;
- // Stack for parentInst
- List<IRInst*> parentInstStack;
-
IRModuleInst* moduleInst = module->getModuleInst();
- parentInstStack.add(moduleInst);
-
- // Add to list
- instsOut.add(moduleInst);
-
- // Traverse all of the instructions
- while (parentInstStack.getCount())
- {
- // If it's in the stack it is assumed it is already in the inst map
- IRInst* parentInst = parentInstStack.getLast();
- parentInstStack.removeLast();
- IRInstListBase childrenList = parentInst->getDecorationsAndChildren();
- for (IRInst* child : childrenList)
- {
- instsOut.add(child);
- parentInstStack.add(child);
- }
- }
+ traverseInstsInSerializationOrder(moduleInst, [&](IRInst* inst) { instsOut.add(inst); });
}
-
/* static */ SlangResult SerialContainerUtil::verifyIRSerialize(
IRModule* module,
Session* session,