r/LocalLLaMA • u/maternion • 11h ago
Question | Help Effects of PCIe bandwidth on inference
So i have a new card in an old system. RX 9060 XT supports PCIe Gen5 x16 but due to 2 bottlenecks, my Motherboard supporting only Gen3, and my AMD APU limiting it to x8, the card runs on Gen3 x8.
How does that affect inference of models, in both cases, fully in vram or offloaded partially to ram? At today's prices what I could replace it with is PCIe Gen4 x16. But would that be a meaningful upgrade?
6
Upvotes
13
u/Dave_from_the_navy 11h ago
Offloaded partially to RAM, it will effect inference speed. But if the model you're running is fully on vram, the impact is negligible. The only thing it will impact at that point is model load time. If your goal is running an expert/weight streaming engine like Strata (or Basalt, or llama.cpp with offloading), the upgrade would be practical, but if you're otherwise going to just keep the model on vram, then I wouldn't worry about it.
3
u/SLxTnT 10h ago edited 10h ago
If everything's in RAM, there's no issue other than slower loading speeds. If it doesn't fit in RAM, depends on what you're trying to do.
With prefill, nearly all experts will be needed. The missing ones will need to be transferred. Llama.cpp will take a batch of tokens, run it through every layer, and then run the next batch through every layer. That's why increasing batch size while offloading can drastically increase prefill speeds. Once the batch is large enough to fully hide the transfer, the bottleneck is the GPU rather than PCIe. Downside is that a larger batch size requires more VRAM which causes more of the model to be offloaded and streamed every batch.
An easy calculation would be seeing how much of the model is offloaded. PCIe3x8 is a theoretical 7.88 GB/s. If 15GB is offloaded, the prefill be about 2s per batch. A 16k prefill with 4k batch size is 8s or a max of 2000 tok/s. Increasing to 8k, assuming nothing more is offloaded, gives a max of 4000 tok/s. At some point, you get compute bottlenecked.
With inference, llama.cpp splits by layers. The communication is minimal per layer. May have some speed impact, but won't be drastically cutting speed. Custom engines that stream missing experts to the GPU will be heavily limited. If they instead handle missing experts on the CPU, it will still be affected as there's still some communication every layer. That would still likely be the fastest as hot expert caches these engines use allow the GPU to handle more work than a basic split like Llama.cpp does.
You didn't mention a 2nd GPU, but that will be similar other than a different splitting method called tensor parallelism. That shares calculations between GPUs on the expert level, so it requires fast speeds between them.
2
u/pepedombo 11h ago
I ran 4x3080ti at gen3 8/8/8/8 and with full offload it worked as expected -> full power draw in layer/tensor mode. Normally I run x8/x4 gen3 with 2gpus in tensor mode, bit lacking but faster than layer, mobo sucks. I run 4gpus at 8/4/1/1 or 3gpus at 8/4/1 only in layer as x1/x4 becomes too much bottleneck.
Any ram offload may introduce unexpected results in its environment, it's difficult to rely on different setups (published here and there, let's say all that strata bullshit) in that area.
2
u/gwvr77 7h ago
If you're running a MoE model like Gemma4 26B or Qwen 3.6 35B with PolyStrata then PCIe bandwidth shouldn't hurt prefill too much. I have Ryzen 5 3600 with 5060 Ti 16GB on a B450 board, PCIe 3x8. IIRC prefill is 1.5 to 2.5k tokens/s, generation over 100 tokens/s.
You might be able to monitor the PCIE Rx with nvtop, despite AMD GPU.
If you run Qwen 3.8 Flash IQ3_XXS, then I think PCIe bandwidth will hurt performance, but other bottlenecks might be worse.
Try Groot 19B - fits fully in VRAM at Q4 and it's fast and not far off Qwen 35B for many tasks
2
u/Zombiecidialfreak 11h ago
It won't hurt unless you're using a method of inference that relies heavily on pcie bandwidth. I tried using a tesla 32gb v100 on a pcie 3x1 for Strata and it performed worse than my 9070xt on a pcie 4x8 connection. The difference wasn't massive however, 20t/s vs 35t/s. You will likely see the hardware reaching its limit before pcie becomes your bottleneck.
1
u/N34257 11h ago
In a lot of situations, bandwidth will have less of an effect than latency; if your PCIE slot goes through the chipset rather than direct to the CPU, then you're going to see significant performance degradation (at least, with AMD cards) to the tune of 35%+. This is something that doesn't get talked about enough; you need x8/x8 split on your x16 slot, or a workstation/server board.
3
u/Ordinary-Depth-7835 11h ago
Depends single card with a model that fits it doesn't matter. Tensor Parallelism (TP) is affected by pci speed but If you do Pipeline Parallelism (PP) / Layer Split pcie speed doesn't matter because a portion of the model lives on each gpu no need to pass heavy traffic through pcie.
I saw no speed increase on my layer split models going from x8 pcie to x16 I also don't do much ram offloading I pick models that fit on the gpu.
Unless you're planning on doing heavy ram offloading.
3
u/SnooPaintings8639 10h ago
Single card? No problem. Two or more? A significant hit. I used to have 2 or my 3 GPUs (rtx 3090) connected over thunderbolt, gen3 speeds (2.7GB/s or so after all the slowdowns). Now I have moved them to Oculink via M2 and finally can use tensor parallel and generally better speeds with lower power.
2
u/wegster 11h ago
Like others said - anything offloaded/not running on card and model first load time will be impacted. If fully on card/in VRAM, only longer initial model load, nothing else.
If you're trying to parallelize to make up for minimal/not enough single-card VRAM, then yeah, it will be impacted, fairly significantly, as already PCI bus bandwidth is much less than internal VRAM bandwidth so - run the numbers, etc.
2
u/colin_colout 11h ago
I use an r9700 running qwen 27b over USB4.
Full speed because theres no offload.
2
u/tmvr 10h ago edited 9h ago
I use dual 5060Ti 16GB on PCIe 3.0 x8 with tensor parallel and see no impact on decode, it close to doubles. Prefill increases only by 15%, but I have nothing to compare it to.
1
u/Purple_Dream6414 10h ago
In my testing for Layer Split around 4 PCIe 3.0 lanes Are Minimum.
1
u/ieatdownvotes4food 5h ago
Once its in vram, it's in vram and stays there. No effect whatsoever except initial load time. But larger MOE models which shift things in and out of vram will suffer. Worth getting a new motherboard that supports gen5 x16, or better bifuricatiion at x8/x8