Skip to content

Your GeForce runs AI at half speed. This fixes it for 20/30/40 series cards. Up to 2× FP16 / BF16 / TF32 tensor throughput

C

Add GA103 and remaining desktop GA106 cards

Zagittaa9b0c75bb79b
diff --git a/README.md b/README.md
index cb658e5..b2d3e2e 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,12 @@
# GPU unlock 1.0.0
+Unlock FP/BF16 instruction issue rate on Nvidia 3000's cards to their professional equivalents
+
This Linux kernel module combines the CMP unlocker's V67/PLM technique with the pre-driver timing of the UEFI approach. It runs the unlock, writes the speed selectors (SS0 `0x88888888`, which selects the full BF16 rate, and the 4-bit SS1 `0x8` IMLA4) and performs FLR before the unmodified NVIDIA driver binds the card. It is neither a UEFI application nor a patched NVIDIA driver.
The benefit of this early kmod driver is that it does not require manual patching each time nvidia releases a new driver version.
-The effect of this unlock is that it doubles the instruction issuing speed of FP/BF16 FMA into FP32 operations on GA102, GA104 and GA106 cards.
+The effect of this unlock is that it doubles the instruction issuing speed of FP/BF16 FMA into FP32 operations on GA102, GA103, GA104 and GA106 cards.
[3090 Ti dense 8192³ GEMM at 450 W, five-sample medians with FP32 accumulation](https://github.com/Zagitta/gpu-unlock/issues/1#issue-5905622687):
@@ -100,14 +102,14 @@ There is no `softdep nvidia pre:` rule: kmod honours only the first
The module does nothing unless the kernel command line opts in:
```
-gpu_unlock.targets=all # every unbound GA102/GA104/GA106 card
+gpu_unlock.targets=all # every unbound GA102/GA103/GA104/GA106 card
gpu_unlock.targets=0000:21:00.0 # only these cards
gpu_unlock.targets=0000:21:00.0,0000:22:00.0 # comma-separated
```
Addresses are full PCI names as `lspci -D` prints them (hex digits in either
case), independent of GPU numbering and display role. An entry that is not
-a GA102/GA104/GA106 card, including `all` mixed with addresses, is logged and ignored.
+a GA102/GA103/GA104/GA106 card, including `all` mixed with addresses, is logged and ignored.
The cards are unlocked concurrently, about a second in all however many
there are, and each on its own: a card that is already bound or powered
down is skipped. Bus mastering that the board firmware left on (Supermicro
diff --git a/kernel/gpu_unlock/main.c b/kernel/gpu_unlock/main.c
index 9ad0ea2..a632896 100644
--- a/kernel/gpu_unlock/main.c
+++ b/kernel/gpu_unlock/main.c
@@ -9,10 +9,11 @@
static char *targets;
module_param(targets, charp, 0444);
-MODULE_PARM_DESC(targets, "\"all\" or comma-separated PCI addresses of GA102/GA104 cards to unlock");
+MODULE_PARM_DESC(targets, "\"all\" or comma-separated PCI addresses of GA102/GA103/GA104/GA106 cards to unlock");
-/* GA102 and GA104 GPU functions in pci.ids, excluding audio functions and the
- * professional (GL) parts, which already run BF16 at full rate.
+/* GA102, GA103, GA104 and GA106 GPU functions in pci.ids, excluding audio
+ * functions and the professional (GL) parts, which already run BF16 at full
+ * rate. GA103 and GA106 also exclude mobile parts.
*/
static const unsigned short supported_ids[] = {
/* GA102 */
@@ -23,8 +24,11 @@ static const unsigned short supported_ids[] = {
0x248a, 0x248c, 0x248d, 0x248e, 0x249c, 0x249d, 0x249f, 0x24a0,
0x24a4, 0x24ac, 0x24ad, 0x24af, 0x24bf, 0x24c0, 0x24c7, 0x24c8,
0x24c9, 0x24dc, 0x24dd, 0x24df, 0x24e0,
- /* GA106 (experimental: same family; validated on RTX 3060 12GB 0x2504) */
- 0x2504,
+ /* GA103 (untested) */
+ 0x2414,
+ /* GA106 (validated only on RTX 3060 12GB 0x2504) */
+ 0x2501, 0x2503, 0x2504, 0x2505, 0x2507, 0x2508, 0x2509, 0x252f,
+ 0x2544,
};
static ASYNC_DOMAIN_EXCLUSIVE(unlock_domain);
@@ -87,7 +91,7 @@ static void report_unmatched(void)
if (pdev)
pci_dev_put(pdev);
else
- pr_err("gpu_unlock: no GA102/GA104 card at \"%.*s\"\n",
+ pr_err("gpu_unlock: no supported card at \"%.*s\"\n",
(int)(end - entry), entry);
}
}
@@ -130,5 +134,5 @@ static void __exit gpu_unlock_exit(void)
module_init(gpu_unlock_init);
module_exit(gpu_unlock_exit);
MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("GA102/GA104 pre-driver BF16 unlock");
+MODULE_DESCRIPTION("Ampere pre-driver BF16 unlock");
MODULE_VERSION("1.0.0");
diff --git a/tests/test_main.c b/tests/test_main.c
index 38e2f5b..063085b 100644
--- a/tests/test_main.c
+++ b/tests/test_main.c
@@ -14,7 +14,7 @@
#define MAX_DEVICES 8
#define RTX_3090 0x2204
#define RTX_3070 0x2484
-#define RTX_3060 0x2503 /* GA106: not supported */
+#define RTX_A2000 0x2531 /* GA106 professional: not supported */
static struct pci_dev devices[MAX_DEVICES];
static unsigned int device_count;
@@ -221,11 +221,11 @@ static bool logged(const char *text)
int main(void)
{
- /* Every unbound GA102/GA104 card at once; other chips and bound cards left alone. */
+ /* Every unbound supported card at once; other chips and bound cards left alone. */
reset("all");
add("0000:01:00.0", RTX_3090, false);
add("0000:21:00.0", RTX_3070, false);
- add("0000:31:00.0", RTX_3060, false);
+ add("0000:31:00.0", RTX_A2000, false);
add("0000:41:00.0", RTX_3090, true);
add("0000:61:00.0", 0x2208, false);
fake.expected_concurrent = 3;
@@ -246,7 +246,7 @@ int main(void)
run();
assert(fake.max_in_flight == 2 && !fake.unlocks[0] && fake.unlocks[1] && fake.unlocks[2]);
assert(fake.loads == 1 && fake.load_dev == &devices[1] && fake.releases == 1);
- assert(!logged("no GA102/GA104 card"));
+ assert(!logged("no supported card"));
puts("list: only listed cards, concurrently PASS");
/* One card failing leaves the others unlocked. */
@@ -274,11 +274,11 @@ int main(void)
/* Unmatched entries, including unsupported chips, are reported; nothing to load for no cards. */
reset("0000:99:00.0,0000:31:00.0");
add("0000:01:00.0", RTX_3090, false);
- add("0000:31:00.0", RTX_3060, false);
+ add("0000:31:00.0", RTX_A2000, false);
run();
assert(!fake.loads && !fake.started && fake.releases == 1);
- assert(logged("gpu_unlock: no GA102/GA104 card at \"0000:99:00.0\""));
- assert(logged("gpu_unlock: no GA102/GA104 card at \"0000:31:00.0\""));
+ assert(logged("gpu_unlock: no supported card at \"0000:99:00.0\""));
+ assert(logged("gpu_unlock: no supported card at \"0000:31:00.0\""));
puts("unmatched target: reported, nothing loaded PASS");
/* No opt-in on the command line: the module does nothing. */