--enable-dynsimd and cmov?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

--enable-dynsimd and cmov?

Fernando Lopez-Lezcano
Hi all, here's an example of something wrong in the --enable-dynsimd
flag for building jack. If I understand its usage correctly it should
create optimized routines that are selected at run time depending on the
capabilities of the cpu jackd is running on.

Here is someone whose jackd fails when compiled with that option. With
an illegal instruction exception.

If I look at the build log I see all gcc incantations are using
-march=i386 -mtune=generic...

-- Fernando


-------- Forwarded Message --------
Subject: Re: [PlanetCCRMA] Rebuilding kernel on FC6/CCRMA
Date: Sun, 10 Jun 2007 11:40:07 +1200

On Sun, 27 May 2007 08:51:07 Fernando Lopez-Lezcano wrote:

> The source packages live here:
> http://ccrma.stanford.edu/planetccrma/mirror/all/linux/SRPMS/
>
> You should be able to rebuild the .src.rpm with (I think)
>   rpmbuild -ba --target=i586 spec_file_name
>
> Sorry, I should start building i586 kernels again...

Thanks for that, Fernando.

Sorry for the late reply, but I did manage to rebuild the kernel for i586 and
it's working nicely.  I had to modify the kernel config for i586 (changed
i686 to i586 in the CPU selection) but otherwise it built fine.

I have had a problem with Jackd on this system however.  Typing
        jackd -d <anydriver>
results in Illegal Instruction.  Running jackd in the debugger shows that it's
the result of a cmov instruction (not supported by the C3 and "optional"
according to the Intel manuals).  I rebuilt the package about 10 times before
I worked out the right combination of flags. Currently, I managed to get it
to work with these configure flags:
   --enable-dynsimd=no --enable-sse=no --enable-optimization-by-cpu --enable-optimize=no
and removing these compiler flags:
    -msse -msse2 -m3dnow

I suspect that I can construct a more minmal case (suspect support for sse and
sse2 that need to be disabled), will experiment further later.  In the mean
time, hopefully this helps someone else with a C3.

Michael



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel
Reply | Threaded
Open this post in threaded view
|

Re: --enable-dynsimd and cmov?

Jussi Laako-2
Fernando Lopez-Lezcano wrote:
> Here is someone whose jackd fails when compiled with that option. With
> an illegal instruction exception.

Seems to be neither Intel or AMD CPU. I have only those available for
testing and those are the only ones I have documentation for.

- If it fails on Intel or AMD, I'm interested to hear about it. Please
attach also output of /proc/cpuinfo and compiler version.
- If it fails on something else like any of the VIA C3 variants or NS
Geode, patches would be welcome... ;)

However, it will fail on pre-486 CPUs without CPUID instruction. But is
anybody seriously using 386+387 combinations anymore?

> results in Illegal Instruction.  Running jackd in the debugger shows that it's
> the result of a cmov instruction (not supported by the C3 and "optional"
> according to the Intel manuals).

"dynsimd" is not using cmov instruction anywhere. This seems to be
"compiler feature" rather than feature of "dynsimd" functionality.

> I suspect that I can construct a more minmal case (suspect support for sse and
> sse2 that need to be disabled), will experiment further later.  In the mean
> time, hopefully this helps someone else with a C3.

"dynsimd" will use either E3DNow! or SSE instructions if the CPU
supports those (according to CPUID instruction). AFAIK, there are
variants of C3 with both. If I don't remember entirely incorrectly, C3
has support for 3DNow (non-Enhanced one?) and C3-2 has support for SSE.

jack will always print out what it has detected at startup time:
"Enhanced3DNow! detected\n"
"SSE2 detected\n"
"No supported SIMD instruction sets detected\n"


BR,

        - Jussi

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel
Reply | Threaded
Open this post in threaded view
|

Re: --enable-dynsimd and cmov?

Jussi Laako-2
In reply to this post by Fernando Lopez-Lezcano
Oh! And be careful not to enable -mfpmath=sse or anything like that in
CFLAGS. And do not use --enable-optimize either. (See my earlier mail
regarding optimization options.)


BR,

        - Jussi

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel
Reply | Threaded
Open this post in threaded view
|

Re: --enable-dynsimd and cmov?

Fernando Lopez-Lezcano
In reply to this post by Jussi Laako-2
On Mon, 2007-06-11 at 23:50 +0300, Jussi Laako wrote:

