Opened 22 months ago

Closed 9 months ago

#8437 closed bug (fixed)

pprCallishMachOp_for_C: MO_Prefetch_Data 0 not supported

Reported by: erikd Owned by:
Priority: normal Milestone:
Component: Build System Version: 7.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: powerpc64
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

Compiling on linux-powerpc64, the build fails on:

ghc-stage1: panic! (the 'impossible' happened)
  (GHC version 7.7.20131010 for powerpc64-unknown-linux):
        pprCallishMachOp_for_C: MO_Prefetch_Data 0 not supported!

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

From file compiler/cmm/PprC.hs :

        (MO_Prefetch_Data _ ) -> unsupported
        --- we could support prefetch via "__builtin_prefetch"
        --- Not adding it for now

Anyone have ideas on how to make this work?

Change History (5)

comment:1 Changed 22 months ago by erikd

The function prototype for __builtin_prefetch is:

void __builtin_prefetch( const void *addr, int rw, int locality );

but the MO_Prefetch_Data constructor only has one element.

Last edited 22 months ago by erikd (previous) (diff)

comment:2 follow-up: Changed 22 months ago by rwbarton

Funny, someone else (I assume!) was also building HEAD on linux-powerpc64 last night and ran into this same issue.

For now, you can try this (untested) patch to simply make prefetches a no-op in the C backend: http://lpaste.net/94144

Ideally, you would output a __builtin_prefetch call where rw is 0, locality is the argument of the MO_Prefetch_Data constructor, and addr comes from the args field of the CmmUnsafeForeignCall. That looks pretty easy to do, by adding another special case for fn_addr and sending MO_Prefetch_Data _ to __builtin_prefetch in pprCallishMachOp_for_C.

comment:3 Changed 22 months ago by carter

urk, this is absolutely my fault, I didn't realize the c backend is used anymore! (seriously, had no idea, thought it was just a bitrotting thing in tree....). Otherwise i'd have added that too. My sincerest apologies for that.

reid's noop patch and sketch for how to do prefetch right sound.

comment:4 Changed 22 months ago by Erik de Castro Lopo <erikd@…>

In 896cee02e766c687a52cd75382bcfed64a623619/ghc:

Make MO_Prefetch_Data a no-op in the C backend (#8437).

Signed-off-by: Erik de Castro Lopo <[email protected]>

comment:5 in reply to: ↑ 2 Changed 9 months ago by thomie

  • Component changed from Compiler to Build System
  • Resolution set to fixed
  • Status changed from new to closed
  • Type of failure changed from None/Unknown to Building GHC failed

Replying to rwbarton:

Ideally, you would output a __builtin_prefetch call where rw is 0, locality is the argument of the MO_Prefetch_Data constructor, and addr comes from the args field of the CmmUnsafeForeignCall. That looks pretty easy to do, by adding another special case for fn_addr and sending MO_Prefetch_Data _ to __builtin_prefetch in pprCallishMachOp_for_C.

Please open a new task ticket if that is still needed. Commit 896cee02e766c687a52cd75382bcfed64a623619 should have fixed the powerpc64 build, so I'm closing this ticket if you agree.

Note: See TracTickets for help on using tickets.