Open Bug 1678083 Opened 4 years ago Updated 2 years ago

Investigate Using Low Power Cores for Some Threads on Apple Silicon

Categories

(Core :: Widget: Cocoa, enhancement, P2)

ARM64
macOS
enhancement

Tracking

()

People

(Reporter: haik, Unassigned)

References

Details

(Keywords: power)

Attachments

(1 file)

We should investigate using low power cores (E cores) for some background tasks.

From Apple's Optimize for Apple Silicon with performance and efficiency cores doc, "Recent Apple Silicon like A13 Bionic has both high-performance cores (P cores) and high-efficiency cores (E cores). These different core types allow you to deliver apps that have both great performance and great battery life. To take full advantage of their performance and efficiency, you can provide the operating system (OS) with information about how to execute your app in the most optimal way. From there, the OS uses semantic information to make better scheduling and performance control decisions."

Type: defect → enhancement
OS: Unspecified → macOS
Hardware: Unspecified → ARM64
Version: unspecified → Trunk

Would this fit into our plans for the scheduler? Will "background tasks" use a different thread that we could put on an efficiency core?

Flags: needinfo?(kwright)
Flags: needinfo?(bas)

Do we know how to tell the OS this information?

Flags: needinfo?(haftandilian)

Tuning Your Code’s Performance for Apple Silicon mentions pthread_set_qos_class_self_np.

Flags: needinfo?(haftandilian)

We could also use this for de-prioritized content processes, such as background tabs or ads.

Note that Fenix could benefit from that too. So does Windows for arm64. (assuming OS support)

We could certainly teach nsThreadPool or at least the background event target to dispatch to the lower-priority cores (either as a whole or with a certain flag/thread). I'm curious if this would be impactful at all. Are there any particular consumers in mind who could get some quick wins out of the efficiency guidelines?

Flags: needinfo?(kwright)

(In reply to Markus Stange [:mstange] from comment #1)

Would this fit into our plans for the scheduler? Will "background tasks" use a different thread that we could put on an efficiency core?

There's a lot of ways to do this, one of the things we could do is run two threadpools inside the scheduler in parallel, and make it depend on the priority. We could also do something more explicit, presumably set through a TaskManager or something along those lines.

But my intuition is that once we properly define priority, low priority would be a good proxy for things which may be run on more efficient cores with lower throughput. Having said that, currently that information doesn't exist.

Flags: needinfo?(bas)

(In reply to Bas Schouten (:bas.schouten) from comment #8)

(In reply to Markus Stange [:mstange] from comment #1)

Would this fit into our plans for the scheduler? Will "background tasks" use a different thread that we could put on an efficiency core?

There's a lot of ways to do this, one of the things we could do is run two threadpools inside the scheduler in parallel, and make it depend on the priority. We could also do something more explicit, presumably set through a TaskManager or something along those lines.

But my intuition is that once we properly define priority, low priority would be a good proxy for things which may be run on more efficient cores with lower throughput. Having said that, currently that information doesn't exist.

Fwiw, there's good reasons to want to think about this since Intel Lakefield uses a heterogeneous architecture as well and Intel announced a similar architecture for Alder Lake. Which I believe is scheduled for H2 2021.

The Windows scheduler generally decides on its own which cores are best suited for which thread on a heterogeneous architecture. But I believe explicitly selecting them should be possible with a combination of the information given by SYSTEM_CPU_SET_INFORMATION and SetThreadAffinityMask.

Severity: -- → S2
Keywords: power
Priority: -- → P2
Depends on: 1748378

Probably not a S2
Reminder, S2 means: (Serious) Major functionality/product severely impaired or a high impact issue and a satisfactory workaround does not exist

Severity: S2 → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: