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.

Add function CodeGenLLVM::AddFunctionsOrdered that takes a range of PrimFuncs or objects convertible to PrimFunc, and adds them to the LLVM module in a deterministic order.

@kparzysz-quic
Copy link
Contributor Author

cc: @jroesch @tkonolige

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.

Add function CodeGenLLVM::AddFunctionsOrdered that takes a range of
PrimFuncs or objects convertible to PrimFuncs, and adds them to the
LLVM module in a deterministic order.
@tqchen
Copy link
Member

tqchen commented Sep 8, 2021

also cc @vinx13 @ZihengJiang @masahi

@tqchen tqchen assigned masahi and jroesch and unassigned masahi Sep 8, 2021
@tkonolige
Copy link
Contributor

Do you think it would be possible to add a test that the functions are in sorted order?

@masahi masahi merged commit b8fcad8 into apache:main Sep 9, 2021
@kparzysz-quic kparzysz-quic deleted the codegenllvm-sort-primfuncs branch September 9, 2021 12:44
ylc pushed a commit to ylc/tvm that referenced this pull request Sep 29, 2021
* [LLVM/CG] Sort PrimFuncs when creating LLVM module

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.

Add function CodeGenLLVM::AddFunctionsOrdered that takes a range of
PrimFuncs or objects convertible to PrimFuncs, and adds them to the
LLVM module in a deterministic order.

* Empty commit to restart build

* Add testcase
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* [LLVM/CG] Sort PrimFuncs when creating LLVM module

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.

Add function CodeGenLLVM::AddFunctionsOrdered that takes a range of
PrimFuncs or objects convertible to PrimFuncs, and adds them to the
LLVM module in a deterministic order.

* Empty commit to restart build

* Add testcase
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.

5 participants