-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[CMake][LIT] Add option to run lit testsuites in parallel #82899
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
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.
Thanks for pushing this through upstream! Let me know if you need me to commit this on your behalf.
@JoeLoser yes please merge, I do not have write access to this repo. |
@patrickdoc Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested Please check whether problems have been caused by your change specifically, as How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
Can you clarify why this is useful/desirable? (it's good practice in general for the PR description to describe the context and motivation for the change, that is the "why" instead of "what" is done) Same for the documentation change: it does not talk about when is it useful/desirable for a user to do. |
Oh you're running very tiny lit target! The problem of this is that most of the lit suite are massively parallel themselves. The way to achieve good parallelism with lit isn't to call the targets the way you're doing here, instead you can do:
Or:
I believe these are giving you "perfect" parallelism without over-subscription problem associated with the cmake option you introduced. Your screenshots are actually misleading in that they show multiple threads apparently "balanced", which looks all nice, but it's actually a "lie": this is just the ninja view of the world. Each of the lit invocation will spawn as many threads as cores on the machine (the over-subscription I'm referring to). |
@patrickdoc @JoeLoser Can we try what Mehdi is suggesting instead of what is enabled by this PR? If that works, I don't see a need for this PR and we can revert it, since there is no clear use case. |
Hey @joker-eph, the pictures in my example weren't my actual builds, just a demonstration of the intended change. I'm aware that lit also tries to parallelize on top of ninja's parallelism so have reduced lit's parallelism with My use-case is CI builds, where we are running the whole build + all the tests, with the goal of being as fast as possible. Using a single mega lit target has some downsides:
The wins I am seeing come from moving parallelism logic out of lit and into Ninja. So we end up with a much smoother build graph because Ninja knows more about the build than lit does. But to do that, we need to allow Ninja to flexibly schedule the lit targets. The upside of the Truthfully even just removing this flag altogether wouldn't affect the "single lit target" use-case (aside from losing the progress bar) because it is already delayed until after every other target anyway. But I've added it as an option here to allow folks to opt-in. For clarification in the docs, would something like this be better:
|
This is weird, your motivation stated earlier was "I want to run a very small set of the tests", I'm having a hard time following now what is the motivating example really!
This is true in theory, however in practice in LLVM the check targets depends on all the binaries needed for all the tests (unless you have many lit test suites in the first place, but I'd like to see an example). Another problem is that running the tests in parallel concurrently with the build is again oversubscribing the machine.
I don't understand your point about small/large? As long as each test is single threader, it does not matter if they are small or large.
If you want to do this in a principle way, then we should
If you care about solving this properly, I'd be happy to see something in this direction, however this isn't the granularity you operate at right now. I rather see this reverted and a more principled approach discussed first. |
@joker-eph sorry about approving/merging this early before engaging more with the community here on the feedback and approach. As I talked with Jeff this morning, he reverted this in 8846b91 and we'll re-evaluate how we want to proceed. Sorry again, and we appreciate your feedback! |
No need to apologize, I assumed all good intents here! |
One more subtlety: when lit runs the tests, it'll run them all and reports the failures. |
Currently
add_lit_target
sets theUSES_TERMINAL
CMake option. When using Ninja, this forces all lit testsuite targets into the single-threadedconsole
pool.This PR adds a new option
LLVM_PARALLEL_LIT
which drops theUSES_TERMINAL
flag, allowing Ninja to run them in parallel.The default setting (
LLVM_PARALLEL_LIT=OFF
) retains the existing behavior of serial testsuite execution.