If your 40-lane CPU only has 32 lanes routed to the PCI-e slots, that's what you are limited to. Sometimes you can snag an extra 4-8 lanes with a m.2 to PCI-e connector but that's it.
In case you have for example 1 16-lane slot & 2 8-lane slots and want 4 GPU's on 8 lanes per GPU you can use bifurcation on the 16-lane slot if your motherboard supports it or an active PCI-e splitter (using a PEX chip) if your motherboard does not support bifurcation. These are rare but exist, Supermicro has a few but the design is a bit awkward.
You'll have to be creative to find how you will mount them ofc.