Merge pull request #17412 from mppf/non-deterministic-task-bundles
Address non-determinism due to map iteration
Follow-up to #6876
I noticed several places in the compiler where a loop iterating over a
form_Map is adding AST nodes. This results in nondeterminism
because the map iteration order is not deterministic.
To address it, this PR adds a new function,
returns a vector of key-value pairs for a
SymbolMap. This vector is
sorted by AST id of the keys before it is returned. Then, I looked at
all of the calls to
form_Map. Some of them do not do anything that
depends on the order, but others appeared to potentially depend on the
order. For calls that could depend on the order, I updated them to call
sortedSymbolMapElts, to use C++ range iteration, and to create
value variables for the iteration.
The changes to
compiler/resolution/interfaceResolution.cpp were causing
test failures somehow. I will leave it to @vasslitvinov to update the
form_Map calls in that file as needed.
- [x] full local testing
- [x] full gasnet testing
Reviewed by @vasslitvinov - thanks!
Modified Files: M compiler/AST/symbol.cpp