> Fernando Lopez-Lezcano wrote:
> > Here is someone whose jackd fails when compiled with that option. With
> > an illegal instruction exception.
>
> Seems to be neither Intel or AMD CPU. I have only those available for
> testing and those are the only ones I have documentation for.
>
> - If it fails on Intel or AMD, I'm interested to hear about it. Please
> attach also output of /proc/cpuinfo and compiler version.
> - If it fails on something else like any of the VIA C3 variants or NS
> Geode, patches would be welcome... ;)
>
> However, it will fail on pre-486 CPUs without CPUID instruction. But is
> anybody seriously using 386+387 combinations anymore?
>
> > results in Illegal Instruction.  Running jackd in the debugger shows that it's
> > the result of a cmov instruction (not supported by the C3 and "optional"
> > according to the Intel manuals).
>
> "dynsimd" is not using cmov instruction anywhere. This seems to be
> "compiler feature" rather than feature of "dynsimd" functionality.

You are right.

I did some more fact finding by using objdump to see which .o files had
a cmov instruction in them. A large number did. It is a problem that
happens when compiling jackd. In a stock configuration (this is 0.103.1
so maybe something has changed, I have to try a more current version) if
you ./configure with --enable-dynsim the build actually fails because
the CFLAGS do not automatically include the -sse -sse2 -3dnow flags that
are needed. But if you add them (as I'm doing) then cmov instructions
get generated even if -march=i386 -tune=generic (which should just
generate i386 instructions)...

Bummer.
I don't know how to fix this, I would need a set of compile flags that
would enable sse/3dnow but disable the generation of non-i386
instructions like cmov.

-- Fernando



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel
Reply | Threaded
Open this post in threaded view
|

Re: --enable-dynsimd and cmov?

Fernando Lopez-Lezcano
On Mon, 2007-06-11 at 16:08 -0700, Fernando Lopez-Lezcano wrote:

> On Mon, 2007-06-11 at 23:50 +0300, Jussi Laako wrote:
> > Fernando Lopez-Lezcano wrote:
> > > Here is someone whose jackd fails when compiled with that option. With
> > > an illegal instruction exception.
> >
> > Seems to be neither Intel or AMD CPU. I have only those available for
> > testing and those are the only ones I have documentation for.
> >
> > - If it fails on Intel or AMD, I'm interested to hear about it. Please
> > attach also output of /proc/cpuinfo and compiler version.
> > - If it fails on something else like any of the VIA C3 variants or NS
> > Geode, patches would be welcome... ;)
> >
> > However, it will fail on pre-486 CPUs without CPUID instruction. But is
> > anybody seriously using 386+387 combinations anymore?
> >
> > > results in Illegal Instruction.  Running jackd in the debugger shows that it's
> > > the result of a cmov instruction (not supported by the C3 and "optional"
> > > according to the Intel manuals).
> >
> > "dynsimd" is not using cmov instruction anywhere. This seems to be
> > "compiler feature" rather than feature of "dynsimd" functionality.
>
> You are right.
>
> I did some more fact finding by using objdump to see which .o files had
> a cmov instruction in them. A large number did. It is a problem that
> happens when compiling jackd. In a stock configuration (this is 0.103.1
> so maybe something has changed, I have to try a more current version) if
> you ./configure with --enable-dynsim the build actually fails because
> the CFLAGS do not automatically include the -sse -sse2 -3dnow flags that
> are needed. But if you add them (as I'm doing) then cmov instructions
> get generated even if -march=i386 -tune=generic (which should just
> generate i386 instructions)...
>
> Bummer.
> I don't know how to fix this, I would need a set of compile flags that
> would enable sse/3dnow but disable the generation of non-i386
> instructions like cmov.

Looks like it would be impossible with the current organization of the
code. See (for example):

http://lists.freedesktop.org/archives/xorg/2005-July/008784.html

Apparently sse enables cmov generation.

Perhaps the source code can/should be reorganized so that a file that
contains "optional at runtime" sse/3dnow code would not contain "always
executable code" as well, so that _only_ that file compilation flags can
include -sse -sse2 -3dnow. And most probably those flags should be
automatically set by the configure process of jack itself.

-- Fernando



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel
Reply | Threaded
Open this post in threaded view
|

Re: --enable-dynsimd and cmov?

Jussi Laako-2
> Perhaps the source code can/should be reorganized so that a file that
> contains "optional at runtime" sse/3dnow code would not contain "always
> executable code" as well, so that _only_ that file compilation flags can
> include -sse -sse2 -3dnow. And most probably those flags should be
> automatically set by the configure process of jack itself.

I can do the reorganization and also modify the Makefile.am a bit, but I
don't know how to deal with the flags with autoconf. Could someone else
take care of autoconf stuff?


        - Jussi


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel