Fitting Four 32 GB Resizable Bars Behind a PCIe Switch on Linux doug.sh · 28 poi...

@best

Fitting Four 32 GB Resizable Bars Behind a PCIe Switch on Linux doug.sh · 28 points · 11 comments · HN thread

TL;DR Doug Calobrisi describes fitting four AMD Radeon AI PRO R9700 GPUs, each with a full 32 GB Resizable BAR, behind a Broadcom PEX88096 PCIe switch on a consumer AM4 board, so the cards can do peer-to-peer transfers. The BIOS could not map six 32 GB BARs, and Linux 7.0 sized the switch window too small, so he wrote an out-of-tree initramfs module (gpu-rebar-layout) that resizes the BARs and rescans before GPU drivers load. P2P then ran at about 14.0 GB/s per pair.

  • A Broadcom PEX88096 switch in the board's single x16 slot gives each of four R9700s eight lanes and enables peer-to-peer copies without the CPU.
  • ROCm only enables P2P when each card's whole 32 GB is mapped, which requires a 32 GB Resizable BAR per card on Linux.
  • With six cards, the BIOS could not fit six 32 GB BARs (each needs 64 GB of address space with its doorbell), so the box failed at POST.
  • Linux 7.0.6 reported 'bridge window can't assign; no space' because pbus_size_mem() sums child sizes and misses alignment gaps for non-power-of-two windows like 32 GB plus 2 MB.
  • An out-of-tree module sets BAR sizes, removes and rescans the root port, and pads alignments; after that all four R9700s reported 32 GB and P2P ran at 14.0 GB/s per pair, 54.7 GB/s for a four-GPU ring.
  • Ilpo Järvinen's 14-patch resource placement series (v5, November 6) fixes the sizing bug but was not yet merged.

Discussion The thread is small and mostly friendly. The author, who is the blog's writer, answers questions about why the BIOS fails and why the setup is needed, with a little banter about photos of the rig. Commenters find the firmware and kernel limitations surprising, and one comment treats the situation as a sign of how hardware capability outpaces address-space plumbing. A critic argues the underlying task is trivial and that layers of software make it hard.

  • Firmware and kernel address-space limits are the real obstacle (many): Commenters note that the CPU can address far more memory than the BIOS allots to PCI devices, so the blocker is firmware and the Linux allocator. The author confirms the AM4 BIOS only gives PCI space up to 512 GB.
  • Simply writing BAR registers should be trivial (some): One commenter finds it absurd that assigning address ranges to peripherals needs a module, a kernel patch and workarounds across several software layers instead of direct register writes.
  • Multi-GPU bandwidth is becoming the bottleneck in AI hardware (some): A commenter observes that once enough GPUs and bandwidth are present, address allocation becomes the thing preventing the hardware from working as intended.
  • Post needs clearer terminology and visuals (a few): Readers asked for the acronym BAR to be defined and for photos of the rig; the author fixed the first and promised photos later.

#PCIe #Linux #ResizableBAR #GPU #P2P #Firmware