You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Michael van der Westhuizen <r1...@gmail.com> on 2007/07/07 21:09:04 UTC

config with wide has no effect on Solaris/Intel + patch

Hi,

I thought it was just me going mad, but a quick glance at
http://people.apache.org/~sebor/stdcxx/results/solaris-10-amd64-sunpro-64b-5.8-12S-solaris-553686-log.gz.txt
confirms that I'm right.

After configuring as: gmake builddir
BUILDMODE=threads,archive,optimized,wide CONFIG=sunpro.config

I see command-lines like this:
CC -c -mt -D_RWSTD_SOLARIS_THREADS -I$(TOPDIR)/include
-I$(BUILDDIR)/include  -library=%none -O   +w
$(TOPDIR)/src/assert.cpp

Note that on Solaris CXXFLAGS.wide is supposed to be -xarch=amd64, but
this is not being used by the build system.

Hunting this down, it seems that sunpro.config expects "uname -p" to
return amd64 on 64 bit Solaris/Intel. This is not true, it returns
i386.

The following patch fixes this for Solaris only - I don't run Sun
Studio on Linux, so I don't know if this is broken there or not.

Michael

Index: etc/config/sunpro.config
===================================================================
--- etc/config/sunpro.config    (revision 554241)
+++ etc/config/sunpro.config    (working copy)
@@ -89,6 +89,9 @@
 else
     # wide (64-bit) flags -- must be set explicitly
     # narrow (32-bit) flags are implicit on AMD64
+    ifeq ($(OSNAME),SunOS)
+        arch=$(shell /usr/bin/optisa amd64)
+    endif
     ifeq ($(arch),amd64)
         wide_flags     = -xarch=amd64
         narrow_flags   =

Re: config with wide has no effect on Solaris/Intel + patch

Posted by Martin Sebor <se...@roguewave.com>.
Michael van der Westhuizen wrote:
> Hi Martin,
> 
> On 7/8/07, Michael van der Westhuizen <r1...@gmail.com> wrote:
>> I've logged a compile-time showstopper (a ube assertion that crops up
>> in both 4.1.3 and 4.2.0) with bugs.sun.com
> [snip]
> 
> The bug available online here:
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6579425

Thanks. I'll keep an eye on it. I haven't seen it in our builds
yet (still waiting for the first batch of successful ones after
the fixes for STDCXX-470, STDCXX-479, and STDCXX-481 that went
in on Monday).

Martin

Re: config with wide has no effect on Solaris/Intel + patch

Posted by Michael van der Westhuizen <r1...@gmail.com>.
Hi Martin,

On 7/8/07, Michael van der Westhuizen <r1...@gmail.com> wrote:
> I've logged a compile-time showstopper (a ube assertion that crops up
> in both 4.1.3 and 4.2.0) with bugs.sun.com
[snip]

The bug available online here:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6579425

Michael

Re: config with wide has no effect on Solaris/Intel + patch

Posted by Michael van der Westhuizen <r1...@gmail.com>.
Hi Martin,

On 7/9/07, Martin Sebor <se...@roguewave.com> wrote:
> Check the list and Jira in case we figure out before you do
> (otherwise keep us posted -- thanks!)

Thanks - I'll definitely keep an eye on the lists.

Michael

Re: config with wide has no effect on Solaris/Intel + patch

Posted by Martin Sebor <se...@roguewave.com>.
Michael van der Westhuizen wrote:
> Hi Martin,
> 
> On 7/7/07, Martin Sebor <se...@roguewave.com> wrote:
> [snip]
>>
>> I recall reading somewhere that Sun C++ 5.9 supports the gcc -m64
>> option but I can't find the reference. Do you happen to have a link?
>> The x86 equivalent I was able to find in the online documentation is
>> still -xarch=amd64 (I couldn't find -m64 in the manual):
>> http://docs.sun.com/source/819-3690/Comp_Options_App.html#pgfId-999544
> 
> I picked the flags up here -
> http://developers.sun.com/sunstudio/documentation/ss12/whatsnew.html

Ah, that's the page I read! Thanks!

> 
> The xarch flags used result in compile-time warnings with C++ 5.9, so
> the -mXX options are really necessary.

Agreed. I created a separate issue for this:
https://issues.apache.org/jira/browse/STDCXX-479

> 
> It's possible to further tune the generated code using non-deprecated
> -xarch options - there are details in the links above.
> 
>> We're only just getting around to setting up the compiler but once it's
>> up and running we'll test your patch with it.
> 
> I've found quite a few issues with C++ 5.9, so we'll probably stick to
> 5.8+patches for now - at least until the obvious optimiser bugs are
> worked out.
> 
> I've logged a compile-time showstopper (a ube assertion that crops up
> in both 4.1.3 and 4.2.0) with bugs.sun.com, but I haven't logged a
> runtime problem with the numeric limits configuration test which makes
> it impossible to compile with any optimisation on sparcv8/sparcv9 (I
> haven't had time to look into the problem).

Ugh. Sounds like we have some work to do...

> 
> I'm also seeing the support/atomic* tests timing out on the i386 and
> amd64 - this is unexpected, but I haven't had time to look into this
> yet.

Check the list and Jira in case we figure out before you do
(otherwise keep us posted -- thanks!)

Martin

> 
> Some of the tests are also hitting backend corner cases - I've never
> seen the UBE take as much memory as it does now, and I've never seen
> it use a whole CPU before:
>  7723 michael   315M  312M cpu0     0    0   0:05:43  50% ube/1
> 
> Michael


Re: config with wide has no effect on Solaris/Intel + patch

Posted by Michael van der Westhuizen <r1...@gmail.com>.
Hi Martin,

On 7/7/07, Martin Sebor <se...@roguewave.com> wrote:
[snip]
>
> I recall reading somewhere that Sun C++ 5.9 supports the gcc -m64
> option but I can't find the reference. Do you happen to have a link?
> The x86 equivalent I was able to find in the online documentation is
> still -xarch=amd64 (I couldn't find -m64 in the manual):
> http://docs.sun.com/source/819-3690/Comp_Options_App.html#pgfId-999544

I picked the flags up here -
http://developers.sun.com/sunstudio/documentation/ss12/whatsnew.html

The xarch flags used result in compile-time warnings with C++ 5.9, so
the -mXX options are really necessary.

It's possible to further tune the generated code using non-deprecated
-xarch options - there are details in the links above.

> We're only just getting around to setting up the compiler but once it's
> up and running we'll test your patch with it.

I've found quite a few issues with C++ 5.9, so we'll probably stick to
5.8+patches for now - at least until the obvious optimiser bugs are
worked out.

I've logged a compile-time showstopper (a ube assertion that crops up
in both 4.1.3 and 4.2.0) with bugs.sun.com, but I haven't logged a
runtime problem with the numeric limits configuration test which makes
it impossible to compile with any optimisation on sparcv8/sparcv9 (I
haven't had time to look into the problem).

I'm also seeing the support/atomic* tests timing out on the i386 and
amd64 - this is unexpected, but I haven't had time to look into this
yet.

Some of the tests are also hitting backend corner cases - I've never
seen the UBE take as much memory as it does now, and I've never seen
it use a whole CPU before:
  7723 michael   315M  312M cpu0     0    0   0:05:43  50% ube/1

Michael

Re: config with wide has no effect on Solaris/Intel + patch

Posted by Martin Sebor <se...@roguewave.com>.
Michael van der Westhuizen wrote:
> Aplogies for replying to my own mail.
> 
> On 7/7/07, Michael van der Westhuizen <r1...@gmail.com> wrote:
>> Hi,
> [snip]
>> Note that on Solaris CXXFLAGS.wide is supposed to be -xarch=amd64, but
>> this is not being used by the build system.
>>
>> Hunting this down, it seems that sunpro.config expects "uname -p" to
>> return amd64 on 64 bit Solaris/Intel. This is not true, it returns
>> i386.

I don't have access to Solaris/AMD64 at the moment but from our logs
uname -a does include i386 and not amd64. I wonder what made us think
it was amd64.

> 
> Here's a better diff. This handles the correct wide flags when using
> Sun C++ 5.9 or better (Studio 12).

Thanks!

I recall reading somewhere that Sun C++ 5.9 supports the gcc -m64
option but I can't find the reference. Do you happen to have a link?
The x86 equivalent I was able to find in the online documentation is
still -xarch=amd64 (I couldn't find -m64 in the manual):
http://docs.sun.com/source/819-3690/Comp_Options_App.html#pgfId-999544

We're only just getting around to setting up the compiler but once it's
up and running we'll test your patch with it.

Martin

PS I think I've figured out why I couldn't find -m64 on the Compiler
Options pages: they are for Sun Studio 11, even though they're pointed
to from the Sun Studio 12 Documentation page here:

   http://developers.sun.com/sunstudio/documentation/ss12/
   --> http://developers.sun.com/sunstudio/documentation/ss12/opts

> 
> Michael
> 
> Index: etc/config/sunpro.config
> ===================================================================
> --- etc/config/sunpro.config    (revision 554241)
> +++ etc/config/sunpro.config    (working copy)
> @@ -77,21 +77,32 @@
> SINGL_CPPFLAGS =
> SINGL_LDFLAGS  =
> 
> -# (try to) determine the architecture via the (non-standard) -p option
> -# recognized on (at least) Linux and Solaris
> -arch=$(shell uname -p 2>/dev/null)
> +CCMAJOR=$(shell echo $(CCVER) | cut -f1 -d'.')
> +CCMINOR=$(shell echo $(CCVER) | cut -f2 -d'.')
> 
> -ifeq ($(arch),sparc)
> -    # wide (64-bit) flags -- must be set explicitly
> -    # narrow (32-bit) flags are implicit on SPARC
> -    wide_flags     = -xarch=v9
> -    narrow_flags   = -xarch=v8
> +ifeq ($(shell expr $(CCMAJOR) \>= 5 \& $(CCMINOR) \>= 9),1)
> +    wide_flags     = -m64
> +    narrow_flags   = -m32
> else
> -    # wide (64-bit) flags -- must be set explicitly
> -    # narrow (32-bit) flags are implicit on AMD64
> -    ifeq ($(arch),amd64)
> -        wide_flags     = -xarch=amd64
> -        narrow_flags   =
> +    # (try to) determine the architecture via the (non-standard) -p option
> +    # recognized on (at least) Linux and Solaris
> +    arch=$(shell uname -p 2>/dev/null)
> +
> +    ifeq ($(arch),sparc)
> +        # wide (64-bit) flags -- must be set explicitly
> +        # narrow (32-bit) flags are implicit on SPARC
> +        wide_flags     = -xarch=v9
> +        narrow_flags   = -xarch=v8
> +    else
> +        # wide (64-bit) flags -- must be set explicitly
> +        # narrow (32-bit) flags are implicit on AMD64
> +        ifeq ($(OSNAME),SunOS)
> +            arch=$(shell /usr/bin/optisa amd64)
> +        endif
> +        ifeq ($(arch),amd64)
> +            wide_flags     = -xarch=amd64
> +            narrow_flags   =
> +        endif
>     endif
> endif
> 


Re: config with wide has no effect on Solaris/Intel + patch

Posted by Michael van der Westhuizen <r1...@gmail.com>.
Aplogies for replying to my own mail.

On 7/7/07, Michael van der Westhuizen <r1...@gmail.com> wrote:
> Hi,
[snip]
> Note that on Solaris CXXFLAGS.wide is supposed to be -xarch=amd64, but
> this is not being used by the build system.
>
> Hunting this down, it seems that sunpro.config expects "uname -p" to
> return amd64 on 64 bit Solaris/Intel. This is not true, it returns
> i386.

Here's a better diff. This handles the correct wide flags when using
Sun C++ 5.9 or better (Studio 12).

Michael

Index: etc/config/sunpro.config
===================================================================
--- etc/config/sunpro.config    (revision 554241)
+++ etc/config/sunpro.config    (working copy)
@@ -77,21 +77,32 @@
 SINGL_CPPFLAGS =
 SINGL_LDFLAGS  =

-# (try to) determine the architecture via the (non-standard) -p option
-# recognized on (at least) Linux and Solaris
-arch=$(shell uname -p 2>/dev/null)
+CCMAJOR=$(shell echo $(CCVER) | cut -f1 -d'.')
+CCMINOR=$(shell echo $(CCVER) | cut -f2 -d'.')

-ifeq ($(arch),sparc)
-    # wide (64-bit) flags -- must be set explicitly
-    # narrow (32-bit) flags are implicit on SPARC
-    wide_flags     = -xarch=v9
-    narrow_flags   = -xarch=v8
+ifeq ($(shell expr $(CCMAJOR) \>= 5 \& $(CCMINOR) \>= 9),1)
+    wide_flags     = -m64
+    narrow_flags   = -m32
 else
-    # wide (64-bit) flags -- must be set explicitly
-    # narrow (32-bit) flags are implicit on AMD64
-    ifeq ($(arch),amd64)
-        wide_flags     = -xarch=amd64
-        narrow_flags   =
+    # (try to) determine the architecture via the (non-standard) -p option
+    # recognized on (at least) Linux and Solaris
+    arch=$(shell uname -p 2>/dev/null)
+
+    ifeq ($(arch),sparc)
+        # wide (64-bit) flags -- must be set explicitly
+        # narrow (32-bit) flags are implicit on SPARC
+        wide_flags     = -xarch=v9
+        narrow_flags   = -xarch=v8
+    else
+        # wide (64-bit) flags -- must be set explicitly
+        # narrow (32-bit) flags are implicit on AMD64
+        ifeq ($(OSNAME),SunOS)
+            arch=$(shell /usr/bin/optisa amd64)
+        endif
+        ifeq ($(arch),amd64)
+            wide_flags     = -xarch=amd64
+            narrow_flags   =
+        endif
     endif
 endif