-
Notifications
You must be signed in to change notification settings - Fork 130
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
cpufeatures: requesting (minimal) miri support #778
Comments
Hang on, this is within my capabilities to send you a pull request. :-) |
I'm curious about the use case for your suggested solution: won't code which actually uses any enabled features fail to compile under miri? And if so, shouldn't it always default to those features being unavailable? |
That is a good point. I hadn't actually tested with, e.g.
However, that isn't something that's inherently true; miri can implement support for particular intrinsics even if it (probably?) can't support arbitrary inline assembly. (It supports the portable SIMD APIs, for example.) So I think it's still useful to allow explicitly-set target features. (I'm not a miri expert, though; I'm drawing this mostly from previous discussion around |
Relevant issue: rust-lang/const-eval#7 The proposed solution is detecting miri is in use and falling back to a portable miri-friendly implementation. We could potentially do just that with |
I mean, that's what clients of |
Per the linked issue:
So unless miri is explicitly known to have support, it really it needs to be hard disabled (essentially the opposite of what enabling a target feature with |
I don't see a practical difference between "hard-disable" and "respect the compiler". If you're running under miri, it's incorrect to provide |
I suppose that’s true, although at the same time we know a priori the set of target features supported under miri is the empty set. You could argue relying on target features is futureproofing, but my issue is we don’t yet know what “target features emulated by miri” would actually look like, and I’d prefer not to try to “support” them until we have a clearer picture of that. Based on that issue it seems like something miri may never support, with emulation always handled at the library level by first detecting if miri is in use. |
Does this mean I should change my PR to have |
The former would be my inclination, at least until there is a concrete notion of a miri-supported target feature |
miri
doesn't support inline assembly, includingcpuid
. But cpufeatures could treat it like it does SGX: if a target feature isn't on at compile time, it's not available at run time.The text was updated successfully, but these errors were encountered: