math.vectors.simd: slightly faster 'sum' on 256-bit vectors: add the two components then do horizontal add, instead of doing a horizontal add on each one and adding the results
parent
c92e54b560
commit
6494e7a53b
|
@ -140,10 +140,8 @@ INSTANCE: A sequence
|
||||||
[ [ [ underlying2>> ] bi@ A-rep ] dip call ] 3bi
|
[ [ [ underlying2>> ] bi@ A-rep ] dip call ] 3bi
|
||||||
\ A boa ; inline
|
\ A boa ; inline
|
||||||
|
|
||||||
: A-v->n-op ( v1 quot scalar-quot -- v2 )
|
: A-v->n-op ( v1 combine-quot reduce-quot -- v2 )
|
||||||
[
|
[ [ [ underlying1>> ] [ underlying2>> ] bi A-rep ] dip call A-rep ]
|
||||||
[ [ underlying1>> A-rep ] dip call ]
|
dip call ; inline
|
||||||
[ [ underlying2>> A-rep ] dip call ] 2bi
|
|
||||||
] dip call ; inline
|
|
||||||
|
|
||||||
;FUNCTOR
|
;FUNCTOR
|
||||||
|
|
|
@ -139,7 +139,7 @@ M\ actor advance optimized.">
|
||||||
<" USE: compiler.tree.debugger
|
<" USE: compiler.tree.debugger
|
||||||
|
|
||||||
M\ actor advance test-mr mr.">
|
M\ actor advance test-mr mr.">
|
||||||
} ;
|
"An example of a high-performance algorithm that uses SIMD primitives can be found in the " { $vocab-link "benchmark.nbody-simd" } " vocabulary." } ;
|
||||||
|
|
||||||
ARTICLE: "math.vectors.simd.intrinsics" "Low-level SIMD primitives"
|
ARTICLE: "math.vectors.simd.intrinsics" "Low-level SIMD primitives"
|
||||||
"The words in the " { $vocab-link "math.vectors.simd.intrinsics" } " vocabulary are used to implement SIMD support. These words have three disadvantages compared to the higher-level " { $link "math-vectors" } " words:"
|
"The words in the " { $vocab-link "math.vectors.simd.intrinsics" } " vocabulary are used to implement SIMD support. These words have three disadvantages compared to the higher-level " { $link "math-vectors" } " words:"
|
||||||
|
|
|
@ -174,7 +174,7 @@ PRIVATE>
|
||||||
{ v/ [ [ (simd-v/) ] double-4-vv->v-op ] }
|
{ v/ [ [ (simd-v/) ] double-4-vv->v-op ] }
|
||||||
{ vmin [ [ (simd-vmin) ] double-4-vv->v-op ] }
|
{ vmin [ [ (simd-vmin) ] double-4-vv->v-op ] }
|
||||||
{ vmax [ [ (simd-vmax) ] double-4-vv->v-op ] }
|
{ vmax [ [ (simd-vmax) ] double-4-vv->v-op ] }
|
||||||
{ sum [ [ (simd-sum) ] [ + ] double-4-v->n-op ] }
|
{ sum [ [ (simd-v+) ] [ (simd-sum) ] double-4-v->n-op ] }
|
||||||
} simd-vector-words
|
} simd-vector-words
|
||||||
|
|
||||||
>>
|
>>
|
||||||
|
|
Loading…
Reference in New Issue