-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add a test to help track wasm features over time #131526
Add a test to help track wasm features over time #131526
Conversation
This came up [on Zulip][zulip] where currently we have no notification channel when the `generic` CPU for WebAssembly changes in LLVM other than users hitting possible breakage. This is going to continue to evolve over time, so the purpose of this test is to provide a location to help indicate what to do when the `generic` CPU changes. The purpose of this test is to provide a nudge to notify various folks that something is changing and warrants release notes and such. Otherwise it's expected that the test should be pretty easy to update if it starts failing. [zulip]: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Wasm.20minimal.20features.20target.20compiler-team.23791/near/476150388
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 the test. I think this can cause some friction during LLVM bumps, but we definitely should be tracking wasm proposals being enabled. I'll cc the llvm wg for opinion.
Hi @rust-lang/wg-llvm, would you be okay if we added a wasm proposals test that would fail if LLVM changes the set of enabled wasm proposals for the wasm cc @nikic and @DianQK specifically as I know both of you do quite a bit of the llvm bumps. |
If the wg-llvm members don't opposite this change, |
When a wholly new feature is added directly, this test case will still pass. Let's query the default enabled features from LLVM. :) I think we can make this kind of check more generic by extending the output of Maybe like this: extern "C" size_t LLVMRustGetTargetEnabledFeaturesCount(LLVMTargetMachineRef TM) {
const TargetMachine *Target = unwrap(TM);
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
const auto FeatTable =
MCInfo->getEnabledProcessorFeatures();
return FeatTable.size();
}
extern "C" void LLVMRustGetTargetEnabledFeature(LLVMTargetMachineRef TM, size_t Index,
const char **Feature,
const char **Desc) {
const TargetMachine *Target = unwrap(TM);
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
const auto FeatTable =
MCInfo->getEnabledProcessorFeatures();
const SubtargetFeatureKV Feat = FeatTable[Index];
*Feature = Feat.Key;
*Desc = Feat.Desc;
} This code modified from rust/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp Lines 366 to 384 in 249df9e
|
In principle this is fine, but this should be a no_core test and it will have to be conditional on the LLVM version. E.g. the current test would fail on LLVM 18 if we actually ran it there (which we don't because it's not no_core). Or alternatively we'd have to explicitly add features on the rust side to make it independent of the LLVM version. This kind of makes sense to have consistent behavior, but on the other hand we sometimes just can't do this, e.g. because enabling |
Wait, am I reading this correctly that |
Yes, |
I... Thanks for this crucial info, this makes it much more complicated... |
To me this is a relatively minor point centered around making it more reliable that we know when to add release notes for changes, so in that sense I wouldn't consider it worth more C++ or a custom test harness or something like that. That's a good point about LLVM versions, and I can mark this LLVM 19+, but that's also a good point about mixing and matching LLVM versions means that this is likely to just be a noisy test in the end and cause undue churn/pain. Given that I think I'll actually go ahead and close this. It's probably best tracked externally to not add more burden on LLVM changes in-repo. |
This came up on Zulip where currently we have no notification channel when the
generic
CPU for WebAssembly changes in LLVM other than users hitting possible breakage. This is going to continue to evolve over time, so the purpose of this test is to provide a location to help indicate what to do when thegeneric
CPU changes. The purpose of this test is to provide a nudge to notify various folks that something is changing and warrants release notes and such. Otherwise it's expected that the test should be pretty easy to update if it starts failing.