lxc config device add NAME-OF-INSTANCE gpu1 gpu pci=ADDR
This was introduced in LXD 4.2 but is getting backported to 4.0.x too (is in 4.0.2 that will hit stable tomorrow).
Note that instead of
pci=ADDR you can also select based on productid/vendorid if that’s more convenient.
I have such a VM here that’s managed by MAAS:
root@athos:~# lxc config show maas-vm12