Skip to content

Commit 7eae7ee

Browse files
aratajewigcbot
authored andcommitted
Fix undeterministic symbols order
`SmallSet` container of pointers doesn't guarantee that the order of iteration matches the order of insertion, therefore elements order is undeterministic. In this case, `SmallSet` container was used for keeping symbols that were later iterated through to print them in shader dumps, resulting in different dumps from run to run. This change introduces the usage of `SmallSetVector` instead of `SmallSet` container, according to LLVM docs: "The difference between SetVector and other sets is that the order of iteration is guaranteed to match the order of insertion into the SetVector. This property is really important for things like sets of pointers. Because pointer values are non-deterministic (e.g. vary across runs of the program on different machines), iterating over the pointers in the set will not be in a well-defined order."
1 parent 63cefea commit 7eae7ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11275,8 +11275,8 @@ void EmitPass::emitSymbolRelocation(Function& F)
1127511275
{
1127611276
Module* pModule = F.getParent();
1127711277

11278-
SmallSet<Function*, 16> funcAddrSymbols;
11279-
SmallSet<GlobalVariable*, 16> globalAddrSymbols;
11278+
SmallSetVector<Function*, 16> funcAddrSymbols;
11279+
SmallSetVector<GlobalVariable*, 16> globalAddrSymbols;
1128011280

1128111281
ModuleMetaData* moduleMD = getAnalysis<MetaDataUtilsWrapper>().getModuleMetaData();
1128211282

0 commit comments

Comments
 (0)