public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: Steve Ellcey <sellcey@mips.com>
To: Carlos O'Donell <carlos@redhat.com>
Cc: <libc-ports@sourceware.org>
Subject: Re: [patch, mips] Improved memset for MIPS
Date: Fri, 06 Sep 2013 23:33:00 -0000	[thread overview]
Message-ID: <1378510388.5770.346.camel@ubuntu-sellcey> (raw)
In-Reply-To: <522A0CF8.8040008@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]

On Fri, 2013-09-06 at 13:12 -0400, Carlos O'Donell wrote:

> Are you able to post this test program for posterity along with
> your patches?

I have attached it to this email.  I compile with -UVERIFY when doing
benchmarks and with -DVERIFY when I am doing correctness testing.  On
one of my 74k boards the old memset took 63.409 seconds and the new one
took 45.577 seconds.  I played with different prefetch hints too while
benchmarking but the prepare-to-store one is the fastest.


> Just run `make bench', wait a while, and compare results before and after.
> 
> Look at bench/README for more details.

I tried running it but all the tests failed with messages like this:


Running /home/sellcey/gcc/memset/obj-mipsisa32r2el-linux-gnu/glibc/obj_default/benchtests/bench-bcopy
/home/sellcey/gcc/memset/obj-mipsisa32r2el-linux-gnu/glibc/obj_default/elf/ld.so.1: 1: /home/sellcey/gcc/memset/obj-mipsisa32r2el-linux-gnu/glibc/obj_default/elf/ld.so.1: ^?ELF^A^A^A^C^H^A�^O4~\�: not found
/home/sellcey/gcc/memset/obj-mipsisa32r2el-linux-gnu/glibc/obj_default/elf/ld.so.1: 2: /home/sellcey/gcc/memset/obj-mipsisa32r2el-linux-gnu/glibc/obj_default/elf/ld.so.1: Syntax error: "(" unexpected


I am not quite sure what to make of this, it seems to be using the right
ld.so.1 but I am not sure what it is that is 'not found'  Could this be
related to the issue of installing the latest libgcc and libstdc++ in
default locations? (glibc 2.18 wiki section 5.1.1)  I built glibc with a
GCC from a non-standard location so the libgcc and libstdc++ for that
compiler are not in the standard locations.

Steve Ellcey
sellcey@mips.com


[-- Attachment #2: test_memset.c --]
[-- Type: text/x-csrc, Size: 1455 bytes --]

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#define STARTOFFSET   64
#define MAXOFFSET 128
#ifdef VERIFY
#define SIZE 1024
#define MAXSETSIZE 520
#define SIZEINC 1
#define OFFSETINC 1
#else
#define SIZE 102400
#define MAXSETSIZE 51200
#define SIZEINC 1
#define OFFSETINC 1
#endif

/* MEMSETVAL must be a value that VAL will never return.  */
#define VAL(N) ((N % 6) + 13)
#define MEMSETVAL 0
signed char dst[SIZE];

extern void *MEMSET_NAME(void *, int, size_t);

test(int offset, int size)
{
  int i;
  char *x;

#ifdef VERIFY
  for (i = 0; i < SIZE; i++) {
    dst[i] = VAL(i);
  }
#endif
  MEMSET_NAME(&dst[offset], MEMSETVAL, size);
#ifdef VERIFY
  /* printf("Test memset of dst[%d] (0x%p), size = %d\n", offset, &dst[offset], size); */
  for (i = 0; i < offset; i++) {
      if (dst[i] != VAL(i))
	printf("FAIL, dst[%d] got changed before it should be (%d instead of %d)\n", i, VAL(i), dst[i]);
  }
  for (i = offset; i < offset+size; i++) {
      if (dst[i] != MEMSETVAL)
	printf("FAIL, dst[%d] was not changed when it should be (%d instead of %d)\n", i, dst[i], MEMSETVAL);
  }
  for (i = offset+size; i < SIZE; i++) {
      if (dst[i] != VAL(i))
	 printf("FAIL, dst[%d] got changed after it should be (%d instead of %d)\n", i, dst[i], VAL(i));
  }
#endif
}

main()
{
  int i, j;
  for (i = STARTOFFSET; i < MAXOFFSET; i = i + OFFSETINC) {
    for (j = 1; j < MAXSETSIZE; j = j + SIZEINC) {
      test(i, j);
    }
  }
  exit(0);
}

  reply	other threads:[~2013-09-06 23:33 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05 17:06 Steve Ellcey 
2013-09-06  0:40 ` Mike Frysinger
2013-09-06 15:42   ` Steve Ellcey
2013-09-06  4:18 ` Carlos O'Donell
2013-09-06 16:03   ` Steve Ellcey
2013-09-06 17:12     ` Carlos O'Donell
2013-09-06 23:33       ` Steve Ellcey [this message]
2013-09-07  2:38         ` Carlos O'Donell
2013-09-10 20:31           ` Steve Ellcey
2013-09-10 21:01             ` Carlos O'Donell
2013-09-10 21:14               ` Steve Ellcey
2013-09-10 22:35                 ` Carlos O'Donell
2013-09-10 22:38                   ` Carlos O'Donell
2013-09-07  5:46         ` Andreas Schwab
2013-09-06 14:31 ` Joseph S. Myers
2013-09-06 15:58   ` Steve Ellcey
2013-09-06 16:09     ` Joseph S. Myers
2013-09-06 16:50       ` Steve Ellcey
2013-09-06 16:59         ` Joseph S. Myers
2013-09-06 17:43           ` Steve Ellcey
2013-09-06 18:57             ` Brooks Moses
2013-09-18 17:41           ` Steve Ellcey
2013-09-19 15:25             ` Carlos O'Donell
2013-09-19 17:02               ` Steve Ellcey
2013-09-20 16:43             ` Joseph S. Myers
2013-09-20 17:32               ` Steve Ellcey
2013-12-12 22:19                 ` Andrew Pinski
2013-12-13  0:01                   ` Carlos O'Donell
2013-12-13  0:14                     ` Steve Ellcey
2013-12-13  0:22                       ` Andrew Pinski
2013-12-13  4:40                       ` Carlos O'Donell
2013-09-06 16:59       ` Steve Ellcey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1378510388.5770.346.camel@ubuntu-sellcey \
    --to=sellcey@mips.com \
    --cc=carlos@redhat.com \
    --cc=libc-ports@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).