[Pixman] add enable-cache-prefetch option

Liu Xinyun xinyun.liu at intel.com
Tue Sep 21 00:45:18 PDT 2010


hi,
   This patch is to add a new configuration option: enable-cache-prefetch,
which is default yes.

   Here is a link which talks on cache issue.
   http://lists.freedesktop.org/archives/pixman/2010-June/000218.html

   When disable it on Atom CPU(configured with --enable-cache-prefetch=no),
it will have a little performance gain. Here is the patch.

Regards,
Liu Xinyun
    

Subject: [PATCH] Add disable cache prefetch.

Disable cache prefetch for ATOM, the performance increased a little.

old: 0.18.4-origin
new: 0.18.4-disable-cache-prefetch
Speedups
========
image-rgba         gnome-terminal-vim-0    25068.39 (25095.11 0.06%) -> 23302.54 (23317.50 0.56%):  1.08x speedup
▏
image-rgba                  ocitysmap-0    8984.46 (8988.04 8.44%) -> 8416.64 (8489.40 6.91%):  1.07x speedup
▏
image-rgba          firefox-talos-gfx-0    58330.34 (58361.84 0.23%) -> 54657.10 (55473.39 1.72%):  1.07x speedup
▏
image-rgba                    poppler-0    17265.62 (17437.80 0.84%) -> 16257.05 (16341.86 0.75%):  1.06x speedup

image-rgba       firefox-planet-gnome-0    104102.19 (104150.67 0.12%) -> 98324.84 (98402.02 0.32%):  1.06x speedup


Signed-off-by: Liu Xinyun <xinyun.liu at intel.com>
Signed-off-by: Chen Miaobo <miaobo.chen at intel.com>
---
 configure.ac         |   13 +++++++++++++
 pixman/pixman-sse2.c |    7 +++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index c9269f4..a531cb7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -280,6 +280,19 @@ fi
 AM_CONDITIONAL(USE_SSE2, test $have_sse2_intrinsics = yes)
 
 dnl ===========================================================================
+dnl cache prefetch 
+AC_ARG_ENABLE(cache-prefetch,
+   [AC_HELP_STRING([--enable-cache-prefetch],
+		   [disable DISABLE_CACHE_PREFETCH macros [default=yes]])],
+   [enable_cache_prefetch=$enableval], [enable_cache_prefetch=yes])
+#AC_CHECK_DECL(enable_cache_prefetch)
+if test $enable_cache_prefetch = no ; then
+   AC_DEFINE(DISABLE_CACHE_PREFETCH, 1, [enable DISABLE_CACHE_PREFETCH macros])
+fi
+AC_CHECK_DECL(DISABLE_CACHE_PREFETCH)
+AC_SUBST(DISABLE_CACHE_PREFETCH)
+
+dnl ===========================================================================
 dnl Other special flags needed when building code using MMX or SSE instructions
 case $host_os in
    solaris*)
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 946e7ba..708838a 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -384,6 +384,13 @@ maybe_prefetch_next (__m128i* addr)
 	cache_prefetch_next (addr);
 }
 
+#ifdef DISABLE_CACHE_PREFETCH
+#define cache_prefetch(addr)		do {} while (0);
+#define cache_prefetch_next(addr)	do {} while (0);
+#define maybe_prefetch(addr)		do {} while (0);
+#define maybe_prefetch_next(addr)	do {} while (0);
+#endif
+
 /* load 4 pixels from a 16-byte boundary aligned address */
 static force_inline __m128i
 load_128_aligned (__m128i* src)
-- 
1.7.0.4



More information about the Pixman mailing list