Opened 4 years ago

Closed 3 years ago

#7540 closed bug (fixed)

Panic on type inference with vectorised parallel arrays

Reported by: tinctorius Owned by: chak
Priority: highest Milestone: 7.8.1
Component: Compiler Version: 7.6.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

{-# LANGUAGE CPP #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ParallelArrays #-}
module Y where

import Data.Array.Parallel

#ifndef BUG
func :: Bool -> [: [: a :] :]
#endif
func True = [: [: :] :]
func False = [: j | j <- func True :]

Result of ghc --make -fvectorise Y.hs:

[1 of 1] Compiling Y                ( C:\tmp\Y.hs, C:\tmp\Y.o )
exprType TYPE [:a{tv b} [tv]:]
exprType TYPE a{tv b} [tv]
exprType TYPE [:a{tv b} [tv]:]
exprType TYPE a{tv b} [tv]
exprType TYPE [:a{tv b} [tv]:]
exprType TYPE a{tv b} [tv]
exprType TYPE [:a{tv b} [tv]:]
exprType TYPE a{tv b} [tv]
Warning: vectorisation failure: identityConv: quantified type changes under vectorisation
  Could NOT call vectorised from original version Y.func

Result of ghc --make -fvectorise -DBUG Y.hs:

[1 of 1] Compiling Y                ( C:\tmp\Y.hs, C:\tmp\Y.o )
exprType TYPE [:t{tv a30W} [tv]:]
exprType TYPE t{tv a30W} [tv]
exprType TYPE [:t{tv a30W} [tv]:]
exprType TYPE t{tv a30W} [tv]
exprType TYPE [:t{tv a30W} [tv]:]
exprType TYPE t{tv a30W} [tv]
exprType TYPE [:t{tv a30W} [tv]:]
exprType TYPE t{tv a30W} [tv]
Warning: vectorisation failure: identityConv: quantified type changes under vectorisation
  Could NOT call vectorised from original version func
exprType TYPE t{tv a30W} [tv]
Warning: vectorisation failure: identityConv: quantified type changes under vectorisation
  Could NOT call vectorised from original version Y.func
ghc: panic! (the 'impossible' happened)
  (GHC version 7.6.1 for x86_64-unknown-mingw32):
        nameModule func1{v r3ap}

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

And so I did.

Change History (3)

comment:1 Changed 4 years ago by tinctorius

An even simpler example:

{-# LANGUAGE CPP #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ParallelArrays #-}
module Y where

import Data.Array.Parallel

#ifndef BUG
func :: Bool -> [:[:a:]:]
#endif
func True = [:[::]:]
func False = func True

Taking [:[::]:] out to its own variable doesn't change a thing, unless it's given a monomorphic type signature.

comment:2 Changed 4 years ago by simonpj

difficulty: Unknown
Milestone: 7.8.1
Owner: set to chak
Priority: normalhighest

Thank you! Yes, I see this happening in HEAD, with -fvectorise. Manuel, you are rewriting the vectoriser. Might you look at this?

Simon

comment:3 Changed 3 years ago by thoughtpolice

Resolution: fixed
Status: newclosed

Both of these examples do not cause the vectoriser to panic, with HEAD built as of this morning. So I'm closing as already fixed.

Note: See TracTickets for help on using tickets.