Skip to content

Commit

Permalink
add README and patches.plist
Browse files Browse the repository at this point in the history
  • Loading branch information
b00t0x committed Jan 10, 2022
1 parent 01546fd commit c60f6ff
Show file tree
Hide file tree
Showing 2 changed files with 225 additions and 1 deletion.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
# CpuTopologyRebuild
A Lilu plugin that optimizes Alder Lake's heterogeneous core configuration.

#### Credits
For example, this kext is possible to recognize the Core i9-12900K's topology as 16 cores 24 threads or 8 cores 24 threads.

### Background
OpenCore's `ProvideCurrentCpuInfo` quirk enables Alder Lake's both P-Cores and E-Cores, but all cores and threads are recognized as equivalent. This can cause potentially single thread or real world performance degradation.

This kext aims to improve performance by rebuild the topology for these cores and threads.

The effect of this kext is not yet clear, but I've seen not only a cosmetic effect, but also some performance improvements. For example, the Geekbench 5 score on the Windows VM have increased in the case of allocating a small number of cores to VMware Fusion.

### Usage
* Use this kext with `ProvideCurrentCpuInfo` quirk.
* `-ctrsmt` boot arg makes E-Cores to be recognized as the 3-way SMT logical threads of the P-Cores. For example, it is recognized as 8 cores 24 threads in Core i9. This option seems to give the closest performance to E-Cores disabled configuration.
* When HT disabled, E-Cores are recognized as a logical thread of P-Cores with or without `-ctrsmt`.

### Topology examples
|||ProvideCurrentCpuInfo|ProvideCurrentCpuInfo<br>+ CpuTopologyRebuild.kext|ProvideCurrentCpuInfo<br>+ CpuTopologyRebuild.kext<br>+ `-ctrsmt`|
|-|:-|-:|-:|-:|
|Core i9|8P+8E+HT|24c24t|16c24t|8c24t|
| |8P+8E |16c16t| 8c16t|8c16t|
|Core i7|8P+4E+HT|20c20t|12c20t|8c20t|
| |8P+4E |12c12t| 8c12t|8c12t|
|Core i5|6P+4E+HT|16c16t|10c16t|6c16t|
| |6P+4E |10c10t| 6c10t|6c10t|

### About patches.plist
patches.plist can be used instead of `ProvideCurrentCpuInfo` quirk. It is not needed normally, but ProvideCurrentCpuInfo doesn't work for High Sierra and earlier, so you can use this patch for older macOS.

### Current problems
* Changing the number of cores in cpuid info causes instability such as random boot failing, so it has not been changed now. Therefore, the number of cores and threads changes can be seen only in limited situations such as a Geekbench result window.
* For the same reason, RestrictEvents.kext's `revcpuname` does not work because the number of cores recognized by RestrictEvents.kext and About This Mac window are different.

### Credits
- [Apple](https://www.apple.com) for macOS
- [vit9696](https://github.com/vit9696) for original [CpuTopologySync](https://github.com/acidanthera/CpuTopologySync/tree/b2ce2619ea7e58ec4553ed3441aa03af6b771cdf)
- [b00t0x](https://github.com/b00t0x) for writing the software and maintaining it
192 changes: 192 additions & 0 deletions patches.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Kernel</key>
<dict>
<key>Patch</key>
<array>
<dict>
<key>Arch</key>
<string>Any</string>
<key>Base</key>
<string>_cpuid_set_info</string>
<key>Comment</key>
<string>core/thread count = 24 for 8P+8E Core i9</string>
<key>Count</key>
<integer>2</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data>uTUAAAAPMg==</data>
<key>Identifier</key>
<string>kernel</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<key>Replace</key>
<data>uBgAGAAx0g==</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
<dict>
<key>Arch</key>
<string>Any</string>
<key>Base</key>
<string>_cpuid_set_info</string>
<key>Comment</key>
<string>core/thread count = 20 for 8P+4E Core i7</string>
<key>Count</key>
<integer>2</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data>uTUAAAAPMg==</data>
<key>Identifier</key>
<string>kernel</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<key>Replace</key>
<data>uBQAFAAx0g==</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
<dict>
<key>Arch</key>
<string>Any</string>
<key>Base</key>
<string>_cpuid_set_info</string>
<key>Comment</key>
<string>core/thread count = 16 for 6P+4E Core i5-12600K</string>
<key>Count</key>
<integer>2</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data>uTUAAAAPMg==</data>
<key>Identifier</key>
<string>kernel</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<key>Replace</key>
<data>uBAAEAAx0g==</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
<dict>
<key>Arch</key>
<string>Any</string>
<key>Base</key>
<string></string>
<key>Comment</key>
<string>cores_per_package = 128 for Big Sur or later</string>
<key>Count</key>
<integer>1</integer>
<key>Enabled</key>
<true/>
<key>Find</key>
<data>wegag8ABiQ==</data>
<key>Identifier</key>
<string>kernel</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data>//3///3//w==</data>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>20.0.0</string>
<key>Replace</key>
<data>wegakLCAiQ==</data>
<key>ReplaceMask</key>
<data>//3///3//w==</data>
<key>Skip</key>
<integer>0</integer>
</dict>
<dict>
<key>Arch</key>
<string>Any</string>
<key>Base</key>
<string></string>
<key>Comment</key>
<string>cores_per_package = 128 for Catalina or earlier 1</string>
<key>Count</key>
<integer>1</integer>
<key>Enabled</key>
<true/>
<key>Find</key>
<data>weoa/8KJ</data>
<key>Identifier</key>
<string>kernel</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string>19.99.99</string>
<key>MinKernel</key>
<string></string>
<key>Replace</key>
<data>uoAAAACJ</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
<dict>
<key>Arch</key>
<string>Any</string>
<key>Base</key>
<string></string>
<key>Comment</key>
<string>cores_per_package = 128 for Catalina or earlier 2</string>
<key>Count</key>
<integer>1</integer>
<key>Enabled</key>
<true/>
<key>Find</key>
<data>wega/8CJ</data>
<key>Identifier</key>
<string>kernel</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string>19.99.99</string>
<key>MinKernel</key>
<string></string>
<key>Replace</key>
<data>uIAAAACJ</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
</array>
</dict>
</dict>
</plist>

0 comments on commit c60f6ff

Please sign in to comment.