Building OpenBSD and ports VS installing from packages

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

Building OpenBSD and ports VS installing from packages

Elias M. Mariani
Hi,
I have this question in my mind for a time now, if I download OpenBSD
and install all the applications from packages do OpenBSD and the apps
use for example AVX512 ? I mean, if I understand correctly, the
compiler should optimize the code for a given set of instructions,
given that, for example, the amd64 distribution works on machines with
and without AVX I assume that the packages are built without AVX
support, is this correct?
If so, building from ports would produce a different code?
Is the same for the OpenBSD build? Would I get a better performance if
I compile from source instead of installing from the packages?

I know that is a silly question, is just that I'm not used to think in
terms of compiled languages, and I want to get this question out of my
head. xD

Elias.

Reply | Threaded
Open this post in threaded view
|

Re: Building OpenBSD and ports VS installing from packages

Il Ka
Hello.

OpenBSD team does not recommend to build anything that exists in packages.

>>If so, building from ports would produce a different code?
In most cases ports are not aware of your microarchitecture.
See my question and Theo's answer.

https://www.mail-archive.com/misc@.../msg160878.html
Reply | Threaded
Open this post in threaded view
|

Re: Building OpenBSD and ports VS installing from packages

Elias M. Mariani
Hi,
I understand that about the builds and packages.
I will re write my question in another form:
If I build, say, firefox on a i386 machine I get a package, and
another if I build firefox on amd64, they differ.
If I build firefox on an amd64 machine WITHOUT AVX support I get a
package, if now I build firefox in an amd64 machine WITH AVX support,
do I still get the same package ?
(firefox is a random pick)

Cheers.
Elias.

2018-05-21 18:24 GMT-03:00 IL Ka <[hidden email]>:

> Hello.
>
> OpenBSD team does not recommend to build anything that exists in packages.
>
>>>If so, building from ports would produce a different code?
> In most cases ports are not aware of your microarchitecture.
> See my question and Theo's answer.
>
> https://www.mail-archive.com/misc@.../msg160878.html
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Building OpenBSD and ports VS installing from packages

Peter Hessler
i386 and amd64 are different platforms, so of course you get different packages.

Within the same platform, all binaries that are built should run on all
possible members of that platform.

So, code will be compiled WITHOUT AVX support, unless it can be detected
at runtime (e.g. mplayer/ffmpeg).  I believe that firefox does not to
runtime detection, so firefox should not directly call AVX.


On 2018 May 21 (Mon) at 18:37:43 -0300 (-0300), Elias M. Mariani wrote:
:Hi,
:I understand that about the builds and packages.
:I will re write my question in another form:
:If I build, say, firefox on a i386 machine I get a package, and
:another if I build firefox on amd64, they differ.
:If I build firefox on an amd64 machine WITHOUT AVX support I get a
:package, if now I build firefox in an amd64 machine WITH AVX support,
:do I still get the same package ?
:(firefox is a random pick)
:
:Cheers.
:Elias.
:
:2018-05-21 18:24 GMT-03:00 IL Ka <[hidden email]>:
:> Hello.
:>
:> OpenBSD team does not recommend to build anything that exists in packages.
:>
:>>>If so, building from ports would produce a different code?
:> In most cases ports are not aware of your microarchitecture.
:> See my question and Theo's answer.
:>
:> https://www.mail-archive.com/misc@.../msg160878.html
:>
:>
:>
:

--
The Computer made me do it.

Reply | Threaded
Open this post in threaded view
|

Re: Building OpenBSD and ports VS installing from packages

Il Ka
In reply to this post by Elias M. Mariani
>> do I still get the same package ?
Yes.

cc(1) does not use microarchitecture-specific features unless you provide
"-march" explicitly.
Other BSDs do it, but OpenBSD does not. So, cc(1) only knows that you are
building something for amd64.
There should not be any difference between nehalem and coffee lake (
both running
openbsd amd64 of course).

Some applications detect AVX extensions dynamically (using cpuid probably),
and use them if can.
OpenBSD is good example (from 5.8):
"Kernel supports x86 AVX instructions on CPUs that have them."

You do not need to recompile kernel to get AVX.
You just install it, and it uses AVX if CPU provides such instructions.
Same with packages.
Reply | Threaded
Open this post in threaded view
|

Re: Building OpenBSD and ports VS installing from packages

Elias M. Mariani
Okey, thanks both for the help!
Elias.

Reply | Threaded
Open this post in threaded view
|

Re: Building OpenBSD and ports VS installing from packages

Stuart Henderson
In reply to this post by Peter Hessler
On 2018-05-21, Peter Hessler <[hidden email]> wrote:
> i386 and amd64 are different platforms, so of course you get different packages.
>
> Within the same platform, all binaries that are built should run on all
> possible members of that platform.
>
> So, code will be compiled WITHOUT AVX support, unless it can be detected
> at runtime (e.g. mplayer/ffmpeg).  I believe that firefox does not to
> runtime detection, so firefox should not directly call AVX.

Firefox isn't a great example, the rust code targets p4 with sse2.

> On 2018 May 21 (Mon) at 18:37:43 -0300 (-0300), Elias M. Mariani wrote:
>:Hi,
>:I understand that about the builds and packages.
>:I will re write my question in another form:
>:If I build, say, firefox on a i386 machine I get a package, and
>:another if I build firefox on amd64, they differ.
>:If I build firefox on an amd64 machine WITHOUT AVX support I get a
>:package, if now I build firefox in an amd64 machine WITH AVX support,
>:do I still get the same package ?
>:(firefox is a random pick)

You may be able to build some things with different compiler flags
to use different cpu-specific instructions (-march, -mtune). If you
have some very specific computation-heavy software that needs to be
high performance then *maybe* it's worth looking into this. But in the
general case you're going to waste far more time than you save just in
compiling, let alone if you have to spend any extra time debugging.