Re: [pgsql-advocacy] [GENERAL] Postgresql & AMD x86-64 - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [pgsql-advocacy] [GENERAL] Postgresql & AMD x86-64
Date
Msg-id 200307181802.h6II2q019592@candle.pha.pa.us
Whole thread Raw
In response to Re: [GENERAL] Postgresql & AMD x86-64  ("Martin D. Weinberg" <weinberg@osprey.astro.umass.edu>)
Responses Re: [pgsql-advocacy] [GENERAL] Postgresql & AMD x86-64  (Manfred Spraul <manfred@colorfullife.com>)
Re: [pgsql-advocacy] [GENERAL] Postgresql & AMD x86-64  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
The following patch automatically enables 64-bit mode on AMD opteron.
We already had spinlock support for it, but I added some comments.

The big question is whether all the operating systems running gcc on
Opteron support the 64-bit flags, and if we want to enable them by
default on Opteron.

If either of these is false, I will need to add a configure flag to
control 64-bit Opteron mode, though we could probably automatically
detect if gcc understand the 64-bit flags.  Another question is whether
any OS reports ia64 without having gcc understand -m64.  I am sure there
are lots of non-ia64-aware OS's running on Opteron, but do any of those
report ia64 as their CPU?

This might be one of those patches that we apply and see what reports we
get during beta.

---------------------------------------------------------------------------

