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

Check if LLD is built when checking if lto_supported #92752

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

jvoung
Copy link
Contributor

@jvoung jvoung commented May 20, 2024

Otherwise, older copies of LLD may not understand the latest bitcode
versions (for example, if we increase ModuleSummaryIndex::BitCodeSummaryVersion)

Related to #90692 (comment)

Otherwise, older copies of LLD may not understand the latest bitcode
versions (for example, if we increase `ModuleSummaryIndex::BitCodeSummaryVersion`)
Otherwise, older copies of LLD may not understand the latest bitcode
versions (for example, if we increase `ModuleSummaryIndex::BitCodeSummaryVersion`)
@jvoung
Copy link
Contributor Author

jvoung commented May 21, 2024

@vitalybuka or @MaskRay would you mind reviewing, or is there anyone else you suggest?
Context is #90692
Thanks!

jvoung added a commit to jvoung/llvm-project that referenced this pull request May 21, 2024
The test has a run with `flto` so makes sense to require `lto` in
some way. Currently it relies on requires `lld-available` to imply
that `lto` is supported, but it would help to separate the two
notions in that `lto` should require up to date components
while `lld-available` may not:
llvm#92752
jvoung added a commit to jvoung/llvm-project that referenced this pull request May 21, 2024
The test has a run with `flto` so makes sense to require `lto` in
some way. Currently it relies on requires `lld-available` to imply
that `lto` is supported, but it would help to separate the two
notions in that `lto` should require up to date components
while `lld-available` may not:
llvm#92752
@MaskRay
Copy link
Member

MaskRay commented May 21, 2024

Perhaps we should lld-available stricter to mean that we have lld in the build directory.

llvm/utils/lit/lit/llvm/config.py has some use_lld code. Can we reuse it?

@jvoung
Copy link
Contributor Author

jvoung commented May 21, 2024

I think that traces back to 2344a72 where there is an "OR" (if (LINKER_IS_LLD OR LLVM_TOOL_LLD_BUILD)...), IIUC

@vitalybuka do you have additional context here or thoughts for this too?

#90692 itself is not a huge thing, but I think it's worth figuring this out so that the next person who increases ModuleSummaryIndex::BitCodeSummaryVersion doesn't run into the same issue.

@vitalybuka
Copy link
Collaborator

Without 2344a72 some tests will not be executed as LLD will not be detected.
There are multiple ways to build compilr-rt, and I am not sure which will fail with use_lld.

Also use_lld probably can be used with system LLD, but compiler-rt by default is built with just build clang.

@jvoung
Copy link
Contributor Author

jvoung commented May 24, 2024

Thanks for the info Vitaly!

Do you remember any of the example tests that were not being executed but should have been and bots (or configuration) to double check?

Did the tests only want the freshly built LLD, and somehow the LLVM_TOOL_LLD_BUILD part wasn't sufficient? Or did the tests want to allow system LLD (but were not testing LTO)?

I'm not sure whether LLVM_TOOL_LLD_BUILD is sufficiently different from the use_lld in llvm/utils/lit/lit/llvm/config.py. It seems to roughly search:

self.config.name.lower() + "_tools_dir",
            "lld_tools_dir",
            "llvm_tools_dir",

lld_tools_dir doesn't seem to be bound in the compiler-rt, and config.name is <unnamed>, so if we use that it would just be checking llvm_tools_dir IIUC. I'm also assuming the use_installed parameter is false, since we don't want that.
And it sets LD_LIBRARY_PATH, but that hasn't seemed to have been a problem for compiler-rt so far?

====

Otherwise, is there a strong reason to have lld-available imply lto_supported and not decouple? Is the concern that this was already assumed in a lot of places and we'd need to inform people that it's decoupled?

@jvoung
Copy link
Contributor Author

jvoung commented Jun 3, 2024

Hi, just wanted to check if you have another other thoughts on the earlier questions, or on how to proceed here?

Thanks!

@vitalybuka
Copy link
Collaborator

Hi, just wanted to check if you have another other thoughts on the earlier questions, or on how to proceed here?

Thanks!

Unfortunately there is not much to add.

These are bots maintained by my team: https://lab.llvm.org/buildbot/#/waterfall?tags=sanitizer

All steps print number of executed test.
https://lab.llvm.org/buildbot/#/builders/269/builds/9539

On some of them 2344a72 enabled additional tests.
My guess it was sanitizer-aarch64-linux or sanitizer-x86_64-linux.

It should be OK to proceed with:

  1. Land this patch
  2. Compare number of tests on build before and after the patch on those bots.
  3. If regressed, revert and investigate

@jvoung
Copy link
Contributor Author

jvoung commented Jun 7, 2024

Thanks Vitaly! Ok I can check the number of test before and after and post them.

Would you mind helping land this if it's ok? I don't yet have commit access.

@vitalybuka
Copy link
Collaborator

Sure.
However, please, if it breaks bots, bring to my attention those, email, or even better Discord.
The bots are configured in such a way that you are on the blame list, and they will send messages from the bot to you, but not to me.

@vitalybuka vitalybuka merged commit c467e60 into llvm:main Jun 7, 2024
4 checks passed
@MaskRay
Copy link
Member

MaskRay commented Jun 7, 2024

Thanks. This makes the feature lld stricter. Since we don't have rg 'REQUIRES.*!lld' and rg 'UNSUPPORTED.*lld' tests, this should be safe. (I still don't have 100% confidence level since runtime tests often expose weird behaviors)

@jvoung
Copy link
Contributor Author

jvoung commented Jun 8, 2024

Thanks!
I compared the number of tests on build before and after in the sanitizer bots: https://docs.google.com/spreadsheets/d/1STjhM3EFr3YldkpCN40Lic2Qk2Ga2uBoqINYub5Fjxs/edit?usp=sharing

overall they look same except one case stage2/ubsan check-cxx on bot sanitizer-x86_64-linux-bootstrap-ubsan.

  • There the number of excluded, unsupported, skip, etc. are the same
  • Only the number of "passed" / total tests is fewer. I believe that's because the run batched this commit with another commit that reverted/deleted some libcxx tests.

@vitalybuka
Copy link
Collaborator

vitalybuka commented Jun 12, 2024

Thanks for detailed comparison!
ubsan check-cxx Should not be affected by this patch, libcxx does not use these CMake files.

@HerrCai0907 HerrCai0907 mentioned this pull request Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants