Recent

Author Topic: 12th gen Intel cpu's  (Read 5904 times)

speter

  • Sr. Member
  • ****
  • Posts: 256
12th gen Intel cpu's
« on: December 02, 2021, 12:42:02 am »
I was reading about Intel's upcoming 12th gen chips in APC (an Australian computer mag); the article mentioned the CPUs would have two types of processors (1=Performance; 2=Power-Efficient).

This made me wonder whether a "normal" compiler (maybe like PFC) would (eventually) support this distinction, or would (specifying the thread type) be the domain of a specialist compiler and/or the OS?

Note that I am _not_ suggesting or requesting such support in FPC. :)

cheers
S.
I climbed mighty mountains, and saw that they were actually tiny foothills. :)

Laz 2.2.0 / FPC 3.2.2 / Windows 11 (64bit)

dbannon

  • Hero Member
  • *****
  • Posts: 1816
    • tomboy-ng, a rewrite of the classic Tomboy
Re: 12th gen Intel cpu's
« Reply #1 on: December 02, 2021, 02:03:03 am »
My guess is it would be an OS role to choose between the available processors, much the same as it moves threads around between processors or cores right now.  The application is unaware of it happening.

Linux / Unix already has "nice" tools to control how much of the CPU an app gets, again without any cooperation from the app itself.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1822
  • Former Delphi 1-7, 10.2 user
Re: 12th gen Intel cpu's
« Reply #2 on: December 02, 2021, 05:14:50 am »
In macOS for the Apple M1 silicon SOCs, the OS takes care of it, although there's also an API for choosing to run something on the efficient cores and not performance cores or vice versa.
Lazarus 2.3, FPC 3.3.1 macOS 12.1 x86_64 Xcode 13.2
Lazarus 2.3, FPC 3.3.1 macOS 12.1 aarch64 Xcode 13.2
Lazarus 2.3, FPC 3.2.2 FreeBSD 13.0 amd64 VM
Lazarus 2.3, FPC 3.2.2 FreeBSD 12.2 amd64 VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 VM
Lazarus 2.0.10 FPC 3.2.0 Win10 amd64 VM

PascalDragon

  • Hero Member
  • *****
  • Posts: 3668
  • Compiler Developer
Re: 12th gen Intel cpu's
« Reply #3 on: December 02, 2021, 08:59:25 am »
This made me wonder whether a "normal" compiler (maybe like PFC) would (eventually) support this distinction, or would (specifying the thread type) be the domain of a specialist compiler and/or the OS?

The compiler is only concerned with generating code suitable for the processor. As both kind of cores have the same feature set there is nothing the compiler needs to do. The remainder is up to the OS and your own code if you want to pin your threads to a specific kind of core (though the OS might override this if it wants to put the high performance cores to sleep).

440bx

  • Hero Member
  • *****
  • Posts: 2626
Re: 12th gen Intel cpu's
« Reply #4 on: December 02, 2021, 09:17:44 am »
As both kind of cores have the same feature set there is nothing the compiler needs to do.
From what I've read, the efficiency cores are missing some instructions such as AVX512.
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

loaded

  • Sr. Member
  • ****
  • Posts: 448
Re: 12th gen Intel cpu's
« Reply #5 on: December 02, 2021, 09:28:44 am »
This feature is also available in the program called Process Explorer;
The desired application can be run on the desired kernel.
If they have been able to do this, it can be done in Lazarusta.
If Ide=Lazarus 2.0.10 32 Bit and Os=Win 10 Home 64 Bit then Get up and do something useful! Because God is the helper of those who start again;

PascalDragon

  • Hero Member
  • *****
  • Posts: 3668
  • Compiler Developer
Re: 12th gen Intel cpu's
« Reply #6 on: December 02, 2021, 09:30:08 am »
As both kind of cores have the same feature set there is nothing the compiler needs to do.
From what I've read, the efficiency cores are missing some instructions such as AVX512.

AVX512 is disabled by default. The efficiency cores need to be disabled so that AVX512 can be enabled for the power cores. See here. This is precisely for the reason that the operating system (and the CPU) can't know whether the program uses AVX512 instructions and thus might migrate a thread of such a program from a power core to an efficiency core (or start it there) and then there'd be an illegal instruction exception. (*) The point is that user applications should be able to run unmodified and thus great care is taken that the feature sets of both kind of cores match (there was a BIG.little ARM variant in the past where the cache line sizes of the two kinds of cores didn't match and that lead to all kinds of funny problems).

(*) Yes, in theory the OS could examine the instruction and reschedule the thread on a power core if the instruction is supported there, but that's apparently not done.

speter

  • Sr. Member
  • ****
  • Posts: 256
Re: 12th gen Intel cpu's
« Reply #7 on: December 02, 2021, 11:08:40 am »
Thanks everyone. A very interesting discussion. :)

cheers
S.
I climbed mighty mountains, and saw that they were actually tiny foothills. :)

Laz 2.2.0 / FPC 3.2.2 / Windows 11 (64bit)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8402
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: 12th gen Intel cpu's
« Reply #8 on: December 07, 2021, 09:30:21 am »
AFAIK, there's no userland API to tell the OS which core the app should run on anyway. So, OS' CPU scheduler is what you can rely on.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9778
  • FPC developer.
Re: 12th gen Intel cpu's
« Reply #9 on: December 07, 2021, 09:53:07 am »
AFAIK, there's no userland API to tell the OS which core the app should run on anyway. So, OS' CPU scheduler is what you can rely on.

The term is called "Processor affinity", and it exists both for *nix (sched_setaffinity or so?) and Windows (https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setprocessaffinitymask)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8402
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: 12th gen Intel cpu's
« Reply #10 on: December 07, 2021, 10:01:22 am »
AFAIK, there's no userland API to tell the OS which core the app should run on anyway. So, OS' CPU scheduler is what you can rely on.

The term is called "Processor affinity", and it exists both for *nix (sched_setaffinity or so?) and Windows (https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setprocessaffinitymask)
Ah, the name isn't very intuitive. But this could work for the API caller itself instead of only for other processes?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9778
  • FPC developer.
Re: 12th gen Intel cpu's
« Reply #11 on: December 07, 2021, 10:21:03 am »
Ah, the name isn't very intuitive. But this could work for the API caller itself instead of only for other processes?

Primarily it is used for your own threads. Note that it might be less advantageous nowadays since the scheduling is much more complicated (per clock boost and thermal room, not even to speak of Alder Lake/Golden Cove)

PascalDragon

  • Hero Member
  • *****
  • Posts: 3668
  • Compiler Developer
Re: 12th gen Intel cpu's
« Reply #12 on: December 07, 2021, 01:29:15 pm »
AFAIK, there's no userland API to tell the OS which core the app should run on anyway. So, OS' CPU scheduler is what you can rely on.

The term is called "Processor affinity", and it exists both for *nix (sched_setaffinity or so?) and Windows (https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setprocessaffinitymask)
Ah, the name isn't very intuitive. But this could work for the API caller itself instead of only for other processes?

On *nix thread IDs are global, so you can provide any thread ID as long as you have the necessary privileges (see here). On Windows SetProcessAffinityMask is for threads inside the specified process (this is used for example by the task manager where you can control the affinity as well). There's also SetThreadAffinityMask and as long as you have a handle to the thread and the necessary privileges you can change the affinity of specific threads inside other processes as well.

 

TinyPortal © 2005-2018