Repository navigation
Add support for SIMD vector comparison intrinsics - #1853
Conversation
ad67673 to
51d1574
Compare
51d1574 to
36f3f45
Compare
36f3f45 to
e8dc758
Compare
celinval
left a comment
There was a problem hiding this comment.
Can you please make sure the fixme tests have an explanation on why they are failing and an issue associated with it?
| } | ||
|
|
||
| impl PartialEq for VectorData { | ||
| /// Rust allows conversions between SIMD vector types with the same size. By |
There was a problem hiding this comment.
I'm a bit curious about this one. Do you have any reference? What kind of conversions are we talking about? I can see conversions between signed and unsigned, but does it allow conversions between float and integer types? Does it allow conversions between types with different sizes?
There was a problem hiding this comment.
Sorry about the confusion, I shouldn't have used "conversions" here nor in the tests. Conversions as such (i.e., with as) don't seem to be allowed for SIMD types.
Unfortunately, there isn't a lot of documentation on this topic. The most complete I've found, at least for this particular SIMD work (the first one, I think) is this RFC, which I've been linking almost everywhere in this PR. But even things like type-checking are loosely defined there, and most of what I've learn has been through trial and error.
| @@ -0,0 +1,2 @@ | |||
| Kani unexpectedly panicked during compilation | |||
There was a problem hiding this comment.
Is this expected? Can we make this a user friendly error?
There was a problem hiding this comment.
The problem here is that we have to do the type-checking... Compiling this with rustc would cause an error, but doing so with Kani didn't. I've added cases for this in vector_cmp and a couple of test cases. But in there I don't have anything to exit gracefully as we do in other cases (e.g., the session object). I agree with you this should just be a compiler error, but in general this is what we do when type-checking (assertions).
celinval
left a comment
There was a problem hiding this comment.
Thank you for all the explanations. I added a few comments based on my understanding. Please let me know if that makes sense.
|
Ready for review again! Typecheck errors are now triggered in I've also undone the I've also moved/edited/added some comments. |
celinval
left a comment
There was a problem hiding this comment.
Thanks Adrian! I only have one ask, can you please make the errors relative to the Rust types instead of the goto ones?
Everything else is nit, and I'm OK with keeping as they are if you prefer.
| /// 2. An integer base type (or just "boolean"-y, as mentioned in | ||
| /// <https://github.com/rust-lang/rfcs/blob/master/text/1199-simd-infrastructure.md#comparisons>). | ||
| /// The signedness doesn't matter, as the result for each element is | ||
| /// either "all ones" (false) or "all zeros" (true). |
|
BTW this is ready for review again, all comments above have been addressed. |
Description of changes:
Vector*expressions which generatevector-*ireps, as regular operators (e.g.,==or<=) aren't picked up by CBMC. This also makes our own type-checking code cleaner.SIMDtests folder toIntrinsics.Resolved issues:
Towards #1148
Call-outs:
Testing:
How is this change tested? Existing regression + more cases.
Is this a refactor change? No.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.