Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hexagon] Sort functions before adding to LLVM codegen #8948

Closed
wants to merge 1 commit into from
Closed

[Hexagon] Sort functions before adding to LLVM codegen #8948

wants to merge 1 commit into from

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.
@@ -730,6 +730,12 @@ runtime::Module BuildHexagon(IRModule mod, Target target) {
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