-
Notifications
You must be signed in to change notification settings - Fork 329
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
Option to set the number of threads for parallel compilation #3048
Merged
Merged
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ff4bbf1
Add -j option for specifying the number of threads for compilation.
imaihal da52a06
Update copyright.
imaihal 2414108
Update the way to create pool.
imaihal 1725657
Change default value
imaihal 4c453c3
Merge branch 'main' into option_to_set_num_threads_for_compilation
imaihal e98f2cd
Change '-j' option as common option.
imaihal 6e6e249
Fix duplicated definitions.
imaihal 470ee6e
Fix duplicated definition again.
imaihal 76119b3
Set the value of option as uint64_t.
imaihal b176efd
Merge branch 'main' into option_to_set_num_threads_for_compilation
imaihal e8bc8bf
Set number of threads in onnx-mlir-opt.
imaihal f5f880d
Set nullptr for initializing pool.
imaihal 2331d91
Restore include sentence for Thread.h
imaihal bc5f0d3
Merge branch 'main' into option_to_set_num_threads_for_compilation
imaihal 0dfc4e4
Merge branch 'main' into option_to_set_num_threads_for_compilation
imaihal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we apply this option to
onnx-mlir-opt
as well so that we can check performance by callingonnx-mlir-opt --constprop-onnx -j8
for a single operation? It's ok if it needs another PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tungld I was thinking along the same lines, also for example to test that we get the same result for a test that uses parallelism.
@imaihal I would then add a test that tries the operation that you parallelized and try it with
-j 4
for example. You may have to copy a large constant to do that... can lift it from a model.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tungld @AlexandreEichenberger Thanks for the comments.
I applied this option to
onnx-mlir-opt
, but parallelization of constprop is not included in this PR (It is included in PR #3042). So I want to add the tests in PR #3042.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely, this PR set the options, and it will be tested once there is a new opt that can use parallelism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@imaihal I didn't see any change to
onnx-mlir-opt.cpp
(e.g. MLIRContext inonnx-mlir-opt.cpp
). I am curious on how this option is effective inonnx-mlir-opt
command line?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tungld New thread pool is created in
MlirOptMain.cpp
of MLIR. This is due to handle-split-input-file
option (https://github.com/llvm/llvm-project/blob/main/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp#L609-L613). So, it seems to be difficult to set our own threadpool inonnx-mlir-opt.cpp
.In lit tests, how about using
--mlir-disable-threading
for single thread and using mlir default(use all cpus) for multi-thread? Or, using pass local option might be possible to specify our own thread pool.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tungld Sorry, it is possible just by modifying onnx-mlir-opt.cpp. I updated.