Ticket #8256: patch-prefetch1.diff

File patch-prefetch1.diff, 7.3 KB (added by carter, 23 months ago)

initial prefetch patch

  • docs/users_guide/7.8.1-notes.xml

    From 2cec084e45392e0b0d198254017b140accee32f0 Mon Sep 17 00:00:00 2001
    From: Austin Seipp <[email protected]>
    Date: Sun, 8 Sep 2013 16:17:39 -0500
    Subject: [PATCH] Revert "Note infinite stack default in release notes."
    
    This reverts commit c798a8c6c66d826efdc0201fa56d45337eecc2af.
    ---
     docs/users_guide/7.8.1-notes.xml | 21 ---------------------
     1 file changed, 21 deletions(-)
    
    diff --git a/docs/users_guide/7.8.1-notes.xml b/docs/users_guide/7.8.1-notes.xml
    index 2021fc6..15bf82b 100644
    a b  
    346346
    347347            <listitem>
    348348                <para>
    349                      By default, the maximum stack size in the runtime
    350                      system is now infinite. This is controlled by the
    351                      <literal>+RTS -K</literal> flag, which was
    352                      previously defaulted to 8MB. In general, this
    353                      will allow more programs to run as they will no
    354                      longer stack overflow as quickly, although they
    355                      may use much more memory.
    356                </para>
    357 
    358                 <para>
    359                      Note that you will still eventually encounter a
    360                      stack overflow - when the heap is completely
    361                      exhausted, as stacks are serviced from the
    362                      storage manager. This will cause a runtime abort
    363                      after invoking
    364                      <literal>StackOverflowHook</literal>.
    365                </para>
    366            </listitem>
    367 
    368             <listitem>
    369                 <para>
    370349                    The performance of <literal>StablePtr</literal>s and
    371350                    <literal>StableName</literal>s has been improved.
    372351               </para>
  • compiler/cmm/CmmParse.y

    -- 
    1.8.2
    
    From 40e1401aab04447b40d540b30c4611b999ae69fe Mon Sep 17 00:00:00 2001
    From: Carter Tazio Schonwald <[email protected]>
    Date: Sun, 8 Sep 2013 22:41:07 -0400
    Subject: [PATCH] some other fixups for adding prefetch i overlooked.
    
    note:should also change the native code gens to support prefetch. should be easy!
    (not doing it for now, but should do it this week)
    ---
     compiler/cmm/CmmParse.y             | 4 ++--
     compiler/cmm/PprC.hs                | 4 +++-
     compiler/codeGen/StgCmmPrim.hs      | 4 ++--
     compiler/nativeGen/PPC/CodeGen.hs   | 2 +-
     compiler/nativeGen/SPARC/CodeGen.hs | 2 +-
     compiler/nativeGen/X86/CodeGen.hs   | 6 ++++--
     compiler/prelude/primops.txt.pp     | 4 ++--
     7 files changed, 15 insertions(+), 11 deletions(-)
    
    diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y
    index 65696b5..830cb92 100644
    a b callishMachOps = listToUFM $ 
    928928        ("prefetch0",MO_Prefetch_Data 0),
    929929        ("prefetch1",MO_Prefetch_Data 1),
    930930        ("prefetch2",MO_Prefetch_Data 2),
    931         ("prefetch3",MO_Prefetch_Data 3),
    932        
     931        ("prefetch3",MO_Prefetch_Data 3)
     932
    933933        -- ToDo: the rest, maybe
    934934        -- edit; which rest?
    935935    ]
  • compiler/cmm/PprC.hs

    diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
    index 149968d..8a446d1 100644
    a b pprCallishMachOp_for_C mop 
    748748        MO_Add2       {} -> unsupported
    749749        MO_U_Mul2     {} -> unsupported
    750750        MO_Touch         -> unsupported
    751         MO_Prefetch_Data -> unsupported
     751        (MO_Prefetch_Data _ ) -> unsupported
     752        --- we COULD support prefetch via "__builtin_prefetch"
     753        --- Not addin g it for now
    752754    where unsupported = panic ("pprCallishMachOp_for_C: " ++ show mop
    753755                            ++ " not supported!")
    754756
  • compiler/codeGen/StgCmmPrim.hs

    diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs
    index 974690d..cf53ed4 100644
    a b doPrefetchAddrOp ::Int -> [LocalReg] 
    12981298                 -> [CmmExpr]
    12991299                 -> FCode ()
    13001300doPrefetchAddrOp locality  res [addr,idx]
    1301    = mkBasicPrefetch 0 res addr idx
    1302 doPrefetchAddrOp _ _
     1301   = mkBasicPrefetch locality 0 res addr idx
     1302doPrefetchAddrOp _ _  _
    13031303   = panic "StgCmmPrim: doPrefetchAddrOp"
    13041304
    13051305mkBasicPrefetch :: Int ->  ByteOff      -- Initial offset in bytes
  • compiler/nativeGen/PPC/CodeGen.hs

    diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs
    index 65533d8..f018276 100644
    a b genCCall' dflags gcp target dest_regs args0 
    11651165                    MO_U_Mul2 {}     -> unsupported
    11661166                    MO_WriteBarrier  -> unsupported
    11671167                    MO_Touch         -> unsupported
    1168                     MO_Prefetch_Data -> unsupported
     1168                    (MO_Prefetch_Data _ ) -> unsupported
    11691169                unsupported = panic ("outOfLineCmmOp: " ++ show mop
    11701170                                  ++ " not supported")
    11711171
  • compiler/nativeGen/SPARC/CodeGen.hs

    diff --git a/compiler/nativeGen/SPARC/CodeGen.hs b/compiler/nativeGen/SPARC/CodeGen.hs
    index 5d2b9a9..4f670f4 100644
    a b outOfLineMachOp_table mop 
    657657        MO_U_Mul2 {}     -> unsupported
    658658        MO_WriteBarrier  -> unsupported
    659659        MO_Touch         -> unsupported
    660         MO_Prefetch_Data -> unsupported
     660        (MO_Prefetch_Data _) -> unsupported
    661661    where unsupported = panic ("outOfLineCmmOp: " ++ show mop
    662662                            ++ " not supported here")
    663663
  • compiler/nativeGen/X86/CodeGen.hs

    diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs
    index f6143d3..1b910e5 100644
    a b genCCall _ (PrimTarget MO_WriteBarrier) _ _ = return nilOL 
    16561656
    16571657genCCall _ (PrimTarget MO_Touch) _ _ = return nilOL
    16581658
    1659 genCCall _ (PrimTarget MO_Prefetch_Data) _ _ = return nilOL
     1659genCCall _ (PrimTarget (MO_Prefetch_Data _ )) _ _ = return nilOL
     1660-- could easily add prefetch to x86 that exactly reflects
     1661--- prefetces 0-3, not doing that for now
    16601662
    16611663genCCall is32Bit (PrimTarget (MO_BSwap width)) [dst] [src] = do
    16621664    dflags <- getDynFlags
    outOfLineCmmOp mop res args 
    23592361              MO_U_Mul2 {}     -> unsupported
    23602362              MO_WriteBarrier  -> unsupported
    23612363              MO_Touch         -> unsupported
    2362               MO_Prefetch_Data -> unsupported
     2364              (MO_Prefetch_Data _ ) -> unsupported
    23632365        unsupported = panic ("outOfLineCmmOp: " ++ show mop
    23642366                          ++ " not supported here")
    23652367
  • compiler/prelude/primops.txt.pp

    diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
    index 00b48f1..ed9d5ff 100644
    a b primop PrefetchByteArrayOp3 "prefetchByteArray3#" GenPrimOp 
    27742774   ByteArray# -> Int# -> ByteArray#
    27752775   with llvm_only = True
    27762776
    2777 primop PrefetchMutableByteArray3Op "prefetchMutableByteArray3#" GenPrimOp
     2777primop PrefetchMutableByteArrayOp3 "prefetchMutableByteArray3#" GenPrimOp
    27782778   MutableByteArray# s -> Int# -> State# s -> State# s
    27792779   with has_side_effects = True
    27802780        llvm_only = True
    primop PrefetchAddrOp3 "prefetchAddr3#" GenPrimOp 
    27852785
    27862786----
    27872787
    2788 primop PrefetchByteArrayOp3 "prefetchByteArray2#" GenPrimOp
     2788primop PrefetchByteArrayOp2 "prefetchByteArray2#" GenPrimOp
    27892789   ByteArray# -> Int# -> ByteArray#
    27902790   with llvm_only = True
    27912791