-
Notifications
You must be signed in to change notification settings - Fork 82
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
Change LanesAtMost32 to LanesAtMost64 (or possibly remove the lane limit altogether) #90
Comments
I believe we should consider an alternative to the use of actual numbers in the name if we are going to wind up changing them around based on these codegen vagaries. |
since it's a dumb temporary limit just call it |
alternatively we can use a const fn and change the internal implementation without having to remove impls for things, which is still backwards-incompatible but in a different way! :D |
I'm not actually positive it's a temporary limit, unless we're planning on requiring all backends to support up to But I agree about renaming it. Maybe something more like |
OTOH, having the count in the name explains what you have to do to fix the error |
We discussed this in the meeting and decided that since we really don't want to go below 32, because we consider AVX2 support important, it's fine to leave it with this name as it is. Also, that the aarch64 codegen problem should be considered as blocking stabilization until we understand why. |
Updated the title of this issue to reflect some expressed sentiment that maybe this trait shouldn't exist at all. We should probably revisit in the future, but it may be appropriate to just produce a monomorphization error. The compiler currently produces one if the size exceeds some implementation-defined value (65535 lanes, I think), but the error is not very descriptive. If we can improve the error reporting, maybe we can remove this trait altogether. |
@calebzulawski IIRC, monomorphization errors are undesirable. As I had understood it, I had thought rustc was developed in such a way as to totally avoid surfacing monomorphization errors to end users. But I don't have a ton of context on that. It might be wise to ping the compiler team on something like this. (If only to discover whether monomorphization errors are a "hard no" or not.) |
Yeah, that would definitely be a good idea. Realistically it's extremely unlikely to encounter the error in "normal" code, but if it's an absolute no we need to keep the trait. We could also explore using a lane count type smaller than |
Actually, I forgot the trait is also preventing sizes that aren't a power of two... so fairly easy to get wrong. Still worth discussing, I think. |
well, technically arrays also have monomorphization errors: |
It does fail? https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=03be5c230f87259db3ed325707a24a44 Or are you saying that error is reported at monomorphization time? I can't tell. In any case, what matters is whether the relevant teams consider that a bug or not (if it's being reported at monomorphization time). I don't know the answer to that question.
As I said, the relevant teams (compiler?) should be consulted about this. cc @rust-lang/compiler |
I'm saying the error is reported at monomorphization time (or at least will be if sufficient obfuscating generics are added). |
Yes, we shouldn't assume that existing behavior is intended and plow forward. That's not a good strategy for cooperation. |
well, for arrays at least, I remember reading that the error on array sizes being more than That said, +1 for cooperation! |
@lqd is working on improving diagnostics during monomorphization time. They are undesirable though. We would definitely prefer these errors to be handled via bounds, but there is no consensus yet on the various aspects of that. Even with improvements to post monomorphization diagnostics, they have subpar UX. Check builds and IDEs won't show them. And they don't occur in libraries that define them, but on crates that use them. Ideas for how to represent the bounds that you need and how to handle them in general are very welcome. If you come to the conclusion that post monomorphization errors are preferrable, that is also important to know. |
I agree that the trait bound is the "rusty" way to do it. The trait bound actually never comes up in the API in non-generic code. In generics the problem is threefold:
I think if we can come up with a name that is descriptive enough to produce a good error message, but flexible enough to stay the same as we reduce limitations (add non-powers-of-two, increase maximum length, etc), we can just stick with a trait. |
|
I mean... ideally you don't want a trait, but a formula, but const_evaluatable_checked is nowhere near ready. Neither impl, design nor consensus wise |
Since this is just a true/false situation a trait might not be perfect but it's pretty good. Once |
@workingjubilee @programmerjake I think we can close this now? |
I think while we changed the name, the driving thrust of this ticket was actually only supporting lanes of a certain count? So we should reorient this instead. |
Towards the end of the discussion I think we settled on using a trait to limit lane counts, rather than a monomorphisation error. |
Closing in favor of #63. We've settled on the |
We would like to support at least 64-lane vectors (to allow AVX-512 vectors of
u8
) but there is an aarch64 codegen issue (rust-lang/rust#84020).Once that issue is solved we can increase the lane limit.
The text was updated successfully, but these errors were encountered: