Open JessyCatterwaul opened 2 months ago
The crash shouldn’t happen and I’ll take a look, but in general, same-type requirements that involve a concrete type (like Foo == Bar<Baz>
etc) are not very efficient. If you eliminate some of those it should help.
Ah, it crashes here:
`Frozen rule should already be subst-simplified`: [Matrix3:Scalar].[FloatingPointScalar:Matrix3x3].[Matrix3x3:Column].[concrete: SIMD3<[Matrix3:Scalar].[FloatingPointScalar:Matrix3x3].[Matrix3x3:Scalar]>] => [Matrix3:Scalar].[FloatingPointScalar:Matrix3x3].[Matrix3x3:Column]
This rule should already have a [subst↓]
next to it because it was imported from the Matrix3 protocol.
Indeed [Matrix3:Scalar].[FloatingPointScalar:Matrix3x3].[Matrix3x3:Scalar]
reduces to [Matrix3:Scalar]
, because of the same-type requirement:
- [Matrix3:Scalar].[FloatingPointScalar:Matrix3x3].[Matrix3x3:Scalar] => [Matrix3:Scalar] [explicit]
And we already have the right rule obtained from applying this reduction:
- [Matrix3:Scalar].[FloatingPointScalar:Matrix3x3].[Matrix3x3:Column].[concrete: SIMD3<[Matrix3:Scalar]>] => [Matrix3:Scalar].[FloatingPointScalar:Matrix3x3].[Matrix3x3:Column]
Description
I'm trying to figure out ways to reduce the necessary
-requirement-machine-max-rule-count
for this library, which currently requires 8000 instead of the default 4000 to compile. The process is difficult because of compiler crashes when attempting to move constraints outwards.Reproduction
I'm sorry this isn't simpler, but this is as far as I've been able to reduce it.
Uncomment the constraint, and this will compile.
Stack dump
Expected behavior
A compiler error instead of a crash
Environment
swift-driver version: 1.113 Apple Swift version 6.0 (swiftlang-6.0.0.7.6 clang-1600.0.24.1) Target: arm64-apple-macosx14.0
Additional information
The constraint should actually be included at an earlier level, like this:
This will work in this example, but it does not scale. If you have any insight, please tell me if it's possible to use that instead of requiring a ridiculous
-requirement-machine-max-rule-count
. Here's the file in the latest commit that uses the problematic constraints.