diff options
author | Carter Tazio Schonwald <carter.schonwald@gmail.com> | 2013-11-02 19:12:53 -0400 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2013-11-03 17:22:54 -0600 |
commit | 37ae422fc1131245705a686d1e3144b3f9e9aa81 (patch) | |
tree | cdfa190eb3bbd483e28c10730ef306856b94daa8 /compiler/prelude/primops.txt.pp | |
parent | c3e7823e560bc4f95b48a6e76f736d875d3937b6 (diff) | |
download | haskell-37ae422fc1131245705a686d1e3144b3f9e9aa81.tar.gz |
Update documentation concerning prefetch ops
Also remove can_fail=True since it's likely unnecessary upon discussion
(see #8256.)
Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'compiler/prelude/primops.txt.pp')
-rw-r--r-- | compiler/prelude/primops.txt.pp | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 872a2bc4d9..37591afe87 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -2608,13 +2608,6 @@ section "Prefetch" convention follows the naming convention of the prefetch intrinsic found in the GCC and Clang C compilers. - The prefetch primops are all marked with the can_fail=True attribute, but - they will never fail. The motivation for enabling the can_fail attribute is - so that prefetches are not hoisted/let floated out. This is because prefetch - is a tool for optimizing usage of system memory bandwidth, and preventing let - hoising makes *WHEN* the prefetch happens a bit more predictable. - - On the LLVM backend, prefetch*N# uses the LLVM prefetch intrinsic with locality level N. The code generated by LLVM is target architecture dependent, but should agree with the GHC NCG on x86 systems. @@ -2636,13 +2629,25 @@ section "Prefetch" The "Intel 64 and IA-32 Architectures Optimization Reference Manual" is especially a helpful read, even if your software is meant for other CPU - architectures or vendor hardware. + architectures or vendor hardware. The manual can be found at + http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-optimization-manual.html . - http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-optimization-manual.html + The {\tt prefetchMutableByteArray} family of operations has the order of operations + determined by passing around the {\tt State#} token. + For the {\tt prefetchByteArray} + and {\tt prefetchAddr} families of operations, consider the following example: + + {\tt let a1 = prefetchByteArray2# a n in ...a1... } + + In the above fragement, {\tt a} is the input variable for the prefetch + and {\tt a1 == a} will be true. To ensure that the prefetch is not treated as deadcode, + the body of the let should only use {\tt a1} and NOT {\tt a}. The same principle + applies for uses of prefetch in a loop. + + } - } ------------------------------------------------------------------------ @@ -2651,57 +2656,45 @@ section "Prefetch" --- primop PrefetchByteArrayOp3 "prefetchByteArray3#" GenPrimOp ByteArray# -> Int# -> ByteArray# - with can_fail = True primop PrefetchMutableByteArrayOp3 "prefetchMutableByteArray3#" GenPrimOp MutableByteArray# s -> Int# -> State# s -> State# s - with can_fail = True primop PrefetchAddrOp3 "prefetchAddr3#" GenPrimOp Addr# -> Int# -> Addr# - with can_fail = True ---- primop PrefetchByteArrayOp2 "prefetchByteArray2#" GenPrimOp ByteArray# -> Int# -> ByteArray# - with can_fail = True primop PrefetchMutableByteArrayOp2 "prefetchMutableByteArray2#" GenPrimOp MutableByteArray# s -> Int# -> State# s -> State# s - with can_fail = True primop PrefetchAddrOp2 "prefetchAddr2#" GenPrimOp Addr# -> Int# -> Addr# - with can_fail = True ---- primop PrefetchByteArrayOp1 "prefetchByteArray1#" GenPrimOp ByteArray# -> Int# -> ByteArray# - with can_fail = True primop PrefetchMutableByteArrayOp1 "prefetchMutableByteArray1#" GenPrimOp MutableByteArray# s -> Int# -> State# s -> State# s - with can_fail = True primop PrefetchAddrOp1 "prefetchAddr1#" GenPrimOp Addr# -> Int# -> Addr# - with can_fail = True ---- primop PrefetchByteArrayOp0 "prefetchByteArray0#" GenPrimOp ByteArray# -> Int# -> ByteArray# - with can_fail = True primop PrefetchMutableByteArrayOp0 "prefetchMutableByteArray0#" GenPrimOp MutableByteArray# s -> Int# -> State# s -> State# s - with can_fail = True primop PrefetchAddrOp0 "prefetchAddr0#" GenPrimOp Addr# -> Int# -> Addr# - with can_fail = True |