Thursday, February 02, 2023

Re: hw.ncpuonline (2 of 2)

On 2023-02-02, Crystal Kolipe <kolipe.c@exoticsilicon.com> wrote:
> On Wed, Feb 01, 2023 at 04:56:17PM -0800, Justin Muir wrote:
>> As requested, dmesg output:
>
> ...
>
>> cpu0: smt 0, core 0, package 0
>> cpu1: smt 1, core 0, package 0
>> cpu2: smt 0, core 1, package 0
>> cpu3: smt 1, core 1, package 0
>
> This CPU presents itself as two cores, each with two threads, making a total
> of four.
>
> As a result, OpenBSD will not schedule processes on the 'extra' threads.
>
> Since the AMD bulldozer architecture, (which this CPU is based on), includes a
> physical integer execution unit for each thread, it's possibly not as crippled
> as most SMT CPUs. Depending on the mix of instructions in the code you are

Ah. So this explains the cpuid responses, it's not what's normally known
as SMT but it's also not fully independent cores.

Now I found https://www.bit-tech.net/reviews/tech/cpus/amd-fx-8150-review/2/
which has more insight.

Given that I think the way OpenBSD detects it is not unreasonable.

> running, you _might_ see a decent performance increase by enabling SMT on
> OpenBSD.
>
> You might also see a performance decrease, for example if you end up running
> two floating point threads on the same physical core and leaving the other one
> idle instead of running them on the separate physical cores.

The description I found suggests that you'd only see that with 256-bit floating
point which is not going to affect many workloads.

While the main reason for OpenBSD not scheduling work on 'cores' it sees
as SMT rather than full cores was for safety, a secondary reason was
that we don't have a way to treat them differently in the scheduler than
'full' cores and as a result were seeing that overall performance was
often better when *not* using them.

And it seems that this second reason is unlikely to apply to Bulldozer.

(A similar scheduler issue presents itself on systems with "big/little"
cpu architectures on various ARM systems and P/E cores on newer Intel
though of course in those cases they are separate cores).

No comments:

Post a Comment