Martin D. Weinberg wrote:
> Bruce,
>
> I didn't change the source tree at all.  I used:
>
> env CFLAGS='-O3 -m64' LD='/usr/bin/ld -melf_x86_64' ./configure --with-CXX --without-zlib
>
> with the experimental gcc and bintils from www.x86-64.org.  I needed
> --without-zlib because I don't have a 64 bit compile yet for zlib.
>
> make
> make install-all-headers
> make check CC='gcc -m64'
>
> The last one is needed to make sure that the shared library gets made
> in the amd64 architecture.
>
> That's it!
>
>
> On Tue, 10 Jun 2003 14:14:22 -0400 (EDT)
> Bruce Momjian <pgman@candle.pha.pa.us> wrote:
>
> >
> > Can you send us a patch?
> >
> > ---------------------------------------------------------------------------
> >
> > Martin D. Weinberg wrote:
> > > Hi folks,
> > >
> > > We recently built a dual K8D-based Opteron box running Linux in 64-bit
> > > mode (Debian 'testing' distribution with newly compiled binutils, gcc,
> > > and various support libraries for amd64 architecture).
> > >
> > > The Postgres 7.3.3 "port" was simply a matter of setting the appropriate
> > > flags to take of the biarchectecture nature of the Linux port.  (that is,
> > > "-m64" to generate 64 bit code and either "gcc -m64" or "ld -melf_x86_64"
> > > for linking").  There were no other issues in the compile.  In the
> > > install, I had to re-init due to the incompatibility of pg_control.
> > >
> > > All the regression tests went smoothly (the one "failure" was in geometry
> > > and is due to round off in the least sig figs of the doubles in the Point
> > > structure or machine zero differences).
> > >
> > > I compared a simple query on local data in both 32bit mode and 64bit mode;
> > > the execute time difference was not significant but this was not a compute
> > > intensive verification (summing up column values in a table).  We have
> > > some other 32-bit amd machines here; I would be happy to try a few other
> > > tests.
> > >
> > > Good job, developers!!!
> > >
> > > On Mon, 07 Apr 2003 18:34:05 +0800
> > > Justin Clift <justin@postgresql.org> wrote:
> > >
> > > > Hi guys,
> > > >
> > > > Does anyone want remote access to the upcoming AMD 64 bit architecture,
> > > > to make sure PostgreSQL runs well on it?
> > > >
> > > > It's only via remote access at present, but the AMD guys are willing to
> > > > help us out here.
> > > >
> > > > Regards and best wishes,
> > > >
> > > > Justin Clift
> > > >
> > > >
> > > > -------- Original Message --------
> > > > Subject: RE: Postgresql AMD x86-64
> > > > Date: Fri, 4 Apr 2003 10:29:24 -0800
> > > > From: marc.miller@amd.com
> > > > To: justin@postgresql.org
> > > > CC: aj@suse.de, chris.rimer@amd.com
> > > >
> > > > Justin,
> > > >
> > > > I apologize for the delayed response.  Unfortunately, at the moment I
> > > > don't have a system available to send you.  If I could get you access to
> > > > a machine remotely, would that be useful to you?  I will need to check
> > > > machine availability before I can promise you anything, but I'm willing
> > > > to be your sponsor in the AMD Developer Center and approve a request for
> > > > access.
> > > >
> > > > -----Original Message-----
> > > > From: Justin Clift [mailto:justin@postgresql.org]
> > > > Sent: Monday, March 10, 2003 7:31 PM
> > > > To: Andreas Jaeger
> > > > Subject: Re: AMD x86-64
> > > >
> > > >
> > > > Hi Andreas,
> > > >
> > > > Have you heard anything back from the AMD guys in relation to this?
> > > >
> > > > We've not heard a single thing from them.
> > > >
> > > > :-(
> > > >
> > > > Regards and best wishes,
> > > >
> > > > Justin Clift
> > > >
> > > >
> > > > Andreas Jaeger wrote:
> > > >  > Justin Clift <justin@postgresql.org> writes:
> > > > <snip>
> > > >  >>Yep, the aim is to allow PostgreSQL developers access to a system
> > > >  >>running x86-64 hardware as needed.
> > > >  >>
> > > >  >>Trying to get ahead of the ballgame these days.  :)
> > > >  >>
> > > >  >>>If you have hammer Hardware, I can provide you with a prerelease of
> > > >  >>>our software,
> > > >  >>
> > > >  >>That would be cool Andreas, thanks.
> > > >  >>
> > > >  >>Now, just need to secure the hardware somehow.  Personally, I feel
> > > >  >>that an email forwarded from you to the right people at AMD may help
> > > >  >>that significantly.  At least, people from AMD should get in contact
> > > >  >>with us to see if something beneficial can be arranged.
> > > >  >
> > > >  > Ok, I forwarded your note and let's see whether they're interested
> > > >  > (there're already a few commercial database like IBM DB2 ported).
> > > >  > From past experience, it might be difficult to get hardware directly
> > > >  > but let's wait for their answer.
> > > >  >
> > > >  > If you don't hear anything this week, feel free to ask me again,
> > > >  >
> > > >  > Andreas
> > > >
> > > >
> > > > --
> > > > "My grandfather once told me that there are two kinds of people: those
> > > > who work and those who take the credit. He told me to try to be in the
> > > > first group; there was less competition there."
> > > > - Indira Gandhi
> > > >
> > > >
> > > > ---------------------------(end of broadcast)---------------------------
> > > > TIP 4: Don't 'kill -9' the postmaster
> > > >
> > >
> > >
> > > --
> > > Martin Weinberg                      Phone: (413) 545-3821
> > > Dept. of Astronomy                   FAX:   (413) 545-4223
> > > 530 Graduate Research Tower         weinberg@astro.umass.edu
> > > University of Massachusetts         http://www.astro.umass.edu/~weinberg/
> > > Amherst, MA  01003-4525
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 6: Have you searched our list archives?
> > >
> > > http://archives.postgresql.org
> > >
> >
> > --
> >   Bruce Momjian                        |  http://candle.pha.pa.us
> >   pgman@candle.pha.pa.us               |  (610) 359-1001
> >   +  If your life is a hard drive,     |  13 Roberts Road
> >   +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> >
>
>
> --
> Martin Weinberg                      Phone: (413) 545-3821
> Dept. of Astronomy                   FAX:   (413) 545-4223
> 530 Graduate Research Tower         weinberg@astro.umass.edu
> University of Massachusetts         http://www.astro.umass.edu/~weinberg/
> Amherst, MA  01003-4525
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: configure
===================================================================
RCS file: /cvsroot/pgsql-server/configure,v
retrieving revision 1.276
diff -c -c -r1.276 configure
*** configure    23 Jun 2003 23:51:57 -0000    1.276
--- configure    18 Jul 2003 16:59:44 -0000
***************
*** 2401,2406 ****
--- 2401,2415 ----
  if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
    CFLAGS="$CFLAGS -g"
  fi
+
+ /* Compile AMD Opteron using gcc in 64-bit mode */
+ if test "$GCC" = yes; then
+ case $host in
+   ia64-*)  CFLAGS="$CFLAGS -m64"
+            LDFLAGS="$LDFLAGS -melf_x86_64";;
+ esac
+ fi
+
  { echo "$as_me:$LINENO: using CFLAGS=$CFLAGS" >&5
  echo "$as_me: using CFLAGS=$CFLAGS" >&6;}

Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql-server/configure.in,v
retrieving revision 1.267
diff -c -c -r1.267 configure.in
*** configure.in    23 Jun 2003 23:51:59 -0000    1.267
--- configure.in    18 Jul 2003 16:59:46 -0000
***************
*** 241,246 ****
--- 241,255 ----
  if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
    CFLAGS="$CFLAGS -g"
  fi
+
+ /* Compile AMD Opteron using gcc in 64-bit mode */
+ if test "$GCC" = yes; then
+ case $host in
+   ia64-*)  CFLAGS="$CFLAGS -m64"
+            LDFLAGS="$LDFLAGS -melf_x86_64";;
+ esac
+ fi
+
  AC_MSG_NOTICE([using CFLAGS=$CFLAGS])

  # Check if the compiler still works with the template settings
Index: src/include/storage/s_lock.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/storage/s_lock.h,v
retrieving revision 1.109
diff -c -c -r1.109 s_lock.h
*** src/include/storage/s_lock.h    24 Jun 2003 23:20:08 -0000    1.109
--- src/include/storage/s_lock.h    18 Jul 2003 16:59:48 -0000
***************
*** 94,100 ****
   */


! #if defined(__i386__) || defined(__x86_64__)
  #define TAS(lock) tas(lock)

  static __inline__ int
--- 94,100 ----
   */


! #if defined(__i386__) || defined(__x86_64__) /* Intel Itanium */
  #define TAS(lock) tas(lock)

  static __inline__ int
***************
*** 113,118 ****
--- 113,119 ----
  #endif     /* __i386__ || __x86_64__ */


+ /* AMD Opteron */
  #ifdef __ia64__
  #define TAS(lock) tas(lock)


pgsql-hackers by date:

Previous
From: Robert Treat
Date:
Subject: Re: plpgsql strangeness with select into
Next
From: Hans-Jürgen Schönig
Date:
Subject: Exception table ...