lkml.org 
[lkml]   [2002]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [CFT] faster athlon/duron memory copy implementation
Date
On 24 October 2002 15:15, Manfred Spraul wrote:
> AMD recommends to perform memory copies with backward read operations
> instead of prefetch.
>
> http://208.15.46.63/events/gdc2002.htm
>
> Attached is a test app that compares several memory copy
> implementations. Could you run it and report the results to me,
> together with cpu, chipset and memory type?
>
> Please run 2 or 3 times.

There are the couple of wrinkles:

__asm__ __volatile__ ( " fsave %0; fwait\n"::"m"(fpu_save[0]) );
Wrong. Parameter is output. Remove one ':', replace "m" -> "=m".

__asm__ __volatile__ (
" femms\n" : :
);
What for? frstor will nuke out MMX state anyway.

static void fast_copy_page(void *to, void *from)
has two fsaves and no frstor ;)

"run three times" - can program do that on its own and find minimum?

I modified your test to be able to run it on Celeron.
(#defined out femms, replaced prefetch -> prefetchnta). Results are below.

I think it is impossible to make Best for all CPUs (tm) copy
function, we will newer know... maybe Hammer will do fastest copies
by rep movsb?

Btw, I used Arjan's program too, attaching my version...
Your method is indeed faster (see npf_copy.c).

We should avoid doing the same thing again and again...
There are several block ops in the kernel (memcpys,
csum_copy routines (see my other post)), can we
coordinate efforts to speed them up too?

FWIW, here's my results (Celeron 1200):
# ./a.out
Athlon test program $Id: fast.c,v 1.6 2000/09/23 09:05:45 arjan Exp $
copy_page() tests
copy_page function 'warm up run' took 42394 cycles per page
copy_page function '2.4 non MMX' took 41923 cycles per page
copy_page function '2.4 MMX fallback' took 41903 cycles per page
copy_page function '2.4 MMX version' took 43036 cycles per page
copy_page function 'faster_copy' took 28337 cycles per page
copy_page function 'even_faster' took 24632 cycles per page
copy_page function 'no_prefetch' took 23087 cycles per page
# ./a.out
Athlon test program $Id: fast.c,v 1.6 2000/09/23 09:05:45 arjan Exp $
copy_page() tests
copy_page function 'warm up run' took 45152 cycles per page
copy_page function '2.4 non MMX' took 44443 cycles per page
copy_page function '2.4 MMX fallback' took 45530 cycles per page
copy_page function '2.4 MMX version' took 45441 cycles per page
copy_page function 'faster_copy' took 29266 cycles per page
copy_page function 'even_faster' took 25849 cycles per page
copy_page function 'no_prefetch' took 24014 cycles per page
# ./a.out
Athlon test program $Id: fast.c,v 1.6 2000/09/23 09:05:45 arjan Exp $
copy_page() tests
copy_page function 'warm up run' took 45850 cycles per page
copy_page function '2.4 non MMX' took 44603 cycles per page
copy_page function '2.4 MMX fallback' took 45631 cycles per page
copy_page function '2.4 MMX version' took 57267 cycles per page
copy_page function 'faster_copy' took 29628 cycles per page
copy_page function 'even_faster' took 25989 cycles per page
copy_page function 'no_prefetch' took 23987 cycles per page
[unhandled content-type:application/x-bzip2]
\
 
 \ /
  Last update: 2005-03-22 13:30    [W:0.107 / U:1.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site