Skip to content

Conversation

@kparzysz-quic
Copy link
Contributor

PrimFuncs are stored in a map where the order of iteration is not deterministic. This can cause a different llvm::Module to be created each time, which can defeat debugging tools like -opt-bisect-limit.

Sort the PrimFuncs in a deterministic way before adding them to the LLVM code generator.

PrimFuncs are stored in a map where the order of iteration is not
deterministic. This can cause a different llvm::Module to be created
each time, which can defeat debugging tools like -opt-bisect-limit.

Sort the PrimFuncs in a deterministic way before adding them to the
LLVM code generator.
funcs.emplace_back(f);
}

std::sort(funcs.begin(), funcs.end(), [](PrimFunc func_a, PrimFunc func_b) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, is this something we should fix else where in the compiler? its probably good to add sorting/ordering for determinism.

cc @mbs-octoml @tkonolige

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are definitely more places in the compiler where the names should be sorted for reproducibility. I had a branch where I tried to make codegen more reproducible, but I can't find it. I remember adding sorts to llvm codegen as well as some places where IRModules were constructed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a generalized version of this PR: #8958.

@kparzysz-quic
Copy link
Contributor Author

Closing in favor of PR #8958.

@kparzysz-quic kparzysz-quic deleted the hexagon-sort-primfunc branch September 8, 2021 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants