On Mon, Dec 04, 2017 at 08:16:47PM +0000, Bhanuprakash Bodireddy wrote:
> Processors support prefetch instruction in anticipation of write but
> compilers(gcc) won't use them unless explicitly asked to do so even
> with '-march=native' specified.
> 
> [Problem]
>   Case A:
>     OVS_PREFETCH_CACHE(addr, OPCH_HTW)
>        __builtin_prefetch(addr, 1, 3)
>          leaq    -112(%rbp), %rax        [Assembly]
>          prefetchw  (%rax)
> 
>   Case B:
>     OVS_PREFETCH_CACHE(addr, OPCH_LTW)
>        __builtin_prefetch(addr, 1, 1)
>          leaq    -112(%rbp), %rax        [Assembly]
>          prefetchw  (%rax)             <***problem***>
> 
>   Inspite of specifying -march=native and using Low Temporal Write(OPCH_LTW),
>   the compiler generates 'prefetchw' instruction instead of 'prefetchwt1'
>   instruction available on processor.
> 
> [Solution]
>   Include -mprefetchwt1
> 
>   Case B:
>     OVS_PREFETCH_CACHE(addr, OPCH_LTW)
>        __builtin_prefetch(addr, 1, 1)
>          leaq    -112(%rbp), %rax        [Assembly]
>          prefetchwt1  (%rax)
> 
> [Testing]
>   $ ./boot.sh
>   $ ./configure
>      checking target hint for cgcc... x86_64
>      checking whether gcc accepts -mprefetchwt1... yes
>   $ make -j
> 
> Signed-off-by: Bhanuprakash Bodireddy <[email protected]>

Does this have any effect if the architecture or CPU configured for use
does not support prefetchwt1?  If it could lead to that situation, then
this does not seem like the right thing to do, and we might want to fall
back to recommending use of the option when the person building knows
that the software will run on a machine with prefetchwt1.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to