CPUTYPE?= in make.conf

Dimitry Andric dim at FreeBSD.org
Fri Oct 4 17:17:05 UTC 2019


On 4 Oct 2019, at 16:13, tech-lists <tech-lists at zyxst.net> wrote:
> 
> I hope this is the right place to ask about this; if not please suggest where?
> 
> I have a large poudriere system running 12.1-STABLE #0 r352869. It compiles
> ports in poudriere jails for many other smaller systems, some on same arch
> (amd64) but different cpu types.
> 
> The host cputype is:
> 
> # llvm-tblgen --version
> LLVM (http://llvm.org/):
> LLVM version 8.0.1
> Optimized build.
> Default target: x86_64-unknown-freebsd12.1
> Host CPU: sandybridge
> 
> The actual cpu is Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz (x2)
> 
> If I make a make.conf for a poudriere jail and define CPUTYPE?=btver1, several
> ports fail to compile, like python36 and lzo2.
> 
> If I do the same and define it as CPUTYPE?=haswell, *everything* fails apart
> from building the jail itself.

This will never work.  Your host Sandybridge CPU is of an earlier
generation (2nd) than the target, which is Haswell.

Targeting Haswell, the compiler will generate instructions that the host
CPU does not support, which in turn will lead to SIGILL signals as soon
as such instructions are encountered.

Similarly, btver1 is an AMD CPU (family 14h), which is likely to differ
from your host CPU in which instructions it supports.  I guess you were
just lucky that any programs ran at all... :)


> If I do the same thing on a different host, where the host cpu is: Intel(R)
> Core(TM) i7-4770K CPU @ 3.50GHz
> 
> no failures happen. llvm-tblgen here reports haswell. The freebsd version is
> the same.

Yes, i7-4770K is of the Haswell generation, so that is expected to work.


> What I'm asking is, is this a hardware failure on the failing system? Or is it
> a capabilities issue, in that the one having the problem hasn't got the right
> instruction set?

This is not a hardware failure, but totally expected behavior.  You can
only run poudriere builds for CPUs of an equal, or earlier generation,
and even then you will have to ensure that the target CPU does not
accidentally support instructions from your host CPU.


> I'm hoping for a performance boost if ports are compiled to the specific
> cputype of the target machine.

It will depend greatly on the type of program.  Some can see minor or
even large performance gains, for example if it is possible to vectorize
many loops in the program.  But for many programs, you will likely find
little to no differences.

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 223 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20191004/68d3cfcb/attachment.sig>


More information about the freebsd-hackers mailing list