← Thu, Nov 12 digest

Fitting Four 32 GB Resizable Bars Behind a PCIe Switch on Linux

read article ↗ hn thread ↗

An engineer details how they fitted four 32 GB GPUs behind a PCIe switch on Linux by bypassing BIOS limitations and working around a kernel resource sizing bug.

read it Essential reading for systems engineers wrestling with multi-GPU topology, PCIe address space limits, and Linux kernel resource allocation bugs.

summary

The author connects four 32 GB AMD GPUs and two RTX 3090s behind a PCIe switch to enable high-speed peer-to-peer transfers for tensor parallel serving. However, the motherboard BIOS fails to allocate enough memory address space for six massive Resizable BARs, and a Linux kernel bug miscalculates bridge window sizes by ignoring gaps between card BARs and doorbells. To resolve this, an out-of-tree initramfs module manually adjusts BAR sizes and aligns resource windows before GPU drivers load. Commenters note the ongoing frustration with legacy firmware limitations restricting MMIO space.

key points

  1. Motherboard BIOSes often fail to map multiple 32 GB Resizable BARs because each card requires 64 GB of address space due to alignment and doorbell register overhead.
  2. A Linux kernel resource sizing bug in pbus_size_mem() incorrectly sums child resources without accounting for alignment gaps between card BARs and doorbells.
  3. An out-of-tree initramfs module (gpu-rebar-layout) manually configures BAR size registers and forces root port rescanning before GPU drivers initialize.
  4. Enabling full Resizable BARs across the switch allows AMD ROCm peer-to-peer transfers to achieve 14 GB/s per link and over 54 GB/s in a ring configuration.

who should read it

Systems engineers, hardware hackers, and ML infrastructure builders running multi-GPU setups on workstation hardware.

discussion positive

consensus

Commenters express frustration with legacy firmware and BIOS limitations restricting MMIO space, highlighting how difficult it is to configure massive memory maps on consumer motherboards.

pushback

One user with a multi-GPU setup noted they avoided these specific issues by connecting cards directly to the mainboard and disabling CSM, though without full 32 GB P2P BAR maps.

best comment by jacquesm ↗

The problem is that with P2P every card will map every other card into its address space. So you're not mapping 128G but likely 512! It depends a bit on what software you use, some software is smart about this and uses a smaller sliding window if it can't use all of it at once and some software is really rigid.

It explains that P2P multiplies address space complexity because every card must map every other card into its address space.

Generated by an LLM from the article and thread. Check the sources before relying on it.