Inspite of specifying -march=native when using Low Temporal Write(OPCH_LTW), the compiler generates 'prefetchw' instruction instead of 'prefetchwt1' instruction available on processor as in 'Case B'. To make the compiler emit prefetchwt1 instruction, -mprefetchwt1 needs to be passed to configure explicitly.
[Problem] Case A: OVS_PREFETCH_CACHE(addr, OPCH_HTW) [__builtin_prefetch(addr, 1, 3)] [Assembly] leaq -112(%rbp), %rax prefetchw (%rax) Case B: OVS_PREFETCH_CACHE(addr, OPCH_LTW) [__builtin_prefetch(addr, 1, 1)] [Assembly] leaq -112(%rbp), %rax prefetchw (%rax) <***problem***> [Solution] ./configure CFLAGS="-g -O2 -mprefetchwt1" Case B: OVS_PREFETCH_CACHE(addr, OPCH_LTW) [__builtin_prefetch(addr, 1, 1)] [Assembly] leaq -112(%rbp), %rax prefetchwt1 (%rax) See also: https://mail.openvswitch.org/pipermail/ovs-dev/2017-December/341591.html Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodire...@intel.com> --- Documentation/intro/install/general.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Documentation/intro/install/general.rst b/Documentation/intro/install/general.rst index 718e5c2..4d2db45 100644 --- a/Documentation/intro/install/general.rst +++ b/Documentation/intro/install/general.rst @@ -280,6 +280,19 @@ With this, GCC will detect the processor and automatically set appropriate flags for it. This should not be used if you are compiling OVS outside the target machine. +Compilers(gcc) won't emit prefetchwt1 instruction even with '-march=native' +specified. In such case, -mprefetchwt1 needs to be explicitly passed during +configuration. + +For example inspite of specifying -march=native when using Low Temporal Write +i.e OVS_PREFETCH_CACHE(addr, OPCH_LTW), the compiler generates 'prefetchw' +instruction instead of 'prefetchwt1' instruction available on processor. + +To make the compiler generate the appropriate instruction, it is recommended +to pass ``-mprefetchwt1`` settings:: + + $ ./configure CFLAGS="-g -O2 -march=native -mprefetchwt1" + .. note:: CFLAGS are not applied when building the Linux kernel module. Custom CFLAGS for the kernel module are supplied using the ``EXTRA_CFLAGS`` variable when -- 2.4.11 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev