Ticket #3555 (closed feature request: duplicate)

Opened 4 years ago

Last modified 4 years ago

Vectorisation error with negative Double const

Reported by: ams Owned by: rl
Priority: normal Milestone:
Component: Data Parallel Haskell Version: 6.13
Keywords: Cc: rl@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Negative Double constants cause an error in parallel comprehensions. This function

negs xs = [: -1.0 | x <- xs :]

doesn't make it through the compiler; this

negs xs = [: (0.0 - 1.0) | x <- xs :]

does.

The error text is

*** Vectorisation error ***

Tycon not vectorised: GHC.Num.T:Num

Attachments

NegConst.hs Download (347 bytes) - added by ams 4 years ago.

Change History

Changed 4 years ago by ams

Changed 4 years ago by ams

  • os changed from Unknown/Multiple to Linux
  • architecture changed from Unknown/Multiple to x86_64 (amd64)

Changed 4 years ago by ams

  • version changed from 6.10.4 to 6.11

Changed 4 years ago by ams

Version is actually 6.13.20090929.

Changed 4 years ago by chak

  • cc rl@… added
  • owner set to rl
  • version changed from 6.11 to 6.13
  • os changed from Linux to Unknown/Multiple
  • architecture changed from x86_64 (amd64) to Unknown/Multiple

The current version of the vectoriser can't handle type classes yet; hence, the error.

BTW, in the current version of DPH, you need to use the simple mock Prelude from package dph in all code that ought to be vectorised — if you use the standard Prelude, you will get similar errors (even without using type classes). We will lift these restrictions in future versions.

Changed 4 years ago by ams

Thanks for the prompt response. Still a bit confused -- not seeing how type classes come into play with -1.0. Is it an overloaded constant? Even in that case, I've given its type as Double explicitly.

Changed 4 years ago by rl

This is because -1.0 gets desugared to negate 1.0 and negate is a method of Num. Unfortunately, Haskell doesn't have negative literals. It would be possible to add support to the vectoriser for this particular case but I'm not sure it's worth it since there is an easy workaround and the problem will go away once we are able to vectorise the prelude.

Changed 4 years ago by rl

  • status changed from new to closed
  • type changed from bug to feature request
  • resolution set to duplicate

I've opened #3577 as a placeholder for issues related to incomplete DPH support.

Note: See TracTickets for help on using tickets.