Boost logo

Boost :

Subject: Re: [boost] [Proposal] Adding CPUID Library in Boost
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-12-12 03:53:57


On 12/12/12 07:45, Andrey Semashev wrote:

> I would find this library useful, although I have already implemented
> a similar library for my closed project. I remember considering a few
> open alternatives when I was deciding whether to write my own
> implementation or not and I didn't find a suitable one.

A rationale to have it as a library would be that people tend to do it
wrong whenever they write inline asm.
I have never seen so much bad inline asm than for the cpuid instruction.

> I'm not sure that Boost implementation should be based on an external
> library. Libcpuid seems to be x86-only while I would prefer Boost
> library to be easily extensible to other architectures. I know not
> every architecture provides a cpuid-like operation but there probably
> are other means.

Which is why what I suggest is just part of Boost.SIMD. It is geared
towards one thing and one thing only: detecting whether a particular
SIMD extension is supported or not, and works across all architectures.
There is also cache detection that we could optionally add, the code is
already there.

For reference, on other platforms you usually need to ask the operating
system about the hardware capabilities, since detecting the capabilities
can only be done by the kernel.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk