FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 04-28-2010, 05:53 AM
Reinhard Tartler
 
Default Architecture Nomenclature

On Mi, Apr 28, 2010 at 02:07:56 (CEST), Kip Warner wrote:

> On Wed, 2010-04-28 at 00:32 +0200, Benjamin Drung wrote:
>>
>> The best solution would be autodetection of SSE2 on runtime. That can
>> be
>> done with a few lines of code.
>
> You're right, that can indeed be done with a few lines of code. e.g.
> cpuid instruction.

SSE2 can be disabled for userland in the kernel. The implementation of
[1] requires this for example.

[1] http://portal.acm.org/citation.cfm?id=1752046.1752053

more safe approach include:

- "avcodec": installing a SIGILL handler to divert some function
pointers

- "vlc": spawning a child process that does some sse instructions and
check if it dies.

> The problem is that you then have to perform a branch every time you
> could potentially use hardware acceleration: a condition for when,
> say, SSE2 is available, and another for a generic implementation.
>
> It isn't ideal performance wise.

If you have both an SSE2 and C only implementation, you can use function
pointers that are set once, not every time the function is called. If
properly implemented, this hardly impacts performance.

> Perhaps for 32-bit x86 architectures where SIMD is required, I could
> build the package for i686 and have it detect at runtime before said is
> actually used, whether it is available or not. If it is not, raise a
> user visible error and terminate.

This can be implemented as SIGILL handler.

> This method assumes the user knows that it is only supported on P4 or
> later generation of x86.

--
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87aaso5diu.fsf@faui44a.informatik.uni-erlangen.de">http://lists.debian.org/87aaso5diu.fsf@faui44a.informatik.uni-erlangen.de
 
Old 04-28-2010, 07:12 AM
Goswin von Brederlow
 
Default Architecture Nomenclature

Reinhard Tartler <siretart@debian.org> writes:

> On Mi, Apr 28, 2010 at 02:07:56 (CEST), Kip Warner wrote:
>
>> On Wed, 2010-04-28 at 00:32 +0200, Benjamin Drung wrote:
>>>
>>> The best solution would be autodetection of SSE2 on runtime. That can
>>> be
>>> done with a few lines of code.
>>
>> You're right, that can indeed be done with a few lines of code. e.g.
>> cpuid instruction.
>
> SSE2 can be disabled for userland in the kernel. The implementation of
> [1] requires this for example.
>
> [1] http://portal.acm.org/citation.cfm?id=1752046.1752053
>
> more safe approach include:
>
> - "avcodec": installing a SIGILL handler to divert some function
> pointers
>
> - "vlc": spawning a child process that does some sse instructions and
> check if it dies.
>
>> The problem is that you then have to perform a branch every time you
>> could potentially use hardware acceleration: a condition for when,
>> say, SSE2 is available, and another for a generic implementation.
>>
>> It isn't ideal performance wise.
>
> If you have both an SSE2 and C only implementation, you can use function
> pointers that are set once, not every time the function is called. If
> properly implemented, this hardly impacts performance.
>
>> Perhaps for 32-bit x86 architectures where SIMD is required, I could
>> build the package for i686 and have it detect at runtime before said is
>> actually used, whether it is available or not. If it is not, raise a
>> user visible error and terminate.
>
> This can be implemented as SIGILL handler.
>
>> This method assumes the user knows that it is only supported on P4 or
>> later generation of x86.

And if nothing else works then compile your source twice, once with SSE2
and once without. You can then use alternatives to let the admin choose
one or the other depending on their hardware.

MfG
Goswin


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87r5m0kq4b.fsf@frosties.localdomain">http://lists.debian.org/87r5m0kq4b.fsf@frosties.localdomain
 
Old 04-28-2010, 09:01 AM
Xavier Oswald
 
Default Architecture Nomenclature

On 17:07 Tue 27 Apr , Kip Warner wrote:
> On Wed, 2010-04-28 at 00:32 +0200, Benjamin Drung wrote:
> >
> > The best solution would be autodetection of SSE2 on runtime. That can
> > be
> > done with a few lines of code.
>
> You're right, that can indeed be done with a few lines of code. e.g.
> cpuid instruction. The problem is that you then have to perform a branch
> every time you could potentially use hardware acceleration: a condition
> for when, say, SSE2 is available, and another for a generic
> implementation.
>
> It isn't ideal performance wise.

Agreed. It's not the way we should go.

> Perhaps for 32-bit x86 architectures where SIMD is required, I could
> build the package for i686 and have it detect at runtime before said is
> actually used, whether it is available or not. If it is not, raise a
> user visible error and terminate.
>
> This method assumes the user knows that it is only supported on P4 or
> later generation of x86.

The point is that only few software use this kind of acceleration.

If you really want to have SS2 and such activated, I suggest to do a rebuilt of
all packages on your machine with your own architecture compilation options.

We want to keep i386 or 'i486' compatible and not loose any performance due to
performing a branch everytime you can activate an architecture optimization.
And if we go through such a way, it will be hard for developers to maintain
packages and it will require a lot of manpower.


Greetings,
--
,'`. Xavier Oswald (xoswald@debian.org)
: :' : GNU/LINUX Debian Developer <http://www.debian.org>
`. `' GPG Key: 1024D/88BBB51E
`- 938D D715 6915 8860 9679 4A0C A430 C6AA 88BB B51E
 
Old 04-28-2010, 10:13 AM
Josselin Mouette
 
Default Architecture Nomenclature

Le mardi 27 avril 2010 * 17:07 -0700, Kip Warner a écrit :
> You're right, that can indeed be done with a few lines of code. e.g.
> cpuid instruction. The problem is that you then have to perform a branch
> every time you could potentially use hardware acceleration: a condition
> for when, say, SSE2 is available, and another for a generic
> implementation.
>
> It isn't ideal performance wise.

The simplest solution is to put the routines in a shared library and to
build two versions of the library. Put the i486 one in /usr/lib and the
SSE2 one in /usr/lib/i686/sse2.

--
.'`. Josselin Mouette
: :' :
`. `' “A handshake with whitnesses is the same
`- as a signed contact.” -- Jörg Schilling


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 1272449593.27381.6.camel@meh">http://lists.debian.org/1272449593.27381.6.camel@meh
 
Old 04-28-2010, 07:19 PM
Kip Warner
 
Default Architecture Nomenclature

On Wed, 2010-04-28 at 12:13 +0200, Josselin Mouette wrote:
> The simplest solution is to put the routines in a shared library and
> to
> build two versions of the library. Put the i486 one in /usr/lib and
> the
> SSE2 one in /usr/lib/i686/sse2.

That might be the way to go. Thanks.

--
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com
 

Thread Tools




All times are GMT. The time now is 11:17 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org