* Re: [Cbe-oss-dev] [RFC 0/3] powerpc: memory copy routines tweaked for Cell
@ 2010-12-23 7:38 syokazuliao
0 siblings, 0 replies; 2+ messages in thread
From: syokazuliao @ 2010-12-23 7:38 UTC (permalink / raw)
To: Gunnar von Boehn
Cc: linuxppc-dev, Michael Ellerman, cbe-oss-dev, Arnd Bergmann
[-- Attachment #1.1: Type: text/plain, Size: 727 bytes --]
Hi everyone,
I'm a new Cell BE user, and my debug platform is YDL6.2 run on PS3.
I wrote two simple test programs that tests Mark Nelson's memcpy routines under
a number of conditions, and the test arrays are aligned on 128-byte boundaries.
Following explains my three files.
1. The main1.C is my first test program, it assigns two 16KB arrays.
2. The main2.C is my second test program, it assigns two 4KB arrays.
3. The test_result.TXT is my test result.
Therefore, I have three questions.
1. How to calculate the bandwidth (MB/s)?
2. Is my result or test way correct?
3. Why is the 4KB result different between main1.C and main2.C?
PS: Please use UltraEdit open my three flies.
[-- Attachment #1.2: Type: text/html, Size: 1565 bytes --]
[-- Attachment #2: main2.C --]
[-- Type: text/plain, Size: 1200 bytes --]
#include <stdlib.h>
#include <stdio.h>
#include <ppu_intrinsics.h>
extern void *memcpy(void *, const void *, size_t);
int main() {
unsigned char *s, *d;
register unsigned long long start, finish, i;
if(posix_memalign((void *)&s, 128, 4096)) {
printf("failed\n");
goto end;
}
for(i = 32, j = 0; i > 0; i--, j += 128) { /* clear s from cache */
__dcbf(s+j);
}
if(posix_memalign((void *)&d, 128, 4096)) {
printf("failed\n");
goto end;
}
for(i = 32, j = 0; i > 0; i--, j += 128) { /* clear d from cache */
__dcbf(s+j);
}
__dcbt(cpymem); /* prefetch memcpy */
__dcbt(cpymem+128);
__dcbt(cpymem+256);
__dcbt(cpymem+384);
__dcbt(cpymem+512);
__dcbt(cpymem+640);
__dcbt(cpymem+768);
__dcbt(cpymem+896);
__dcbt(cpymem+1024);
__dcbt(cpymem+1152);
__dcbt(cpymem+1280);
__dcbt(cpymem+1408);
__dcbt(cpymem+1536);
__dcbt(cpymem+1664);
__dcbt(cpymem+1792);
__dcbt(cpymem+1920);
__dcbt(cpymem+2048);
__dcbt(cpymem+2176);
__dcbt(cpymem+2304);
__dcbt(cpymem+2432);
__sync();
start = __mftb();
memcpy(d, s, 4096);
finish = __mftb();
printf("%lld\n", finish - start);
free(s);
free(d);
end:
return 0;
}
[-- Attachment #3: test_result.TXT --]
[-- Type: text/plain, Size: 442 bytes --]
Copy Memory-to-Memory, results are in ticks.
16KB 4KB 2KB 1KB 512B 256B 128B 64B 32B 16B
-----------------------------------------------------------------------------------------------------------------------------------
main1.C 2063~2466 669~879 60~63 33~36 22~24 19~21 17~21 17~19 15~17 15~16
main2.C 110~114 60~62 33~36 21~24 19~21 17~18 17~18 15~16 15~16
[-- Attachment #4: test_result.TXT --]
[-- Type: text/plain, Size: 442 bytes --]
Copy Memory-to-Memory, results are in ticks.
16KB 4KB 2KB 1KB 512B 256B 128B 64B 32B 16B
-----------------------------------------------------------------------------------------------------------------------------------
main1.C 2063~2466 669~879 60~63 33~36 22~24 19~21 17~21 17~19 15~17 15~16
main2.C 110~114 60~62 33~36 21~24 19~21 17~18 17~18 15~16 15~16
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [Cbe-oss-dev] [RFC 0/3] powerpc: memory copy routines tweaked for Cell
@ 2010-12-23 7:49 syokazuliao
0 siblings, 0 replies; 2+ messages in thread
From: syokazuliao @ 2010-12-23 7:49 UTC (permalink / raw)
To: Gunnar von Boehn
Cc: linuxppc-dev, Michael Ellerman, cbe-oss-dev, Arnd Bergmann
[-- Attachment #1.1: Type: text/plain, Size: 74 bytes --]
Sorry, I was send wrong files.
I send my three files again.
[-- Attachment #1.2: Type: text/html, Size: 312 bytes --]
[-- Attachment #2: main1.C --]
[-- Type: text/plain, Size: 1204 bytes --]
#include <stdlib.h>
#include <stdio.h>
#include <ppu_intrinsics.h>
extern void *memcpy(void *, const void *, size_t);
int main() {
unsigned char *s, *d;
register unsigned long long start, finish, i;
if(posix_memalign((void *)&s, 128, 16384)) {
printf("failed\n");
goto end;
}
for(i = 128, j = 0; i > 0; i--, j += 128) { /* clear s from cache */
__dcbf(s+j);
}
if(posix_memalign((void *)&d, 128, 16384)) {
printf("failed\n");
goto end;
}
for(i = 128, j = 0; i > 0; i--, j += 128) { /* clear d from cache */
__dcbf(s+j);
}
__dcbt(memcpy); /* prefetch memcpy */
__dcbt(memcpy+128);
__dcbt(memcpy+256);
__dcbt(memcpy+384);
__dcbt(memcpy+512);
__dcbt(memcpy+640);
__dcbt(memcpy+768);
__dcbt(memcpy+896);
__dcbt(memcpy+1024);
__dcbt(memcpy+1152);
__dcbt(memcpy+1280);
__dcbt(memcpy+1408);
__dcbt(memcpy+1536);
__dcbt(memcpy+1664);
__dcbt(memcpy+1792);
__dcbt(memcpy+1920);
__dcbt(memcpy+2048);
__dcbt(memcpy+2176);
__dcbt(memcpy+2304);
__dcbt(memcpy+2432);
__sync();
start = __mftb();
memcpy(d, s, 4096);
finish = __mftb();
printf("%lld\n", finish - start);
free(s);
free(d);
end:
return 0;
}
[-- Attachment #3: main2.C --]
[-- Type: text/plain, Size: 1200 bytes --]
#include <stdlib.h>
#include <stdio.h>
#include <ppu_intrinsics.h>
extern void *memcpy(void *, const void *, size_t);
int main() {
unsigned char *s, *d;
register unsigned long long start, finish, i;
if(posix_memalign((void *)&s, 128, 4096)) {
printf("failed\n");
goto end;
}
for(i = 32, j = 0; i > 0; i--, j += 128) { /* clear s from cache */
__dcbf(s+j);
}
if(posix_memalign((void *)&d, 128, 4096)) {
printf("failed\n");
goto end;
}
for(i = 32, j = 0; i > 0; i--, j += 128) { /* clear d from cache */
__dcbf(s+j);
}
__dcbt(cpymem); /* prefetch memcpy */
__dcbt(cpymem+128);
__dcbt(cpymem+256);
__dcbt(cpymem+384);
__dcbt(cpymem+512);
__dcbt(cpymem+640);
__dcbt(cpymem+768);
__dcbt(cpymem+896);
__dcbt(cpymem+1024);
__dcbt(cpymem+1152);
__dcbt(cpymem+1280);
__dcbt(cpymem+1408);
__dcbt(cpymem+1536);
__dcbt(cpymem+1664);
__dcbt(cpymem+1792);
__dcbt(cpymem+1920);
__dcbt(cpymem+2048);
__dcbt(cpymem+2176);
__dcbt(cpymem+2304);
__dcbt(cpymem+2432);
__sync();
start = __mftb();
memcpy(d, s, 4096);
finish = __mftb();
printf("%lld\n", finish - start);
free(s);
free(d);
end:
return 0;
}
[-- Attachment #4: test_result.TXT --]
[-- Type: text/plain, Size: 449 bytes --]
Copy Memory-to-Memory, results are in ticks.
16KB 4KB 2KB 1KB 512B 256B 128B 64B 32B 16B
-----------------------------------------------------------------------------------------------------------------------------------
main1.C 2063~2466 669~879 60~63 33~36 22~24 19~21 17~21 17~19 15~17 15~16
main2.C 110~114 60~62 33~36 21~24 19~21 17~18 17~18 15~16 15~16
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-23 9:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-23 7:38 [Cbe-oss-dev] [RFC 0/3] powerpc: memory copy routines tweaked for Cell syokazuliao
-- strict thread matches above, loose matches on Subject: below --
2010-12-23 7:49 syokazuliao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox