
#9353: prefetch primops are not currently useful -------------------------------------+------------------------------------- Reporter: | Owner: carter MikeIzbicki | Status: patch Type: bug | Milestone: 7.10.1 Priority: normal | Version: 7.8.2 Component: Compiler | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: D350 | -------------------------------------+------------------------------------- Comment (by carter): So one complication that came up is that to provide the refitted pure prefetch operations as a naive primop is that the types need to be of the shape ` Addr# -> Int# -> a -> (# a #)` For some reason, the more "obvious" type ` Addr# -> Int# -> a -> a` will make GHC panic! Looking at how seq is defined, another option to consider would be to take a page from seq and define the prefetch operations in the pseudo op style like seq, ie `prefetchSeq addr offset b = case prefetch# addr offset of _ -> b` This would allow giving it the type `Addr# -> Int# -> a -> a`, with the prefetch# operation itself then having a type like `Addr# -> Int# -> State#` and the `has_side_effects=True` attribute Luite has helped sketch out this new design, and has pointed out how the semantics of touch# and seq and seq# relate to this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9353#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler