Skip to content
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

The plugin seem not able to use associativity of addition #73

Open
Mikolaj opened this issue Feb 20, 2023 · 0 comments
Open

The plugin seem not able to use associativity of addition #73

Mikolaj opened this issue Feb 20, 2023 · 0 comments

Comments

@Mikolaj
Copy link
Contributor

Mikolaj commented Feb 20, 2023

The plugin can't solve: Expected: ShapeInt (((m6 + k1) + n14) + (n + k3)) Actual: ShapeInt ((((m6 + k1) + n14) + n) + k3).

A longer fragment of the error message with GHC 9.4.4:

simplified/HordeAd/Core/AstVectorize.hs:435:42: error:
    • Could not deduce (((k2 + m7) - 1) ~ n14)
      from the context: (KnownNat n13, (1 + n13) ~ ((k1 + k2) + k3))
        bound by a pattern with pattern synonym:
                   :. :: forall (n1 :: GHC.TypeNats.Nat) i.
                         KnownNat n1 =>
                         forall (n :: GHC.TypeNats.Nat).
                         (KnownNat n, (1 + n) ~ n1) =>
                         i -> Index n i -> Index n1 i,
                 in an equation for ‘projectGatherN’
        at simplified/HordeAd/Core/AstVectorize.hs:425:26-36
      or from: ((m7 + k2) ~ (1 + n14), KnownNat n14)
        bound by a pattern with constructor:
                   ::: :: forall (n1 :: GHC.TypeNats.Nat) i.
                          KnownNat n1 =>
                          i -> SizedList n1 i -> SizedList (1 + n1) i,
                 in an equation for ‘projectGatherN’
        at simplified/HordeAd/Core/AstVectorize.hs:426:26-57
      or from: (KnownNat n15,
                (1 + n15) ~ (((((m6 + k1) + m7) + k2) + n) + k3))
        bound by a pattern with pattern synonym:
                   :$ :: forall (n1 :: GHC.TypeNats.Nat) i.
                         KnownNat n1 =>
                         forall (n :: GHC.TypeNats.Nat).
                         (KnownNat n, (1 + n) ~ n1) =>
                         i -> Shape n i -> Shape n1 i,
                 in an equation for ‘projectGatherN’
        at simplified/HordeAd/Core/AstVectorize.hs:427:22-67
      Expected: ShapeInt (((m6 + k1) + n14) + (n + k3))
        Actual: ShapeInt ((((m6 + k1) + n14) + n) + k3)
      ‘n14’ is a rigid type variable bound by

To reproduce, compile the following branch: https://github.com/Mikolaj/horde-ad/tree/plugin-associativity

Use allow-newer if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant