-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib] Reinstate the FixedPointConversion tests #36205
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
Conversation
@swift-ci Please test |
Build failed |
Build failed |
Linux with preset
|
macOS with preset
|
The following // EXPECTED: Fatal error: Float16 value cannot be converted to UInt32
// because the result would be less than UInt32.min
// FloatingPointConversionTraps.Float16ToUInt32Conversion/dest=-1.1
UInt32(Float16(-1.1)) //-> ACTUAL: UInt32.max
// FloatingPointConversionTraps.Float16ToUInt32Conversion/dest=-2047
UInt32(Float16(-2047.0)) //-> ACTUAL: (UInt32.max - 2046)
// FloatingPointConversionTraps.UInt32/Float16/negative
UInt32(Float16(-123.0)) //-> ACTUAL: (UInt32.max - 122) These expected and actual results are from an Xcode Playground (iOS or tvOS). |
🤔 This doesn't make sense to me, and in more than one way: First, on my actual iPad with the release version of Swift Playgrounds, it says: UInt32(Float16(-1.1)) // Error: Negative literal '-1.1' cannot be converted to 'UInt32' This behaves as expected and doesn't line up with what you're seeing. Second, this also shouldn't be testing floating-point conversions: as the diagnostic shows, since SE-0213, literal initialization behaves like coercion. Third, curiously, testing actual conversions on the iPad shows that something's not right: let x = -1.1 as Double
UInt32(Float16(x)) // 0
let y = -1.1 as Float16
UInt32(y) // 0 -- Uh oh... |
Aha! I have found the think-o. And I don't think I'm to blame for this one :) |
In an Xcode 12.4 Playground (iOS simulated), I'm only seeing that diagnostic when using integer literals with UInt32(Float16(-123.0)) //-> 4294967173
UInt32(Float16(-123)) //-> error: Negative literal '-123' cannot be converted to 'UInt32'
I'm seeing the same results either way, and also for let x = Float16(-1.1) //-> -1.1
let y = Float16(-2047.0) //-> -2047.0
let z = Float16(-123.0) //-> -123.0
UInt32(x) //-> 4294967295
UInt32(exactly: x) //-> nil
UInt32(y) //-> 4294965249
UInt32(exactly: y) //-> 4294965249
UInt32(z) //-> 4294967173
UInt32(exactly: z) //-> 4294967173 It's possible that the |
@swift-ci please test |
I would expect the same failures for |
Build failed |
Unrelated test failure on Linux:
Let’s try again... @swift-ci please test Linux platform |
@benrimmington Sorry, in case it wasn’t clear, the cause of the test failures is now identified and fixed by #36219. |
@xwu Thanks, I've taken a look at your pull request. I was actually referring to the test results from 3 days ago. There were failures for |
All checks have passed. However, the tests are among the slowest, and are currently unsupported on macOS CI. Shall I try to split the test suites into separate files?
|
@benrimmington Yikes, agree it's probably a good idea to split, but why is it so slow in the first place? |
@xwu The expanded gyb file contains 1768 tests. On macOS, using the Debug: 86% of testing time is compilation time.
Release: 92% of testing time is compilation time.
|
I see--thanks. Was worried that certain conversions were running unusually slowly. |
@swift-ci Please test |
https://ci.swift.org/job/swift-PR-Linux/26014/ Release configuration tests are now 5.5x to 7x faster on Linux, by splitting the GYB output into smaller files, and building with the
(I need to adjust some test values in the GYB template.) |
https://ci.swift.org/job/swift-PR-macos/26050/ The testing times are too slow on macOS and simulators.
|
@swift-ci Please test |
Build failed |
Build failed |
The testing times are better, now that the 20 generated files are built and run in parallel.
|
@swift-ci Please test |
@stephentyrone I believe this is ready for review.
|
These can obviously be sped up quite a bit more, but I'm fine with taking them as is for now. |
Follow-up to: #23524
I've tested on an Intel-based Mac (without
Float16
):Resolves: rdar://problem/49177883